Skip to content

Commit f00958d

Browse files
Merge pull request #289 from rabi/node_vlan
Move ctlplaneVlan and ctlplaneGateway to InstanceSpec
2 parents bd32176 + fb6a8b3 commit f00958d

File tree

6 files changed

+33
-3
lines changed

6 files changed

+33
-3
lines changed

api/bases/baremetal.openstack.org_openstackbaremetalsets.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ spec:
8383
ctlPlaneIP:
8484
description: CtlPlaneIP - Control Plane IP in CIDR notation
8585
type: string
86+
ctlplaneGateway:
87+
description: 'CtlplaneGateway - IP of gateway for ctrlplane
88+
network (TODO: acquire this is another manner?)'
89+
type: string
90+
ctlplaneVlan:
91+
description: CtlplaneVlan - Vlan for ctlplane network
92+
type: integer
8693
networkData:
8794
description: NetworkData - Host Network Data
8895
properties:

api/v1beta1/openstackbaremetalset_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ type InstanceSpec struct {
3434
// +kubebuilder:validation:Optional
3535
// CtlPlaneIP - Control Plane IP in CIDR notation
3636
CtlPlaneIP string `json:"ctlPlaneIP,omitempty"`
37+
// CtlplaneGateway - IP of gateway for ctrlplane network (TODO: acquire this is another manner?)
38+
// +kubebuilder:validation:Optional
39+
CtlplaneGateway string `json:"ctlplaneGateway,omitempty"`
40+
// +kubebuilder:validation:Optional
41+
// CtlplaneVlan - Vlan for ctlplane network
42+
CtlplaneVlan *int `json:"ctlplaneVlan,omitempty"`
3743
// +kubebuilder:validation:Optional
3844
// UserData - Host User Data
3945
UserData *corev1.SecretReference `json:"userData,omitempty"`

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/baremetal.openstack.org_openstackbaremetalsets.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ spec:
8383
ctlPlaneIP:
8484
description: CtlPlaneIP - Control Plane IP in CIDR notation
8585
type: string
86+
ctlplaneGateway:
87+
description: 'CtlplaneGateway - IP of gateway for ctrlplane
88+
network (TODO: acquire this is another manner?)'
89+
type: string
90+
ctlplaneVlan:
91+
description: CtlplaneVlan - Vlan for ctlplane network
92+
type: integer
8693
networkData:
8794
description: NetworkData - Host Network Data
8895
properties:

pkg/openstackbaremetalset/baremetalhost.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,17 @@ func BaremetalHostProvision(
110110
templateParameters := make(map[string]interface{})
111111
templateParameters["CtlplaneIpVersion"] = CtlplaneIPVersion
112112
templateParameters["CtlplaneIp"] = ipAddr
113-
if instance.Spec.CtlplaneVlan != nil {
113+
if instance.Spec.BaremetalHosts[hostName].CtlplaneVlan != nil {
114+
templateParameters["CtlplaneVlan"] = *instance.Spec.BaremetalHosts[hostName].CtlplaneVlan
115+
} else if instance.Spec.CtlplaneVlan != nil {
114116
templateParameters["CtlplaneVlan"] = *instance.Spec.CtlplaneVlan
115117
}
116118
templateParameters["CtlplaneInterface"] = instance.Spec.CtlplaneInterface
117-
templateParameters["CtlplaneGateway"] = instance.Spec.CtlplaneGateway
119+
if instance.Spec.BaremetalHosts[hostName].CtlplaneGateway != "" {
120+
templateParameters["CtlplaneGateway"] = instance.Spec.BaremetalHosts[hostName].CtlplaneGateway
121+
} else {
122+
templateParameters["CtlplaneGateway"] = instance.Spec.CtlplaneGateway
123+
}
118124
templateParameters["CtlplaneNetmask"] = net.IP(ipNet.Mask)
119125
if len(instance.Spec.BootstrapDNS) > 0 {
120126
templateParameters["CtlplaneDns"] = instance.Spec.BootstrapDNS

tests/functional/openstackbaremetalset_controller_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ var _ = Describe("BaremetalSet Test", func() {
104104
BmhLabelSelector: nil,
105105
},
106106
},
107-
CtlplaneGateway: "",
108107
BootstrapDNS: nil,
109108
DNSSearchDomains: nil,
110109
OpenStackBaremetalSetTemplateSpec: coreSpec,

0 commit comments

Comments
 (0)