From 8f415948ccbc9b90b201b16da581cef6f4e5d51e Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Thu, 27 Jul 2023 12:01:36 +0200 Subject: [PATCH] Create keystoneapi route and svc endpoint overrides Creates the route for the keystoneapi, also allows to customize the route via override. Generats the service override for the env with what is configured in the externalEndpoints, or specified in the service template override. Depends-On: https://github.com/openstack-k8s-operators/lib-common/pull/313 Depends-On: https://github.com/openstack-k8s-operators/keystone-operator/pull/289 Jira: OSP-26690 --- ....openstack.org_openstackcontrolplanes.yaml | 1197 ++++++++++++----- apis/core/v1beta1/conditions.go | 15 + .../v1beta1/openstackcontrolplane_types.go | 24 +- apis/core/v1beta1/zz_generated.deepcopy.go | 22 + apis/go.mod | 26 +- apis/go.sum | 48 +- ....openstack.org_openstackcontrolplanes.yaml | 1197 ++++++++++++----- ...nstack-operator.clusterserviceversion.yaml | 18 + config/rbac/role.yaml | 19 + ...controlplane_galera_network_isolation.yaml | 17 +- ...ne_galera_network_isolation_3replicas.yaml | 17 +- ...enstackcontrolplane_network_isolation.yaml | 17 +- ...ckcontrolplane_network_isolation_ceph.yaml | 17 +- .../core/openstackcontrolplane_controller.go | 10 +- go.mod | 30 +- go.sum | 48 +- main.go | 2 + pkg/openstack/common.go | 275 ++++ pkg/openstack/keystone.go | 56 +- 19 files changed, 2351 insertions(+), 704 deletions(-) diff --git a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml index dad49c970..04b477e16 100644 --- a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -118,32 +118,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - endpoint - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -152,6 +126,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -2887,32 +2912,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - endpoint - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -2921,6 +2920,55 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + 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 pvc: type: string replicas: @@ -2983,32 +3031,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - endpoint - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -3017,6 +3039,55 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + 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 pvc: type: string replicas: @@ -3160,6 +3231,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -3220,6 +3342,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -3393,27 +3566,78 @@ spec: additionalProperties: type: string type: object - preserveJobs: - default: false - type: boolean - replicas: - default: 1 - format: int32 - maximum: 32 - minimum: 0 - type: integer - resources: + override: properties: - claims: + service: items: properties: - name: + endpointURL: type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: + 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: array + type: object + preserveJobs: + default: false + type: boolean + 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: @@ -3433,20 +3657,6 @@ spec: x-kubernetes-int-or-string: true type: object type: object - route: - properties: - routeLocation: - type: string - routeName: - default: horizon - type: string - routeTLSCA: - type: string - routeTLSEnabled: - type: string - routeTLSKey: - type: string - type: object secret: type: string required: @@ -3923,6 +4133,107 @@ spec: type: object keystone: 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: true type: boolean @@ -3959,32 +4270,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - endpoint - - ipAddressPool - type: object - type: array memcachedInstance: default: memcached type: string @@ -3996,6 +4281,57 @@ spec: 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: admin: AdminPassword @@ -4877,31 +5213,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -4910,6 +5221,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -5209,32 +5571,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - endpoint - - ipAddressPool - type: object - type: array extraMounts: items: properties: @@ -5999,6 +6335,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object passwordSelectors: default: database: NeutronDatabasePassword @@ -6098,31 +6485,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -6131,6 +6493,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -6252,31 +6665,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -6285,6 +6673,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -6333,31 +6772,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -6366,6 +6780,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -6457,31 +6922,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -6490,6 +6930,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -7023,32 +7514,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - endpoint - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -7057,6 +7522,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object passwordSelectors: default: database: PlacementDatabasePassword @@ -7495,6 +8011,12 @@ spec: type: object externalEndpoint: properties: + endpoint: + default: internal + enum: + - internal + - public + type: string ipAddressPool: minLength: 1 type: string @@ -11185,6 +11707,57 @@ spec: type: string containerImageProxy: type: string + override: + properties: + service: + items: + 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: array + type: object passwordSelectors: default: service: SwiftPassword diff --git a/apis/core/v1beta1/conditions.go b/apis/core/v1beta1/conditions.go index 5d44a3b08..cd5aa2c0b 100644 --- a/apis/core/v1beta1/conditions.go +++ b/apis/core/v1beta1/conditions.go @@ -33,6 +33,9 @@ const ( // OpenStackControlPlaneKeystoneAPIReadyCondition Status=True condition which indicates if KeystoneAPI is configured and operational OpenStackControlPlaneKeystoneAPIReadyCondition condition.Type = "OpenStackControlPlaneKeystoneAPIReady" + // OpenStackControlPlaneExposeKeystoneAPIReadyCondition Status=True condition which indicates if KeystoneAPI is exposed via a route + OpenStackControlPlaneExposeKeystoneAPIReadyCondition condition.Type = "OpenStackControlPlaneExposeKeystoneAPIReady" + // OpenStackControlPlanePlacementAPIReadyCondition Status=True condition which indicates if PlacementAPI is configured and operational OpenStackControlPlanePlacementAPIReadyCondition condition.Type = "OpenStackControlPlanePlacementAPIReady" @@ -75,6 +78,9 @@ const ( // OpenStackControlPlaneCeilometerReadyCondition Status=True condition which indicates if OpenStack Ceilometer service is configured and operational OpenStackControlPlaneCeilometerReadyCondition condition.Type = "OpenStackControlPlaneCeilometerReady" + // OpenStackControlPlaneServiceOverrideReadyCondition Status=True condition which indicates if OpenStack service override has created ok + OpenStackControlPlaneServiceOverrideReadyCondition condition.Type = "OpenStackControlPlaneServiceOverrideReady" + // OpenStackControlPlaneManilaReadyInitMessage OpenStackControlPlaneManilaReadyInitMessage = "OpenStackControlPlane Manila not started" @@ -321,4 +327,13 @@ const ( // OpenStackControlPlaneCeilometerReadyErrorMessage OpenStackControlPlaneCeilometerReadyErrorMessage = "OpenStackControlPlane Ceilometer error occured %s" + + // OpenStackControlPlaneExposeServiceReadyInitMessage + OpenStackControlPlaneExposeServiceReadyInitMessage = "OpenStackControlPlane %s exposing service %s not started" + + // OpenStackControlPlaneExposeServiceReadyErrorMessage + OpenStackControlPlaneExposeServiceReadyErrorMessage = "OpenStackControlPlane %s exposing service via route %s error occured %s" + + // OpenStackControlPlaneExposeServiceReadyMessage + OpenStackControlPlaneExposeServiceReadyMessage = "OpenStackControlPlane %s service exposed" ) diff --git a/apis/core/v1beta1/openstackcontrolplane_types.go b/apis/core/v1beta1/openstackcontrolplane_types.go index fafbd3e8e..ed170b64f 100644 --- a/apis/core/v1beta1/openstackcontrolplane_types.go +++ b/apis/core/v1beta1/openstackcontrolplane_types.go @@ -26,18 +26,20 @@ import ( ironicv1 "github.com/openstack-k8s-operators/ironic-operator/api/v1beta1" keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1" condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" + "github.com/openstack-k8s-operators/lib-common/modules/common/route" + "github.com/openstack-k8s-operators/lib-common/modules/common/service" "github.com/openstack-k8s-operators/lib-common/modules/common/util" "github.com/openstack-k8s-operators/lib-common/modules/storage" 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" novav1 "github.com/openstack-k8s-operators/nova-operator/api/v1beta1" + octaviav1 "github.com/openstack-k8s-operators/octavia-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" telemetryv1 "github.com/openstack-k8s-operators/telemetry-operator/api/v1beta1" rabbitmqv1 "github.com/rabbitmq/cluster-operator/api/v1beta1" - octaviav1 "github.com/openstack-k8s-operators/octavia-operator/api/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -186,9 +188,21 @@ type KeystoneSection struct { Enabled bool `json:"enabled"` // +kubebuilder:validation:Optional - //+operator-sdk:csv:customresourcedefinitions:type=spec + // +operator-sdk:csv:customresourcedefinitions:type=spec // Template - Overrides to use when creating the Keystone service Template keystonev1.KeystoneAPISpec `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"` +} + +// Override to override the generated manifest of several child resources. +type Override struct { + // +kubebuilder:validation:Optional + // Route overrides to use when creating the public service endpoint + Route *route.OverrideSpec `json:"route,omitempty"` } // PlacementSection defines the desired state of Placement service @@ -304,6 +318,12 @@ type RabbitmqTemplate struct { // MetalLBConfig to configure the MetalLB loadbalancer service type MetalLBConfig struct { + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Enum=internal;public + // +kubebuilder:default=internal + // Endpoint, OpenStack endpoint this service maps to + Endpoint service.Endpoint `json:"endpoint"` + // +kubebuilder:validation:Required // +kubebuilder:validation:MinLength=1 //+operator-sdk:csv:customresourcedefinitions:type=spec diff --git a/apis/core/v1beta1/zz_generated.deepcopy.go b/apis/core/v1beta1/zz_generated.deepcopy.go index e9e2e9029..96ee0d99d 100644 --- a/apis/core/v1beta1/zz_generated.deepcopy.go +++ b/apis/core/v1beta1/zz_generated.deepcopy.go @@ -24,6 +24,7 @@ package v1beta1 import ( memcachedv1beta1 "github.com/openstack-k8s-operators/infra-operator/apis/memcached/v1beta1" "github.com/openstack-k8s-operators/lib-common/modules/common/condition" + "github.com/openstack-k8s-operators/lib-common/modules/common/route" "github.com/openstack-k8s-operators/lib-common/modules/storage" apiv1beta1 "github.com/openstack-k8s-operators/mariadb-operator/api/v1beta1" ovn_operatorapiv1beta1 "github.com/openstack-k8s-operators/ovn-operator/api/v1beta1" @@ -168,6 +169,7 @@ func (in *IronicSection) DeepCopy() *IronicSection { func (in *KeystoneSection) DeepCopyInto(out *KeystoneSection) { *out = *in in.Template.DeepCopyInto(&out.Template) + in.APIOverride.DeepCopyInto(&out.APIOverride) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeystoneSection. @@ -474,6 +476,26 @@ func (in *OpenStackExtraVolMounts) DeepCopy() *OpenStackExtraVolMounts { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Override) DeepCopyInto(out *Override) { + *out = *in + if in.Route != nil { + in, out := &in.Route, &out.Route + *out = new(route.OverrideSpec) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Override. +func (in *Override) DeepCopy() *Override { + if in == nil { + return nil + } + out := new(Override) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OvnResources) DeepCopyInto(out *OvnResources) { *out = *in diff --git a/apis/go.mod b/apis/go.mod index 456f48849..03171638d 100644 --- a/apis/go.mod +++ b/apis/go.mod @@ -11,7 +11,7 @@ require ( github.com/openstack-k8s-operators/horizon-operator/api v0.1.1-0.20230828060631-f5678c16313e github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230829092744-a3dd5edba332 github.com/openstack-k8s-operators/ironic-operator/api v0.1.1-0.20230825083339-bc99e910c674 - github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230823144632-e4b8db8a76bc + github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230830083045-d73d07cca617 github.com/openstack-k8s-operators/lib-common/modules/common v0.1.1-0.20230824094610-976b18ca2875 github.com/openstack-k8s-operators/manila-operator/api v0.1.1-0.20230817135608-41dee07f5847 github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230823144333-b9363c5be8d2 @@ -65,7 +65,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/openshift/api v3.9.0+incompatible // indirect - github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.0 //indirect + github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.1-0.20230824094610-976b18ca2875 //indirect github.com/openstack-k8s-operators/lib-common/modules/storage v0.1.1-0.20230824094610-976b18ca2875 github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.16.0 // indirect @@ -100,3 +100,25 @@ require ( // mschuppert: map to latest commit from release-4.13 tag // must consistent within modules and service operators replace github.com/openshift/api => github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 //allow-merging + +replace github.com/openstack-k8s-operators/lib-common/modules/common => github.com/stuggi/lib-common/modules/common v0.0.0-20230907071651-c816e73a2ebd + +replace github.com/openstack-k8s-operators/keystone-operator/api => github.com/stuggi/keystone-operator/api v0.0.0-20230907073946-d4e322f577a3 + +replace github.com/openstack-k8s-operators/glance-operator/api => github.com/stuggi/glance-operator/api v0.0.0-20230907074755-6f3da2dbf3f7 + +replace github.com/openstack-k8s-operators/placement-operator/api => github.com/stuggi/placement-operator/api v0.0.0-20230907075121-486b243c7540 + +replace github.com/openstack-k8s-operators/cinder-operator/api => github.com/stuggi/cinder-operator/api v0.0.0-20230907075756-6fe6fbd8efb3 + +replace github.com/openstack-k8s-operators/neutron-operator/api => github.com/stuggi/neutron-operator/api v0.0.0-20230907080310-fd4ed88bd3b0 + +replace github.com/openstack-k8s-operators/nova-operator/api => github.com/stuggi/nova-operator/api v0.0.0-20230907081449-1e1716beaa6b + +replace github.com/openstack-k8s-operators/heat-operator/api => github.com/stuggi/heat-operator/api v0.0.0-20230907081627-c8d89e9ee0e4 + +replace github.com/openstack-k8s-operators/horizon-operator/api => github.com/stuggi/horizon-operator/api v0.0.0-20230907082041-fce6d41bb7e7 + +replace github.com/openstack-k8s-operators/manila-operator/api => github.com/stuggi/manila-operator/api v0.0.0-20230907094801-a6cf634f20f6 + +replace github.com/openstack-k8s-operators/swift-operator/api => github.com/stuggi/swift-operator/api v0.0.0-20230907082551-0514a4d0c787 diff --git a/apis/go.sum b/apis/go.sum index 30942f38f..fb40b5f06 100644 --- a/apis/go.sum +++ b/apis/go.sum @@ -126,42 +126,20 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 h1:rncLxJBpFGqBztyxCMwNRnMjhhIDOWHJowi6q8G6koI= github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7/go.mod h1:ctXNyWanKEjGj8sss1KjjHQ3ENKFm33FFnS5BKaIPh4= -github.com/openstack-k8s-operators/cinder-operator/api v0.1.1-0.20230822085155-98a680937115 h1:7O/YnKJEUnn1bh3eEH4Yuqx0GzTe4HXd4zyzOD+NWxc= -github.com/openstack-k8s-operators/cinder-operator/api v0.1.1-0.20230822085155-98a680937115/go.mod h1:GEZ6VarA74XXRa4SagCymoRrxQQVWvxZ2K7O4/YSxK4= -github.com/openstack-k8s-operators/glance-operator/api v0.1.1-0.20230827173355-391b0669d71f h1:dIDdStKBEtE5p3YvAwXIePNw7N/X6WMk2dRxcHTBHE4= -github.com/openstack-k8s-operators/glance-operator/api v0.1.1-0.20230827173355-391b0669d71f/go.mod h1:4mRCop53FgDo19PnkFDqQHhsKMaJd/vJe+zvdOEl9oQ= -github.com/openstack-k8s-operators/heat-operator/api v0.1.1-0.20230828054057-36837cde8504 h1:Aj5Dwb/xLrfb0HqbbtWZ6HroCtK8VaYM72V513UZ+Us= -github.com/openstack-k8s-operators/heat-operator/api v0.1.1-0.20230828054057-36837cde8504/go.mod h1:37QLjCxwfdFZAEoq7n7eBBBIARpzgGLZk4+PxM1CMoo= -github.com/openstack-k8s-operators/horizon-operator/api v0.1.1-0.20230828060631-f5678c16313e h1:YnropAKFAvFTH6ieqQYqOfXmd7RnU78jCVcQ6Td2XaQ= -github.com/openstack-k8s-operators/horizon-operator/api v0.1.1-0.20230828060631-f5678c16313e/go.mod h1:dfeiJ4Ul8dDmOSSwmKu/X7rLE8K2H1kwdUdf1Ik/K2w= github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230829092744-a3dd5edba332 h1:OxhwqONfFHQjJuJjK3HKTXTSo2oQwKa97s+T+vKspkY= github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230829092744-a3dd5edba332/go.mod h1:t1xmsiZDqM3wXcLMqgHp7/iilK8ozuOkydV4Vi2Qibk= github.com/openstack-k8s-operators/ironic-operator/api v0.1.1-0.20230825083339-bc99e910c674 h1:EC1JeDLqeVhYqpbhaMI3Upca20YTcQycjt3cK8xOgo4= github.com/openstack-k8s-operators/ironic-operator/api v0.1.1-0.20230825083339-bc99e910c674/go.mod h1:3h2WeBFiW2dIyz5+FxoMQfX+82XOKOR/a/ddWrakZXg= -github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230823144632-e4b8db8a76bc h1:78MQTRkSM5lMqdYmvjzQZGUlD6BHwYb5PSpm9m3Z310= -github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230823144632-e4b8db8a76bc/go.mod h1:LNJJdteQG4E2fhWDerE+f8S2/ephEJg8yBkH1eqYYOo= -github.com/openstack-k8s-operators/lib-common/modules/common v0.1.1-0.20230824094610-976b18ca2875 h1:pj22n6PQy/XAmV5m6XaarMY6X1lvxAh16oVT5ZSVoNI= -github.com/openstack-k8s-operators/lib-common/modules/common v0.1.1-0.20230824094610-976b18ca2875/go.mod h1:Mqg9hyHpWPda62750vqmk5TajxP3zbYPDP1rtSH7mg0= -github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.0 h1:mMeJvCQfZmakssvMyHjzp/ngxKysETDj9GJYhRwydzg= -github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.0/go.mod h1:+paEFOL5IlJzhg9fy7/1+HSErVkWUgUj1ORLFwgvxnI= +github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.1-0.20230824094610-976b18ca2875 h1:aUlwELsLYWQ3FL+/nRG/1uGVNW86c3MhtLrHNVDd57k= +github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.1-0.20230824094610-976b18ca2875/go.mod h1:Vng+vqdTJUuZ+AEzSAaU0I7bn3qwYMMFEUHHhiH0440= github.com/openstack-k8s-operators/lib-common/modules/storage v0.1.1-0.20230824094610-976b18ca2875 h1:lC8Nw4PF2Lcqc7BJAdlBvYPyLqyaKa9R1e15dM9b3BY= github.com/openstack-k8s-operators/lib-common/modules/storage v0.1.1-0.20230824094610-976b18ca2875/go.mod h1:lazDTPD8BYde2yyzZ3HbOfG51Sf87vSr4KXwpF57hDs= -github.com/openstack-k8s-operators/manila-operator/api v0.1.1-0.20230817135608-41dee07f5847 h1:YzdSGsLdyyWpzC3wL6Eaw+N6OaB12x93eWEaiJQXS7s= -github.com/openstack-k8s-operators/manila-operator/api v0.1.1-0.20230817135608-41dee07f5847/go.mod h1:gNH4zYG6NGUE6LsD81naotD9oH7CNSKqBW/51hE/Qm8= github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230823144333-b9363c5be8d2 h1:vYb2ET44wVnZKsLjDxTZpQzqGyhINJKe0nkkOYS08DU= github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230823144333-b9363c5be8d2/go.mod h1:m5XuZSa5Zt5uAw3WbJYOIkFAGXy01mybVekcKOq1qHI= -github.com/openstack-k8s-operators/neutron-operator/api v0.1.1-0.20230824160722-048e30e1d426 h1:yZ+0Vx9+bFSzaD9PgSrFyOUNfcpeQLRGHyXTbiXVNhw= -github.com/openstack-k8s-operators/neutron-operator/api v0.1.1-0.20230824160722-048e30e1d426/go.mod h1:36bJXyJll5kJt8HYOzY+dfXIhQTXciWm0gTstSX0wUo= -github.com/openstack-k8s-operators/nova-operator/api v0.1.2-0.20230828132407-f07662231bdb h1:ViSJh3PzIAWD9B8uwj7uNXU47Knx8feuQ1N3Sv5omQ8= -github.com/openstack-k8s-operators/nova-operator/api v0.1.2-0.20230828132407-f07662231bdb/go.mod h1:CEy8QMQjsSnosfTSkNNyrUb0FWfB5+139VjVp8eRF80= github.com/openstack-k8s-operators/octavia-operator/api v0.0.0-20230825164400-086bc6962fa6 h1:BkrKsbSkkqew5H2cBX2uRwjyu/DoRahfDzt1bhThc9I= github.com/openstack-k8s-operators/octavia-operator/api v0.0.0-20230825164400-086bc6962fa6/go.mod h1:8k2LWIFkjPGWaiZRJhMThieyJJZciRUZz17oBcgFWtk= github.com/openstack-k8s-operators/ovn-operator/api v0.1.1-0.20230825114232-c3f91544c28f h1:dCocvrutADtQGs2k8/EHpcODEdzRu+AZ61aFZVOyo/A= github.com/openstack-k8s-operators/ovn-operator/api v0.1.1-0.20230825114232-c3f91544c28f/go.mod h1:SBsCNWj0Wedzvudeeaii3Ch3JQ4kVwbUt6hXVhSc7Do= -github.com/openstack-k8s-operators/placement-operator/api v0.1.1-0.20230828152242-813edf2a8bfd h1:lXpx5IWeORLJ5oXOMFcQynhVhCcCB8uT+/PcLUuDeL0= -github.com/openstack-k8s-operators/placement-operator/api v0.1.1-0.20230828152242-813edf2a8bfd/go.mod h1:gsI+bvX70Y7NXZtAL36V18qufVO0xYW6Z2rbEKL5Nqo= -github.com/openstack-k8s-operators/swift-operator/api v0.1.1-0.20230824202713-d98dfa78a348 h1:TIK339twRJgA1w0Rx5JeVWWd71KH54Yn9diOprR//9g= -github.com/openstack-k8s-operators/swift-operator/api v0.1.1-0.20230824202713-d98dfa78a348/go.mod h1:HrDnaSOYvnqZITCiUI5r+6W2q+m4zify9X8d+P0Q9RE= github.com/openstack-k8s-operators/telemetry-operator/api v0.1.1-0.20230824075008-ac5d892e6e75 h1:nRFZGaz8tPG+19iYlND6CNgasorCB1rQkGHLuJs8vPs= github.com/openstack-k8s-operators/telemetry-operator/api v0.1.1-0.20230824075008-ac5d892e6e75/go.mod h1:rRn2PvBo/B9Ct7Zqz1PeOIiIdKaVJIBVF7irQJsYecw= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -197,6 +175,28 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stuggi/cinder-operator/api v0.0.0-20230907075756-6fe6fbd8efb3 h1:5b25gNTbph/hNSqS7+eMw9pHiadA3qUAwehP9YbMs1M= +github.com/stuggi/cinder-operator/api v0.0.0-20230907075756-6fe6fbd8efb3/go.mod h1:RGJVo58IzrLeEa1e2kAWiVT/p0PJFoDEj8Nuq7/mvGE= +github.com/stuggi/glance-operator/api v0.0.0-20230907074755-6f3da2dbf3f7 h1:bXRlD6n4PxnaMNcRjRiZK7RYixnDUKEHagl3V9z1Rm4= +github.com/stuggi/glance-operator/api v0.0.0-20230907074755-6f3da2dbf3f7/go.mod h1:pV1GRmdtWrLK2X235bCk8csrZPIpn6YOVRBNtZHPMBM= +github.com/stuggi/heat-operator/api v0.0.0-20230907081627-c8d89e9ee0e4 h1:dxR0SmsfIj888Nt9r5H3zLYULpxN9VVeZ9HkpvXVi/c= +github.com/stuggi/heat-operator/api v0.0.0-20230907081627-c8d89e9ee0e4/go.mod h1:fnMLAHa9ul7ry/8Lud3NJ4YYKp1OPmRism8TP/ryTJM= +github.com/stuggi/horizon-operator/api v0.0.0-20230907082041-fce6d41bb7e7 h1:6YqW/SimfFZ+HQ9s50FrbOLpeFleIFy7BZHf4CAf3Zs= +github.com/stuggi/horizon-operator/api v0.0.0-20230907082041-fce6d41bb7e7/go.mod h1:Usjf48uBzShtnTbgLGZRTk1wIQpDP7fTtuQG86OxEcQ= +github.com/stuggi/keystone-operator/api v0.0.0-20230907073946-d4e322f577a3 h1:jgtM1aAMrjv2I5oLjxlBFqTcc2FvIb3i1rA9RBz87GM= +github.com/stuggi/keystone-operator/api v0.0.0-20230907073946-d4e322f577a3/go.mod h1:xVGf/an6HspP2PmYvTxJG07kq4hOX/f2nRx9tMK2k7A= +github.com/stuggi/lib-common/modules/common v0.0.0-20230907071651-c816e73a2ebd h1:UdvJwGL6uHHlVb01tNooLPivtpgC7obdhXQINdgllYc= +github.com/stuggi/lib-common/modules/common v0.0.0-20230907071651-c816e73a2ebd/go.mod h1:Mqg9hyHpWPda62750vqmk5TajxP3zbYPDP1rtSH7mg0= +github.com/stuggi/manila-operator/api v0.0.0-20230907094801-a6cf634f20f6 h1:n8A6qv/HOgZrCdYOr+fy1JuEJ0NOB6nGSr7SYq51e4Y= +github.com/stuggi/manila-operator/api v0.0.0-20230907094801-a6cf634f20f6/go.mod h1:5HEHzp0nkk+1mprYDije9dWJKGUT4Zka4JWx5ogvWqo= +github.com/stuggi/neutron-operator/api v0.0.0-20230907080310-fd4ed88bd3b0 h1:T7ihoINXh4aAv8k2XZfrcFsy/LbMqdTjzmTpmZOZKoE= +github.com/stuggi/neutron-operator/api v0.0.0-20230907080310-fd4ed88bd3b0/go.mod h1:vobRlJbNkn3KyKBJ6FAPknTHPpNVgjxxWJa1ToseXwo= +github.com/stuggi/nova-operator/api v0.0.0-20230907081449-1e1716beaa6b h1:EktAODWooVAmglZJYwdsATJk9lT2ElRFamohDSibmNA= +github.com/stuggi/nova-operator/api v0.0.0-20230907081449-1e1716beaa6b/go.mod h1:ZFgocIdylVSzJF02Fpvph9s1r4rFHdM1dr93glL9JpA= +github.com/stuggi/placement-operator/api v0.0.0-20230907075121-486b243c7540 h1:lYVtBR2DfQyqLW0hGMEebyq9RovHt1SPxBG1PPLW8Xc= +github.com/stuggi/placement-operator/api v0.0.0-20230907075121-486b243c7540/go.mod h1:cbc6SwemjH0TxQuz+FUB8LkFrNB184uH6SCs1sqmz/k= +github.com/stuggi/swift-operator/api v0.0.0-20230907082551-0514a4d0c787 h1:t+Kmm9WP3LBpOmbPRau/uBxvJlCV41WNbBW6dGm7H8c= +github.com/stuggi/swift-operator/api v0.0.0-20230907082551-0514a4d0c787/go.mod h1:/eHw7UibA93goMEmf79mqhZSZW/wXBu1v2i/Ndzt1qM= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= diff --git a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml index dad49c970..04b477e16 100644 --- a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -118,32 +118,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - endpoint - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -152,6 +126,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -2887,32 +2912,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - endpoint - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -2921,6 +2920,55 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + 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 pvc: type: string replicas: @@ -2983,32 +3031,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - endpoint - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -3017,6 +3039,55 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + 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 pvc: type: string replicas: @@ -3160,6 +3231,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -3220,6 +3342,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -3393,27 +3566,78 @@ spec: additionalProperties: type: string type: object - preserveJobs: - default: false - type: boolean - replicas: - default: 1 - format: int32 - maximum: 32 - minimum: 0 - type: integer - resources: + override: properties: - claims: + service: items: properties: - name: + endpointURL: type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: + 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: array + type: object + preserveJobs: + default: false + type: boolean + 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: @@ -3433,20 +3657,6 @@ spec: x-kubernetes-int-or-string: true type: object type: object - route: - properties: - routeLocation: - type: string - routeName: - default: horizon - type: string - routeTLSCA: - type: string - routeTLSEnabled: - type: string - routeTLSKey: - type: string - type: object secret: type: string required: @@ -3923,6 +4133,107 @@ spec: type: object keystone: 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: true type: boolean @@ -3959,32 +4270,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - endpoint - - ipAddressPool - type: object - type: array memcachedInstance: default: memcached type: string @@ -3996,6 +4281,57 @@ spec: 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: admin: AdminPassword @@ -4877,31 +5213,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -4910,6 +5221,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -5209,32 +5571,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - endpoint - - ipAddressPool - type: object - type: array extraMounts: items: properties: @@ -5999,6 +6335,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object passwordSelectors: default: database: NeutronDatabasePassword @@ -6098,31 +6485,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -6131,6 +6493,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -6252,31 +6665,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -6285,6 +6673,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -6333,31 +6772,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -6366,6 +6780,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -6457,31 +6922,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -6490,6 +6930,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object replicas: default: 1 format: int32 @@ -7023,32 +7514,6 @@ spec: additionalProperties: type: string type: object - externalEndpoints: - items: - properties: - endpoint: - enum: - - internal - - public - type: string - ipAddressPool: - minLength: 1 - type: string - loadBalancerIPs: - items: - type: string - type: array - sharedIP: - default: true - type: boolean - sharedIPKey: - default: "" - type: string - required: - - endpoint - - ipAddressPool - type: object - type: array networkAttachments: items: type: string @@ -7057,6 +7522,57 @@ spec: additionalProperties: type: string type: object + override: + properties: + service: + items: + 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: array + type: object passwordSelectors: default: database: PlacementDatabasePassword @@ -7495,6 +8011,12 @@ spec: type: object externalEndpoint: properties: + endpoint: + default: internal + enum: + - internal + - public + type: string ipAddressPool: minLength: 1 type: string @@ -11185,6 +11707,57 @@ spec: type: string containerImageProxy: type: string + override: + properties: + service: + items: + 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: array + type: object passwordSelectors: default: service: SwiftPassword diff --git a/config/manifests/bases/openstack-operator.clusterserviceversion.yaml b/config/manifests/bases/openstack-operator.clusterserviceversion.yaml index affbaed82..06e7017b4 100644 --- a/config/manifests/bases/openstack-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/openstack-operator.clusterserviceversion.yaml @@ -117,6 +117,24 @@ spec: path: keystone.enabled x-descriptors: - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - description: IPAddressPool expose VIP via MetalLB on the IPAddressPool + displayName: IPAddress Pool + path: keystone.externalEndpoints[0].ipAddressPool + - description: LoadBalancerIPs, request given IPs from the pool if available. + Using a list to allow dual stack (IPv4/IPv6) support + displayName: Load Balancer IPs + path: keystone.externalEndpoints[0].loadBalancerIPs + - description: SharedIP if true, VIP/VIPs get shared with multiple services + displayName: Shared IP + path: keystone.externalEndpoints[0].sharedIP + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - description: SharedIPKey specifies the sharing key which gets set as the annotation + on the LoadBalancer service. Services which share the same VIP must have + the same SharedIPKey. Defaults to the IPAddressPool if SharedIP is true, + but no SharedIPKey specified. + displayName: Shared IPKey + path: keystone.externalEndpoints[0].sharedIPKey - description: Template - Overrides to use when creating the Keystone service displayName: Template path: keystone.template diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index cc92d9754..71e78cd24 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -81,6 +81,13 @@ rules: - get - list - watch +- apiGroups: + - "" + resources: + - services + verbs: + - get + - list - apiGroups: - core.openstack.org resources: @@ -343,6 +350,18 @@ rules: - list - update - watch +- apiGroups: + - route.openshift.io + resources: + - routes + verbs: + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - security.openshift.io resourceNames: diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml index 5a50e645f..e3ce43356 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml @@ -54,14 +54,21 @@ spec: networkAttachments: - storage keystone: + apiOverride: + route: {} template: + 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 databaseInstance: openstack secret: osp-secret - externalEndpoints: - - endpoint: internal - ipAddressPool: internalapi - loadBalancerIPs: - - 172.17.0.80 mariadb: enabled: false templates: 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 8930a5287..1e7c8162b 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation_3replicas.yaml @@ -54,14 +54,21 @@ spec: networkAttachments: - storage keystone: + apiOverride: + route: {} template: + 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 databaseInstance: openstack secret: osp-secret - externalEndpoints: - - endpoint: internal - ipAddressPool: internalapi - loadBalancerIPs: - - 172.17.0.80 mariadb: enabled: false templates: diff --git a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml index d0c962132..77c7d947a 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml @@ -54,14 +54,21 @@ spec: networkAttachments: - storage keystone: + apiOverride: + route: {} template: + 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 databaseInstance: openstack secret: osp-secret - externalEndpoints: - - endpoint: internal - ipAddressPool: internalapi - loadBalancerIPs: - - 172.17.0.80 mariadb: templates: openstack: diff --git a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml index ee119b8aa..0945c1343 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml @@ -98,14 +98,21 @@ spec: networkAttachments: - storage keystone: + apiOverride: + route: {} template: + 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 databaseInstance: openstack secret: osp-secret - externalEndpoints: - - endpoint: internal - ipAddressPool: internalapi - loadBalancerIPs: - - 172.17.0.80 mariadb: templates: openstack: diff --git a/controllers/core/openstackcontrolplane_controller.go b/controllers/core/openstackcontrolplane_controller.go index 8bf480e18..3647ec9d9 100644 --- a/controllers/core/openstackcontrolplane_controller.go +++ b/controllers/core/openstackcontrolplane_controller.go @@ -20,6 +20,7 @@ import ( "context" "fmt" + routev1 "github.com/openshift/api/route/v1" cinderv1 "github.com/openstack-k8s-operators/cinder-operator/api/v1beta1" glancev1 "github.com/openstack-k8s-operators/glance-operator/api/v1beta1" heatv1 "github.com/openstack-k8s-operators/heat-operator/api/v1beta1" @@ -29,13 +30,16 @@ import ( keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1" condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" "github.com/openstack-k8s-operators/lib-common/modules/common/helper" + 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" novav1 "github.com/openstack-k8s-operators/nova-operator/api/v1beta1" octaviav1 "github.com/openstack-k8s-operators/octavia-operator/api/v1beta1" corev1beta1 "github.com/openstack-k8s-operators/openstack-operator/apis/core/v1beta1" + "github.com/openstack-k8s-operators/openstack-operator/pkg/openstack" + 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" @@ -85,6 +89,8 @@ type OpenStackControlPlaneReconciler struct { //+kubebuilder:rbac:groups=telemetry.openstack.org,resources=ceilometercentrals,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=route.openshift.io,resources=routes,verbs=get;list;watch;create;update;patch;delete; +//+kubebuilder:rbac:groups=core,resources=services,verbs=get;list; // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. @@ -150,9 +156,6 @@ func (r *OpenStackControlPlaneReconciler) Reconcile(ctx context.Context, req ctr return ctrl.Result{}, nil } - // Reset all ReadyConditons to 'Unknown' - instance.InitConditions() - return r.reconcileNormal(ctx, instance, helper) } @@ -325,5 +328,6 @@ func (r *OpenStackControlPlaneReconciler) SetupWithManager(mgr ctrl.Manager) err Owns(&horizonv1.Horizon{}). Owns(&telemetryv1.CeilometerCentral{}). Owns(&octaviav1.Octavia{}). + Owns(&routev1.Route{}). Complete(r) } diff --git a/go.mod b/go.mod index 6f7c5df9e..b6e8b819d 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/openstack-k8s-operators/horizon-operator/api v0.1.1-0.20230828060631-f5678c16313e github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230829092744-a3dd5edba332 github.com/openstack-k8s-operators/ironic-operator/api v0.1.1-0.20230825083339-bc99e910c674 - github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230823144632-e4b8db8a76bc + github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230830083045-d73d07cca617 github.com/openstack-k8s-operators/lib-common/modules/common v0.1.1-0.20230824094610-976b18ca2875 github.com/openstack-k8s-operators/manila-operator/api v0.1.1-0.20230817135608-41dee07f5847 github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230823144333-b9363c5be8d2 @@ -74,8 +74,8 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/openshift/api v3.9.0+incompatible // indirect - github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.0 //indirect + github.com/openshift/api v3.9.0+incompatible + github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.1-0.20230824094610-976b18ca2875 //indirect github.com/openstack-k8s-operators/lib-common/modules/storage v0.1.1-0.20230824094610-976b18ca2875 //indirect github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.16.0 // indirect @@ -101,7 +101,7 @@ require ( k8s.io/component-base v0.26.8 //indirect k8s.io/klog/v2 v2.100.1 // indirect k8s.io/kube-openapi v0.0.0-20230515203736-54b630e78af5 //indirect - k8s.io/utils v0.0.0-20230726121419-3b25d923346b //indirect + k8s.io/utils v0.0.0-20230726121419-3b25d923346b sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd //indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect sigs.k8s.io/yaml v1.3.0 // indirect @@ -112,3 +112,25 @@ replace github.com/openstack-k8s-operators/openstack-operator/apis => ./apis // mschuppert: map to latest commit from release-4.13 tag // must consistent within modules and service operators replace github.com/openshift/api => github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 //allow-merging + +replace github.com/openstack-k8s-operators/lib-common/modules/common => github.com/stuggi/lib-common/modules/common v0.0.0-20230907071651-c816e73a2ebd + +replace github.com/openstack-k8s-operators/keystone-operator/api => github.com/stuggi/keystone-operator/api v0.0.0-20230907073946-d4e322f577a3 + +replace github.com/openstack-k8s-operators/glance-operator/api => github.com/stuggi/glance-operator/api v0.0.0-20230907074755-6f3da2dbf3f7 + +replace github.com/openstack-k8s-operators/placement-operator/api => github.com/stuggi/placement-operator/api v0.0.0-20230907075121-486b243c7540 + +replace github.com/openstack-k8s-operators/cinder-operator/api => github.com/stuggi/cinder-operator/api v0.0.0-20230907075756-6fe6fbd8efb3 + +replace github.com/openstack-k8s-operators/neutron-operator/api => github.com/stuggi/neutron-operator/api v0.0.0-20230907080310-fd4ed88bd3b0 + +replace github.com/openstack-k8s-operators/nova-operator/api => github.com/stuggi/nova-operator/api v0.0.0-20230907081449-1e1716beaa6b + +replace github.com/openstack-k8s-operators/heat-operator/api => github.com/stuggi/heat-operator/api v0.0.0-20230907081627-c8d89e9ee0e4 + +replace github.com/openstack-k8s-operators/horizon-operator/api => github.com/stuggi/horizon-operator/api v0.0.0-20230907082041-fce6d41bb7e7 + +replace github.com/openstack-k8s-operators/manila-operator/api => github.com/stuggi/manila-operator/api v0.0.0-20230907094801-a6cf634f20f6 + +replace github.com/openstack-k8s-operators/swift-operator/api => github.com/stuggi/swift-operator/api v0.0.0-20230907082551-0514a4d0c787 diff --git a/go.sum b/go.sum index e68a66b14..41036fa25 100644 --- a/go.sum +++ b/go.sum @@ -133,36 +133,18 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 h1:rncLxJBpFGqBztyxCMwNRnMjhhIDOWHJowi6q8G6koI= github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7/go.mod h1:ctXNyWanKEjGj8sss1KjjHQ3ENKFm33FFnS5BKaIPh4= -github.com/openstack-k8s-operators/cinder-operator/api v0.1.1-0.20230822085155-98a680937115 h1:7O/YnKJEUnn1bh3eEH4Yuqx0GzTe4HXd4zyzOD+NWxc= -github.com/openstack-k8s-operators/cinder-operator/api v0.1.1-0.20230822085155-98a680937115/go.mod h1:GEZ6VarA74XXRa4SagCymoRrxQQVWvxZ2K7O4/YSxK4= github.com/openstack-k8s-operators/dataplane-operator/api v0.1.1-0.20230829012108-d1bde177e5a4 h1:1nLv/JrcNbW82xa26RcI6FGRs4tuVt512qttDA8No8s= github.com/openstack-k8s-operators/dataplane-operator/api v0.1.1-0.20230829012108-d1bde177e5a4/go.mod h1:xwL2kjh+IdDB5LCaU39VxtQN8L70cmYUzofkq1PV0Vw= -github.com/openstack-k8s-operators/glance-operator/api v0.1.1-0.20230827173355-391b0669d71f h1:dIDdStKBEtE5p3YvAwXIePNw7N/X6WMk2dRxcHTBHE4= -github.com/openstack-k8s-operators/glance-operator/api v0.1.1-0.20230827173355-391b0669d71f/go.mod h1:4mRCop53FgDo19PnkFDqQHhsKMaJd/vJe+zvdOEl9oQ= -github.com/openstack-k8s-operators/heat-operator/api v0.1.1-0.20230828054057-36837cde8504 h1:Aj5Dwb/xLrfb0HqbbtWZ6HroCtK8VaYM72V513UZ+Us= -github.com/openstack-k8s-operators/heat-operator/api v0.1.1-0.20230828054057-36837cde8504/go.mod h1:37QLjCxwfdFZAEoq7n7eBBBIARpzgGLZk4+PxM1CMoo= -github.com/openstack-k8s-operators/horizon-operator/api v0.1.1-0.20230828060631-f5678c16313e h1:YnropAKFAvFTH6ieqQYqOfXmd7RnU78jCVcQ6Td2XaQ= -github.com/openstack-k8s-operators/horizon-operator/api v0.1.1-0.20230828060631-f5678c16313e/go.mod h1:dfeiJ4Ul8dDmOSSwmKu/X7rLE8K2H1kwdUdf1Ik/K2w= github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230829092744-a3dd5edba332 h1:OxhwqONfFHQjJuJjK3HKTXTSo2oQwKa97s+T+vKspkY= github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230829092744-a3dd5edba332/go.mod h1:t1xmsiZDqM3wXcLMqgHp7/iilK8ozuOkydV4Vi2Qibk= github.com/openstack-k8s-operators/ironic-operator/api v0.1.1-0.20230825083339-bc99e910c674 h1:EC1JeDLqeVhYqpbhaMI3Upca20YTcQycjt3cK8xOgo4= github.com/openstack-k8s-operators/ironic-operator/api v0.1.1-0.20230825083339-bc99e910c674/go.mod h1:3h2WeBFiW2dIyz5+FxoMQfX+82XOKOR/a/ddWrakZXg= -github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230823144632-e4b8db8a76bc h1:78MQTRkSM5lMqdYmvjzQZGUlD6BHwYb5PSpm9m3Z310= -github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230823144632-e4b8db8a76bc/go.mod h1:LNJJdteQG4E2fhWDerE+f8S2/ephEJg8yBkH1eqYYOo= -github.com/openstack-k8s-operators/lib-common/modules/common v0.1.1-0.20230824094610-976b18ca2875 h1:pj22n6PQy/XAmV5m6XaarMY6X1lvxAh16oVT5ZSVoNI= -github.com/openstack-k8s-operators/lib-common/modules/common v0.1.1-0.20230824094610-976b18ca2875/go.mod h1:Mqg9hyHpWPda62750vqmk5TajxP3zbYPDP1rtSH7mg0= -github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.0 h1:mMeJvCQfZmakssvMyHjzp/ngxKysETDj9GJYhRwydzg= -github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.0/go.mod h1:+paEFOL5IlJzhg9fy7/1+HSErVkWUgUj1ORLFwgvxnI= +github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.1-0.20230824094610-976b18ca2875 h1:aUlwELsLYWQ3FL+/nRG/1uGVNW86c3MhtLrHNVDd57k= +github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.1-0.20230824094610-976b18ca2875/go.mod h1:Vng+vqdTJUuZ+AEzSAaU0I7bn3qwYMMFEUHHhiH0440= github.com/openstack-k8s-operators/lib-common/modules/storage v0.1.1-0.20230824094610-976b18ca2875 h1:lC8Nw4PF2Lcqc7BJAdlBvYPyLqyaKa9R1e15dM9b3BY= github.com/openstack-k8s-operators/lib-common/modules/storage v0.1.1-0.20230824094610-976b18ca2875/go.mod h1:lazDTPD8BYde2yyzZ3HbOfG51Sf87vSr4KXwpF57hDs= -github.com/openstack-k8s-operators/manila-operator/api v0.1.1-0.20230817135608-41dee07f5847 h1:YzdSGsLdyyWpzC3wL6Eaw+N6OaB12x93eWEaiJQXS7s= -github.com/openstack-k8s-operators/manila-operator/api v0.1.1-0.20230817135608-41dee07f5847/go.mod h1:gNH4zYG6NGUE6LsD81naotD9oH7CNSKqBW/51hE/Qm8= github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230823144333-b9363c5be8d2 h1:vYb2ET44wVnZKsLjDxTZpQzqGyhINJKe0nkkOYS08DU= github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230823144333-b9363c5be8d2/go.mod h1:m5XuZSa5Zt5uAw3WbJYOIkFAGXy01mybVekcKOq1qHI= -github.com/openstack-k8s-operators/neutron-operator/api v0.1.1-0.20230824160722-048e30e1d426 h1:yZ+0Vx9+bFSzaD9PgSrFyOUNfcpeQLRGHyXTbiXVNhw= -github.com/openstack-k8s-operators/neutron-operator/api v0.1.1-0.20230824160722-048e30e1d426/go.mod h1:36bJXyJll5kJt8HYOzY+dfXIhQTXciWm0gTstSX0wUo= -github.com/openstack-k8s-operators/nova-operator/api v0.1.2-0.20230828132407-f07662231bdb h1:ViSJh3PzIAWD9B8uwj7uNXU47Knx8feuQ1N3Sv5omQ8= -github.com/openstack-k8s-operators/nova-operator/api v0.1.2-0.20230828132407-f07662231bdb/go.mod h1:CEy8QMQjsSnosfTSkNNyrUb0FWfB5+139VjVp8eRF80= github.com/openstack-k8s-operators/octavia-operator/api v0.0.0-20230825164400-086bc6962fa6 h1:BkrKsbSkkqew5H2cBX2uRwjyu/DoRahfDzt1bhThc9I= github.com/openstack-k8s-operators/octavia-operator/api v0.0.0-20230825164400-086bc6962fa6/go.mod h1:8k2LWIFkjPGWaiZRJhMThieyJJZciRUZz17oBcgFWtk= github.com/openstack-k8s-operators/openstack-ansibleee-operator/api v0.1.1-0.20230825160730-622c804fd1c2 h1:0/zQoIM+ph2AnrALV3OKccTu9n91hLbXMsB5guYDbik= @@ -171,10 +153,6 @@ github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.1.1-0.202 github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.1.1-0.20230823035821-d980f270d836/go.mod h1:H8r8C3OLaWMze/io3LP8otMz07vmjBZKV4Fk4U9JH9s= github.com/openstack-k8s-operators/ovn-operator/api v0.1.1-0.20230825114232-c3f91544c28f h1:dCocvrutADtQGs2k8/EHpcODEdzRu+AZ61aFZVOyo/A= github.com/openstack-k8s-operators/ovn-operator/api v0.1.1-0.20230825114232-c3f91544c28f/go.mod h1:SBsCNWj0Wedzvudeeaii3Ch3JQ4kVwbUt6hXVhSc7Do= -github.com/openstack-k8s-operators/placement-operator/api v0.1.1-0.20230828152242-813edf2a8bfd h1:lXpx5IWeORLJ5oXOMFcQynhVhCcCB8uT+/PcLUuDeL0= -github.com/openstack-k8s-operators/placement-operator/api v0.1.1-0.20230828152242-813edf2a8bfd/go.mod h1:gsI+bvX70Y7NXZtAL36V18qufVO0xYW6Z2rbEKL5Nqo= -github.com/openstack-k8s-operators/swift-operator/api v0.1.1-0.20230824202713-d98dfa78a348 h1:TIK339twRJgA1w0Rx5JeVWWd71KH54Yn9diOprR//9g= -github.com/openstack-k8s-operators/swift-operator/api v0.1.1-0.20230824202713-d98dfa78a348/go.mod h1:HrDnaSOYvnqZITCiUI5r+6W2q+m4zify9X8d+P0Q9RE= github.com/openstack-k8s-operators/telemetry-operator/api v0.1.1-0.20230824075008-ac5d892e6e75 h1:nRFZGaz8tPG+19iYlND6CNgasorCB1rQkGHLuJs8vPs= github.com/openstack-k8s-operators/telemetry-operator/api v0.1.1-0.20230824075008-ac5d892e6e75/go.mod h1:rRn2PvBo/B9Ct7Zqz1PeOIiIdKaVJIBVF7irQJsYecw= github.com/operator-framework/api v0.17.3 h1:wddE1SLKTNiIzwt28DbBIO+vPG2GOV6dkB9xBkDfT3o= @@ -214,6 +192,28 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stuggi/cinder-operator/api v0.0.0-20230907075756-6fe6fbd8efb3 h1:5b25gNTbph/hNSqS7+eMw9pHiadA3qUAwehP9YbMs1M= +github.com/stuggi/cinder-operator/api v0.0.0-20230907075756-6fe6fbd8efb3/go.mod h1:RGJVo58IzrLeEa1e2kAWiVT/p0PJFoDEj8Nuq7/mvGE= +github.com/stuggi/glance-operator/api v0.0.0-20230907074755-6f3da2dbf3f7 h1:bXRlD6n4PxnaMNcRjRiZK7RYixnDUKEHagl3V9z1Rm4= +github.com/stuggi/glance-operator/api v0.0.0-20230907074755-6f3da2dbf3f7/go.mod h1:pV1GRmdtWrLK2X235bCk8csrZPIpn6YOVRBNtZHPMBM= +github.com/stuggi/heat-operator/api v0.0.0-20230907081627-c8d89e9ee0e4 h1:dxR0SmsfIj888Nt9r5H3zLYULpxN9VVeZ9HkpvXVi/c= +github.com/stuggi/heat-operator/api v0.0.0-20230907081627-c8d89e9ee0e4/go.mod h1:fnMLAHa9ul7ry/8Lud3NJ4YYKp1OPmRism8TP/ryTJM= +github.com/stuggi/horizon-operator/api v0.0.0-20230907082041-fce6d41bb7e7 h1:6YqW/SimfFZ+HQ9s50FrbOLpeFleIFy7BZHf4CAf3Zs= +github.com/stuggi/horizon-operator/api v0.0.0-20230907082041-fce6d41bb7e7/go.mod h1:Usjf48uBzShtnTbgLGZRTk1wIQpDP7fTtuQG86OxEcQ= +github.com/stuggi/keystone-operator/api v0.0.0-20230907073946-d4e322f577a3 h1:jgtM1aAMrjv2I5oLjxlBFqTcc2FvIb3i1rA9RBz87GM= +github.com/stuggi/keystone-operator/api v0.0.0-20230907073946-d4e322f577a3/go.mod h1:xVGf/an6HspP2PmYvTxJG07kq4hOX/f2nRx9tMK2k7A= +github.com/stuggi/lib-common/modules/common v0.0.0-20230907071651-c816e73a2ebd h1:UdvJwGL6uHHlVb01tNooLPivtpgC7obdhXQINdgllYc= +github.com/stuggi/lib-common/modules/common v0.0.0-20230907071651-c816e73a2ebd/go.mod h1:Mqg9hyHpWPda62750vqmk5TajxP3zbYPDP1rtSH7mg0= +github.com/stuggi/manila-operator/api v0.0.0-20230907094801-a6cf634f20f6 h1:n8A6qv/HOgZrCdYOr+fy1JuEJ0NOB6nGSr7SYq51e4Y= +github.com/stuggi/manila-operator/api v0.0.0-20230907094801-a6cf634f20f6/go.mod h1:5HEHzp0nkk+1mprYDije9dWJKGUT4Zka4JWx5ogvWqo= +github.com/stuggi/neutron-operator/api v0.0.0-20230907080310-fd4ed88bd3b0 h1:T7ihoINXh4aAv8k2XZfrcFsy/LbMqdTjzmTpmZOZKoE= +github.com/stuggi/neutron-operator/api v0.0.0-20230907080310-fd4ed88bd3b0/go.mod h1:vobRlJbNkn3KyKBJ6FAPknTHPpNVgjxxWJa1ToseXwo= +github.com/stuggi/nova-operator/api v0.0.0-20230907081449-1e1716beaa6b h1:EktAODWooVAmglZJYwdsATJk9lT2ElRFamohDSibmNA= +github.com/stuggi/nova-operator/api v0.0.0-20230907081449-1e1716beaa6b/go.mod h1:ZFgocIdylVSzJF02Fpvph9s1r4rFHdM1dr93glL9JpA= +github.com/stuggi/placement-operator/api v0.0.0-20230907075121-486b243c7540 h1:lYVtBR2DfQyqLW0hGMEebyq9RovHt1SPxBG1PPLW8Xc= +github.com/stuggi/placement-operator/api v0.0.0-20230907075121-486b243c7540/go.mod h1:cbc6SwemjH0TxQuz+FUB8LkFrNB184uH6SCs1sqmz/k= +github.com/stuggi/swift-operator/api v0.0.0-20230907082551-0514a4d0c787 h1:t+Kmm9WP3LBpOmbPRau/uBxvJlCV41WNbBW6dGm7H8c= +github.com/stuggi/swift-operator/api v0.0.0-20230907082551-0514a4d0c787/go.mod h1:/eHw7UibA93goMEmf79mqhZSZW/wXBu1v2i/Ndzt1qM= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= diff --git a/main.go b/main.go index 67742cebc..72789afd6 100644 --- a/main.go +++ b/main.go @@ -61,6 +61,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/healthz" "sigs.k8s.io/controller-runtime/pkg/log/zap" + routev1 "github.com/openshift/api/route/v1" clientv1 "github.com/openstack-k8s-operators/openstack-operator/apis/client/v1beta1" corev1 "github.com/openstack-k8s-operators/openstack-operator/apis/core/v1beta1" clientcontrollers "github.com/openstack-k8s-operators/openstack-operator/controllers/client" @@ -99,6 +100,7 @@ func init() { utilruntime.Must(telemetryv1.AddToScheme(scheme)) utilruntime.Must(swiftv1.AddToScheme(scheme)) utilruntime.Must(clientv1.AddToScheme(scheme)) + utilruntime.Must(routev1.AddToScheme(scheme)) //+kubebuilder:scaffold:scheme } diff --git a/pkg/openstack/common.go b/pkg/openstack/common.go index 760a87c0a..684cc792c 100644 --- a/pkg/openstack/common.go +++ b/pkg/openstack/common.go @@ -2,9 +2,23 @@ package openstack import ( "context" + "fmt" + "time" + routev1 "github.com/openshift/api/route/v1" + "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/route" + "github.com/openstack-k8s-operators/lib-common/modules/common/service" + "github.com/openstack-k8s-operators/lib-common/modules/common/util" + corev1 "github.com/openstack-k8s-operators/openstack-operator/apis/core/v1beta1" + k8s_corev1 "k8s.io/api/core/v1" k8s_errors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/utils/pointer" + "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -27,3 +41,264 @@ func EnsureDeleted(ctx context.Context, helper *helper.Helper, obj client.Object return ctrl.Result{}, nil } + +// AddServiceComponentLabel - adds component label to the service override to be able to query +// the service labels to check for any route creation +func AddServiceComponentLabel(svcOverride *service.OverrideSpec, value string) service.OverrideSpec { + if svcOverride == nil { + svcOverride = &service.OverrideSpec{} + } + if svcOverride.EmbeddedLabelsAnnotations == nil { + svcOverride.EmbeddedLabelsAnnotations = &service.EmbeddedLabelsAnnotations{} + } + svcOverride.EmbeddedLabelsAnnotations.Labels = util.MergeStringMaps( + svcOverride.EmbeddedLabelsAnnotations.Labels, map[string]string{common.AppSelector: value}) + + return *svcOverride +} + +// RouteDetails - route details +type RouteDetails struct { + RouteName string + Namespace string + Endpoint string + RouteOverrideSpec *route.OverrideSpec + ServiceLabel map[string]string + ServiceSpec *k8s_corev1.Service + endpointURL string + hostname *string + route *routev1.Route +} + +// GetRoutesListWithLabel - Get all routes in namespace of the obj matching label selector +func GetRoutesListWithLabel( + ctx context.Context, + h *helper.Helper, + namespace string, + labelSelectorMap map[string]string, +) (*routev1.RouteList, error) { + routeList := &routev1.RouteList{} + listOpts := []client.ListOption{ + client.InNamespace(namespace), + client.MatchingLabels(labelSelectorMap), + } + + if err := h.GetClient().List(ctx, routeList, listOpts...); err != nil { + err = fmt.Errorf("Error listing routes for %s: %w", labelSelectorMap, err) + return nil, err + } + + return routeList, nil +} + +// EnsureRoute - +func EnsureRoute( + ctx context.Context, + instance *corev1.OpenStackControlPlane, + helper *helper.Helper, + owner metav1.Object, + svcs *k8s_corev1.ServiceList, + svcOverrides map[string]service.OverrideSpec, + overrideSpec *route.OverrideSpec, + condType condition.Type, +) (map[string]service.OverrideSpec, ctrl.Result, error) { + + cleanCondition := map[bool]string{} + + for _, svc := range svcs.Items { + rd := RouteDetails{ + RouteName: svc.Name, + Namespace: svc.Namespace, + Endpoint: svc.Annotations[service.AnnotationEndpointKey], + RouteOverrideSpec: overrideSpec, + ServiceSpec: &svc, + } + svcOverride := svcOverrides[rd.Endpoint] + + // If the service has the create ingress annotation and its a default ClusterIP service -> create route + if svc.ObjectMeta.Annotations[service.AnnotationIngressCreateKey] == "true" && svc.Spec.Type == k8s_corev1.ServiceTypeClusterIP { + + if instance.Status.Conditions.Get(condType) == nil { + instance.Status.Conditions.Set(condition.UnknownCondition( + condType, + condition.InitReason, + corev1.OpenStackControlPlaneExposeServiceReadyInitMessage, + owner.GetName(), + svc.Name, + )) + } + + if routeName, ok := svc.ObjectMeta.Annotations[service.AnnotationIngressNameKey]; ok { + rd.RouteName = routeName + } + if labelVal, ok := svcOverride.EmbeddedLabelsAnnotations.Labels[common.AppSelector]; ok { + rd.ServiceLabel = map[string]string{common.AppSelector: labelVal} + } + + // check if there is already a route with common.AppSelector from the service + if svcLabelVal, ok := svc.Labels[common.AppSelector]; ok { + routes, err := GetRoutesListWithLabel( + ctx, + helper, + instance.Namespace, + map[string]string{common.AppSelector: svcLabelVal}, + ) + if err != nil { + return svcOverrides, ctrl.Result{}, err + } + + // check the routes if name changed where we are the owner + for _, r := range routes.Items { + instanceRef := metav1.OwnerReference{ + APIVersion: instance.APIVersion, + Kind: instance.Kind, + Name: instance.GetName(), + UID: instance.GetUID(), + BlockOwnerDeletion: pointer.Bool(true), + Controller: pointer.Bool(true), + } + + owner := metav1.GetControllerOf(&r.ObjectMeta) + + if r.Name != rd.RouteName && owner != nil && referSameObject(*owner, instanceRef) { + // Delete any other owner refs from ref list to not block deletion until owners are gone + r.SetOwnerReferences([]metav1.OwnerReference{instanceRef}) + + // Delete route + err := helper.GetClient().Delete(ctx, &r) + if err != nil && !k8s_errors.IsNotFound(err) { + err = fmt.Errorf("Error deleting service %s: %w", r.Name, err) + return svcOverrides, ctrl.Result{}, err + } + } + } + } + + ctrlResult, err := rd.CreateRoute(ctx, helper, owner) + if err != nil { + instance.Status.Conditions.Set(condition.FalseCondition( + condType, + condition.ErrorReason, + condition.SeverityWarning, + corev1.OpenStackControlPlaneExposeServiceReadyErrorMessage, + owner.GetName(), + rd.RouteName, + err.Error())) + + return svcOverrides, ctrlResult, err + } else if (ctrlResult != ctrl.Result{}) { + return svcOverrides, ctrlResult, nil + } + + cleanCondition[true] = rd.Endpoint + + // update override for the service with the route endpoint url + if rd.endpointURL != "" { + // Any trailing path will be added on the service-operator level. + svcOverride.EndpointURL = &rd.endpointURL + instance.Status.Conditions.MarkTrue(condType, corev1.OpenStackControlPlaneExposeServiceReadyMessage, owner.GetName()) + } + } + + // make sure the route is deleted and endpointURL cleaned + if svc.ObjectMeta.Annotations[service.AnnotationIngressCreateKey] == "false" { + err := rd.DeleteRoute(ctx, helper) + if err != nil { + return svcOverrides, ctrl.Result{}, err + } + + //svcOverride.EndpointURL = nil + //helper.GetLogger().Info(fmt.Sprintf("Service %s override endpointURL removed", svc.Name)) + } + svcOverrides[rd.Endpoint] = svcOverride + } + + if _, ok := cleanCondition[true]; !ok { + instance.Status.Conditions.Remove(condType) + } + + return svcOverrides, ctrl.Result{}, nil +} + +// CreateRoute - +func (rd *RouteDetails) CreateRoute( + ctx context.Context, + helper *helper.Helper, + owner metav1.Object, +) (ctrl.Result, error) { + // TODO TLS + route, err := route.NewRoute( + route.GenericRoute(&route.GenericRouteDetails{ + Name: rd.RouteName, + Namespace: rd.Namespace, + Labels: rd.ServiceLabel, + ServiceName: rd.ServiceSpec.Name, + TargetPortName: rd.ServiceSpec.Name, + }), + time.Duration(5)*time.Second, + rd.RouteOverrideSpec, + ) + if err != nil { + return ctrl.Result{}, err + } + route.OwnerReferences = append(route.OwnerReferences, owner) + + ctrlResult, err := route.CreateOrPatch(ctx, helper) + if err != nil { + return ctrlResult, err + } else if (ctrlResult != ctrl.Result{}) { + return ctrlResult, nil + } + + rd.hostname = ptr.To(route.GetHostname()) + rd.endpointURL = "http://" + *rd.hostname + rd.route = route.GetRoute() + + return ctrl.Result{}, nil +} + +// DeleteRoute - +func (rd *RouteDetails) DeleteRoute( + ctx context.Context, + helper *helper.Helper, +) error { + + route, err := route.NewRoute( + route.GenericRoute(&route.GenericRouteDetails{ + Name: rd.RouteName, + Namespace: rd.Namespace, + Labels: map[string]string{ + common.AppSelector: rd.RouteName, + }, + ServiceName: rd.ServiceSpec.Name, + TargetPortName: rd.ServiceSpec.Name, + }), + time.Duration(5)*time.Second, + nil, + ) + if err != nil { + return err + } + + err = route.Delete(ctx, helper) + if err != nil { + return err + } + + return nil +} + +// Returns true if a and b point to the same object. +func referSameObject(a, b metav1.OwnerReference) bool { + aGV, err := schema.ParseGroupVersion(a.APIVersion) + if err != nil { + return false + } + + bGV, err := schema.ParseGroupVersion(b.APIVersion) + if err != nil { + return false + } + + return aGV.Group == bGV.Group && a.Kind == b.Kind && a.Name == b.Name +} diff --git a/pkg/openstack/keystone.go b/pkg/openstack/keystone.go index b84846c9b..1b4078aa2 100644 --- a/pkg/openstack/keystone.go +++ b/pkg/openstack/keystone.go @@ -4,14 +4,20 @@ 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" keystonev1 "github.com/openstack-k8s-operators/keystone-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" + "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" ) @@ -29,12 +35,61 @@ func ReconcileKeystoneAPI(ctx context.Context, instance *corev1beta1.OpenStackCo return res, err } instance.Status.Conditions.Remove(corev1beta1.OpenStackControlPlaneKeystoneAPIReadyCondition) + instance.Status.Conditions.Remove(corev1beta1.OpenStackControlPlaneExposeKeystoneAPIReadyCondition) return ctrl.Result{}, nil } + // add selector to service overrides + for _, endpointType := range []service.Endpoint{service.EndpointPublic, service.EndpointInternal} { + if instance.Spec.Keystone.Template.Override.Service == nil { + instance.Spec.Keystone.Template.Override.Service = map[string]service.OverrideSpec{} + } + instance.Spec.Keystone.Template.Override.Service[string(endpointType)] = + AddServiceComponentLabel( + ptr.To(instance.Spec.Keystone.Template.Override.Service[string(endpointType)]), + keystoneAPI.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: "keystone", Namespace: instance.Namespace}, keystoneAPI); err != nil { + if !k8s_errors.IsNotFound(err) { + return ctrl.Result{}, err + } + } + + if keystoneAPI.Status.Conditions.IsTrue(condition.ExposeServiceReadyCondition) { + svcs, err := service.GetServicesListWithLabel( + ctx, + helper, + instance.Namespace, + map[string]string{common.AppSelector: keystoneAPI.Name}, + ) + if err != nil { + return ctrl.Result{}, err + } + + var ctrlResult reconcile.Result + instance.Spec.Keystone.Template.Override.Service, ctrlResult, err = EnsureRoute( + ctx, + instance, + helper, + keystoneAPI, + svcs, + instance.Spec.Keystone.Template.Override.Service, + instance.Spec.Keystone.APIOverride.Route, + corev1beta1.OpenStackControlPlaneExposeKeystoneAPIReadyCondition, + ) + if err != nil { + return ctrlResult, err + } else if (ctrlResult != ctrl.Result{}) { + return ctrlResult, nil + } + } + helper.GetLogger().Info("Reconciling KeystoneAPI", "KeystoneAPI.Namespace", instance.Namespace, "KeystoneAPI.Name", "keystone") op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), keystoneAPI, func() error { instance.Spec.Keystone.Template.DeepCopyInto(&keystoneAPI.Spec) + if keystoneAPI.Spec.Secret == "" { keystoneAPI.Spec.Secret = instance.Spec.Secret } @@ -76,5 +131,4 @@ func ReconcileKeystoneAPI(ctx context.Context, instance *corev1beta1.OpenStackCo } return ctrl.Result{}, nil - }