diff --git a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml index 74f7876db..4474044c0 100644 --- a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -3555,25 +3555,85 @@ spec: type: object glance: properties: - apiOverride: - properties: - route: - properties: - metadata: - properties: - annotations: - additionalProperties: + apiOverrides: + additionalProperties: + properties: + route: + properties: + metadata: + properties: + annotations: + additionalProperties: + type: string + type: object + labels: + additionalProperties: + type: string + type: object + type: object + spec: + properties: + alternateBackends: + items: + properties: + kind: + enum: + - Service + - "" + type: string + name: + type: string + weight: + format: int32 + maximum: 256 + minimum: 0 + type: integer + type: object + maxItems: 3 + type: array + host: + maxLength: 253 + pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ type: string - type: object - labels: - additionalProperties: + path: + pattern: ^/ type: string - type: object - type: object - spec: - properties: - alternateBackends: - items: + port: + properties: + targetPort: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - targetPort + type: object + subdomain: + maxLength: 253 + pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ + type: string + tls: + properties: + caCertificate: + type: string + certificate: + type: string + destinationCACertificate: + type: string + insecureEdgeTerminationPolicy: + type: string + key: + type: string + termination: + enum: + - edge + - reencrypt + - passthrough + type: string + required: + - termination + type: object + to: properties: kind: enum: @@ -3588,78 +3648,20 @@ spec: minimum: 0 type: integer type: object - maxItems: 3 - type: array - host: - maxLength: 253 - pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ - type: string - path: - pattern: ^/ - type: string - port: - properties: - targetPort: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - targetPort - type: object - subdomain: - maxLength: 253 - pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ - type: string - tls: - properties: - caCertificate: - type: string - certificate: - type: string - destinationCACertificate: - type: string - insecureEdgeTerminationPolicy: - type: string - key: - type: string - termination: - enum: - - edge - - reencrypt - - passthrough - type: string - required: - - termination - type: object - to: - properties: - kind: - enum: - - Service - - "" - type: string - name: - type: string - weight: - format: int32 - maximum: 256 - minimum: 0 - type: integer - type: object - wildcardPolicy: - enum: - - None - - Subdomain - - "" - type: string - type: object - type: object - tls: - properties: - secretName: - type: string - type: object + wildcardPolicy: + enum: + - None + - Subdomain + - "" + type: string + type: object + type: object + tls: + properties: + secretName: + type: string + type: object + type: object type: object enabled: default: true @@ -4444,137 +4446,143 @@ spec: - extraVol type: object type: array - glanceAPI: - properties: - containerImage: - type: string - customServiceConfig: - type: string - customServiceConfigSecrets: - items: - type: string - type: array - debug: - properties: - service: - default: false - type: boolean - type: object - networkAttachments: - items: + glanceAPIs: + additionalProperties: + properties: + containerImage: type: string - type: array - nodeSelector: - additionalProperties: + customServiceConfig: type: string - type: object - override: - properties: - service: - additionalProperties: - properties: - endpointURL: - type: string - metadata: - properties: - annotations: - additionalProperties: + customServiceConfigSecrets: + items: + type: string + type: array + debug: + properties: + service: + default: false + type: boolean + type: object + networkAttachments: + items: + type: string + type: array + nodeSelector: + additionalProperties: + type: string + type: object + override: + properties: + service: + additionalProperties: + properties: + endpointURL: + type: string + metadata: + properties: + annotations: + additionalProperties: + type: string + type: object + labels: + additionalProperties: + type: string + type: object + type: object + spec: + properties: + externalName: type: string - type: object - labels: - additionalProperties: + externalTrafficPolicy: type: string - type: object - type: object - spec: - properties: - externalName: - type: string - externalTrafficPolicy: - type: string - internalTrafficPolicy: - type: string - ipFamilyPolicy: - type: string - loadBalancerClass: - type: string - loadBalancerSourceRanges: - items: + internalTrafficPolicy: type: string - type: array - sessionAffinity: - type: string - sessionAffinityConfig: - properties: - clientIP: - properties: - timeoutSeconds: - format: int32 - type: integer - type: object - type: object - type: - type: string - type: object + ipFamilyPolicy: + type: string + loadBalancerClass: + type: string + loadBalancerSourceRanges: + items: + type: string + type: array + sessionAffinity: + type: string + sessionAffinityConfig: + properties: + clientIP: + properties: + timeoutSeconds: + format: int32 + type: integer + type: object + type: object + type: + type: string + type: object + type: object type: object - type: object - type: object - pvc: - type: string - replicas: - default: 1 - format: int32 - maximum: 32 - minimum: 0 - type: integer - resources: - properties: - claims: - items: - properties: - name: - type: string - required: + type: object + pvc: + type: string + replicas: + default: 1 + format: int32 + maximum: 32 + minimum: 0 + type: integer + 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 - 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 - type: object - storageClass: - type: string - storageRequest: - type: string - type: - default: split - enum: - - split - - single - type: string - required: - - containerImage - - storageRequest + 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 + type: object + storageClass: + type: string + storageRequest: + type: string + type: + default: split + enum: + - split + - single + - edge + type: string + required: + - containerImage + - storageRequest + type: object type: object imageCacheSize: default: "" type: string + keystoneEndpoint: + default: "" + type: string nodeSelector: additionalProperties: type: string @@ -4626,8 +4634,9 @@ spec: required: - containerImage - databaseInstance - - glanceAPI + - glanceAPIs - imageCacheSize + - keystoneEndpoint - secret - storageRequest type: object diff --git a/apis/core/v1beta1/openstackcontrolplane_types.go b/apis/core/v1beta1/openstackcontrolplane_types.go index 75d2510f5..5fb99367c 100644 --- a/apis/core/v1beta1/openstackcontrolplane_types.go +++ b/apis/core/v1beta1/openstackcontrolplane_types.go @@ -297,7 +297,7 @@ type GlanceSection struct { // +kubebuilder:validation:Optional // +operator-sdk:csv:customresourcedefinitions:type=spec // APIOverride, provides the ability to override the generated manifest of several child resources. - APIOverride Override `json:"apiOverride,omitempty"` + APIOverride map[string]Override `json:"apiOverrides,omitempty"` } // CinderSection defines the desired state of Cinder service diff --git a/apis/core/v1beta1/zz_generated.deepcopy.go b/apis/core/v1beta1/zz_generated.deepcopy.go index 57d8f4643..d2f048834 100644 --- a/apis/core/v1beta1/zz_generated.deepcopy.go +++ b/apis/core/v1beta1/zz_generated.deepcopy.go @@ -126,7 +126,13 @@ func (in *GaleraSection) DeepCopy() *GaleraSection { func (in *GlanceSection) DeepCopyInto(out *GlanceSection) { *out = *in in.Template.DeepCopyInto(&out.Template) - in.APIOverride.DeepCopyInto(&out.APIOverride) + if in.APIOverride != nil { + in, out := &in.APIOverride, &out.APIOverride + *out = make(map[string]Override, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlanceSection. diff --git a/apis/go.mod b/apis/go.mod index 3bb255ec4..3a84de8af 100644 --- a/apis/go.mod +++ b/apis/go.mod @@ -8,7 +8,7 @@ require ( github.com/openstack-k8s-operators/barbican-operator/api v0.0.0-20231207160658-3b1359af5f52 github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231208230042-a3f120021b62 github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231205132751-b5000faad819 - github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231211221509-70df3a214fda + github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231215121058-9d0a5762fadd github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20231212061843-87c824741b45 github.com/openstack-k8s-operators/horizon-operator/api v0.3.1-0.20231212041209-95729f0f09ae github.com/openstack-k8s-operators/infra-operator/apis v0.3.1-0.20231211112757-94d545047df2 diff --git a/apis/go.sum b/apis/go.sum index 12c78e9da..be7d72908 100644 --- a/apis/go.sum +++ b/apis/go.sum @@ -136,8 +136,8 @@ github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231208230042-a github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231208230042-a3f120021b62/go.mod h1:aa0sajD3CR9Em6tn28o6lRRdY42Qsy5iQaEGKxzJrNg= github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231205132751-b5000faad819 h1:QyKf2ifup+JTMth0lbufMjR3daAMKP71PeODqzWMG6g= github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231205132751-b5000faad819/go.mod h1:Wn+GO3Kddf7C5wM2vLNo2Ub1KRmy6qCuTwdyJlxXUuc= -github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231211221509-70df3a214fda h1:ob0lT9En7rlTd3DzaABAGIuvbtY7qCTpCb0QBRBClXE= -github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231211221509-70df3a214fda/go.mod h1:clURAsYt8FW9NK/b25Toi5A9sMLT3mkMufqIjWQu8Rs= +github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231215121058-9d0a5762fadd h1:UDf9+ZmsDDOsSKAfrCd5tVppGfFNz6M1ypw9zr7LDrs= +github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231215121058-9d0a5762fadd/go.mod h1:KNJ9X/3Svh/AuU+pVkJW6yAyTP9LdcIFsluEPlNhWa8= github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20231212061843-87c824741b45 h1:cv2dIYZlb5RMaMpwm7kW2ImbtXHSrVgwfzyBWmKHDQ0= github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20231212061843-87c824741b45/go.mod h1:EbUoaC7FbvC/B3cZhLt1XGYBauNTB67+I5cdypoEpgc= github.com/openstack-k8s-operators/horizon-operator/api v0.3.1-0.20231212041209-95729f0f09ae h1:9sIHGpiQpgBHhSn/0xpT/TZOF4Ms48lCEcPUMDTj2xw= diff --git a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml index 74f7876db..4474044c0 100644 --- a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -3555,25 +3555,85 @@ spec: type: object glance: properties: - apiOverride: - properties: - route: - properties: - metadata: - properties: - annotations: - additionalProperties: + apiOverrides: + additionalProperties: + properties: + route: + properties: + metadata: + properties: + annotations: + additionalProperties: + type: string + type: object + labels: + additionalProperties: + type: string + type: object + type: object + spec: + properties: + alternateBackends: + items: + properties: + kind: + enum: + - Service + - "" + type: string + name: + type: string + weight: + format: int32 + maximum: 256 + minimum: 0 + type: integer + type: object + maxItems: 3 + type: array + host: + maxLength: 253 + pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ type: string - type: object - labels: - additionalProperties: + path: + pattern: ^/ type: string - type: object - type: object - spec: - properties: - alternateBackends: - items: + port: + properties: + targetPort: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - targetPort + type: object + subdomain: + maxLength: 253 + pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ + type: string + tls: + properties: + caCertificate: + type: string + certificate: + type: string + destinationCACertificate: + type: string + insecureEdgeTerminationPolicy: + type: string + key: + type: string + termination: + enum: + - edge + - reencrypt + - passthrough + type: string + required: + - termination + type: object + to: properties: kind: enum: @@ -3588,78 +3648,20 @@ spec: minimum: 0 type: integer type: object - maxItems: 3 - type: array - host: - maxLength: 253 - pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ - type: string - path: - pattern: ^/ - type: string - port: - properties: - targetPort: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - required: - - targetPort - type: object - subdomain: - maxLength: 253 - pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ - type: string - tls: - properties: - caCertificate: - type: string - certificate: - type: string - destinationCACertificate: - type: string - insecureEdgeTerminationPolicy: - type: string - key: - type: string - termination: - enum: - - edge - - reencrypt - - passthrough - type: string - required: - - termination - type: object - to: - properties: - kind: - enum: - - Service - - "" - type: string - name: - type: string - weight: - format: int32 - maximum: 256 - minimum: 0 - type: integer - type: object - wildcardPolicy: - enum: - - None - - Subdomain - - "" - type: string - type: object - type: object - tls: - properties: - secretName: - type: string - type: object + wildcardPolicy: + enum: + - None + - Subdomain + - "" + type: string + type: object + type: object + tls: + properties: + secretName: + type: string + type: object + type: object type: object enabled: default: true @@ -4444,137 +4446,143 @@ spec: - extraVol type: object type: array - glanceAPI: - properties: - containerImage: - type: string - customServiceConfig: - type: string - customServiceConfigSecrets: - items: - type: string - type: array - debug: - properties: - service: - default: false - type: boolean - type: object - networkAttachments: - items: + glanceAPIs: + additionalProperties: + properties: + containerImage: type: string - type: array - nodeSelector: - additionalProperties: + customServiceConfig: type: string - type: object - override: - properties: - service: - additionalProperties: - properties: - endpointURL: - type: string - metadata: - properties: - annotations: - additionalProperties: + customServiceConfigSecrets: + items: + type: string + type: array + debug: + properties: + service: + default: false + type: boolean + type: object + networkAttachments: + items: + type: string + type: array + nodeSelector: + additionalProperties: + type: string + type: object + override: + properties: + service: + additionalProperties: + properties: + endpointURL: + type: string + metadata: + properties: + annotations: + additionalProperties: + type: string + type: object + labels: + additionalProperties: + type: string + type: object + type: object + spec: + properties: + externalName: type: string - type: object - labels: - additionalProperties: + externalTrafficPolicy: type: string - type: object - type: object - spec: - properties: - externalName: - type: string - externalTrafficPolicy: - type: string - internalTrafficPolicy: - type: string - ipFamilyPolicy: - type: string - loadBalancerClass: - type: string - loadBalancerSourceRanges: - items: + internalTrafficPolicy: type: string - type: array - sessionAffinity: - type: string - sessionAffinityConfig: - properties: - clientIP: - properties: - timeoutSeconds: - format: int32 - type: integer - type: object - type: object - type: - type: string - type: object + ipFamilyPolicy: + type: string + loadBalancerClass: + type: string + loadBalancerSourceRanges: + items: + type: string + type: array + sessionAffinity: + type: string + sessionAffinityConfig: + properties: + clientIP: + properties: + timeoutSeconds: + format: int32 + type: integer + type: object + type: object + type: + type: string + type: object + type: object type: object - type: object - type: object - pvc: - type: string - replicas: - default: 1 - format: int32 - maximum: 32 - minimum: 0 - type: integer - resources: - properties: - claims: - items: - properties: - name: - type: string - required: + type: object + pvc: + type: string + replicas: + default: 1 + format: int32 + maximum: 32 + minimum: 0 + type: integer + 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 - 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 - type: object - storageClass: - type: string - storageRequest: - type: string - type: - default: split - enum: - - split - - single - type: string - required: - - containerImage - - storageRequest + 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 + type: object + storageClass: + type: string + storageRequest: + type: string + type: + default: split + enum: + - split + - single + - edge + type: string + required: + - containerImage + - storageRequest + type: object type: object imageCacheSize: default: "" type: string + keystoneEndpoint: + default: "" + type: string nodeSelector: additionalProperties: type: string @@ -4626,8 +4634,9 @@ spec: required: - containerImage - databaseInstance - - glanceAPI + - glanceAPIs - imageCacheSize + - keystoneEndpoint - secret - storageRequest type: object diff --git a/config/manifests/bases/openstack-operator.clusterserviceversion.yaml b/config/manifests/bases/openstack-operator.clusterserviceversion.yaml index 7bf65d02d..56da6db2d 100644 --- a/config/manifests/bases/openstack-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/openstack-operator.clusterserviceversion.yaml @@ -109,10 +109,10 @@ spec: - description: APIOverride, provides the ability to override the generated manifest of several child resources. displayName: APIOverride - path: glance.apiOverride + path: glance.apiOverrides - description: TLS - overrides tls parameters for public endpoint displayName: TLS - path: glance.apiOverride.tls + path: glance.apiOverrides.tls - description: Enabled - Whether Glance service should be deployed and managed displayName: Enabled path: glance.enabled diff --git a/config/samples/core_v1beta1_openstackcontrolplane.yaml b/config/samples/core_v1beta1_openstackcontrolplane.yaml index 2b2ea38c4..ebd5dc94b 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane.yaml @@ -64,9 +64,11 @@ spec: databaseInstance: openstack storageClass: "" storageRequest: 10G - glanceAPI: - type: single - replicas: 1 + keystoneEndpoint: default + glanceAPIs: + default: + type: single + replicas: 1 cinder: template: databaseInstance: openstack diff --git a/config/samples/core_v1beta1_openstackcontrolplane_collapsed_cell.yaml b/config/samples/core_v1beta1_openstackcontrolplane_collapsed_cell.yaml index c133079b9..2fcf93199 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_collapsed_cell.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_collapsed_cell.yaml @@ -48,9 +48,11 @@ spec: databaseInstance: openstack storageClass: "" storageRequest: 10G - glanceAPI: - replicas: 1 - type: single + keystoneEndpoint: default + glanceAPIs: + default: + replicas: 1 + type: single cinder: template: databaseInstance: openstack diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera.yaml index 9861494b7..9f711d192 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera.yaml @@ -56,9 +56,11 @@ spec: databaseInstance: openstack storageClass: "" storageRequest: 10G - glanceAPI: - type: single - replicas: 1 + keystoneEndpoint: default + glanceAPIs: + default: + type: single + replicas: 1 cinder: template: databaseInstance: openstack diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera_3replicas.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera_3replicas.yaml index e7259cddf..1adb65e28 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera_3replicas.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera_3replicas.yaml @@ -56,9 +56,11 @@ spec: storageClass: "" storageRequest: 10G secret: osp-secret - glanceAPI: - replicas: 1 - type: single + keystoneEndpoint: default + glanceAPIs: + default: + replicas: 1 + type: single cinder: template: databaseInstance: openstack diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml index d70d21567..ccc4216f3 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml @@ -56,28 +56,31 @@ spec: - storage replicas: 0 # backend needs to be configured glance: - apiOverride: - route: {} + apiOverrides: + default: + route: {} template: databaseInstance: openstack storageClass: "" storageRequest: 10G secret: osp-secret - glanceAPI: - type: single - replicas: 1 - override: - service: - internal: - metadata: - annotations: - metallb.universe.tf/address-pool: internalapi - metallb.universe.tf/allow-shared-ip: internalapi - metallb.universe.tf/loadBalancerIPs: 172.17.0.80 - spec: - type: LoadBalancer - networkAttachments: - - storage + keystoneEndpoint: default + glanceAPIs: + default: + type: single + replicas: 1 + override: + service: + internal: + metadata: + annotations: + metallb.universe.tf/address-pool: internalapi + metallb.universe.tf/allow-shared-ip: internalapi + metallb.universe.tf/loadBalancerIPs: 172.17.0.80 + spec: + type: LoadBalancer + networkAttachments: + - storage keystone: apiOverride: route: {} diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas.yaml index 80d0e8b8c..a6817e8ff 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas.yaml @@ -78,28 +78,31 @@ spec: barbicanKeystoneListener: replicas: 1 glance: - apiOverride: - route: {} + apiOverrides: + default: + route: {} template: databaseInstance: openstack storageClass: "" storageRequest: 10G secret: osp-secret - glanceAPI: - type: single - replicas: 1 - override: - service: - internal: - metadata: - annotations: - metallb.universe.tf/address-pool: internalapi - metallb.universe.tf/allow-shared-ip: internalapi - metallb.universe.tf/loadBalancerIPs: 172.17.0.80 - spec: - type: LoadBalancer - networkAttachments: - - storage + keystoneEndpoint: default + glanceAPIs: + default: + type: single + replicas: 1 + override: + service: + internal: + metadata: + annotations: + metallb.universe.tf/address-pool: internalapi + metallb.universe.tf/allow-shared-ip: internalapi + metallb.universe.tf/loadBalancerIPs: 172.17.0.80 + spec: + type: LoadBalancer + networkAttachments: + - storage keystone: apiOverride: route: {} diff --git a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml index f2661f259..5d7657ce8 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml @@ -78,28 +78,31 @@ spec: barbicanKeystoneListener: replicas: 1 glance: - apiOverride: - route: {} + apiOverrides: + default: + route: {} template: databaseInstance: openstack storageClass: "" storageRequest: 10G secret: osp-secret - glanceAPI: - type: single - replicas: 1 - override: - service: - internal: - metadata: - annotations: - metallb.universe.tf/address-pool: internalapi - metallb.universe.tf/allow-shared-ip: internalapi - metallb.universe.tf/loadBalancerIPs: 172.17.0.80 - spec: - type: LoadBalancer - networkAttachments: - - storage + keystoneEndpoint: default + glanceAPIs: + default: + type: single + replicas: 1 + override: + service: + internal: + metadata: + annotations: + metallb.universe.tf/address-pool: internalapi + metallb.universe.tf/allow-shared-ip: internalapi + metallb.universe.tf/loadBalancerIPs: 172.17.0.80 + spec: + type: LoadBalancer + networkAttachments: + - storage keystone: apiOverride: route: {} diff --git a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml index 046cdc7eb..fbca56701 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml @@ -107,8 +107,9 @@ spec: - storage replicas: 0 # backend needs to be configured glance: - apiOverride: - route: {} + apiOverrides: + default: + route: {} template: databaseInstance: openstack customServiceConfig: | @@ -124,20 +125,22 @@ spec: storageClass: "" storageRequest: 10G secret: osp-secret - glanceAPI: - replicas: 1 - override: - service: - internal: - metadata: - annotations: - metallb.universe.tf/address-pool: internalapi - metallb.universe.tf/allow-shared-ip: internalapi - metallb.universe.tf/loadBalancerIPs: 172.17.0.80 - spec: - type: LoadBalancer - networkAttachments: - - storage + keystoneEndpoint: default + glanceAPIs: + default: + replicas: 1 + override: + service: + internal: + metadata: + annotations: + metallb.universe.tf/address-pool: internalapi + metallb.universe.tf/allow-shared-ip: internalapi + metallb.universe.tf/loadBalancerIPs: 172.17.0.80 + spec: + type: LoadBalancer + networkAttachments: + - storage keystone: apiOverride: route: {} diff --git a/go.mod b/go.mod index 7602a88c8..b1276d9a4 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231208230042-a3f120021b62 github.com/openstack-k8s-operators/dataplane-operator/api v0.3.1-0.20231212100408-1277c2eb40df github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231205132751-b5000faad819 - github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231211221509-70df3a214fda + github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231215121058-9d0a5762fadd github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20231212061843-87c824741b45 github.com/openstack-k8s-operators/horizon-operator/api v0.3.1-0.20231212041209-95729f0f09ae github.com/openstack-k8s-operators/infra-operator/apis v0.3.1-0.20231211112757-94d545047df2 diff --git a/go.sum b/go.sum index 65dad9e65..56a86449d 100644 --- a/go.sum +++ b/go.sum @@ -149,8 +149,8 @@ github.com/openstack-k8s-operators/dataplane-operator/api v0.3.1-0.2023121210040 github.com/openstack-k8s-operators/dataplane-operator/api v0.3.1-0.20231212100408-1277c2eb40df/go.mod h1:JtmEd6r3XsEmzGQyPLkn+ljE1ZY1Kkk7Gio4z5eiFfs= github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231205132751-b5000faad819 h1:QyKf2ifup+JTMth0lbufMjR3daAMKP71PeODqzWMG6g= github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231205132751-b5000faad819/go.mod h1:Wn+GO3Kddf7C5wM2vLNo2Ub1KRmy6qCuTwdyJlxXUuc= -github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231211221509-70df3a214fda h1:ob0lT9En7rlTd3DzaABAGIuvbtY7qCTpCb0QBRBClXE= -github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231211221509-70df3a214fda/go.mod h1:clURAsYt8FW9NK/b25Toi5A9sMLT3mkMufqIjWQu8Rs= +github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231215121058-9d0a5762fadd h1:UDf9+ZmsDDOsSKAfrCd5tVppGfFNz6M1ypw9zr7LDrs= +github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231215121058-9d0a5762fadd/go.mod h1:KNJ9X/3Svh/AuU+pVkJW6yAyTP9LdcIFsluEPlNhWa8= github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20231212061843-87c824741b45 h1:cv2dIYZlb5RMaMpwm7kW2ImbtXHSrVgwfzyBWmKHDQ0= github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20231212061843-87c824741b45/go.mod h1:EbUoaC7FbvC/B3cZhLt1XGYBauNTB67+I5cdypoEpgc= github.com/openstack-k8s-operators/horizon-operator/api v0.3.1-0.20231212041209-95729f0f09ae h1:9sIHGpiQpgBHhSn/0xpT/TZOF4Ms48lCEcPUMDTj2xw= diff --git a/pkg/openstack/glance.go b/pkg/openstack/glance.go index c4b18f720..3cd7394c8 100644 --- a/pkg/openstack/glance.go +++ b/pkg/openstack/glance.go @@ -4,20 +4,24 @@ import ( "context" "fmt" - "github.com/openstack-k8s-operators/lib-common/modules/common" + glancev1 "github.com/openstack-k8s-operators/glance-operator/api/v1beta1" "github.com/openstack-k8s-operators/lib-common/modules/common/condition" "github.com/openstack-k8s-operators/lib-common/modules/common/helper" "github.com/openstack-k8s-operators/lib-common/modules/common/service" - - "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - glancev1 "github.com/openstack-k8s-operators/glance-operator/api/v1beta1" + "github.com/openstack-k8s-operators/lib-common/modules/common/util" corev1beta1 "github.com/openstack-k8s-operators/openstack-operator/apis/core/v1beta1" k8s_errors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/reconcile" +) + +const ( + // svcSelector is used as selector to get the list of "Services" associated + // to a specific glanceAPI instance + svcSelector = "glanceAPI" ) // ReconcileGlance - @@ -41,16 +45,23 @@ func ReconcileGlance(ctx context.Context, instance *corev1beta1.OpenStackControl } // add selector to service overrides - for _, endpointType := range []service.Endpoint{service.EndpointPublic, service.EndpointInternal} { - if instance.Spec.Glance.Template.GlanceAPI.Override.Service == nil { - instance.Spec.Glance.Template.GlanceAPI.Override.Service = map[service.Endpoint]service.RoutedOverrideSpec{} + for name, glanceAPI := range instance.Spec.Glance.Template.GlanceAPIs { + var currentAPI glancev1.GlanceAPITemplate + for _, endpointType := range []service.Endpoint{service.EndpointPublic, service.EndpointInternal} { + currentAPI = instance.Spec.Glance.Template.GlanceAPIs[name] + if glanceAPI.Override.Service == nil { + currentAPI.Override.Service = map[service.Endpoint]service.RoutedOverrideSpec{} + } + currentAPI.Override.Service[endpointType] = AddServiceComponentLabel( + currentAPI.Override.Service[endpointType], glance.Name) + instance.Spec.Glance.Template.GlanceAPIs[name] = currentAPI + var svcOverride service.RoutedOverrideSpec + svcOverride = currentAPI.Override.Service[endpointType] + apiFilter := fmt.Sprintf("%s-%s", glance.Name, name) + svcOverride.EmbeddedLabelsAnnotations.Labels = util.MergeStringMaps( + svcOverride.EmbeddedLabelsAnnotations.Labels, map[string]string{svcSelector: apiFilter}) } - instance.Spec.Glance.Template.GlanceAPI.Override.Service[endpointType] = - AddServiceComponentLabel( - instance.Spec.Manila.Template.ManilaAPI.Override.Service[endpointType], - glance.Name) } - // When component services got created check if there is the need to create a route if err := helper.GetClient().Get(ctx, types.NamespacedName{Name: "glance", Namespace: instance.Namespace}, glance); err != nil { if !k8s_errors.IsNotFound(err) { @@ -59,38 +70,63 @@ func ReconcileGlance(ctx context.Context, instance *corev1beta1.OpenStackControl } if glance.Status.Conditions.IsTrue(glancev1.GlanceAPIReadyCondition) { - svcs, err := service.GetServicesListWithLabel( - ctx, - helper, - instance.Namespace, - map[string]string{common.AppSelector: glance.Name}, - ) - if err != nil { - return ctrl.Result{}, err + // initialize the main APIOverride struct + if instance.Spec.Glance.APIOverride == nil { + instance.Spec.Glance.APIOverride = map[string]corev1beta1.Override{} } var ctrlResult reconcile.Result - instance.Spec.Glance.Template.GlanceAPI.Override.Service, ctrlResult, err = EnsureEndpointConfig( - ctx, - instance, - helper, - glance, - svcs, - instance.Spec.Glance.Template.GlanceAPI.Override.Service, - instance.Spec.Glance.APIOverride, - corev1beta1.OpenStackControlPlaneExposeGlanceReadyCondition, - ) - if err != nil { - return ctrlResult, err - } else if (ctrlResult != ctrl.Result{}) { - return ctrlResult, nil + var changed bool = false + for name, glanceAPI := range instance.Spec.Glance.Template.GlanceAPIs { + if _, ok := instance.Spec.Glance.APIOverride[name]; ok { + instance.Spec.Glance.APIOverride[name] = corev1beta1.Override{} + } + if instance.Spec.Glance.Template.KeystoneEndpoint == name { + // Retrieve the services by Label and filter on glanceAPI: for + // each instance we should get **only** the associated `SVCs` + // and not the whole list. As per the Glance design doc we know + // that a given instance name is made in the form: " + // ", so we build the filter accordingly + // to resolve the label as - + apiFilter := fmt.Sprintf("%s-%s", glance.Name, name) + svcs, err := service.GetServicesListWithLabel( + ctx, + helper, + instance.Namespace, + map[string]string{svcSelector: apiFilter}, + ) + if err != nil { + return ctrl.Result{}, err + } + _, ctrlResult, err = EnsureEndpointConfig( + ctx, + instance, + helper, + glance, + svcs, + glanceAPI.Override.Service, + instance.Spec.Glance.APIOverride[name], + corev1beta1.OpenStackControlPlaneExposeGlanceReadyCondition, + ) + if err != nil { + return ctrlResult, err + } + // let's keep track of changes for any instance, but return + // only when the iteration on the whole APIList is over + if (ctrlResult != ctrl.Result{}) { + changed = true + } + } + } + // if one of the API changed, return + if changed { + return ctrl.Result{}, nil } } Log.Info("Reconciling Glance", "Glance.Namespace", instance.Namespace, "Glance.Name", "glance") op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), glance, func() error { instance.Spec.Glance.Template.DeepCopyInto(&glance.Spec) - if glance.Spec.Secret == "" { glance.Spec.Secret = instance.Spec.Secret } diff --git a/tests/kuttl/common/assert-sample-deployment.yaml b/tests/kuttl/common/assert-sample-deployment.yaml index d07c7cdec..817cd6ae9 100644 --- a/tests/kuttl/common/assert-sample-deployment.yaml +++ b/tests/kuttl/common/assert-sample-deployment.yaml @@ -38,8 +38,9 @@ spec: databaseInstance: openstack storageRequest: 10G secret: osp-secret - glanceAPI: - replicas: 1 + glanceAPIs: + default: + replicas: 1 cinder: template: databaseInstance: openstack diff --git a/tests/kuttl/tests/collapsed/01-assert-collapsed-cell.yaml b/tests/kuttl/tests/collapsed/01-assert-collapsed-cell.yaml index e3524aeae..bb63846d0 100644 --- a/tests/kuttl/tests/collapsed/01-assert-collapsed-cell.yaml +++ b/tests/kuttl/tests/collapsed/01-assert-collapsed-cell.yaml @@ -28,8 +28,9 @@ spec: template: databaseInstance: openstack storageRequest: 10G - glanceAPI: - replicas: 1 + glanceAPIs: + default: + replicas: 1 cinder: template: databaseInstance: openstack diff --git a/tests/kuttl/tests/galera-3replicas/01-assert-galera-3replicas.yaml b/tests/kuttl/tests/galera-3replicas/01-assert-galera-3replicas.yaml index 97cde1f25..218a3de93 100644 --- a/tests/kuttl/tests/galera-3replicas/01-assert-galera-3replicas.yaml +++ b/tests/kuttl/tests/galera-3replicas/01-assert-galera-3replicas.yaml @@ -37,8 +37,9 @@ spec: template: databaseInstance: openstack storageRequest: 10G - glanceAPI: - replicas: 1 + glanceAPIs: + default: + replicas: 1 cinder: template: databaseInstance: openstack diff --git a/tests/kuttl/tests/galera-basic/01-assert-galera.yaml b/tests/kuttl/tests/galera-basic/01-assert-galera.yaml index 13e74e923..1429299d2 100644 --- a/tests/kuttl/tests/galera-basic/01-assert-galera.yaml +++ b/tests/kuttl/tests/galera-basic/01-assert-galera.yaml @@ -37,8 +37,9 @@ spec: template: databaseInstance: openstack storageRequest: 10G - glanceAPI: - replicas: 1 + glanceAPIs: + default: + replicas: 1 cinder: template: databaseInstance: openstack