Skip to content

Commit

Permalink
Merge pull request #228 from rabi/vlan
Browse files Browse the repository at this point in the history
Use ctlplane vlan in networkdata
  • Loading branch information
openshift-merge-bot[bot] authored Jan 6, 2025
2 parents 927fdf8 + b13b7b3 commit 91f3a89
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/bases/baremetal.openstack.org_openstackbaremetalsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ spec:
description: 'CtlplaneNetmask - Netmask to use for ctlplane network
(TODO: acquire this is another manner?)'
type: string
ctlplaneVlan:
description: CtlplaneVlan - Vlan for ctlplane network
type: integer
deploymentSSHSecret:
description: DeploymentSSHSecret - Name of secret holding the cloud-admin
ssh keys
Expand Down
3 changes: 3 additions & 0 deletions api/v1beta1/openstackbaremetalset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ type OpenStackBaremetalSetSpec struct {
// CtlplaneGateway - IP of gateway for ctrlplane network (TODO: acquire this is another manner?)
// +kubebuilder:validation:Optional
CtlplaneGateway string `json:"ctlplaneGateway,omitempty"`
// +kubebuilder:validation:Optional
// CtlplaneVlan - Vlan for ctlplane network
CtlplaneVlan *int `json:"ctlplaneVlan,omitempty"`
// DomainName is the domain name that will be set on the underlying Metal3 BaremetalHosts (TODO: acquire this is another manner?)
// +kubebuilder:validation:Optional
DomainName string `json:"domainName,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ spec:
description: 'CtlplaneNetmask - Netmask to use for ctlplane network
(TODO: acquire this is another manner?)'
type: string
ctlplaneVlan:
description: CtlplaneVlan - Vlan for ctlplane network
type: integer
deploymentSSHSecret:
description: DeploymentSSHSecret - Name of secret holding the cloud-admin
ssh keys
Expand Down
3 changes: 3 additions & 0 deletions pkg/openstackbaremetalset/baremetalhost.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ func BaremetalHostProvision(
templateParameters := make(map[string]interface{})
templateParameters["CtlplaneIpVersion"] = CtlplaneIPVersion
templateParameters["CtlplaneIp"] = ipAddr
if instance.Spec.CtlplaneVlan != nil {
templateParameters["CtlplaneVlan"] = *instance.Spec.CtlplaneVlan
}
templateParameters["CtlplaneInterface"] = instance.Spec.CtlplaneInterface
templateParameters["CtlplaneGateway"] = instance.Spec.CtlplaneGateway
templateParameters["CtlplaneNetmask"] = net.IP(ipNet.Mask)
Expand Down
13 changes: 13 additions & 0 deletions templates/openstackbaremetalset/cloudinit/networkdata
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@ links:
- name: {{ .CtlplaneInterface }}
id: {{ .CtlplaneInterface }}
type: vif
{{- if (index . "CtlplaneVlan") }}
- name: {{ .CtlplaneInterface }}.{{ .CtlplaneVlan }}
id: {{ .CtlplaneInterface }}.{{ .CtlplaneVlan }}
type: vlan
vlan_id: {{ .CtlplaneVlan }}
vlan_link: {{ .CtlplaneInterface }}
vlan_mac_address: null
{{- end }}
networks:
{{- if (index . "CtlplaneVlan") }}
- link: {{ .CtlplaneInterface }}.{{ .CtlplaneVlan }}
id: {{ .CtlplaneInterface }}.{{ .CtlplaneVlan }}
{{- else }}
- link: {{ .CtlplaneInterface }}
id: {{ .CtlplaneInterface }}
{{- end }}
type: {{ .CtlplaneIpVersion }}
ip_address: {{ .CtlplaneIp }}
netmask: "{{ .CtlplaneNetmask }}"
Expand Down

0 comments on commit 91f3a89

Please sign in to comment.