Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

baremetal: enable and document "pod_cidr" and "service_cidr" options #1472

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/configuration-reference/platforms/baremetal.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ cluster "bare-metal" {

network_mtu = 1500

pod_cidr = "10.2.0.0/16"

service_cidr = "10.3.0.0/16"

controller_domains = var.controller_domains

controller_macs = var.controller_macs
Expand Down Expand Up @@ -160,6 +164,8 @@ os_version = var.custom_default_os_version
| `matchbox_endpoint` | Matchbox API endpoint. | - | string | true |
| `matchbox_http_endpoint` | Matchbox HTTP read-only endpoint. Example: "http://matchbox.example.com:8080" | - | string | true |
| `network_mtu` | Physical Network MTU. | 1500 | number | false |
| `pod_cidr` | CIDR IPv4 range to assign Kubernetes pods. | "10.2.0.0/16" | string | false |
| `service_cidr` | CIDR IPv4 range to assign Kubernetes services. | "10.3.0.0/16" | string | false |
| `worker_names` | Ordered list of worker names. Example: ["node2", "node3"] | - | list(string) | true |
| `worker_macs` | Ordered list of worker identifying MAC addresses. Example ["52:54:00:b2:2f:86", "52:54:00:c3:61:77"] | - | list(string) | true |
| `worker_domains` | Ordered list of worker FQDNs. Example ["node2.example.com", "node3.example.com"] | - | list(string) | true |
Expand Down
6 changes: 6 additions & 0 deletions pkg/platform/baremetal/baremetal.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ type config struct {
MatchboxEndpoint string `hcl:"matchbox_endpoint"`
MatchboxHTTPEndpoint string `hcl:"matchbox_http_endpoint"`
NetworkMTU int `hcl:"network_mtu,optional"`
PodCIDR string `hcl:"pod_cidr,optional"`
ServiceCIDR string `hcl:"service_cidr,optional"`
OSChannel string `hcl:"os_channel,optional"`
OSVersion string `hcl:"os_version,optional"`
SSHPubKeys []string `hcl:"ssh_pubkeys"`
Expand Down Expand Up @@ -212,6 +214,8 @@ func createTerraformConfigFile(cfg *config, terraformPath string) error {
MatchboxEndpoint string
MatchboxHTTPEndpoint string
NetworkMTU int
PodCIDR string
ServiceCIDR string
OSChannel string
OSVersion string
SSHPublicKeys string
Expand Down Expand Up @@ -243,6 +247,8 @@ func createTerraformConfigFile(cfg *config, terraformPath string) error {
MatchboxEndpoint: cfg.MatchboxEndpoint,
MatchboxHTTPEndpoint: cfg.MatchboxHTTPEndpoint,
NetworkMTU: cfg.NetworkMTU,
PodCIDR: cfg.PodCIDR,
ServiceCIDR: cfg.ServiceCIDR,
OSChannel: cfg.OSChannel,
OSVersion: cfg.OSVersion,
SSHPublicKeys: string(keyListBytes),
Expand Down
8 changes: 8 additions & 0 deletions pkg/platform/baremetal/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ module "bare-metal-{{.ClusterName}}" {
network_mtu = {{ .NetworkMTU }}
{{- end }}

{{- if .PodCIDR }}
pod_cidr = "{{.PodCIDR}}"
{{- end }}

{{- if .ServiceCIDR }}
service_cidr = "{{.ServiceCIDR}}"
{{- end }}

{{- if .KubeAPIServerExtraFlags }}
kube_apiserver_extra_flags = [
{{- range .KubeAPIServerExtraFlags }}
Expand Down