diff --git a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml index 8ff1198af..db920a52e 100644 --- a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -1341,6 +1341,775 @@ spec: - secret type: object type: object + designate: + properties: + apiOverride: + 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 + 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 + type: object + enabled: + default: false + type: boolean + template: + properties: + None: + type: string + backendMdnsServerProtocol: + type: string + backendWorkerServerProtocol: + type: string + customServiceConfig: + default: '# add your customization here' + type: string + databaseInstance: + type: string + databaseUser: + default: designate + type: string + debug: + properties: + dbInitContainer: + default: false + type: boolean + dbSync: + default: false + type: boolean + type: object + defaultConfigOverwrite: + additionalProperties: + type: string + type: object + designateAPI: + properties: + None: + type: string + backendMdnsServerProtocol: + type: string + backendWorkerServerProtocol: + type: string + containerImage: + type: string + customServiceConfig: + type: string + customServiceConfigSecrets: + items: + type: string + type: array + databaseHostname: + type: string + databaseUser: + default: designate + type: string + debug: + properties: + initContainer: + default: false + type: boolean + service: + default: false + type: boolean + type: object + defaultConfigOverwrite: + additionalProperties: + type: string + 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 + externalTrafficPolicy: + type: string + internalTrafficPolicy: + type: string + 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 + passwordSelectors: + default: + database: DesignateDatabasePassword + service: DesignatePassword + properties: + database: + default: DesignateDatabasePassword + type: string + service: + default: DesignatePassword + type: string + type: object + 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 + 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 + secret: + type: string + serviceAccount: + type: string + serviceUser: + default: designate + type: string + transportURLSecret: + type: string + required: + - containerImage + type: object + designateCentral: + properties: + None: + type: string + backendMdnsServerProtocol: + type: string + backendWorkerServerProtocol: + type: string + containerImage: + type: string + customServiceConfig: + type: string + customServiceConfigSecrets: + items: + type: string + type: array + databaseHostname: + type: string + databaseUser: + default: designate + type: string + debug: + properties: + initContainer: + default: false + type: boolean + service: + default: false + type: boolean + type: object + defaultConfigOverwrite: + additionalProperties: + type: string + type: object + networkAttachments: + items: + type: string + type: array + nodeSelector: + additionalProperties: + type: string + type: object + passwordSelectors: + default: + database: DesignateDatabasePassword + service: DesignatePassword + properties: + database: + default: DesignateDatabasePassword + type: string + service: + default: DesignatePassword + type: string + type: object + 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 + 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 + secret: + type: string + serviceAccount: + type: string + serviceUser: + default: designate + type: string + transportURLSecret: + type: string + required: + - containerImage + type: object + designateMdns: + properties: + None: + type: string + backendMdnsServerProtocol: + type: string + backendWorkerServerProtocol: + type: string + containerImage: + type: string + customServiceConfig: + type: string + customServiceConfigSecrets: + items: + type: string + type: array + databaseHostname: + type: string + databaseUser: + default: designate + type: string + debug: + properties: + initContainer: + default: false + type: boolean + service: + default: false + type: boolean + type: object + defaultConfigOverwrite: + additionalProperties: + type: string + type: object + networkAttachments: + items: + type: string + type: array + nodeSelector: + additionalProperties: + type: string + type: object + passwordSelectors: + default: + database: DesignateDatabasePassword + service: DesignatePassword + properties: + database: + default: DesignateDatabasePassword + type: string + service: + default: DesignatePassword + type: string + type: object + 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 + 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 + secret: + type: string + serviceAccount: + type: string + serviceUser: + default: designate + type: string + transportURLSecret: + type: string + required: + - containerImage + type: object + designateProducer: + properties: + None: + type: string + backendMdnsServerProtocol: + type: string + backendWorkerServerProtocol: + type: string + containerImage: + type: string + customServiceConfig: + type: string + customServiceConfigSecrets: + items: + type: string + type: array + databaseHostname: + type: string + databaseUser: + default: designate + type: string + debug: + properties: + initContainer: + default: false + type: boolean + service: + default: false + type: boolean + type: object + defaultConfigOverwrite: + additionalProperties: + type: string + type: object + networkAttachments: + items: + type: string + type: array + nodeSelector: + additionalProperties: + type: string + type: object + passwordSelectors: + default: + database: DesignateDatabasePassword + service: DesignatePassword + properties: + database: + default: DesignateDatabasePassword + type: string + service: + default: DesignatePassword + type: string + type: object + 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 + 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 + secret: + type: string + serviceAccount: + type: string + serviceUser: + default: designate + type: string + transportURLSecret: + type: string + required: + - containerImage + type: object + designateWorker: + properties: + None: + type: string + backendMdnsServerProtocol: + type: string + backendWorkerServerProtocol: + type: string + containerImage: + type: string + customServiceConfig: + type: string + customServiceConfigSecrets: + items: + type: string + type: array + databaseHostname: + type: string + databaseUser: + default: designate + type: string + debug: + properties: + initContainer: + default: false + type: boolean + service: + default: false + type: boolean + type: object + defaultConfigOverwrite: + additionalProperties: + type: string + type: object + networkAttachments: + items: + type: string + type: array + nodeSelector: + additionalProperties: + type: string + type: object + passwordSelectors: + default: + database: DesignateDatabasePassword + service: DesignatePassword + properties: + database: + default: DesignateDatabasePassword + type: string + service: + default: DesignatePassword + type: string + type: object + 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 + 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 + secret: + type: string + serviceAccount: + type: string + serviceUser: + default: designate + type: string + transportURLSecret: + type: string + required: + - containerImage + type: object + nodeSelector: + additionalProperties: + type: string + type: object + passwordSelectors: + default: + database: DesignateDatabasePassword + service: DesignatePassword + properties: + database: + default: DesignateDatabasePassword + type: string + service: + default: DesignatePassword + type: string + type: object + preserveJobs: + default: false + type: boolean + rabbitMqClusterName: + default: rabbitmq + type: string + 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 + type: object + secret: + type: string + serviceUser: + default: designate + type: string + required: + - designateAPI + - designateCentral + - designateMdns + - designateProducer + - designateWorker + - rabbitMqClusterName + - secret + type: object + type: object dns: properties: enabled: diff --git a/apis/core/v1beta1/conditions.go b/apis/core/v1beta1/conditions.go index 900b30888..1e416f9b1 100644 --- a/apis/core/v1beta1/conditions.go +++ b/apis/core/v1beta1/conditions.go @@ -141,11 +141,17 @@ const ( // OpenStackControlPlaneOctaviaReadyCondition Status=True condition which indicates if Octavia is configured and operational OpenStackControlPlaneOctaviaReadyCondition condition.Type = "OpenStackControlPlaneOctaviaReady" + // OpenStackControlPlaneDesignateReadyCondition Status=True condition which indicates if Designate is configured and operational + OpenStackControlPlaneDesignateReadyCondition condition.Type = "OpenStackControlPlaneDesignateReady" + // OpenStackControlPlaneRedisReadyCondition Status=True condition which indicates if Redis is configured and operational OpenStackControlPlaneRedisReadyCondition condition.Type = "OpenStackControlPlaneRedisReady" // OpenStackControlPlaneExposeOctaviaReadyCondition Status=True condition which indicates if Octavia is exposed via a route OpenStackControlPlaneExposeOctaviaReadyCondition condition.Type = "OpenStackControlPlaneExposeOctaviaReady" + + // OpenStackControlPlaneExposeDesignateReadyCondition Status=True condition which indicates if Designate is exposed via a route + OpenStackControlPlaneExposeDesignateReadyCondition condition.Type = "OpenStackControlPlaneExposeDesignateReady" ) // OpenStackControlPlane Reasons used by API objects. @@ -364,6 +370,18 @@ const ( // OpenStackControlPlaneOctaviaReadyErrorMessage OpenStackControlPlaneOctaviaReadyErrorMessage = "OpenStackControlPlane Octavia error occured %s" + // OpenStackControlPlaneDesignateReadyInitMessage + OpenStackControlPlaneDesignateReadyInitMessage = "OpenStackControlPlane Designate not started" + + // OpenStackControlPlaneDesignateReadyMessage + OpenStackControlPlaneDesignateReadyMessage = "OpenStackControlPlane Designate completed" + + // OpenStackControlPlaneDesignateReadyRunningMessage + OpenStackControlPlaneDesignateReadyRunningMessage = "OpenStackControlPlane Designate in progress" + + // OpenStackControlPlaneDesignateReadyErrorMessage + OpenStackControlPlaneDesignateReadyErrorMessage = "OpenStackControlPlane Designate error occured %s" + // OpenStackControlPlaneRedisReadyInitMessage OpenStackControlPlaneRedisReadyInitMessage = "OpenStackControlPlane Redis not started" diff --git a/apis/core/v1beta1/openstackcontrolplane_types.go b/apis/core/v1beta1/openstackcontrolplane_types.go index dde7f7e87..e91b2668c 100644 --- a/apis/core/v1beta1/openstackcontrolplane_types.go +++ b/apis/core/v1beta1/openstackcontrolplane_types.go @@ -34,6 +34,7 @@ import ( neutronv1 "github.com/openstack-k8s-operators/neutron-operator/api/v1beta1" novav1 "github.com/openstack-k8s-operators/nova-operator/api/v1beta1" octaviav1 "github.com/openstack-k8s-operators/octavia-operator/api/v1beta1" + designatev1 "github.com/openstack-k8s-operators/designate-operator/api/v1beta1" ovnv1 "github.com/openstack-k8s-operators/ovn-operator/api/v1beta1" placementv1 "github.com/openstack-k8s-operators/placement-operator/api/v1beta1" swiftv1 "github.com/openstack-k8s-operators/swift-operator/api/v1beta1" @@ -155,6 +156,9 @@ type OpenStackControlPlaneSpec struct { // Octavia - Parameters related to the Octavia service Octavia OctaviaSection `json:"octavia,omitempty"` + // Designate - Parameters related to the Designate service + Designate DesignateSection `json:"designate,omitempty"` + // Redis - Parameters related to the Redis service Redis RedisSection `json:"redis,omitempty"` @@ -547,6 +551,25 @@ type OctaviaSection struct { APIOverride Override `json:"apiOverride,omitempty"` } +// DesignateSection defines the desired state of the Designate service +type DesignateSection struct { + // +kubebuilder:validation:Optional + // Enabled - Whether the Designate service should be deployed and managed + // +kubebuilder:default=false + // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} + Enabled bool `json:"enabled"` + + // +kubebuilder:valdiation:Optional + // +operator-sdk:csv:customresourcedefinitions:type=spec + // Template - Overrides to use when creating Designate Resources + Template designatev1.DesignateSpec `json:"template,omitempty"` + + // +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"` +} + // RedisSection defines the desired state of the Redis service type RedisSection struct { // +kubebuilder:validation:Optional @@ -641,6 +664,7 @@ func (instance *OpenStackControlPlane) InitConditions() { condition.UnknownCondition(OpenStackControlPlaneHeatReadyCondition, condition.InitReason, OpenStackControlPlaneHeatReadyInitMessage), condition.UnknownCondition(OpenStackControlPlaneSwiftReadyCondition, condition.InitReason, OpenStackControlPlaneSwiftReadyInitMessage), condition.UnknownCondition(OpenStackControlPlaneOctaviaReadyCondition, condition.InitReason, OpenStackControlPlaneOctaviaReadyInitMessage), + condition.UnknownCondition(OpenStackControlPlaneDesignateReadyCondition, condition.InitReason, OpenStackControlPlaneDesignateReadyInitMessage), condition.UnknownCondition(OpenStackControlPlaneRedisReadyCondition, condition.InitReason, OpenStackControlPlaneRedisReadyInitMessage), // Also add the overall status condition as Unknown diff --git a/apis/core/v1beta1/zz_generated.deepcopy.go b/apis/core/v1beta1/zz_generated.deepcopy.go index bbe5b7cdc..2c7985df3 100644 --- a/apis/core/v1beta1/zz_generated.deepcopy.go +++ b/apis/core/v1beta1/zz_generated.deepcopy.go @@ -81,6 +81,23 @@ func (in *DNSMasqSection) DeepCopy() *DNSMasqSection { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DesignateSection) DeepCopyInto(out *DesignateSection) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.APIOverride.DeepCopyInto(&out.APIOverride) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DesignateSection. +func (in *DesignateSection) DeepCopy() *DesignateSection { + if in == nil { + return nil + } + out := new(DesignateSection) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GaleraSection) DeepCopyInto(out *GaleraSection) { *out = *in @@ -428,6 +445,7 @@ func (in *OpenStackControlPlaneSpec) DeepCopyInto(out *OpenStackControlPlaneSpec in.Ceilometer.DeepCopyInto(&out.Ceilometer) in.Swift.DeepCopyInto(&out.Swift) in.Octavia.DeepCopyInto(&out.Octavia) + in.Designate.DeepCopyInto(&out.Designate) in.Redis.DeepCopyInto(&out.Redis) if in.ExtraMounts != nil { in, out := &in.ExtraMounts, &out.ExtraMounts diff --git a/apis/go.mod b/apis/go.mod index b5b3d08d8..88bb989ad 100644 --- a/apis/go.mod +++ b/apis/go.mod @@ -6,6 +6,7 @@ require ( github.com/onsi/ginkgo/v2 v2.13.0 github.com/onsi/gomega v1.28.0 github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231006133827-ce89e0fd01f2 + github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231005181456-cbf92d9662db github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231013112543-a07d8273b82d github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20231015090350-5fdcca35e29e github.com/openstack-k8s-operators/horizon-operator/api v0.3.1-0.20231015112558-692aca16f97d diff --git a/apis/go.sum b/apis/go.sum index e0a7e0e83..7157970d1 100644 --- a/apis/go.sum +++ b/apis/go.sum @@ -130,6 +130,8 @@ github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 h1:rncLxJBpFGqBztyxC github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7/go.mod h1:ctXNyWanKEjGj8sss1KjjHQ3ENKFm33FFnS5BKaIPh4= github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231006133827-ce89e0fd01f2 h1:sPQWPiTBSyNf1vdImemK4vAjavwmf/cKXkIrIMOVWTs= github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231006133827-ce89e0fd01f2/go.mod h1:8NFIyjXZeC+T2UBcmTDTfSatRdhi2eaZlaAuzcT2rNk= +github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231005181456-cbf92d9662db h1:p30j9aOE336NfA/cTvyd+d0t1B/PTzcyghwtVCKN3OQ= +github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231005181456-cbf92d9662db/go.mod h1:fNgVy3LvqYF2jTelcaJKaWT0agEwBtJ++MXSdPT/BF4= github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231013112543-a07d8273b82d h1:WEG0KPgsujhwVh7W/IbJ8I8JTDUuJj6V5rWD6L+KzbI= github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231013112543-a07d8273b82d/go.mod h1:D+c4nLxVzSZDeYqAGrfD5po2+udzVkF5M5SCF9QeMMY= github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20231015090350-5fdcca35e29e h1:XBXHAOx6UbYT5IKiSX4GcFLrvc6ccdcHi39As7+1NvM= diff --git a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml index 8ff1198af..db920a52e 100644 --- a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -1341,6 +1341,775 @@ spec: - secret type: object type: object + designate: + properties: + apiOverride: + 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 + 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 + type: object + enabled: + default: false + type: boolean + template: + properties: + None: + type: string + backendMdnsServerProtocol: + type: string + backendWorkerServerProtocol: + type: string + customServiceConfig: + default: '# add your customization here' + type: string + databaseInstance: + type: string + databaseUser: + default: designate + type: string + debug: + properties: + dbInitContainer: + default: false + type: boolean + dbSync: + default: false + type: boolean + type: object + defaultConfigOverwrite: + additionalProperties: + type: string + type: object + designateAPI: + properties: + None: + type: string + backendMdnsServerProtocol: + type: string + backendWorkerServerProtocol: + type: string + containerImage: + type: string + customServiceConfig: + type: string + customServiceConfigSecrets: + items: + type: string + type: array + databaseHostname: + type: string + databaseUser: + default: designate + type: string + debug: + properties: + initContainer: + default: false + type: boolean + service: + default: false + type: boolean + type: object + defaultConfigOverwrite: + additionalProperties: + type: string + 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 + externalTrafficPolicy: + type: string + internalTrafficPolicy: + type: string + 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 + passwordSelectors: + default: + database: DesignateDatabasePassword + service: DesignatePassword + properties: + database: + default: DesignateDatabasePassword + type: string + service: + default: DesignatePassword + type: string + type: object + 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 + 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 + secret: + type: string + serviceAccount: + type: string + serviceUser: + default: designate + type: string + transportURLSecret: + type: string + required: + - containerImage + type: object + designateCentral: + properties: + None: + type: string + backendMdnsServerProtocol: + type: string + backendWorkerServerProtocol: + type: string + containerImage: + type: string + customServiceConfig: + type: string + customServiceConfigSecrets: + items: + type: string + type: array + databaseHostname: + type: string + databaseUser: + default: designate + type: string + debug: + properties: + initContainer: + default: false + type: boolean + service: + default: false + type: boolean + type: object + defaultConfigOverwrite: + additionalProperties: + type: string + type: object + networkAttachments: + items: + type: string + type: array + nodeSelector: + additionalProperties: + type: string + type: object + passwordSelectors: + default: + database: DesignateDatabasePassword + service: DesignatePassword + properties: + database: + default: DesignateDatabasePassword + type: string + service: + default: DesignatePassword + type: string + type: object + 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 + 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 + secret: + type: string + serviceAccount: + type: string + serviceUser: + default: designate + type: string + transportURLSecret: + type: string + required: + - containerImage + type: object + designateMdns: + properties: + None: + type: string + backendMdnsServerProtocol: + type: string + backendWorkerServerProtocol: + type: string + containerImage: + type: string + customServiceConfig: + type: string + customServiceConfigSecrets: + items: + type: string + type: array + databaseHostname: + type: string + databaseUser: + default: designate + type: string + debug: + properties: + initContainer: + default: false + type: boolean + service: + default: false + type: boolean + type: object + defaultConfigOverwrite: + additionalProperties: + type: string + type: object + networkAttachments: + items: + type: string + type: array + nodeSelector: + additionalProperties: + type: string + type: object + passwordSelectors: + default: + database: DesignateDatabasePassword + service: DesignatePassword + properties: + database: + default: DesignateDatabasePassword + type: string + service: + default: DesignatePassword + type: string + type: object + 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 + 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 + secret: + type: string + serviceAccount: + type: string + serviceUser: + default: designate + type: string + transportURLSecret: + type: string + required: + - containerImage + type: object + designateProducer: + properties: + None: + type: string + backendMdnsServerProtocol: + type: string + backendWorkerServerProtocol: + type: string + containerImage: + type: string + customServiceConfig: + type: string + customServiceConfigSecrets: + items: + type: string + type: array + databaseHostname: + type: string + databaseUser: + default: designate + type: string + debug: + properties: + initContainer: + default: false + type: boolean + service: + default: false + type: boolean + type: object + defaultConfigOverwrite: + additionalProperties: + type: string + type: object + networkAttachments: + items: + type: string + type: array + nodeSelector: + additionalProperties: + type: string + type: object + passwordSelectors: + default: + database: DesignateDatabasePassword + service: DesignatePassword + properties: + database: + default: DesignateDatabasePassword + type: string + service: + default: DesignatePassword + type: string + type: object + 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 + 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 + secret: + type: string + serviceAccount: + type: string + serviceUser: + default: designate + type: string + transportURLSecret: + type: string + required: + - containerImage + type: object + designateWorker: + properties: + None: + type: string + backendMdnsServerProtocol: + type: string + backendWorkerServerProtocol: + type: string + containerImage: + type: string + customServiceConfig: + type: string + customServiceConfigSecrets: + items: + type: string + type: array + databaseHostname: + type: string + databaseUser: + default: designate + type: string + debug: + properties: + initContainer: + default: false + type: boolean + service: + default: false + type: boolean + type: object + defaultConfigOverwrite: + additionalProperties: + type: string + type: object + networkAttachments: + items: + type: string + type: array + nodeSelector: + additionalProperties: + type: string + type: object + passwordSelectors: + default: + database: DesignateDatabasePassword + service: DesignatePassword + properties: + database: + default: DesignateDatabasePassword + type: string + service: + default: DesignatePassword + type: string + type: object + 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 + 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 + secret: + type: string + serviceAccount: + type: string + serviceUser: + default: designate + type: string + transportURLSecret: + type: string + required: + - containerImage + type: object + nodeSelector: + additionalProperties: + type: string + type: object + passwordSelectors: + default: + database: DesignateDatabasePassword + service: DesignatePassword + properties: + database: + default: DesignateDatabasePassword + type: string + service: + default: DesignatePassword + type: string + type: object + preserveJobs: + default: false + type: boolean + rabbitMqClusterName: + default: rabbitmq + type: string + 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 + type: object + secret: + type: string + serviceUser: + default: designate + type: string + required: + - designateAPI + - designateCentral + - designateMdns + - designateProducer + - designateWorker + - rabbitMqClusterName + - secret + type: object + type: object dns: properties: enabled: diff --git a/config/manifests/bases/openstack-operator.clusterserviceversion.yaml b/config/manifests/bases/openstack-operator.clusterserviceversion.yaml index f9e92873d..3f7044a69 100644 --- a/config/manifests/bases/openstack-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/openstack-operator.clusterserviceversion.yaml @@ -50,6 +50,19 @@ spec: - description: Template - Overrides to use when creating Cinder Resources displayName: Template path: cinder.template + - description: APIOverride, provides the ability to override the generated manifest + of several child resources. + displayName: APIOverride + path: designate.apiOverride + - description: Enabled - Whether the Designate service should be deployed and + managed + displayName: Enabled + path: designate.enabled + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - description: Template - Overrides to use when creating Designate Resources + displayName: Template + path: designate.template - description: DNS - Parameters related to the DNSMasq service displayName: DNS path: dns diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 6c13715fa..f6ca00ddc 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -114,6 +114,18 @@ rules: - get - patch - update +- apiGroups: + - designate.openstack.org + resources: + - designates + verbs: + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - glance.openstack.org resources: diff --git a/config/samples/core_v1beta1_openstackcontrolplane.yaml b/config/samples/core_v1beta1_openstackcontrolplane.yaml index 8ad4d51cd..9f7cf0fe5 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane.yaml @@ -152,3 +152,17 @@ spec: secret: osp-secret redis: enabled: false + cwdesignate: + template: + databaseInstance: openstack + secret: osp-secret + designateAPI: + replicas: 1 + designateCentral: + replicas: 0 # backend needs to be configured + designateWorker: + replicas: 0 # backend needs to be configured + designateProducer: + replicas: 0 # backend needs to be configured + designateMdns: + replicas: 0 # backend needs to be configured diff --git a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml index 0619f35d2..3f953cc1c 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml @@ -310,3 +310,33 @@ spec: secret: osp-secret redis: enabled: false + designate: + enabled: false + apiOverride: + route: {} + template: + databaseInstance: openstack + secret: osp-secret + desiganteAPI: + 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 + designateCentral: + replicas: 1 + designateWorker: + replicas: 0 + networkAttachements: + - designate + designateProducer: + replicas: 0 + designateMdn: + replicas: 0 + networkAttachements: + - designate diff --git a/controllers/core/openstackcontrolplane_controller.go b/controllers/core/openstackcontrolplane_controller.go index 2ce0515f1..b02200e66 100644 --- a/controllers/core/openstackcontrolplane_controller.go +++ b/controllers/core/openstackcontrolplane_controller.go @@ -32,6 +32,7 @@ import ( condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" "github.com/openstack-k8s-operators/lib-common/modules/common/helper" + designatev1 "github.com/openstack-k8s-operators/designate-operator/api/v1beta1" manilav1 "github.com/openstack-k8s-operators/manila-operator/api/v1beta1" mariadbv1 "github.com/openstack-k8s-operators/mariadb-operator/api/v1beta1" neutronv1 "github.com/openstack-k8s-operators/neutron-operator/api/v1beta1" @@ -90,6 +91,7 @@ type OpenStackControlPlaneReconciler struct { //+kubebuilder:rbac:groups=telemetry.openstack.org,resources=ceilometers,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=swift.openstack.org,resources=swifts,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=octavia.openstack.org,resources=octavias,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=designate.openstack.org,resources=designates,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=redis.openstack.org,resources=redises,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=route.openshift.io,resources=routes,verbs=get;list;watch;create;update;patch;delete; //+kubebuilder:rbac:groups=route.openshift.io,resources=routes/custom-host,verbs=create;update;patch @@ -311,6 +313,13 @@ func (r *OpenStackControlPlaneReconciler) reconcileNormal(ctx context.Context, i return ctrlResult, nil } + ctrlResult, err = openstack.ReconcileDesignate(ctx, instance, helper) + if err != nil { + return ctrl.Result{}, err + } else if (ctrlResult != ctrl.Result{}) { + return ctrlResult, nil + } + return ctrl.Result{}, nil } @@ -339,6 +348,7 @@ func (r *OpenStackControlPlaneReconciler) SetupWithManager(mgr ctrl.Manager) err Owns(&telemetryv1.Ceilometer{}). Owns(&redisv1.Redis{}). Owns(&octaviav1.Octavia{}). + Owns(&designatev1.Designate{}). Owns(&routev1.Route{}). Complete(r) } diff --git a/go.mod b/go.mod index 51982518d..a12e25f2e 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/onsi/gomega v1.28.0 github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231006133827-ce89e0fd01f2 github.com/openstack-k8s-operators/dataplane-operator/api v0.3.1-0.20231015102122-7f1bd9b4e18f + github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231005181456-cbf92d9662db github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231013112543-a07d8273b82d github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20231015090350-5fdcca35e29e github.com/openstack-k8s-operators/horizon-operator/api v0.3.1-0.20231015112558-692aca16f97d diff --git a/go.sum b/go.sum index d9fca8007..c7f22e5e6 100644 --- a/go.sum +++ b/go.sum @@ -139,6 +139,8 @@ github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231006133827-c github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231006133827-ce89e0fd01f2/go.mod h1:8NFIyjXZeC+T2UBcmTDTfSatRdhi2eaZlaAuzcT2rNk= github.com/openstack-k8s-operators/dataplane-operator/api v0.3.1-0.20231015102122-7f1bd9b4e18f h1:gl+3rXaKjCfwt6OOJjOcT+wsQtH2KQvNX4K1spBuO5M= github.com/openstack-k8s-operators/dataplane-operator/api v0.3.1-0.20231015102122-7f1bd9b4e18f/go.mod h1:UyIqxl7rB1yWpp5KmhUmdYk+LTDNP67KkrRJkjtxs2I= +github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231005181456-cbf92d9662db h1:p30j9aOE336NfA/cTvyd+d0t1B/PTzcyghwtVCKN3OQ= +github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231005181456-cbf92d9662db/go.mod h1:fNgVy3LvqYF2jTelcaJKaWT0agEwBtJ++MXSdPT/BF4= github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231013112543-a07d8273b82d h1:WEG0KPgsujhwVh7W/IbJ8I8JTDUuJj6V5rWD6L+KzbI= github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231013112543-a07d8273b82d/go.mod h1:D+c4nLxVzSZDeYqAGrfD5po2+udzVkF5M5SCF9QeMMY= github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20231015090350-5fdcca35e29e h1:XBXHAOx6UbYT5IKiSX4GcFLrvc6ccdcHi39As7+1NvM= diff --git a/main.go b/main.go index 8d2816934..24fda0ae1 100644 --- a/main.go +++ b/main.go @@ -30,6 +30,7 @@ import ( cinderv1 "github.com/openstack-k8s-operators/cinder-operator/api/v1beta1" dataplanev1beta1 "github.com/openstack-k8s-operators/dataplane-operator/api/v1beta1" + designatev1 "github.com/openstack-k8s-operators/designate-operator/api/v1beta1" glancev1 "github.com/openstack-k8s-operators/glance-operator/api/v1beta1" heatv1 "github.com/openstack-k8s-operators/heat-operator/api/v1beta1" horizonv1 "github.com/openstack-k8s-operators/horizon-operator/api/v1beta1" @@ -91,6 +92,7 @@ func init() { utilruntime.Must(ovnv1.AddToScheme(scheme)) utilruntime.Must(neutronv1.AddToScheme(scheme)) utilruntime.Must(octaviav1.AddToScheme(scheme)) + utilruntime.Must(designatev1.AddToScheme(scheme)) utilruntime.Must(dataplanev1beta1.AddToScheme(scheme)) utilruntime.Must(ansibleeev1.AddToScheme(scheme)) utilruntime.Must(rabbitmqv1.AddToScheme(scheme)) @@ -281,4 +283,7 @@ func setupServiceOperatorDefaults() { // Octavia octaviav1.SetupDefaults() + + // Designate + designatev1.SetupDefaults() } diff --git a/pkg/openstack/designate.go b/pkg/openstack/designate.go new file mode 100644 index 000000000..58374e1ad --- /dev/null +++ b/pkg/openstack/designate.go @@ -0,0 +1,134 @@ +package openstack + +import ( + "context" + "fmt" + + "github.com/openstack-k8s-operators/lib-common/modules/common" + "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" + + designatev1 "github.com/openstack-k8s-operators/designate-operator/api/v1beta1" + 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" +) + +// ReconcileDesignate - +func ReconcileDesignate(ctx context.Context, instance *corev1beta1.OpenStackControlPlane, helper *helper.Helper) (ctrl.Result, error) { + designate := &designatev1.Designate{ + ObjectMeta: metav1.ObjectMeta{ + Name: "designate", + Namespace: instance.Namespace, + }, + } + + if !instance.Spec.Designate.Enabled { + if res, err := EnsureDeleted(ctx, helper, designate); err != nil { + return res, err + } + instance.Status.Conditions.Remove(corev1beta1.OpenStackControlPlaneDesignateReadyCondition) + instance.Status.Conditions.Remove(corev1beta1.OpenStackControlPlaneExposeDesignateReadyCondition) + return ctrl.Result{}, nil + } + + // add selector to service overrides + for _, endpointType := range []service.Endpoint{service.EndpointPublic, service.EndpointInternal} { + if instance.Spec.Designate.Template.DesignateAPI.Override.Service == nil { + instance.Spec.Designate.Template.DesignateAPI.Override.Service = map[service.Endpoint]service.RoutedOverrideSpec{} + } + instance.Spec.Designate.Template.DesignateAPI.Override.Service[endpointType] = + AddServiceComponentLabel( + instance.Spec.Designate.Template.DesignateAPI.Override.Service[endpointType], + designate.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: "designate", Namespace: instance.Namespace}, designate); err != nil { + if !k8s_errors.IsNotFound(err) { + return ctrl.Result{}, err + } + } + + if designate.Status.Conditions.IsTrue(designatev1.DesignateAPIReadyCondition) { + svcs, err := service.GetServicesListWithLabel( + ctx, + helper, + instance.Namespace, + map[string]string{common.AppSelector: designate.Name}, + ) + if err != nil { + return ctrl.Result{}, err + } + + var ctrlResult reconcile.Result + instance.Spec.Designate.Template.DesignateAPI.Override.Service, ctrlResult, err = EnsureRoute( + ctx, + instance, + helper, + designate, + svcs, + instance.Spec.Designate.Template.DesignateAPI.Override.Service, + instance.Spec.Designate.APIOverride.Route, + corev1beta1.OpenStackControlPlaneExposeDesignateReadyCondition, + ) + if err != nil { + return ctrlResult, err + } else if (ctrlResult != ctrl.Result{}) { + return ctrlResult, nil + } + } + + helper.GetLogger().Info("Reconciling Designate", "Designate.Namespace", instance.Namespace, "Designate.Name", "designate") + op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), designate, func() error { + instance.Spec.Designate.Template.DeepCopyInto(&designate.Spec) + + if designate.Spec.Secret == "" { + designate.Spec.Secret = instance.Spec.Secret + } + if designate.Spec.NodeSelector == nil && instance.Spec.NodeSelector != nil { + designate.Spec.NodeSelector = instance.Spec.NodeSelector + } + if designate.Spec.DatabaseInstance == "" { + //designate.Spec.DatabaseInstance = instance.Name // name of MariaDB we create here + designate.Spec.DatabaseInstance = "openstack" //FIXME: see above + } + err := controllerutil.SetControllerReference(helper.GetBeforeObject(), designate, helper.GetScheme()) + if err != nil { + return err + } + return nil + }) + + if err != nil { + instance.Status.Conditions.Set(condition.FalseCondition( + corev1beta1.OpenStackControlPlaneDesignateReadyCondition, + condition.ErrorReason, + condition.SeverityWarning, + corev1beta1.OpenStackControlPlaneDesignateReadyErrorMessage, + err.Error())) + return ctrl.Result{}, err + } + if op != controllerutil.OperationResultNone { + helper.GetLogger().Info(fmt.Sprintf("Designate %s - %s", designate.Name, op)) + } + + if designate.IsReady() { + instance.Status.Conditions.MarkTrue(corev1beta1.OpenStackControlPlaneDesignateReadyCondition, corev1beta1.OpenStackControlPlaneDesignateReadyMessage) + } else { + instance.Status.Conditions.Set(condition.FalseCondition( + corev1beta1.OpenStackControlPlaneDesignateReadyCondition, + condition.RequestedReason, + condition.SeverityInfo, + corev1beta1.OpenStackControlPlaneDesignateReadyRunningMessage)) + } + + return ctrl.Result{}, nil + +} diff --git a/tests/kuttl/common/assert-sample-deployment.yaml b/tests/kuttl/common/assert-sample-deployment.yaml index 9e1b69611..382e2d87f 100644 --- a/tests/kuttl/common/assert-sample-deployment.yaml +++ b/tests/kuttl/common/assert-sample-deployment.yaml @@ -139,6 +139,21 @@ spec: replicas: 1 swiftProxy: replicas: 1 + designate: + enabled: false + template: + databaseInstance: openstack + secret: osp-secret + designateAPI: + replicas: 1 + desiganteCentral: + replicas: 0 # backend needs to be configured + designateWorker: + replicas: 0 # backend needs to be configured + designateProducer: + replicas: 0 # backend needs to be configured + designateMdns: + replicas: 0 # backend needs to be configured status: conditions: - message: Setup complete