Skip to content

Commit 8a2b9f0

Browse files
Merge pull request #1112 from rabi/node_selection
Allow using node specific BmhLabelSelector
2 parents 5a91443 + 2d033ba commit 8a2b9f0

File tree

10 files changed

+45
-7
lines changed

10 files changed

+45
-7
lines changed

apis/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ spec:
5555
baremetalHosts:
5656
additionalProperties:
5757
properties:
58+
bmhLabelSelector:
59+
additionalProperties:
60+
type: string
61+
type: object
5862
ctlPlaneIP:
5963
type: string
6064
networkData:
@@ -1159,6 +1163,10 @@ spec:
11591163
type: object
11601164
type: array
11611165
type: object
1166+
bmhLabelSelector:
1167+
additionalProperties:
1168+
type: string
1169+
type: object
11621170
hostName:
11631171
type: string
11641172
managementNetwork:

apis/dataplane/v1beta1/common.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ type NodeSection struct {
107107
// +kubebuilder:validation:Optional
108108
Networks []infranetworkv1.IPSetNetwork `json:"networks,omitempty"`
109109

110+
// +kubebuilder:validation:Optional
111+
// BmhLabelSelector allows for a sub-selection of BaremetalHosts based on arbitrary labels for a node.
112+
BmhLabelSelector map[string]string `json:"bmhLabelSelector,omitempty"`
113+
110114
// UserData node specific user-data
111115
// +kubebuilder:validation:Optional
112116
UserData *corev1.SecretReference `json:"userData,omitempty"`

apis/dataplane/v1beta1/openstackdataplanenodeset_webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ func (spec *OpenStackDataPlaneNodeSetSpec) Default() {
9090
nodeSetHostMap := make(map[string]baremetalv1.InstanceSpec)
9191
for _, node := range spec.Nodes {
9292
instanceSpec := baremetalv1.InstanceSpec{}
93+
instanceSpec.BmhLabelSelector = node.BmhLabelSelector
9394
instanceSpec.UserData = node.UserData
9495
instanceSpec.NetworkData = node.NetworkData
9596
instanceSpec.PreprovisioningNetworkDataName = node.PreprovisioningNetworkDataName

apis/dataplane/v1beta1/zz_generated.deepcopy.go

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

apis/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/openstack-k8s-operators/neutron-operator/api v0.4.1-0.20240926230407-337ebd074754
2424
github.com/openstack-k8s-operators/nova-operator/api v0.4.1-0.20240927075736-b326c891c264
2525
github.com/openstack-k8s-operators/octavia-operator/api v0.4.1-0.20240925065929-d1afc2060b03
26-
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.4.1-0.20240927122706-1b183c2f5e70
26+
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.4.1-0.20241001012129-35d814b03f68
2727
github.com/openstack-k8s-operators/ovn-operator/api v0.4.1-0.20240927090053-577fecad6a62
2828
github.com/openstack-k8s-operators/placement-operator/api v0.4.1-0.20240927095310-c6943846a0d3
2929
github.com/openstack-k8s-operators/swift-operator/api v0.4.1-0.20240926101408-dd3012b19cbf

apis/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ github.com/openstack-k8s-operators/nova-operator/api v0.4.1-0.20240927075736-b32
128128
github.com/openstack-k8s-operators/nova-operator/api v0.4.1-0.20240927075736-b326c891c264/go.mod h1:+TMPvKsqHsHlkkV/A9P+8p/064OIx1Rd06U93Mnem+E=
129129
github.com/openstack-k8s-operators/octavia-operator/api v0.4.1-0.20240925065929-d1afc2060b03 h1:dtZt46FtT6lv+gsr0X/QWXwHqiDEHTrmUNLeQ7JXxrg=
130130
github.com/openstack-k8s-operators/octavia-operator/api v0.4.1-0.20240925065929-d1afc2060b03/go.mod h1:yIKaqQ/993P2ZiR65yLXw75gmVk2ay8SnQ/Ail1lM+Y=
131-
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.4.1-0.20240927122706-1b183c2f5e70 h1:CuFPpi2PoSzD+fh5fYCgW9kNGCK+TDM7Xa9GFCD6EV0=
132-
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.4.1-0.20240927122706-1b183c2f5e70/go.mod h1:N5Glt/ks9WVZ1XiFOyy0nvnt19FNzS9Cfx7K1drm2d0=
131+
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.4.1-0.20241001012129-35d814b03f68 h1:9Y8OoFPZYgFkKLFnb6CsMCUabqdtQLEwQOp4PhhadU8=
132+
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.4.1-0.20241001012129-35d814b03f68/go.mod h1:N5Glt/ks9WVZ1XiFOyy0nvnt19FNzS9Cfx7K1drm2d0=
133133
github.com/openstack-k8s-operators/ovn-operator/api v0.4.1-0.20240927090053-577fecad6a62 h1:9G4QaiIfHTFa+20ng0sKKucX4Cma0/99Fxje6xLX3lo=
134134
github.com/openstack-k8s-operators/ovn-operator/api v0.4.1-0.20240927090053-577fecad6a62/go.mod h1:cJAu1qRppfZyhIjkRmai6FimO5ulCPBuCtgFKh8v0rg=
135135
github.com/openstack-k8s-operators/placement-operator/api v0.4.1-0.20240927095310-c6943846a0d3 h1:s4CConICNwCf9AOHh7Bltp5mgbQHlzTtUMlUWiNj0R4=

config/crd/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ spec:
5555
baremetalHosts:
5656
additionalProperties:
5757
properties:
58+
bmhLabelSelector:
59+
additionalProperties:
60+
type: string
61+
type: object
5862
ctlPlaneIP:
5963
type: string
6064
networkData:
@@ -1159,6 +1163,10 @@ spec:
11591163
type: object
11601164
type: array
11611165
type: object
1166+
bmhLabelSelector:
1167+
additionalProperties:
1168+
type: string
1169+
type: object
11621170
hostName:
11631171
type: string
11641172
managementNetwork:

docs/assemblies/con_provisioning-bare-metal-data-plane-nodes.adoc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ For virtual-media provisioning BMC address should use virtual-media as below.
9090

9191
To provision the baremetal nodes for edpm, OpenStackDataPlaneNodeSet spec should have the
9292
`baremetalSetTemplate` section as show below. Other than `bmhLabelSelector`, `hardwareReqs`
93-
field can also be provided for appropriate BMH selection.
93+
field can also be provided for appropriate BMH selection. To select a particular BMH for a
94+
node, `bmhLabelSelector` can be provided in the node section of the `OpenStackDataPlaneNodeSet`
95+
spec. These labels would be used in addition to the labels set in `baremetalSetTemplate` to
96+
select BMHs for the node.
9497

9598
apiVersion: dataplane.openstack.org/v1beta1
9699
kind: OpenStackDataPlaneNodeSet
@@ -103,6 +106,13 @@ field can also be provided for appropriate BMH selection.
103106
workload: compute
104107
ctlplaneInterface: enp1s0
105108
cloudUserName: cloud-admin
109+
nodes:
110+
edpm-compute-0
111+
hostName: edpm-compute-0
112+
ansible:
113+
ansibleHost: 192.168.122.100
114+
bmhLabelSelector:
115+
nodeName: edpm-compute-01
106116

107117
=== Relevant Status Condition
108118

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ require (
3131
github.com/openstack-k8s-operators/neutron-operator/api v0.4.1-0.20240926230407-337ebd074754
3232
github.com/openstack-k8s-operators/nova-operator/api v0.4.1-0.20240927075736-b326c891c264
3333
github.com/openstack-k8s-operators/octavia-operator/api v0.4.1-0.20240925065929-d1afc2060b03
34-
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.4.1-0.20240927122706-1b183c2f5e70
34+
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.4.1-0.20241001012129-35d814b03f68
3535
github.com/openstack-k8s-operators/openstack-operator/apis v0.0.0-20240531084739-3b4c0451297c
3636
github.com/openstack-k8s-operators/ovn-operator/api v0.4.1-0.20240927090053-577fecad6a62
3737
github.com/openstack-k8s-operators/placement-operator/api v0.4.1-0.20240927095310-c6943846a0d3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ github.com/openstack-k8s-operators/nova-operator/api v0.4.1-0.20240927075736-b32
140140
github.com/openstack-k8s-operators/nova-operator/api v0.4.1-0.20240927075736-b326c891c264/go.mod h1:+TMPvKsqHsHlkkV/A9P+8p/064OIx1Rd06U93Mnem+E=
141141
github.com/openstack-k8s-operators/octavia-operator/api v0.4.1-0.20240925065929-d1afc2060b03 h1:dtZt46FtT6lv+gsr0X/QWXwHqiDEHTrmUNLeQ7JXxrg=
142142
github.com/openstack-k8s-operators/octavia-operator/api v0.4.1-0.20240925065929-d1afc2060b03/go.mod h1:yIKaqQ/993P2ZiR65yLXw75gmVk2ay8SnQ/Ail1lM+Y=
143-
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.4.1-0.20240927122706-1b183c2f5e70 h1:CuFPpi2PoSzD+fh5fYCgW9kNGCK+TDM7Xa9GFCD6EV0=
144-
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.4.1-0.20240927122706-1b183c2f5e70/go.mod h1:N5Glt/ks9WVZ1XiFOyy0nvnt19FNzS9Cfx7K1drm2d0=
143+
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.4.1-0.20241001012129-35d814b03f68 h1:9Y8OoFPZYgFkKLFnb6CsMCUabqdtQLEwQOp4PhhadU8=
144+
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.4.1-0.20241001012129-35d814b03f68/go.mod h1:N5Glt/ks9WVZ1XiFOyy0nvnt19FNzS9Cfx7K1drm2d0=
145145
github.com/openstack-k8s-operators/ovn-operator/api v0.4.1-0.20240927090053-577fecad6a62 h1:9G4QaiIfHTFa+20ng0sKKucX4Cma0/99Fxje6xLX3lo=
146146
github.com/openstack-k8s-operators/ovn-operator/api v0.4.1-0.20240927090053-577fecad6a62/go.mod h1:cJAu1qRppfZyhIjkRmai6FimO5ulCPBuCtgFKh8v0rg=
147147
github.com/openstack-k8s-operators/placement-operator/api v0.4.1-0.20240927095310-c6943846a0d3 h1:s4CConICNwCf9AOHh7Bltp5mgbQHlzTtUMlUWiNj0R4=

0 commit comments

Comments
 (0)