From cea7e5e70022195f10060a21f18e2886adca6b13 Mon Sep 17 00:00:00 2001 From: rabi Date: Wed, 13 Sep 2023 07:42:42 +0530 Subject: [PATCH] Move nodes to top level of nodeset spec We should not have nodes in nodeTemplate. NodeTemplate contains everything that's common for all nodes. Depends-On: https://github.com/openstack-k8s-operators/install_yamls/pull/535 --- ...nstack.org_openstackdataplanenodesets.yaml | 1454 ++++++++--------- api/v1beta1/common.go | 5 - .../openstackdataplanenodeset_types.go | 5 + .../openstackdataplanenodeset_webhook.go | 6 +- api/v1beta1/zz_generated.deepcopy.go | 14 +- ...nstack.org_openstackdataplanenodesets.yaml | 1454 ++++++++--------- ...ane_v1beta1_openstackdataplanenodeset.yaml | 22 +- ...1_openstackdataplanenodeset_baremetal.yaml | 188 ++- ...kdataplanenodeset_baremetal_with_ipam.yaml | 6 +- ...1beta1_openstackdataplanenodeset_ceph.yaml | 44 +- ...nstackdataplanenodeset_customnetworks.yaml | 28 +- ...1_openstackdataplanenodeset_with_ipam.yaml | 62 +- docs/openstack_dataplanenodeset.md | 2 +- docs/openstack_dataplaneservice.md | 1 - pkg/deployment/baremetal.go | 2 +- pkg/deployment/inventory.go | 24 +- pkg/deployment/ipam.go | 4 +- pkg/deployment/kube_service.go | 4 +- tests/functional/base_test.go | 10 +- .../dataplane-create-test/00-assert.yaml | 24 +- .../00-dataplane-create.yaml | 24 +- .../00-assert.yaml | 2 +- .../00-dataplane-create.yaml | 2 +- .../01-assert.yaml | 2 +- .../dataplane-extramounts/00-assert.yaml | 2 +- .../00-dataplane-create.yaml | 2 +- .../dataplane-service-config/00-create.yaml | 2 +- .../00-assert.yaml | 2 +- .../00-dataplane-create.yaml | 2 +- 29 files changed, 1696 insertions(+), 1703 deletions(-) diff --git a/api/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml b/api/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml index e9f188a92..cf10ee39a 100644 --- a/api/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml +++ b/api/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml @@ -1066,821 +1066,820 @@ spec: - subnetName type: object type: array - nodes: - additionalProperties: + userData: + properties: + name: + type: string + namespace: + type: string + type: object + x-kubernetes-map-type: atomic + required: + - ansibleSSHPrivateKeySecret + type: object + nodes: + additionalProperties: + properties: + ansible: properties: - ansible: - properties: - ansibleHost: - type: string - ansiblePort: - type: integer - ansibleUser: + ansibleHost: + type: string + ansiblePort: + type: integer + ansibleUser: + type: string + ansibleVars: + x-kubernetes-preserve-unknown-fields: true + type: object + extraMounts: + items: + properties: + extraVolType: + type: string + mounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + propagation: + items: type: string - ansibleVars: - x-kubernetes-preserve-unknown-fields: true - type: object - extraMounts: - items: - properties: - extraVolType: - type: string - mounts: - items: + type: array + volumes: + items: + properties: + awsElasticBlockStore: properties: - mountPath: + fsType: type: string - mountPropagation: + partition: + format: int32 + type: integer + readOnly: + type: boolean + volumeID: type: string - name: + required: + - volumeID + type: object + azureDisk: + properties: + cachingMode: + type: string + diskName: type: string + diskURI: + type: string + fsType: + type: string + kind: + type: string + readOnly: + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + properties: readOnly: type: boolean - subPath: + secretName: type: string - subPathExpr: + shareName: type: string required: - - mountPath - - name + - secretName + - shareName type: object - type: array - propagation: - items: - type: string - type: array - volumes: - items: + cephfs: properties: - awsElasticBlockStore: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - azureDisk: + monitors: + items: + type: string + type: array + path: + type: string + readOnly: + type: boolean + secretFile: + type: string + secretRef: properties: - cachingMode: - type: string - diskName: - type: string - diskURI: - type: string - fsType: - type: string - kind: + name: type: string - readOnly: - type: boolean - required: - - diskName - - diskURI type: object - azureFile: + x-kubernetes-map-type: atomic + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: properties: - readOnly: - type: boolean - secretName: - type: string - shareName: + name: type: string - required: - - secretName - - shareName type: object - cephfs: - properties: - monitors: - items: + x-kubernetes-map-type: atomic + volumeID: + type: string + required: + - volumeID + type: object + configMap: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: type: string - type: array - path: - type: string - readOnly: - type: boolean - secretFile: - type: string - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - user: - type: string - required: - - monitors - type: object - cinder: + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - volumeID: + name: type: string - required: - - volumeID type: object - configMap: - properties: - defaultMode: - format: int32 - type: integer - items: - items: + x-kubernetes-map-type: atomic + readOnly: + type: boolean + volumeAttributes: + additionalProperties: + type: string + type: object + required: + - driver + type: object + downwardAPI: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + fieldRef: properties: - key: + apiVersion: type: string - mode: - format: int32 - type: integer - path: + fieldPath: type: string required: - - key - - path + - fieldPath type: object - type: array - name: - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - csi: - properties: - driver: - type: string - fsType: - type: string - nodePublishSecretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - readOnly: - type: boolean - volumeAttributes: - additionalProperties: + x-kubernetes-map-type: atomic + mode: + format: int32 + type: integer + path: type: string - type: object - required: - - driver - type: object - downwardAPI: - properties: - defaultMode: - format: int32 - type: integer - items: - items: + resourceFieldRef: properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - mode: - format: int32 - type: integer - path: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic required: - - path + - resource type: object - type: array - type: object - emptyDir: - properties: - medium: - type: string - sizeLimit: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - ephemeral: + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + emptyDir: + properties: + medium: + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + properties: + volumeClaimTemplate: properties: - volumeClaimTemplate: + metadata: + type: object + spec: properties: - metadata: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name type: object - spec: + resources: properties: - accessModes: + claims: items: - type: string + properties: + name: + type: string + required: + - name + type: object type: array - dataSource: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - required: - - kind - - name - type: object - x-kubernetes-map-type: atomic - dataSourceRef: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - namespace: - type: string - required: - - kind + x-kubernetes-list-map-keys: - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true type: object - resources: - properties: - claims: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true type: object - selector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: + type: object + selector: + properties: + matchExpressions: + items: + properties: + key: type: string - type: object + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string type: object - x-kubernetes-map-type: atomic - storageClassName: - type: string - volumeMode: - type: string - volumeName: - type: string type: object - required: - - spec + x-kubernetes-map-type: atomic + storageClassName: + type: string + volumeMode: + type: string + volumeName: + type: string type: object + required: + - spec type: object - fc: - properties: - fsType: - type: string - lun: - format: int32 - type: integer - readOnly: - type: boolean - targetWWNs: - items: - type: string - type: array - wwids: - items: - type: string - type: array - type: object - flexVolume: - properties: - driver: - type: string - fsType: - type: string - options: - additionalProperties: - type: string - type: object - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - required: - - driver - type: object - flocker: - properties: - datasetName: - type: string - datasetUUID: - type: string - type: object - gcePersistentDisk: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - pdName: - type: string - readOnly: - type: boolean - required: - - pdName - type: object - gitRepo: - properties: - directory: - type: string - repository: - type: string - revision: - type: string - required: - - repository - type: object - glusterfs: - properties: - endpoints: - type: string - path: - type: string - readOnly: - type: boolean - required: - - endpoints - - path - type: object - hostPath: - properties: - path: - type: string - type: - type: string - required: - - path - type: object - iscsi: - properties: - chapAuthDiscovery: - type: boolean - chapAuthSession: - type: boolean - fsType: - type: string - initiatorName: - type: string - iqn: - type: string - iscsiInterface: - type: string - lun: - format: int32 - type: integer - portals: - items: - type: string - type: array - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - targetPortal: - type: string - required: - - iqn - - lun - - targetPortal - type: object - name: + type: object + fc: + properties: + fsType: type: string - nfs: - properties: - path: - type: string - readOnly: - type: boolean - server: - type: string - required: - - path - - server - type: object - persistentVolumeClaim: - properties: - claimName: - type: string - readOnly: - type: boolean - required: - - claimName + lun: + format: int32 + type: integer + readOnly: + type: boolean + targetWWNs: + items: + type: string + type: array + wwids: + items: + type: string + type: array + type: object + flexVolume: + properties: + driver: + type: string + fsType: + type: string + options: + additionalProperties: + type: string type: object - photonPersistentDisk: + readOnly: + type: boolean + secretRef: properties: - fsType: - type: string - pdID: + name: type: string - required: - - pdID type: object - portworxVolume: + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + properties: + datasetName: + type: string + datasetUUID: + type: string + type: object + gcePersistentDisk: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + pdName: + type: string + readOnly: + type: boolean + required: + - pdName + type: object + gitRepo: + properties: + directory: + type: string + repository: + type: string + revision: + type: string + required: + - repository + type: object + glusterfs: + properties: + endpoints: + type: string + path: + type: string + readOnly: + type: boolean + required: + - endpoints + - path + type: object + hostPath: + properties: + path: + type: string + type: + type: string + required: + - path + type: object + iscsi: + properties: + chapAuthDiscovery: + type: boolean + chapAuthSession: + type: boolean + fsType: + type: string + initiatorName: + type: string + iqn: + type: string + iscsiInterface: + type: string + lun: + format: int32 + type: integer + portals: + items: + type: string + type: array + readOnly: + type: boolean + secretRef: properties: - fsType: - type: string - readOnly: - type: boolean - volumeID: + name: type: string - required: - - volumeID type: object - projected: - properties: - defaultMode: - format: int32 - type: integer - sources: - items: + x-kubernetes-map-type: atomic + targetPortal: + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + type: string + nfs: + properties: + path: + type: string + readOnly: + type: boolean + server: + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + properties: + claimName: + type: string + readOnly: + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + properties: + fsType: + type: string + pdID: + type: string + required: + - pdID + type: object + portworxVolume: + properties: + fsType: + type: string + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + projected: + properties: + defaultMode: + format: int32 + type: integer + sources: + items: + properties: + configMap: properties: - configMap: - properties: - items: - items: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + properties: + items: + items: + properties: + fieldRef: properties: - key: + apiVersion: type: string - mode: - format: int32 - type: integer - path: + fieldPath: type: string required: - - key - - path + - fieldPath type: object - type: array - name: - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - downwardAPI: - properties: - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - required: - - path - type: object - type: array - type: object - secret: - properties: - items: - items: + x-kubernetes-map-type: atomic + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: properties: - key: + containerName: type: string - mode: - format: int32 - type: integer - path: + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: type: string required: - - key - - path + - resource type: object - type: array - name: - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - serviceAccountToken: - properties: - audience: - type: string - expirationSeconds: - format: int64 - type: integer - path: - type: string - required: - - path - type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array type: object - type: array - type: object - quobyte: - properties: - group: - type: string - readOnly: - type: boolean - registry: - type: string - tenant: - type: string - user: - type: string - volume: - type: string - required: - - registry - - volume - type: object - rbd: - properties: - fsType: - type: string - image: - type: string - keyring: - type: string - monitors: - items: - type: string - type: array - pool: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - user: - type: string - required: - - image - - monitors - type: object - scaleIO: - properties: - fsType: - type: string - gateway: - type: string - protectionDomain: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - sslEnabled: - type: boolean - storageMode: - type: string - storagePool: - type: string - system: - type: string - volumeName: - type: string - required: - - gateway - - secretRef - - system - type: object - secret: - properties: - defaultMode: - format: int32 - type: integer - items: - items: + secret: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: properties: - key: + audience: type: string - mode: - format: int32 + expirationSeconds: + format: int64 type: integer path: type: string required: - - key - path type: object - type: array - optional: - type: boolean - secretName: + type: object + type: array + type: object + quobyte: + properties: + group: + type: string + readOnly: + type: boolean + registry: + type: string + tenant: + type: string + user: + type: string + volume: + type: string + required: + - registry + - volume + type: object + rbd: + properties: + fsType: + type: string + image: + type: string + keyring: + type: string + monitors: + items: + type: string + type: array + pool: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: type: string type: object - storageos: + x-kubernetes-map-type: atomic + user: + type: string + required: + - image + - monitors + type: object + scaleIO: + properties: + fsType: + type: string + gateway: + type: string + protectionDomain: + type: string + readOnly: + type: boolean + secretRef: properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - volumeName: - type: string - volumeNamespace: + name: type: string type: object - vsphereVolume: + x-kubernetes-map-type: atomic + sslEnabled: + type: boolean + storageMode: + type: string + storagePool: + type: string + system: + type: string + volumeName: + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + optional: + type: boolean + secretName: + type: string + type: object + storageos: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: properties: - fsType: - type: string - storagePolicyID: - type: string - storagePolicyName: - type: string - volumePath: + name: type: string - required: - - volumePath type: object + x-kubernetes-map-type: atomic + volumeName: + type: string + volumeNamespace: + type: string + type: object + vsphereVolume: + properties: + fsType: + type: string + storagePolicyID: + type: string + storagePolicyName: + type: string + volumePath: + type: string required: - - name + - volumePath type: object - type: array - required: - - mounts - - volumes - type: object - type: array - hostName: + required: + - name + type: object + type: array + required: + - mounts + - volumes + type: object + type: array + hostName: + type: string + managementNetwork: + type: string + networkConfig: + properties: + template: type: string - managementNetwork: + type: object + networkData: + properties: + name: + type: string + namespace: type: string - networkConfig: - properties: - template: - type: string - type: object - networkData: - properties: - name: - type: string - namespace: - type: string - type: object - x-kubernetes-map-type: atomic - networks: - items: - properties: - defaultRoute: - type: boolean - fixedIP: - type: string - name: - pattern: ^[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9]$ - type: string - subnetName: - pattern: ^[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9]$ - type: string - required: - - name - - subnetName - type: object - type: array - userData: - properties: - name: - type: string - namespace: - type: string - type: object - x-kubernetes-map-type: atomic type: object - type: object - userData: - properties: - name: - type: string - namespace: - type: string - type: object - x-kubernetes-map-type: atomic - required: - - ansibleSSHPrivateKeySecret - - nodes + x-kubernetes-map-type: atomic + networks: + items: + properties: + defaultRoute: + type: boolean + fixedIP: + type: string + name: + pattern: ^[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9]$ + type: string + subnetName: + pattern: ^[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9]$ + type: string + required: + - name + - subnetName + type: object + type: array + userData: + properties: + name: + type: string + namespace: + type: string + type: object + x-kubernetes-map-type: atomic + type: object type: object preProvisioned: type: boolean @@ -1900,6 +1899,7 @@ spec: type: array required: - nodeTemplate + - nodes type: object status: properties: diff --git a/api/v1beta1/common.go b/api/v1beta1/common.go index dfc44b935..e8b60f992 100644 --- a/api/v1beta1/common.go +++ b/api/v1beta1/common.go @@ -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 diff --git a/api/v1beta1/openstackdataplanenodeset_types.go b/api/v1beta1/openstackdataplanenodeset_types.go index 98ebab917..830eec5b8 100644 --- a/api/v1beta1/openstackdataplanenodeset_types.go +++ b/api/v1beta1/openstackdataplanenodeset_types.go @@ -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"} diff --git a/api/v1beta1/openstackdataplanenodeset_webhook.go b/api/v1beta1/openstackdataplanenodeset_webhook.go index 0b817167d..360439b5b 100644 --- a/api/v1beta1/openstackdataplanenodeset_webhook.go +++ b/api/v1beta1/openstackdataplanenodeset_webhook.go @@ -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 == "" { @@ -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 diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 42a73636a..7f5591692 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -188,13 +188,6 @@ func (in *NodeSection) DeepCopy() *NodeSection { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeTemplate) DeepCopyInto(out *NodeTemplate) { *out = *in - if in.Nodes != nil { - in, out := &in.Nodes, &out.Nodes - *out = make(map[string]NodeSection, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } out.NetworkConfig = in.NetworkConfig if in.Networks != nil { in, out := &in.Networks, &out.Networks @@ -297,6 +290,13 @@ func (in *OpenStackDataPlaneNodeSetSpec) DeepCopyInto(out *OpenStackDataPlaneNod *out = *in in.BaremetalSetTemplate.DeepCopyInto(&out.BaremetalSetTemplate) in.NodeTemplate.DeepCopyInto(&out.NodeTemplate) + if in.Nodes != nil { + in, out := &in.Nodes, &out.Nodes + *out = make(map[string]NodeSection, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } if in.Env != nil { in, out := &in.Env, &out.Env *out = make([]v1.EnvVar, len(*in)) diff --git a/config/crd/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml b/config/crd/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml index e9f188a92..cf10ee39a 100644 --- a/config/crd/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml +++ b/config/crd/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml @@ -1066,821 +1066,820 @@ spec: - subnetName type: object type: array - nodes: - additionalProperties: + userData: + properties: + name: + type: string + namespace: + type: string + type: object + x-kubernetes-map-type: atomic + required: + - ansibleSSHPrivateKeySecret + type: object + nodes: + additionalProperties: + properties: + ansible: properties: - ansible: - properties: - ansibleHost: - type: string - ansiblePort: - type: integer - ansibleUser: + ansibleHost: + type: string + ansiblePort: + type: integer + ansibleUser: + type: string + ansibleVars: + x-kubernetes-preserve-unknown-fields: true + type: object + extraMounts: + items: + properties: + extraVolType: + type: string + mounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + propagation: + items: type: string - ansibleVars: - x-kubernetes-preserve-unknown-fields: true - type: object - extraMounts: - items: - properties: - extraVolType: - type: string - mounts: - items: + type: array + volumes: + items: + properties: + awsElasticBlockStore: properties: - mountPath: + fsType: type: string - mountPropagation: + partition: + format: int32 + type: integer + readOnly: + type: boolean + volumeID: type: string - name: + required: + - volumeID + type: object + azureDisk: + properties: + cachingMode: + type: string + diskName: type: string + diskURI: + type: string + fsType: + type: string + kind: + type: string + readOnly: + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + properties: readOnly: type: boolean - subPath: + secretName: type: string - subPathExpr: + shareName: type: string required: - - mountPath - - name + - secretName + - shareName type: object - type: array - propagation: - items: - type: string - type: array - volumes: - items: + cephfs: properties: - awsElasticBlockStore: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - azureDisk: + monitors: + items: + type: string + type: array + path: + type: string + readOnly: + type: boolean + secretFile: + type: string + secretRef: properties: - cachingMode: - type: string - diskName: - type: string - diskURI: - type: string - fsType: - type: string - kind: + name: type: string - readOnly: - type: boolean - required: - - diskName - - diskURI type: object - azureFile: + x-kubernetes-map-type: atomic + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: properties: - readOnly: - type: boolean - secretName: - type: string - shareName: + name: type: string - required: - - secretName - - shareName type: object - cephfs: - properties: - monitors: - items: + x-kubernetes-map-type: atomic + volumeID: + type: string + required: + - volumeID + type: object + configMap: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: type: string - type: array - path: - type: string - readOnly: - type: boolean - secretFile: - type: string - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - user: - type: string - required: - - monitors - type: object - cinder: + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - volumeID: + name: type: string - required: - - volumeID type: object - configMap: - properties: - defaultMode: - format: int32 - type: integer - items: - items: + x-kubernetes-map-type: atomic + readOnly: + type: boolean + volumeAttributes: + additionalProperties: + type: string + type: object + required: + - driver + type: object + downwardAPI: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + fieldRef: properties: - key: + apiVersion: type: string - mode: - format: int32 - type: integer - path: + fieldPath: type: string required: - - key - - path + - fieldPath type: object - type: array - name: - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - csi: - properties: - driver: - type: string - fsType: - type: string - nodePublishSecretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - readOnly: - type: boolean - volumeAttributes: - additionalProperties: + x-kubernetes-map-type: atomic + mode: + format: int32 + type: integer + path: type: string - type: object - required: - - driver - type: object - downwardAPI: - properties: - defaultMode: - format: int32 - type: integer - items: - items: + resourceFieldRef: properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - mode: - format: int32 - type: integer - path: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic required: - - path + - resource type: object - type: array - type: object - emptyDir: - properties: - medium: - type: string - sizeLimit: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - ephemeral: + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + emptyDir: + properties: + medium: + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + properties: + volumeClaimTemplate: properties: - volumeClaimTemplate: + metadata: + type: object + spec: properties: - metadata: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name type: object - spec: + resources: properties: - accessModes: + claims: items: - type: string + properties: + name: + type: string + required: + - name + type: object type: array - dataSource: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - required: - - kind - - name - type: object - x-kubernetes-map-type: atomic - dataSourceRef: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - namespace: - type: string - required: - - kind + x-kubernetes-list-map-keys: - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true type: object - resources: - properties: - claims: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true type: object - selector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: + type: object + selector: + properties: + matchExpressions: + items: + properties: + key: type: string - type: object + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string type: object - x-kubernetes-map-type: atomic - storageClassName: - type: string - volumeMode: - type: string - volumeName: - type: string type: object - required: - - spec + x-kubernetes-map-type: atomic + storageClassName: + type: string + volumeMode: + type: string + volumeName: + type: string type: object + required: + - spec type: object - fc: - properties: - fsType: - type: string - lun: - format: int32 - type: integer - readOnly: - type: boolean - targetWWNs: - items: - type: string - type: array - wwids: - items: - type: string - type: array - type: object - flexVolume: - properties: - driver: - type: string - fsType: - type: string - options: - additionalProperties: - type: string - type: object - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - required: - - driver - type: object - flocker: - properties: - datasetName: - type: string - datasetUUID: - type: string - type: object - gcePersistentDisk: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - pdName: - type: string - readOnly: - type: boolean - required: - - pdName - type: object - gitRepo: - properties: - directory: - type: string - repository: - type: string - revision: - type: string - required: - - repository - type: object - glusterfs: - properties: - endpoints: - type: string - path: - type: string - readOnly: - type: boolean - required: - - endpoints - - path - type: object - hostPath: - properties: - path: - type: string - type: - type: string - required: - - path - type: object - iscsi: - properties: - chapAuthDiscovery: - type: boolean - chapAuthSession: - type: boolean - fsType: - type: string - initiatorName: - type: string - iqn: - type: string - iscsiInterface: - type: string - lun: - format: int32 - type: integer - portals: - items: - type: string - type: array - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - targetPortal: - type: string - required: - - iqn - - lun - - targetPortal - type: object - name: + type: object + fc: + properties: + fsType: type: string - nfs: - properties: - path: - type: string - readOnly: - type: boolean - server: - type: string - required: - - path - - server - type: object - persistentVolumeClaim: - properties: - claimName: - type: string - readOnly: - type: boolean - required: - - claimName + lun: + format: int32 + type: integer + readOnly: + type: boolean + targetWWNs: + items: + type: string + type: array + wwids: + items: + type: string + type: array + type: object + flexVolume: + properties: + driver: + type: string + fsType: + type: string + options: + additionalProperties: + type: string type: object - photonPersistentDisk: + readOnly: + type: boolean + secretRef: properties: - fsType: - type: string - pdID: + name: type: string - required: - - pdID type: object - portworxVolume: + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + properties: + datasetName: + type: string + datasetUUID: + type: string + type: object + gcePersistentDisk: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + pdName: + type: string + readOnly: + type: boolean + required: + - pdName + type: object + gitRepo: + properties: + directory: + type: string + repository: + type: string + revision: + type: string + required: + - repository + type: object + glusterfs: + properties: + endpoints: + type: string + path: + type: string + readOnly: + type: boolean + required: + - endpoints + - path + type: object + hostPath: + properties: + path: + type: string + type: + type: string + required: + - path + type: object + iscsi: + properties: + chapAuthDiscovery: + type: boolean + chapAuthSession: + type: boolean + fsType: + type: string + initiatorName: + type: string + iqn: + type: string + iscsiInterface: + type: string + lun: + format: int32 + type: integer + portals: + items: + type: string + type: array + readOnly: + type: boolean + secretRef: properties: - fsType: - type: string - readOnly: - type: boolean - volumeID: + name: type: string - required: - - volumeID type: object - projected: - properties: - defaultMode: - format: int32 - type: integer - sources: - items: + x-kubernetes-map-type: atomic + targetPortal: + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + type: string + nfs: + properties: + path: + type: string + readOnly: + type: boolean + server: + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + properties: + claimName: + type: string + readOnly: + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + properties: + fsType: + type: string + pdID: + type: string + required: + - pdID + type: object + portworxVolume: + properties: + fsType: + type: string + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + projected: + properties: + defaultMode: + format: int32 + type: integer + sources: + items: + properties: + configMap: properties: - configMap: - properties: - items: - items: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + properties: + items: + items: + properties: + fieldRef: properties: - key: + apiVersion: type: string - mode: - format: int32 - type: integer - path: + fieldPath: type: string required: - - key - - path + - fieldPath type: object - type: array - name: - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - downwardAPI: - properties: - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - required: - - path - type: object - type: array - type: object - secret: - properties: - items: - items: + x-kubernetes-map-type: atomic + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: properties: - key: + containerName: type: string - mode: - format: int32 - type: integer - path: + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: type: string required: - - key - - path + - resource type: object - type: array - name: - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - serviceAccountToken: - properties: - audience: - type: string - expirationSeconds: - format: int64 - type: integer - path: - type: string - required: - - path - type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array type: object - type: array - type: object - quobyte: - properties: - group: - type: string - readOnly: - type: boolean - registry: - type: string - tenant: - type: string - user: - type: string - volume: - type: string - required: - - registry - - volume - type: object - rbd: - properties: - fsType: - type: string - image: - type: string - keyring: - type: string - monitors: - items: - type: string - type: array - pool: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - user: - type: string - required: - - image - - monitors - type: object - scaleIO: - properties: - fsType: - type: string - gateway: - type: string - protectionDomain: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - sslEnabled: - type: boolean - storageMode: - type: string - storagePool: - type: string - system: - type: string - volumeName: - type: string - required: - - gateway - - secretRef - - system - type: object - secret: - properties: - defaultMode: - format: int32 - type: integer - items: - items: + secret: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: properties: - key: + audience: type: string - mode: - format: int32 + expirationSeconds: + format: int64 type: integer path: type: string required: - - key - path type: object - type: array - optional: - type: boolean - secretName: + type: object + type: array + type: object + quobyte: + properties: + group: + type: string + readOnly: + type: boolean + registry: + type: string + tenant: + type: string + user: + type: string + volume: + type: string + required: + - registry + - volume + type: object + rbd: + properties: + fsType: + type: string + image: + type: string + keyring: + type: string + monitors: + items: + type: string + type: array + pool: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: type: string type: object - storageos: + x-kubernetes-map-type: atomic + user: + type: string + required: + - image + - monitors + type: object + scaleIO: + properties: + fsType: + type: string + gateway: + type: string + protectionDomain: + type: string + readOnly: + type: boolean + secretRef: properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - x-kubernetes-map-type: atomic - volumeName: - type: string - volumeNamespace: + name: type: string type: object - vsphereVolume: + x-kubernetes-map-type: atomic + sslEnabled: + type: boolean + storageMode: + type: string + storagePool: + type: string + system: + type: string + volumeName: + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + optional: + type: boolean + secretName: + type: string + type: object + storageos: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: properties: - fsType: - type: string - storagePolicyID: - type: string - storagePolicyName: - type: string - volumePath: + name: type: string - required: - - volumePath type: object + x-kubernetes-map-type: atomic + volumeName: + type: string + volumeNamespace: + type: string + type: object + vsphereVolume: + properties: + fsType: + type: string + storagePolicyID: + type: string + storagePolicyName: + type: string + volumePath: + type: string required: - - name + - volumePath type: object - type: array - required: - - mounts - - volumes - type: object - type: array - hostName: + required: + - name + type: object + type: array + required: + - mounts + - volumes + type: object + type: array + hostName: + type: string + managementNetwork: + type: string + networkConfig: + properties: + template: type: string - managementNetwork: + type: object + networkData: + properties: + name: + type: string + namespace: type: string - networkConfig: - properties: - template: - type: string - type: object - networkData: - properties: - name: - type: string - namespace: - type: string - type: object - x-kubernetes-map-type: atomic - networks: - items: - properties: - defaultRoute: - type: boolean - fixedIP: - type: string - name: - pattern: ^[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9]$ - type: string - subnetName: - pattern: ^[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9]$ - type: string - required: - - name - - subnetName - type: object - type: array - userData: - properties: - name: - type: string - namespace: - type: string - type: object - x-kubernetes-map-type: atomic type: object - type: object - userData: - properties: - name: - type: string - namespace: - type: string - type: object - x-kubernetes-map-type: atomic - required: - - ansibleSSHPrivateKeySecret - - nodes + x-kubernetes-map-type: atomic + networks: + items: + properties: + defaultRoute: + type: boolean + fixedIP: + type: string + name: + pattern: ^[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9]$ + type: string + subnetName: + pattern: ^[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9]$ + type: string + required: + - name + - subnetName + type: object + type: array + userData: + properties: + name: + type: string + namespace: + type: string + type: object + x-kubernetes-map-type: atomic + type: object type: object preProvisioned: type: boolean @@ -1900,6 +1899,7 @@ spec: type: array required: - nodeTemplate + - nodes type: object status: properties: diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenodeset.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenodeset.yaml index 38a9c5985..3e2464673 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenodeset.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenodeset.yaml @@ -21,19 +21,19 @@ spec: preProvisioned: true deployStrategy: deploy: true + nodes: + edpm-compute-0: + hostName: edpm-compute-0 + ansible: + ansibleHost: 192.168.122.100 + ansibleVars: + ctlplane_ip: 192.168.122.100 + internal_api_ip: 172.17.0.100 + storage_ip: 172.18.0.100 + tenant_ip: 172.19.0.100 + fqdn_internal_api: edpm-compute-0.example.com nodeTemplate: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret - nodes: - edpm-compute-0: - hostName: edpm-compute-0 - ansible: - ansibleHost: 192.168.122.100 - ansibleVars: - ctlplane_ip: 192.168.122.100 - internal_api_ip: 172.17.0.100 - storage_ip: 172.18.0.100 - tenant_ip: 172.19.0.100 - fqdn_internal_api: edpm-compute-0.example.com managementNetwork: ctlplane ansible: ansibleUser: cloud-admin diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal.yaml index ce97ae047..65d3b37ad 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal.yaml @@ -32,105 +32,103 @@ spec: - 192.168.111.1 dnsSearchDomains: - osptest.openstack.org - nodeTemplate: - ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret - nodes: - edpm-compute-0: - hostName: edpm-compute-0 - ansible: - ansibleHost: 192.168.111.100 - ansibleVars: - ctlplane_ip: 192.168.111.100 - internal_api_ip: 172.17.0.100 - storage_ip: 172.18.0.100 - tenant_ip: 172.19.0.100 - fqdn_internal_api: edpm-compute-0.example.com - edpm-compute-1: - hostName: edpm-compute-1 - ansible: - ansibleHost: 192.168.111.101 - ansibleVars: - ctlplane_ip: 192.168.111.101 - internal_api_ip: 172.17.0.101 - storage_ip: 172.18.0.101 - tenant_ip: 172.19.0.101 - fqdn_internal_api: edpm-compute-1.example.com + nodes: + edpm-compute-0: + hostName: edpm-compute-0 + ansible: + ansibleHost: 192.168.111.100 + ansibleVars: + ctlplane_ip: 192.168.111.100 + internal_api_ip: 172.17.0.100 + storage_ip: 172.18.0.100 + tenant_ip: 172.19.0.100 + fqdn_internal_api: edpm-compute-0.example.com + edpm-compute-1: + hostName: edpm-compute-1 ansible: - ansibleUser: cloud-admin - ansiblePort: 22 + ansibleHost: 192.168.111.101 ansibleVars: - service_net_map: - nova_api_network: internal_api - nova_libvirt_network: internal_api - edpm_chrony_ntp_servers: - - pool.ntp.org - # edpm_network_config - # Default nic config template for a EDPM compute node - # These vars are edpm_network_config role vars - edpm_network_config_template: templates/single_nic_vlans/single_nic_vlans.j2 - edpm_network_config_hide_sensitive_logs: false + ctlplane_ip: 192.168.111.101 + internal_api_ip: 172.17.0.101 + storage_ip: 172.18.0.101 + tenant_ip: 172.19.0.101 + fqdn_internal_api: edpm-compute-1.example.com + nodeTemplate: + ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret + ansible: + ansibleUser: cloud-admin + ansiblePort: 22 + ansibleVars: + service_net_map: + nova_api_network: internal_api + nova_libvirt_network: internal_api + edpm_chrony_ntp_servers: + - pool.ntp.org + # edpm_network_config + # Default nic config template for a EDPM compute node + # These vars are edpm_network_config role vars + edpm_network_config_template: templates/single_nic_vlans/single_nic_vlans.j2 + edpm_network_config_hide_sensitive_logs: false - # These vars are for the network config templates themselves and are - # considered EDPM network defaults. - neutron_physical_bridge_name: br-ex - neutron_public_interface_name: eth0 - ctlplane_mtu: 1500 - ctlplane_subnet_cidr: 24 - ctlplane_gateway_ip: 192.168.111.1 - ctlplane_host_routes: - - ip_netmask: 0.0.0.0/0 - next_hop: 192.168.111.1 - external_mtu: 1500 - external_vlan_id: 44 - external_cidr: '24' - external_host_routes: [] - internal_api_mtu: 1500 - internal_api_vlan_id: 20 - internal_api_cidr: '24' - internal_api_host_routes: [] - storage_mtu: 1500 - storage_vlan_id: 21 - storage_cidr: '24' - storage_host_routes: [] - tenant_mtu: 1500 - tenant_vlan_id: 22 - tenant_cidr: '24' - tenant_host_routes: [] - role_networks: - - InternalApi - - Storage - - Tenant - networks_lower: - External: external - InternalApi: internal_api - Storage: storage - Tenant: tenant + # These vars are for the network config templates themselves and are + # considered EDPM network defaults. + neutron_physical_bridge_name: br-ex + neutron_public_interface_name: eth0 + ctlplane_mtu: 1500 + ctlplane_subnet_cidr: 24 + ctlplane_gateway_ip: 192.168.111.1 + ctlplane_host_routes: + - ip_netmask: 0.0.0.0/0 + next_hop: 192.168.111.1 + external_mtu: 1500 + external_vlan_id: 44 + external_cidr: '24' + external_host_routes: [] + internal_api_mtu: 1500 + internal_api_vlan_id: 20 + internal_api_cidr: '24' + internal_api_host_routes: [] + storage_mtu: 1500 + storage_vlan_id: 21 + storage_cidr: '24' + storage_host_routes: [] + tenant_mtu: 1500 + tenant_vlan_id: 22 + tenant_cidr: '24' + tenant_host_routes: [] + role_networks: + - InternalApi + - Storage + - Tenant + networks_lower: + External: external + InternalApi: internal_api + Storage: storage + Tenant: tenant - # edpm_nodes_validation - edpm_nodes_validation_validate_controllers_icmp: false - edpm_nodes_validation_validate_gateway_icmp: false + # edpm_nodes_validation + edpm_nodes_validation_validate_controllers_icmp: false + edpm_nodes_validation_validate_gateway_icmp: false - edpm_ovn_metadata_agent_metadata_agent_DEFAULT_metadata_proxy_shared_secret: 12345678 - edpm_ovn_metadata_agent_DEFAULT_bind_host: 127.0.0.1 - ctlplane_dns_nameservers: - - 192.168.111.1 - dns_search_domains: [] + edpm_ovn_metadata_agent_metadata_agent_DEFAULT_metadata_proxy_shared_secret: 12345678 + edpm_ovn_metadata_agent_DEFAULT_bind_host: 127.0.0.1 + ctlplane_dns_nameservers: + - 192.168.111.1 + dns_search_domains: [] - registry_url: quay.io/podified-antelope-centos9 - image_tag: current-podified - edpm_ovn_controller_agent_image: "{{ registry_url }}/openstack-ovn-controller:{{ image_tag }}" - edpm_iscsid_image: "{{ registry_url }}/openstack-iscsid:{{ image_tag }}" - edpm_logrotate_crond_image: "{{ registry_url }}/openstack-cron:{{ image_tag }}" - edpm_nova_compute_container_image: "{{ registry_url }}/openstack-nova-compute:{{ image_tag }}" - edpm_nova_libvirt_container_image: "{{ registry_url }}/openstack-nova-libvirt:{{ image_tag }}" - edpm_ovn_metadata_agent_image: "{{ registry_url }}/openstack-neutron-metadata-agent-ovn:{{ image_tag }}" + registry_url: quay.io/podified-antelope-centos9 + image_tag: current-podified + edpm_ovn_controller_agent_image: "{{ registry_url }}/openstack-ovn-controller:{{ image_tag }}" + edpm_iscsid_image: "{{ registry_url }}/openstack-iscsid:{{ image_tag }}" + edpm_logrotate_crond_image: "{{ registry_url }}/openstack-cron:{{ image_tag }}" + edpm_nova_compute_container_image: "{{ registry_url }}/openstack-nova-compute:{{ image_tag }}" + edpm_nova_libvirt_container_image: "{{ registry_url }}/openstack-nova-libvirt:{{ image_tag }}" + edpm_ovn_metadata_agent_image: "{{ registry_url }}/openstack-neutron-metadata-agent-ovn:{{ image_tag }}" - gather_facts: false - enable_debug: false - # edpm firewall, change the allowed CIDR if needed - edpm_sshd_configure_firewall: true - edpm_sshd_allowed_ranges: ['192.168.111.0/24'] - # SELinux module - edpm_selinux_mode: enforcing - deployStrategy: - deploy: false + gather_facts: false + enable_debug: false + # edpm firewall, change the allowed CIDR if needed + edpm_sshd_configure_firewall: true + edpm_sshd_allowed_ranges: ['192.168.111.0/24'] + # SELinux module + edpm_selinux_mode: enforcing diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal_with_ipam.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal_with_ipam.yaml index 9d57f984d..1c82b505e 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal_with_ipam.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal_with_ipam.yaml @@ -25,11 +25,11 @@ spec: app: openstack ctlplaneInterface: enp1s0 cloudUserName: cloud-admin + nodes: + edpm-compute-0: + hostName: edpm-compute-0 nodeTemplate: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret - nodes: - edpm-compute-0: - hostName: edpm-compute-0 networks: - name: CtlPlane subnetName: subnet1 diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_ceph.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_ceph.yaml index 9914b69a0..11f8777f5 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_ceph.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_ceph.yaml @@ -11,31 +11,29 @@ spec: value: "True" deployStrategy: deploy: false + nodes: + edpm-compute-0: + hostName: edpm-compute-0 + ansible: + ansibleHost: 192.168.122.100 + ansibleVars: + ctlplane_ip: 192.168.122.100 + internal_api_ip: 172.17.0.100 + storage_ip: 172.18.0.100 + tenant_ip: 172.19.0.100 + fqdn_internal_api: edpm-compute-0.example.com + edpm-compute-1: + hostName: edpm-compute-1 + ansible: + ansibleHost: 192.168.122.101 + ansibleVars: + ctlplane_ip: 192.168.122.101 + internal_api_ip: 172.17.0.101 + storage_ip: 172.18.0.101 + tenant_ip: 172.19.0.101 + fqdn_internal_api: edpm-compute-1.example.com nodeTemplate: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret - nodes: - edpm-compute-0: - hostName: edpm-compute-0 - ansible: - ansibleHost: 192.168.122.100 - ansibleVars: - ctlplane_ip: 192.168.122.100 - internal_api_ip: 172.17.0.100 - storage_ip: 172.18.0.100 - tenant_ip: 172.19.0.100 - fqdn_internal_api: edpm-compute-0.example.com - deployStrategy: - deploy: false - edpm-compute-1: - hostName: edpm-compute-1 - ansible: - ansibleHost: 192.168.122.101 - ansibleVars: - ctlplane_ip: 192.168.122.101 - internal_api_ip: 172.17.0.101 - storage_ip: 172.18.0.101 - tenant_ip: 172.19.0.101 - fqdn_internal_api: edpm-compute-1.example.com preProvisioned: true extraMounts: - extraVolType: Ceph diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_customnetworks.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_customnetworks.yaml index 971739068..92933011e 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_customnetworks.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_customnetworks.yaml @@ -25,23 +25,21 @@ spec: - nova deployStrategy: deploy: false + nodes: + edpm-compute-0: + hostName: edpm-compute-0 + ansible: + ansibleHost: 192.168.1.5 + ansibleVars: + ctlplane_ip: 192.168.1.5 + internal_api_ip: 172.17.0.101 + storage_ip: 172.18.0.101 + tenant_ip: 172.19.0.101 + external_ip: 172.20.12.76 + fqdn_internal_api: edpm-compute-1.example.com + ansible_ssh_transfer_method: scp nodeTemplate: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret - nodes: - edpm-compute-0: - hostName: edpm-compute-0 - ansible: - ansibleHost: 192.168.1.5 - ansibleVars: - ctlplane_ip: 192.168.1.5 - internal_api_ip: 172.17.0.101 - storage_ip: 172.18.0.101 - tenant_ip: 172.19.0.101 - external_ip: 172.20.12.76 - fqdn_internal_api: edpm-compute-1.example.com - ansible_ssh_transfer_method: scp - ansibleUser: cloud-admin - managed: false managementNetwork: ctlplane ansible: ansibleUser: cloud-admin diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_with_ipam.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_with_ipam.yaml index 64c582c2f..ad262f667 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_with_ipam.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_with_ipam.yaml @@ -20,39 +20,39 @@ spec: - ovn - libvirt - nova + nodes: + edpm-compute-0: + hostName: edpm-compute-0 + ansible: + ansibleHost: 192.168.122.100 + networks: + - name: CtlPlane + subnetName: subnet1 + defaultRoute: true + fixedIP: 192.168.122.100 + - name: InternalApi + subnetName: subnet1 + - name: Storage + subnetName: subnet1 + - name: Tenant + subnetName: subnet1 + edpm-compute-1: + hostName: edpm-compute-1 + ansible: + ansibleHost: 192.168.122.101 + networks: + - name: CtlPlane + subnetName: subnet1 + defaultRoute: true + fixedIP: 192.168.122.101 + - name: InternalApi + subnetName: subnet1 + - name: Storage + subnetName: subnet1 + - name: Tenant + subnetName: subnet1 nodeTemplate: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret - nodes: - edpm-compute-0: - hostName: edpm-compute-0 - ansible: - ansibleHost: 192.168.122.100 - networks: - - name: CtlPlane - subnetName: subnet1 - defaultRoute: true - fixedIP: 192.168.122.100 - - name: InternalApi - subnetName: subnet1 - - name: Storage - subnetName: subnet1 - - name: Tenant - subnetName: subnet1 - edpm-compute-1: - hostName: edpm-compute-1 - ansible: - ansibleHost: 192.168.122.101 - networks: - - name: CtlPlane - subnetName: subnet1 - defaultRoute: true - fixedIP: 192.168.122.101 - - name: InternalApi - subnetName: subnet1 - - name: Storage - subnetName: subnet1 - - name: Tenant - subnetName: subnet1 managementNetwork: ctlplane ansible: ansibleUser: cloud-admin diff --git a/docs/openstack_dataplanenodeset.md b/docs/openstack_dataplanenodeset.md index 3303cf7be..218634e75 100644 --- a/docs/openstack_dataplanenodeset.md +++ b/docs/openstack_dataplanenodeset.md @@ -92,7 +92,6 @@ NodeTemplate is a specification of the node attributes that override top level a | Field | Description | Scheme | Required | | ----- | ----------- | ------ | -------- | | ansibleSSHPrivateKeySecret | AnsibleSSHPrivateKeySecret Name of a private SSH key secret containing private SSH key for connecting to node. The named secret must be of the form: Secret.data.ssh-privatekey: | string | true | -| nodes | Nodes - Map of Node Names and node specific data. Values here override defaults in the upper level section. | map[string][NodeSection](#nodesection) | true | | networkConfig | NetworkConfig - Network configuration details. Contains os-net-config related properties. | [NetworkConfigSection](#networkconfigsection) | false | | networks | Networks - Instance networks | []infranetworkv1.IPSetNetwork | false | | managementNetwork | ManagementNetwork - Name of network to use for management (SSH/Ansible) | string | false | @@ -134,6 +133,7 @@ OpenStackDataPlaneNodeSetSpec defines the desired state of OpenStackDataPlaneNod | ----- | ----------- | ------ | -------- | | baremetalSetTemplate | BaremetalSetTemplate Template for BaremetalSet for the NodeSet | baremetalv1.OpenStackBaremetalSetSpec | false | | nodeTemplate | NodeTemplate - node attributes specific to nodes defined by this resource. These attributes can be overriden at the individual node level, else take their defaults from valus in this section. | [NodeTemplate](#nodetemplate) | true | +| nodes | Nodes - Map of Node Names and node specific data. Values here override defaults in the upper level section. | map[string][NodeSection](#nodesection) | true | | preProvisioned | \n\nPreProvisioned - Whether the nodes are actually pre-provisioned (True) or should be preprovisioned (False) | bool | false | | env | Env is a list containing the environment variables to pass to the pod | []corev1.EnvVar | false | | deployStrategy | DeployStrategy section to control how the node is deployed | [DeployStrategySection](#deploystrategysection) | false | diff --git a/docs/openstack_dataplaneservice.md b/docs/openstack_dataplaneservice.md index 99ae44cc3..a1d39c92c 100644 --- a/docs/openstack_dataplaneservice.md +++ b/docs/openstack_dataplaneservice.md @@ -93,7 +93,6 @@ NodeTemplate is a specification of the node attributes that override top level a | Field | Description | Scheme | Required | | ----- | ----------- | ------ | -------- | | ansibleSSHPrivateKeySecret | AnsibleSSHPrivateKeySecret Name of a private SSH key secret containing private SSH key for connecting to node. The named secret must be of the form: Secret.data.ssh-privatekey: | string | true | -| nodes | Nodes - Map of Node Names and node specific data. Values here override defaults in the upper level section. | map[string][NodeSection](#nodesection) | true | | networkConfig | NetworkConfig - Network configuration details. Contains os-net-config related properties. | [NetworkConfigSection](#networkconfigsection) | false | | networks | Networks - Instance networks | []infranetworkv1.IPSetNetwork | false | | managementNetwork | ManagementNetwork - Name of network to use for management (SSH/Ansible) | string | false | diff --git a/pkg/deployment/baremetal.go b/pkg/deployment/baremetal.go index 5da9255a1..392d2dc44 100644 --- a/pkg/deployment/baremetal.go +++ b/pkg/deployment/baremetal.go @@ -51,7 +51,7 @@ func DeployBaremetalSet( utils.LogForObject(helper, "Reconciling BaremetalSet", instance) _, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), baremetalSet, func() error { instance.Spec.BaremetalSetTemplate.DeepCopyInto(&baremetalSet.Spec) - for nodeName, node := range instance.Spec.NodeTemplate.Nodes { + for nodeName, node := range instance.Spec.Nodes { hostName := node.HostName ipSet, ok := ipSets[nodeName] instanceSpec := baremetalSet.Spec.BaremetalHosts[hostName] diff --git a/pkg/deployment/inventory.go b/pkg/deployment/inventory.go index 7aa9874be..fee15efbb 100644 --- a/pkg/deployment/inventory.go +++ b/pkg/deployment/inventory.go @@ -47,7 +47,7 @@ func GenerateNodeSetInventory(ctx context.Context, helper *helper.Helper, return "", err } - for nodeName, node := range instance.Spec.NodeTemplate.Nodes { + for nodeName, node := range instance.Spec.Nodes { host := roleNameGroup.AddHost(nodeName) var dnsSearchDomains []string @@ -191,16 +191,16 @@ func populateInventoryFromIPAM( // getAnsibleUser returns the string value from the template unless it is set in the node func getAnsibleUser(instance *dataplanev1.OpenStackDataPlaneNodeSet, nodeName string) string { - if instance.Spec.NodeTemplate.Nodes[nodeName].Ansible.AnsibleUser != "" { - return instance.Spec.NodeTemplate.Nodes[nodeName].Ansible.AnsibleUser + if instance.Spec.Nodes[nodeName].Ansible.AnsibleUser != "" { + return instance.Spec.Nodes[nodeName].Ansible.AnsibleUser } return instance.Spec.NodeTemplate.Ansible.AnsibleUser } // getAnsiblePort returns the string value from the template unless it is set in the node func getAnsiblePort(instance *dataplanev1.OpenStackDataPlaneNodeSet, nodeName string) string { - if instance.Spec.NodeTemplate.Nodes[nodeName].Ansible.AnsiblePort > 0 { - return strconv.Itoa(instance.Spec.NodeTemplate.Nodes[nodeName].Ansible.AnsiblePort) + if instance.Spec.Nodes[nodeName].Ansible.AnsiblePort > 0 { + return strconv.Itoa(instance.Spec.Nodes[nodeName].Ansible.AnsiblePort) } return strconv.Itoa(instance.Spec.NodeTemplate.Ansible.AnsiblePort) } @@ -209,24 +209,24 @@ func getAnsiblePort(instance *dataplanev1.OpenStackDataPlaneNodeSet, nodeName st func getAnsibleManagementNetwork( instance *dataplanev1.OpenStackDataPlaneNodeSet, nodeName string) string { - if instance.Spec.NodeTemplate.Nodes[nodeName].ManagementNetwork != "" { - return instance.Spec.NodeTemplate.Nodes[nodeName].ManagementNetwork + if instance.Spec.Nodes[nodeName].ManagementNetwork != "" { + return instance.Spec.Nodes[nodeName].ManagementNetwork } return instance.Spec.NodeTemplate.ManagementNetwork } // getAnsibleNetworkConfig returns a JSON string value from the template unless it is set in the node func getAnsibleNetworkConfig(instance *dataplanev1.OpenStackDataPlaneNodeSet, nodeName string) dataplanev1.NetworkConfigSection { - if instance.Spec.NodeTemplate.Nodes[nodeName].NetworkConfig.Template != "" { - return instance.Spec.NodeTemplate.Nodes[nodeName].NetworkConfig + if instance.Spec.Nodes[nodeName].NetworkConfig.Template != "" { + return instance.Spec.Nodes[nodeName].NetworkConfig } return instance.Spec.NodeTemplate.NetworkConfig } // getAnsibleNetworks returns a JSON string mapping fixedIP and/or network name to their valules func getAnsibleNetworks(instance *dataplanev1.OpenStackDataPlaneNodeSet, nodeName string) []infranetworkv1.IPSetNetwork { - if len(instance.Spec.NodeTemplate.Nodes[nodeName].Networks) > 0 { - return instance.Spec.NodeTemplate.Nodes[nodeName].Networks + if len(instance.Spec.Nodes[nodeName].Networks) > 0 { + return instance.Spec.Nodes[nodeName].Networks } return instance.Spec.NodeTemplate.Networks } @@ -256,7 +256,7 @@ func getAnsibleVars( nodeSet[key] = v } - for key, val := range instance.Spec.NodeTemplate.Nodes[nodeName].Ansible.AnsibleVars { + for key, val := range instance.Spec.Nodes[nodeName].Ansible.AnsibleVars { var v interface{} nodeYamlError = yaml.Unmarshal(val, &v) if nodeYamlError != nil { diff --git a/pkg/deployment/ipam.go b/pkg/deployment/ipam.go index eb945cab5..610a279f6 100644 --- a/pkg/deployment/ipam.go +++ b/pkg/deployment/ipam.go @@ -71,7 +71,7 @@ func createOrPatchDNSData(ctx context.Context, helper *helper.Helper, var allDNSRecords []infranetworkv1.DNSHost var ctlplaneSearchDomain string // Build DNSData CR - for nodeName, node := range instance.Spec.NodeTemplate.Nodes { + for nodeName, node := range instance.Spec.Nodes { nets := node.Networks if len(nets) == 0 { nets = instance.Spec.NodeTemplate.Networks @@ -210,7 +210,7 @@ func reserveIPs(ctx context.Context, helper *helper.Helper, allIPSets := make(map[string]infranetworkv1.IPSet) // CreateOrPatch IPSets - for nodeName, node := range instance.Spec.NodeTemplate.Nodes { + for nodeName, node := range instance.Spec.Nodes { nets := node.Networks if len(nets) == 0 { diff --git a/pkg/deployment/kube_service.go b/pkg/deployment/kube_service.go index 139fd189e..60437a672 100644 --- a/pkg/deployment/kube_service.go +++ b/pkg/deployment/kube_service.go @@ -43,8 +43,8 @@ func CreateKubeServices( return err } - addresses := make([]string, len(nodeSet.Spec.NodeTemplate.Nodes)) - for _, item := range nodeSet.Spec.NodeTemplate.Nodes { + addresses := make([]string, len(nodeSet.Spec.Nodes)) + for _, item := range nodeSet.Spec.Nodes { addresses = append(addresses, item.Ansible.AnsibleHost) } diff --git a/tests/functional/base_test.go b/tests/functional/base_test.go index 8bbbc0e61..2ecd53feb 100644 --- a/tests/functional/base_test.go +++ b/tests/functional/base_test.go @@ -27,10 +27,10 @@ func DefaultDataPlaneNodeSetSpec() dataplanev1.OpenStackDataPlaneNodeSetSpec { PreProvisioned: false, NodeTemplate: dataplanev1.NodeTemplate{ AnsibleSSHPrivateKeySecret: "dataplane-ansible-ssh-private-key-secret", - Nodes: map[string]dataplanev1.NodeSection{ - "edpm-compute-node-set": { - HostName: "edpm-bm-compute-1", - }, + }, + Nodes: map[string]dataplanev1.NodeSection{ + "edpm-compute-node-set": { + HostName: "edpm-bm-compute-1", }, }, } @@ -44,8 +44,8 @@ func DefaultDataPlaneNoNodeSetSpec() dataplanev1.OpenStackDataPlaneNodeSetSpec { PreProvisioned: true, NodeTemplate: dataplanev1.NodeTemplate{ AnsibleSSHPrivateKeySecret: "dataplane-ansible-ssh-private-key-secret", - Nodes: map[string]dataplanev1.NodeSection{}, }, + Nodes: map[string]dataplanev1.NodeSection{}, } } diff --git a/tests/kuttl/tests/dataplane-create-test/00-assert.yaml b/tests/kuttl/tests/dataplane-create-test/00-assert.yaml index b80609ae1..b5a0a9a77 100644 --- a/tests/kuttl/tests/dataplane-create-test/00-assert.yaml +++ b/tests/kuttl/tests/dataplane-create-test/00-assert.yaml @@ -10,6 +10,18 @@ spec: value: "True" - name: ANSIBLE_ENABLE_TASK_DEBUGGER value: "True" + nodes: + edpm-compute-0: + ansible: + ansibleHost: 192.168.122.100 + ansibleUser: cloud-admin + ansibleVars: + ctlplane_ip: 192.168.122.100 + fqdn_internal_api: edpm-compute-0.example.com + internal_api_ip: 172.17.0.100 + storage_ip: 172.18.0.100 + tenant_ip: 172.19.0.100 + hostName: edpm-compute-0 nodeTemplate: ansible: ansiblePort: 22 @@ -88,18 +100,6 @@ spec: tenant_vlan_id: 22 ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret managementNetwork: ctlplane - nodes: - edpm-compute-0: - ansible: - ansibleHost: 192.168.122.100 - ansibleUser: cloud-admin - ansibleVars: - ctlplane_ip: 192.168.122.100 - fqdn_internal_api: edpm-compute-0.example.com - internal_api_ip: 172.17.0.100 - storage_ip: 172.18.0.100 - tenant_ip: 172.19.0.100 - hostName: edpm-compute-0 preProvisioned: true services: - download-cache diff --git a/tests/kuttl/tests/dataplane-create-test/00-dataplane-create.yaml b/tests/kuttl/tests/dataplane-create-test/00-dataplane-create.yaml index 63612cda2..bd7e89908 100644 --- a/tests/kuttl/tests/dataplane-create-test/00-dataplane-create.yaml +++ b/tests/kuttl/tests/dataplane-create-test/00-dataplane-create.yaml @@ -21,20 +21,20 @@ spec: preProvisioned: true deployStrategy: deploy: false + nodes: + edpm-compute-0: + hostName: edpm-compute-0 + ansible: + ansibleHost: 192.168.122.100 + ansibleUser: cloud-admin + ansibleVars: + ctlplane_ip: 192.168.122.100 + internal_api_ip: 172.17.0.100 + storage_ip: 172.18.0.100 + tenant_ip: 172.19.0.100 + fqdn_internal_api: edpm-compute-0.example.com nodeTemplate: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret - nodes: - edpm-compute-0: - hostName: edpm-compute-0 - ansible: - ansibleHost: 192.168.122.100 - ansibleUser: cloud-admin - ansibleVars: - ctlplane_ip: 192.168.122.100 - internal_api_ip: 172.17.0.100 - storage_ip: 172.18.0.100 - tenant_ip: 172.19.0.100 - fqdn_internal_api: edpm-compute-0.example.com managementNetwork: ctlplane ansible: ansibleUser: cloud-admin diff --git a/tests/kuttl/tests/dataplane-deploy-no-nodes-test/00-assert.yaml b/tests/kuttl/tests/dataplane-deploy-no-nodes-test/00-assert.yaml index 858fe511e..f1e5f51af 100644 --- a/tests/kuttl/tests/dataplane-deploy-no-nodes-test/00-assert.yaml +++ b/tests/kuttl/tests/dataplane-deploy-no-nodes-test/00-assert.yaml @@ -21,9 +21,9 @@ spec: value: "True" - name: ANSIBLE_ENABLE_TASK_DEBUGGER value: "True" + nodes: {} nodeTemplate: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret - nodes: {} status: conditions: - message: Deployment not started diff --git a/tests/kuttl/tests/dataplane-deploy-no-nodes-test/00-dataplane-create.yaml b/tests/kuttl/tests/dataplane-deploy-no-nodes-test/00-dataplane-create.yaml index a73951acd..ae258a610 100644 --- a/tests/kuttl/tests/dataplane-deploy-no-nodes-test/00-dataplane-create.yaml +++ b/tests/kuttl/tests/dataplane-deploy-no-nodes-test/00-dataplane-create.yaml @@ -35,6 +35,6 @@ spec: value: "True" - name: ANSIBLE_ENABLE_TASK_DEBUGGER value: "True" + nodes: {} nodeTemplate: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret - nodes: {} diff --git a/tests/kuttl/tests/dataplane-deploy-no-nodes-test/01-assert.yaml b/tests/kuttl/tests/dataplane-deploy-no-nodes-test/01-assert.yaml index d14ad2d53..bc4071418 100644 --- a/tests/kuttl/tests/dataplane-deploy-no-nodes-test/01-assert.yaml +++ b/tests/kuttl/tests/dataplane-deploy-no-nodes-test/01-assert.yaml @@ -21,9 +21,9 @@ spec: value: "True" - name: ANSIBLE_ENABLE_TASK_DEBUGGER value: "True" + nodes: {} nodeTemplate: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret - nodes: {} status: conditions: - message: Setup complete diff --git a/tests/kuttl/tests/dataplane-extramounts/00-assert.yaml b/tests/kuttl/tests/dataplane-extramounts/00-assert.yaml index 2ec052004..980f96137 100644 --- a/tests/kuttl/tests/dataplane-extramounts/00-assert.yaml +++ b/tests/kuttl/tests/dataplane-extramounts/00-assert.yaml @@ -9,8 +9,8 @@ spec: deploy: true services: - test-service + nodes: {} nodeTemplate: - nodes: {} extraMounts: - extraVolType: edpm-ansible mounts: diff --git a/tests/kuttl/tests/dataplane-extramounts/00-dataplane-create.yaml b/tests/kuttl/tests/dataplane-extramounts/00-dataplane-create.yaml index 27e3f1d96..b35c6f4f5 100644 --- a/tests/kuttl/tests/dataplane-extramounts/00-dataplane-create.yaml +++ b/tests/kuttl/tests/dataplane-extramounts/00-dataplane-create.yaml @@ -16,9 +16,9 @@ spec: deploy: true services: - test-service + nodes: {} nodeTemplate: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret - nodes: {} extraMounts: - extraVolType: edpm-ansible mounts: diff --git a/tests/kuttl/tests/dataplane-service-config/00-create.yaml b/tests/kuttl/tests/dataplane-service-config/00-create.yaml index 73e7ff94b..a26105d3b 100644 --- a/tests/kuttl/tests/dataplane-service-config/00-create.yaml +++ b/tests/kuttl/tests/dataplane-service-config/00-create.yaml @@ -58,8 +58,8 @@ spec: value: "True" - name: ANSIBLE_ENABLE_TASK_DEBUGGER value: "True" + nodes: {} nodeTemplate: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret - nodes: {} services: - kuttl-service diff --git a/tests/kuttl/tests/dataplane-service-custom-image/00-assert.yaml b/tests/kuttl/tests/dataplane-service-custom-image/00-assert.yaml index 38f1541cd..3ea441d5a 100644 --- a/tests/kuttl/tests/dataplane-service-custom-image/00-assert.yaml +++ b/tests/kuttl/tests/dataplane-service-custom-image/00-assert.yaml @@ -9,8 +9,8 @@ spec: deploy: true services: - custom-image-service + nodes: {} nodeTemplate: - nodes: {} ansible: ansibleUser: cloud-admin ansiblePort: 22 diff --git a/tests/kuttl/tests/dataplane-service-custom-image/00-dataplane-create.yaml b/tests/kuttl/tests/dataplane-service-custom-image/00-dataplane-create.yaml index e1d3e3a5a..e08176179 100644 --- a/tests/kuttl/tests/dataplane-service-custom-image/00-dataplane-create.yaml +++ b/tests/kuttl/tests/dataplane-service-custom-image/00-dataplane-create.yaml @@ -24,8 +24,8 @@ spec: deploy: true services: - custom-image-service + nodes: {} nodeTemplate: - nodes: {} ansible: ansibleUser: cloud-admin ansiblePort: 22