Skip to content

Commit

Permalink
Move nodes to top level of nodeset spec
Browse files Browse the repository at this point in the history
We should not have nodes in nodeTemplate. NodeTemplate contains
everything that's common for all nodes.

Depends-On: openstack-k8s-operators/install_yamls#535
  • Loading branch information
rabi committed Sep 13, 2023
1 parent 2a4ab82 commit cea7e5e
Show file tree
Hide file tree
Showing 29 changed files with 1,696 additions and 1,703 deletions.
1,454 changes: 727 additions & 727 deletions api/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions api/v1beta1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ type NodeTemplate struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:io.kubernetes:Secret"}
AnsibleSSHPrivateKeySecret string `json:"ansibleSSHPrivateKeySecret"`

// Nodes - Map of Node Names and node specific data. Values here override defaults in the
// upper level section.
// +kubebuilder:validation:Required
Nodes map[string]NodeSection `json:"nodes"`

// NetworkConfig - Network configuration details. Contains os-net-config
// related properties.
// +kubebuilder:validation:Optional
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/openstackdataplanenodeset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ type OpenStackDataPlaneNodeSetSpec struct {
// from valus in this section.
NodeTemplate NodeTemplate `json:"nodeTemplate"`

// Nodes - Map of Node Names and node specific data. Values here override defaults in the
// upper level section.
// +kubebuilder:validation:Required
Nodes map[string]NodeSection `json:"nodes"`

// +kubebuilder:validation:Optional
//
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
Expand Down
6 changes: 3 additions & 3 deletions api/v1beta1/openstackdataplanenodeset_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ func (r *OpenStackDataPlaneNodeSet) Default() {

// Default - set defaults for this OpenStackDataPlaneNodeSet Spec
func (spec *OpenStackDataPlaneNodeSetSpec) Default() {
for nodeName, node := range spec.NodeTemplate.Nodes {
for nodeName, node := range spec.Nodes {
if node.HostName == "" {
node.HostName = nodeName
}
spec.NodeTemplate.Nodes[nodeName] = *node.DeepCopy()
spec.Nodes[nodeName] = *node.DeepCopy()
}

if spec.BaremetalSetTemplate.DeploymentSSHSecret == "" {
Expand All @@ -61,7 +61,7 @@ func (spec *OpenStackDataPlaneNodeSetSpec) Default() {

if !spec.PreProvisioned && spec.BaremetalSetTemplate.BaremetalHosts == nil {
nodeSetHostMap := make(map[string]baremetalv1.InstanceSpec)
for _, node := range spec.NodeTemplate.Nodes {
for _, node := range spec.Nodes {
instanceSpec := baremetalv1.InstanceSpec{}
instanceSpec.UserData = node.UserData
instanceSpec.NetworkData = node.NetworkData
Expand Down
14 changes: 7 additions & 7 deletions api/v1beta1/zz_generated.deepcopy.go

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

Loading

0 comments on commit cea7e5e

Please sign in to comment.