From 2b7a145301bb0a4c13975c531ab181aa7c4ed1bf Mon Sep 17 00:00:00 2001 From: Amit Uniyal Date: Wed, 25 Mar 2026 11:55:27 +0530 Subject: [PATCH] Remove copy of api/v1beta1 Remove the redundant api/v1beta1/ directory that was maintained for backward compability during transition period, the new location is now api/nova/v1beta1/. Also restore Makefile controller-gen targets to use paths="./..." --- Makefile | 5 +- api/v1beta1/common_types.go | 238 ---- api/v1beta1/common_webhook.go | 186 --- api/v1beta1/conditions.go | 205 --- api/v1beta1/groupversion_info.go | 36 - api/v1beta1/nova_types.go | 243 ---- api/v1beta1/nova_webhook.go | 459 ------- api/v1beta1/novaapi_types.go | 260 ---- api/v1beta1/novaapi_webhook.go | 164 --- api/v1beta1/novacell_types.go | 323 ----- api/v1beta1/novacell_webhook.go | 249 ---- api/v1beta1/novacompute_types.go | 261 ---- api/v1beta1/novacompute_webhook.go | 226 --- api/v1beta1/novaconductor_types.go | 285 ---- api/v1beta1/novaconductor_webhook.go | 140 -- api/v1beta1/novametadata_types.go | 321 ----- api/v1beta1/novametadata_webhook.go | 172 --- api/v1beta1/novanovncproxy_types.go | 292 ---- api/v1beta1/novanovncproxy_webhook.go | 150 -- api/v1beta1/novascheduler_types.go | 234 ---- api/v1beta1/novascheduler_webhook.go | 134 -- api/v1beta1/zz_generated.deepcopy.go | 1817 ------------------------- 22 files changed, 2 insertions(+), 6398 deletions(-) delete mode 100644 api/v1beta1/common_types.go delete mode 100644 api/v1beta1/common_webhook.go delete mode 100644 api/v1beta1/conditions.go delete mode 100644 api/v1beta1/groupversion_info.go delete mode 100644 api/v1beta1/nova_types.go delete mode 100644 api/v1beta1/nova_webhook.go delete mode 100644 api/v1beta1/novaapi_types.go delete mode 100644 api/v1beta1/novaapi_webhook.go delete mode 100644 api/v1beta1/novacell_types.go delete mode 100644 api/v1beta1/novacell_webhook.go delete mode 100644 api/v1beta1/novacompute_types.go delete mode 100644 api/v1beta1/novacompute_webhook.go delete mode 100644 api/v1beta1/novaconductor_types.go delete mode 100644 api/v1beta1/novaconductor_webhook.go delete mode 100644 api/v1beta1/novametadata_types.go delete mode 100644 api/v1beta1/novametadata_webhook.go delete mode 100644 api/v1beta1/novanovncproxy_types.go delete mode 100644 api/v1beta1/novanovncproxy_webhook.go delete mode 100644 api/v1beta1/novascheduler_types.go delete mode 100644 api/v1beta1/novascheduler_webhook.go delete mode 100644 api/v1beta1/zz_generated.deepcopy.go diff --git a/Makefile b/Makefile index 27888f1fa..f8100d0cb 100644 --- a/Makefile +++ b/Makefile @@ -114,13 +114,12 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform .PHONY: manifests manifests: gowork controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. - $(CONTROLLER_GEN) crd webhook paths="./api/nova/..." output:crd:artifacts:config=config/crd/bases && \ - $(CONTROLLER_GEN) rbac:roleName=manager-role paths="./..." output:dir=config/rbac && \ + $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases && \ rm -f api/bases/* && cp -a config/crd/bases api/ .PHONY: generate generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. - $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./api/nova/..." + $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." .PHONY: fmt fmt: ## Run go fmt against code. diff --git a/api/v1beta1/common_types.go b/api/v1beta1/common_types.go deleted file mode 100644 index a41792196..000000000 --- a/api/v1beta1/common_types.go +++ /dev/null @@ -1,238 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - corev1 "k8s.io/api/core/v1" - - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" - "github.com/openstack-k8s-operators/lib-common/modules/common/util" -) - -// Container image fall-back defaults -const ( - NovaAPIContainerImage = "quay.io/podified-antelope-centos9/openstack-nova-api:current-podified" - NovaConductorContainerImage = "quay.io/podified-antelope-centos9/openstack-nova-conductor:current-podified" - NovaMetadataContainerImage = "quay.io/podified-antelope-centos9/openstack-nova-api:current-podified" - NovaNoVNCContainerImage = "quay.io/podified-antelope-centos9/openstack-nova-novncproxy:current-podified" - NovaSchedulerContainerImage = "quay.io/podified-antelope-centos9/openstack-nova-scheduler:current-podified" - NovaComputeContainerImage = "quay.io/podified-antelope-centos9/openstack-nova-compute:current-podified" -) - -// Compute drivers names -const ( - IronicDriver = "ironic.IronicDriver" -) - -const ( - // ComputeDiscoverHashKey is the key to hash of compute discovery job based on compute templates for cell - ComputeDiscoverHashKey = "nova-compute-discovery" -) - -// NovaServiceBase contains the fields that are needed for each nova service CRD -type NovaServiceBase struct { - // +kubebuilder:validation:Optional - // The service specific Container Image URL (will be set to environmental default if empty) - ContainerImage string `json:"containerImage"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=1 - // +kubebuilder:validation:Maximum=32 - // +kubebuilder:validation:Minimum=0 - // Replicas of the service to run - Replicas *int32 `json:"replicas"` - - // +kubebuilder:validation:Optional - // NodeSelector to target subset of worker nodes running this service - NodeSelector *map[string]string `json:"nodeSelector,omitempty"` - - // +kubebuilder:validation:Optional - // CustomServiceConfig - customize the service config using this parameter to change service defaults, - // or overwrite rendered information using raw OpenStack config format. The content gets added to - // to /etc//.conf.d directory as custom.conf file. - CustomServiceConfig string `json:"customServiceConfig"` - - // +kubebuilder:validation:Optional - // Resources - Compute Resources required by this service (Limits/Requests). - // https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - Resources corev1.ResourceRequirements `json:"resources,omitempty"` - - // +kubebuilder:validation:Optional - // NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network - NetworkAttachments []string `json:"networkAttachments,omitempty"` - - // +kubebuilder:validation:Optional - // TopologyRef to apply the Topology defined by the associated CR referenced - // by name - TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"` -} - -// PasswordSelector to identify the DB and AdminUser password from the Secret -type PasswordSelector struct { - // +kubebuilder:validation:Optional - // +kubebuilder:default="NovaPassword" - // Service - Selector to get the keystone service user password from the - // Secret - Service string `json:"service"` - // +kubebuilder:validation:Optional - // +kubebuilder:default="MetadataSecret" - // MetadataSecret - the name of the field to get the metadata secret from the - // Secret - MetadataSecret string `json:"metadataSecret"` - // +kubebuilder:validation:Optional - // +kubebuilder:default="MetadataCellsSecret" - // prefixMetadataCellsSecret - the prefix name of the field to get the metadata secret from the - // Secret for cells. Vale of metadata_proxy_shared_secret - // information for the nova-metadata service. This secret is shared - // between nova and neutron ovn-metadata inside selected cell - // and if this is not defined the global metadata_proxy_shared_secret - // secret will be used - PrefixMetadataCellsSecret string `json:"prefixMetadataCellsSecret"` -} - -// AuthSpec defines authentication parameters for Nova services -type AuthSpec struct { - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // ApplicationCredentialSecret - the name of the k8s Secret that contains the - // application credential data used for authentication - ApplicationCredentialSecret string `json:"applicationCredentialSecret,omitempty"` -} - -// NovaImages defines container images used by top level Nova CR -type NovaImages struct { - // +kubebuilder:validation:Required - // APIContainerImageURL - APIContainerImageURL string `json:"apiContainerImageURL"` - - // +kubebuilder:validation:Required - // SchedulerContainerImageURL - SchedulerContainerImageURL string `json:"schedulerContainerImageURL"` - - NovaCellImages `json:",inline"` -} - -// Default sets default image URLs for NovaImages -func (r *NovaImages) Default(defaults NovaDefaults) { - r.NovaCellImages.Default(defaults.NovaCellDefaults) - if r.APIContainerImageURL == "" { - r.APIContainerImageURL = defaults.APIContainerImageURL - } - if r.SchedulerContainerImageURL == "" { - r.SchedulerContainerImageURL = defaults.SchedulerContainerImageURL - } -} - -// NovaCellImages defines container images used by NovaCell services -type NovaCellImages struct { - - // +kubebuilder:validation:Required - // ConductorContainerImageURL - ConductorContainerImageURL string `json:"conductorContainerImageURL"` - - // +kubebuilder:validation:Required - // MetadataContainerImageURL - MetadataContainerImageURL string `json:"metadataContainerImageURL"` - - // +kubebuilder:validation:Required - // NoVNCContainerImageURL - NoVNCContainerImageURL string `json:"novncproxyContainerImageURL"` - - // +kubebuilder:validation:Required - // NovaComputeContainerImageURL - NovaComputeContainerImageURL string `json:"computeContainerImageURL"` -} - -// Default sets default image URLs for NovaCellImages -func (r *NovaCellImages) Default(defaults NovaCellDefaults) { - if r.ConductorContainerImageURL == "" { - r.ConductorContainerImageURL = defaults.ConductorContainerImageURL - } - if r.MetadataContainerImageURL == "" { - r.MetadataContainerImageURL = defaults.MetadataContainerImageURL - } - if r.NoVNCContainerImageURL == "" { - r.NoVNCContainerImageURL = defaults.NoVNCContainerImageURL - } - if r.NovaComputeContainerImageURL == "" { - r.NovaComputeContainerImageURL = defaults.NovaComputeContainerImageURL - } -} - -// SetupDefaults - initializes any CRD field defaults based on environment variables (the defaulting mechanism itself is implemented via webhooks) -func SetupDefaults() { - // Acquire environmental defaults and initialize NovaCell defaults with them - novaCellDefaults := NovaCellDefaults{ - ConductorContainerImageURL: util.GetEnvVar("RELATED_IMAGE_NOVA_CONDUCTOR_IMAGE_URL_DEFAULT", NovaConductorContainerImage), - MetadataContainerImageURL: util.GetEnvVar("RELATED_IMAGE_NOVA_API_IMAGE_URL_DEFAULT", NovaMetadataContainerImage), - NoVNCContainerImageURL: util.GetEnvVar("RELATED_IMAGE_NOVA_NOVNC_IMAGE_URL_DEFAULT", NovaNoVNCContainerImage), - NovaComputeContainerImageURL: util.GetEnvVar("RELATED_IMAGE_NOVA_COMPUTE_IMAGE_URL_DEFAULT", NovaComputeContainerImage), - } - - SetupNovaCellDefaults(novaCellDefaults) - - // Acquire environmental defaults and initialize Nova defaults with them - novaDefaults := NovaDefaults{ - APIContainerImageURL: util.GetEnvVar("RELATED_IMAGE_NOVA_API_IMAGE_URL_DEFAULT", NovaAPIContainerImage), - SchedulerContainerImageURL: util.GetEnvVar("RELATED_IMAGE_NOVA_SCHEDULER_IMAGE_URL_DEFAULT", NovaSchedulerContainerImage), - NovaCellDefaults: novaCellDefaults, - APITimeout: 60, - } - - SetupNovaDefaults(novaDefaults) - - // Acquire environmental defaults and initialize NovaAPI defaults with them - novaAPIDefaults := NovaAPIDefaults{ - ContainerImageURL: util.GetEnvVar("RELATED_IMAGE_NOVA_API_IMAGE_URL_DEFAULT", NovaAPIContainerImage), - } - - SetupNovaAPIDefaults(novaAPIDefaults) - - // Acquire environmental defaults and initialize NovaConductor defaults with them - novaConductorDefaults := NovaConductorDefaults{ - ContainerImageURL: util.GetEnvVar("RELATED_IMAGE_NOVA_CONDUCTOR_IMAGE_URL_DEFAULT", NovaConductorContainerImage), - } - - SetupNovaConductorDefaults(novaConductorDefaults) - - // Acquire environmental defaults and initialize NovaMetadata defaults with them - novaMetadataDefaults := NovaMetadataDefaults{ - ContainerImageURL: util.GetEnvVar("RELATED_IMAGE_NOVA_API_IMAGE_URL_DEFAULT", NovaMetadataContainerImage), - } - - SetupNovaMetadataDefaults(novaMetadataDefaults) - - // Acquire environmental defaults and initialize NovaNoVNCProxy defaults with them - novaNoVNCProxyDefaults := NovaNoVNCProxyDefaults{ - ContainerImageURL: util.GetEnvVar("RELATED_IMAGE_NOVA_NOVNC_IMAGE_URL_DEFAULT", NovaNoVNCContainerImage), - } - - SetupNovaNoVNCProxyDefaults(novaNoVNCProxyDefaults) - - // Acquire environmental defaults and initialize NovaScheduler defaults with them - novaSchedulerDefaults := NovaSchedulerDefaults{ - ContainerImageURL: util.GetEnvVar("RELATED_IMAGE_NOVA_SCHEDULER_IMAGE_URL_DEFAULT", NovaSchedulerContainerImage), - } - SetupNovaSchedulerDefaults(novaSchedulerDefaults) - - // Acquire environmental defaults and initialize NovaCompute defaults with them - novaComputeDefaults := NovaComputeDefaults{ - ContainerImageURL: util.GetEnvVar("RELATED_IMAGE_NOVA_COMPUTE_IMAGE_URL_DEFAULT", NovaComputeContainerImage), - } - - SetupNovaComputeDefaults(novaComputeDefaults) -} diff --git a/api/v1beta1/common_webhook.go b/api/v1beta1/common_webhook.go deleted file mode 100644 index 7bbc52681..000000000 --- a/api/v1beta1/common_webhook.go +++ /dev/null @@ -1,186 +0,0 @@ -/* -Copyright 2024. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - "fmt" - "path/filepath" - "strings" - - common_webhook "github.com/openstack-k8s-operators/lib-common/modules/common/webhook" - "k8s.io/apimachinery/pkg/util/validation/field" -) - -// ValidateDefaultConfigOverwrite checks if the file names in the overwrite map -// are allowed and return an error for each unsupported files. The allowedKeys -// list supports direct string match and globs like provider*.yaml -func ValidateDefaultConfigOverwrite( - basePath *field.Path, - defaultConfigOverwrite map[string]string, - allowedKeys []string, -) field.ErrorList { - var errors field.ErrorList - for requested := range defaultConfigOverwrite { - if !matchAny(requested, allowedKeys) { - errors = append( - errors, - field.Invalid( - basePath, - requested, - fmt.Sprintf( - "Only the following keys are valid: %s", - strings.Join(allowedKeys, ", ")), - ), - ) - } - } - return errors -} - -func matchAny(requested string, allowed []string) bool { - for _, a := range allowed { - if matched, _ := filepath.Match(a, requested); matched { - return true - } - } - return false -} - -// getDeprecatedFields returns the centralized list of deprecated fields for NovaSpecCore -func (spec *NovaSpecCore) getDeprecatedFields(old *NovaSpecCore) []common_webhook.DeprecatedFieldUpdate { - // Get new field value (handle nil NotificationsBus) - var newNotifBusCluster *string - if spec.NotificationsBus != nil { - newNotifBusCluster = &spec.NotificationsBus.Cluster - } - - deprecatedFields := []common_webhook.DeprecatedFieldUpdate{ - { - DeprecatedFieldName: "apiMessageBusInstance", - NewFieldPath: []string{"messagingBus", "cluster"}, - NewDeprecatedValue: &spec.APIMessageBusInstance, - NewValue: &spec.MessagingBus.Cluster, - }, - { - DeprecatedFieldName: "notificationsBusInstance", - NewFieldPath: []string{"notificationsBus", "cluster"}, - NewDeprecatedValue: spec.NotificationsBusInstance, - NewValue: newNotifBusCluster, - }, - } - - // If old spec is provided (UPDATE operation), add old values - if old != nil { - deprecatedFields[0].OldDeprecatedValue = &old.APIMessageBusInstance - deprecatedFields[1].OldDeprecatedValue = old.NotificationsBusInstance - } - - return deprecatedFields -} - -// validateDeprecatedFieldsCreate validates deprecated fields during CREATE operations -func (spec *NovaSpecCore) validateDeprecatedFieldsCreate(basePath *field.Path) ([]string, field.ErrorList) { - // Get deprecated fields list (without old values for CREATE) - deprecatedFieldsUpdate := spec.getDeprecatedFields(nil) - - // Convert to DeprecatedField list for CREATE validation - deprecatedFields := make([]common_webhook.DeprecatedField, len(deprecatedFieldsUpdate)) - for i, df := range deprecatedFieldsUpdate { - deprecatedFields[i] = common_webhook.DeprecatedField{ - DeprecatedFieldName: df.DeprecatedFieldName, - NewFieldPath: df.NewFieldPath, - DeprecatedValue: df.NewDeprecatedValue, - NewValue: df.NewValue, - } - } - - // Validate top-level NovaSpecCore fields - warnings := common_webhook.ValidateDeprecatedFieldsCreate(deprecatedFields, basePath) - - // Validate deprecated fields in cell templates - for cellName, cellTemplate := range spec.CellTemplates { - cellPath := basePath.Child("cellTemplates").Key(cellName) - cellWarnings := cellTemplate.validateDeprecatedFieldsCreate(cellPath) - warnings = append(warnings, cellWarnings...) - } - - return warnings, nil -} - -// validateDeprecatedFieldsUpdate validates deprecated fields during UPDATE operations -func (spec *NovaSpecCore) validateDeprecatedFieldsUpdate(old NovaSpecCore, basePath *field.Path) ([]string, field.ErrorList) { - // Get deprecated fields list with old values - deprecatedFields := spec.getDeprecatedFields(&old) - warnings, errors := common_webhook.ValidateDeprecatedFieldsUpdate(deprecatedFields, basePath) - - // Validate deprecated fields in cell templates - for cellName, cellTemplate := range spec.CellTemplates { - if oldCell, exists := old.CellTemplates[cellName]; exists { - cellPath := basePath.Child("cellTemplates").Key(cellName) - cellWarnings, cellErrors := cellTemplate.validateDeprecatedFieldsUpdate(oldCell, cellPath) - warnings = append(warnings, cellWarnings...) - errors = append(errors, cellErrors...) - } - } - - return warnings, errors -} - -// getDeprecatedFields returns the centralized list of deprecated fields for NovaCellTemplate -func (spec *NovaCellTemplate) getDeprecatedFields(old *NovaCellTemplate) []common_webhook.DeprecatedFieldUpdate { - deprecatedFields := []common_webhook.DeprecatedFieldUpdate{ - { - DeprecatedFieldName: "cellMessageBusInstance", - NewFieldPath: []string{"messagingBus", "cluster"}, - NewDeprecatedValue: &spec.CellMessageBusInstance, - NewValue: &spec.MessagingBus.Cluster, - }, - } - - // If old spec is provided (UPDATE operation), add old values - if old != nil { - deprecatedFields[0].OldDeprecatedValue = &old.CellMessageBusInstance - } - - return deprecatedFields -} - -// validateDeprecatedFieldsCreate validates deprecated fields during CREATE operations for NovaCellTemplate -func (spec *NovaCellTemplate) validateDeprecatedFieldsCreate(basePath *field.Path) []string { - // Get deprecated fields list (without old values for CREATE) - deprecatedFieldsUpdate := spec.getDeprecatedFields(nil) - - // Convert to DeprecatedField list for CREATE validation - deprecatedFields := make([]common_webhook.DeprecatedField, len(deprecatedFieldsUpdate)) - for i, df := range deprecatedFieldsUpdate { - deprecatedFields[i] = common_webhook.DeprecatedField{ - DeprecatedFieldName: df.DeprecatedFieldName, - NewFieldPath: df.NewFieldPath, - DeprecatedValue: df.NewDeprecatedValue, - NewValue: df.NewValue, - } - } - - return common_webhook.ValidateDeprecatedFieldsCreate(deprecatedFields, basePath) -} - -// validateDeprecatedFieldsUpdate validates deprecated fields during UPDATE operations for NovaCellTemplate -func (spec *NovaCellTemplate) validateDeprecatedFieldsUpdate(old NovaCellTemplate, basePath *field.Path) ([]string, field.ErrorList) { - // Get deprecated fields list with old values - deprecatedFields := spec.getDeprecatedFields(&old) - return common_webhook.ValidateDeprecatedFieldsUpdate(deprecatedFields, basePath) -} diff --git a/api/v1beta1/conditions.go b/api/v1beta1/conditions.go deleted file mode 100644 index bceb8886e..000000000 --- a/api/v1beta1/conditions.go +++ /dev/null @@ -1,205 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" -) - -// Nova Condition Types used by API objects. -const ( - // NovaAPIReadyCondition indicates if the NovaAPI is operational - NovaAPIReadyCondition condition.Type = "NovaAPIReady" - // NovaConductorReadyCondition indicates if the NovaConductor is ready - // in a given cell. - NovaConductorReadyCondition condition.Type = "NovaConductorReady" - // NovaAPIDBReadyCondition indicates if the nova_api DB is created - NovaAPIDBReadyCondition condition.Type = "NovaAPIDBReady" - // NovaAllCellsDBReadyCondition indicates that the DB for each configured - // Cell is created successfully - NovaAllCellsDBReadyCondition condition.Type = "NovaAllCellDBReady" - // NovaAllCellsReadyCondition indicates that every defined Cell is ready - NovaAllCellsReadyCondition condition.Type = "NovaAllCellReady" - // NovaAPIMQReadyCondition indicated that the top level message bus is ready - NovaAPIMQReadyCondition condition.Type = "NovaAPIMQReady" - // NovaAllCellsMQReadyCondition indicates that the message bus for each - // configured Cell is created successfully - NovaAllCellsMQReadyCondition condition.Type = "NovaAllCellsMQReady" - // NovaSchedulerReadyCondition indicates if the NovaScheduler is operational - NovaSchedulerReadyCondition condition.Type = "NovaSchedulerReady" - // NovaCellReadyCondition indicates when the given NovaCell instance is Ready - NovaCellReadyCondition condition.Type = "NovaCellReady" - // NovaMetadataReadyCondition indicates when the given NovaMetadata instance is Ready - NovaMetadataReadyCondition condition.Type = "NovaMetadataReady" - // NovaNoVNCProxyReadyCondition indicates when the given NoVNCProxy instance is Ready - NovaNoVNCProxyReadyCondition condition.Type = "NovaNoVNCProxyReady" - // NovaComputeServiceConfigReady indicates when the compute service config - // is ready for the given NovaCell - NovaComputeServiceConfigReady condition.Type = "NovaComputeServiceConfigReady" - // NovaAllControlPlaneComputesReadyCondition indicates that every defined NovaCompute is ready but undiscovered - NovaAllControlPlaneComputesReadyCondition condition.Type = "NovaAllControlPlaneComputesReady" - //NovaCellsDeletionCondition indicates that the NovaCells deletion is in progress - NovaCellsDeletionCondition condition.Type = "NovaCellsDeletion" - - // notifications - // NovaNotificationMQReadyCondition indicated that the top level notification message bus is ready - NovaNotificationMQReadyCondition condition.Type = "NovaNotificationMQReady" -) - -// Common Messages used by API objects. -const ( - // NovaAPIReadyInitMessage - NovaAPIReadyInitMessage = "NovaAPI not started" - - // NovaAPIReadyErrorMessage - NovaAPIReadyErrorMessage = "NovaAPI error occurred %s" - - // NovaConductorReadyInitMessage - NovaConductorReadyInitMessage = "NovaConductor not started" - - // NovaConductorReadyErrorMessage - NovaConductorReadyErrorMessage = "NovaConductor error occurred %s" - - // NovaAllCellsDBReadyInitMessage - NovaAllCellsDBReadyInitMessage = "DB creation not started" - - // NovaAllCellsDBReadyCreatingMessage - NovaAllCellsDBReadyCreatingMessage = "DB creation ongoing for %s" - - // NovaAllCellsDBReadyErrorMessage - NovaAllCellsDBReadyErrorMessage = "DB creation failed for %s" - - // NovaAllCellsReadyMessage - NovaAllCellsDBReadyMessage = "All DBs created successfully" - - // NovaAllCellsReadyInitMessage - NovaAllCellsReadyInitMessage = "NovaCells are not started" - - // NovaAllCellsReadyCreatingMessage - NovaAllCellsReadyNotReadyMessage = "NovaCell %s is not Ready" - - // NovaAllCellsReadyWaitingMessage - NovaAllCellsReadyWaitingMessage = "NovaCell creation waits for DB creation for %s" - - // NovaAllCellsReadyErrorMessage - NovaAllCellsReadyErrorMessage = "NovaCell creation failed for %s" - - // NovaAllCellsReadyMessage - NovaAllCellsReadyMessage = "All NovaCells are ready" - - // NovaAPIMQReadyInitMessage - NovaAPIMQReadyInitMessage = "API message bus not started" - - // NovaAPIMQReadyErrorMessage - NovaAPIMQReadyErrorMessage = "API message bus creation failed: %s" - - // NovaAPIMQReadyMessage - NovaAPIMQReadyMessage = "API message bus creation successfully" - - // NovaAPIMQReadyCreatingMessage - NovaAPIMQReadyCreatingMessage = "API message bus creation ongoing" - - // NovaAllCellsMQReadyInitMessage - NovaAllCellsMQReadyInitMessage = "Message bus creation not started" - - // NovaAllCellsMQReadyErrorMessage - NovaAllCellsMQReadyCreatingMessage = "Message bus creation ongoing for %s" - - // NovaAllCellsMQReadyErrorMessage - NovaAllCellsMQReadyErrorMessage = "Message bus creation failed for %s" - - // NovaAllCellsMQReadyMessage - NovaAllCellsMQReadyMessage = "All message buses created successfully" - - // NovaSchedulerReadyInitMessage - NovaSchedulerReadyInitMessage = "NovaScheduler not started" - - // NovaSchedulerReadyErrorMessage - NovaSchedulerReadyErrorMessage = "NovaScheduler error occurred %s" - - // InputReadyWaitingMessage - InputReadyWaitingMessage = "Input data resources missing: %s" - - // NovaApplicationCredentialSecretErrorMessage - NovaApplicationCredentialSecretErrorMessage = "Error with application credential secret" - - // NovaCellReadyInitMessage - NovaCellReadyInitMessage = "The status of NovaCell %s is unknown" - - // NovaCellReadyNotExistsMessage - NovaCellReadyNotExistsMessage = "Waiting for NovaCell %s to exists" - - // NovaCellReadyNotReadyMessage - NovaCellReadyNotReadyMessage = "Waiting for NovaCell %s to become Ready" - - //NovaCellReadyErrorMessage - NovaCellReadyErrorMessage = "Error occurred while querying NovaCell %s: %s" - - //NovaCellReadyMessage - NovaCellReadyMessage = "NovaCell %s is Ready" - - //NovaMetadataReadyInitMessage - NovaMetadataReadyInitMessage = "NovaMetadata not started" - - //NovaMetadataReadyErrorMessage - NovaMetadataReadyErrorMessage = "NovaMetadata error occurred %s" - - //NovaNoVNCProxyReadyInitMessage - NovaNoVNCProxyReadyInitMessage = "NovaNoVNCProxy not started" - - //NovaNoVNCProxyReadyErrorMessage - NovaNoVNCProxyReadyErrorMessage = "NovaNoVNCProxy error occurred %s" - - //NovaComputeServiceConfigInitMessage - NovaComputeServiceConfigInitMessage = "Compute service config generation is not started" - - //NovaComputeServiceConfigErrorMessage - NovaComputeServiceConfigErrorMessage = "Compute service config generation error occurred %s" - - //NovaComputeReadyInitMessage - NovaComputeReadyInitMessage = "NovaCompute not started" - - //NovaComputeReadyErrorMessage - NovaComputeReadyErrorMessage = "NovaCompute error occurred %s" - - //CellHostDiscoverInitMessage - CellHostDiscoverInitMessage = "Not all host discovered in cell" - - //CellHostDiscoverErrorMessage - CellHostDiscoverErrorMessage = "CellHostDiscover error occurred %s" - - // NovaCellsDeletionConditionInitMessage - NovaCellsDeletionConditionInitMessage = "NovaCells deletion not started" - - // NovaCellsDeletionMessage - NovaCellsDeletionMessage = "NovaCells deletion in progress: %s" - - // NovaCellsDeletionConditionReadyMessage - NovaCellsDeletionConditionReadyMessage = "There is no more NovaCells to delete" - // notifications - // NovaNotificationMQReadyInitMessage - NovaNotificationMQReadyInitMessage = "Notification message bus not started" - - // NovaNotificationMQReadyErrorMessage - NovaNotificationMQReadyErrorMessage = "Notification message bus creation failed: %s" - - // NovaNotificationMQReadyCreatingMessage - NovaNotificationMQReadyCreatingMessage = "Notification message bus creation ongoing" - - // NovaNotificationMQReadyMessage - NovaNotificationMQReadyMessage = "Notification message bus created successfully" -) diff --git a/api/v1beta1/groupversion_info.go b/api/v1beta1/groupversion_info.go deleted file mode 100644 index 7ee40c982..000000000 --- a/api/v1beta1/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1beta1 contains API Schema definitions for the nova v1beta1 API group -// +kubebuilder:object:generate=true -// +groupName=nova.openstack.org -package v1beta1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "nova.openstack.org", Version: "v1beta1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/api/v1beta1/nova_types.go b/api/v1beta1/nova_types.go deleted file mode 100644 index 39d4a5c11..000000000 --- a/api/v1beta1/nova_types.go +++ /dev/null @@ -1,243 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1" - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" - condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// NovaSpecCore defines the template for NovaSpec used in OpenStackControlPlane -type NovaSpecCore struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // +kubebuilder:validation:Optional - // +kubebuilder:default=keystone - // KeystoneInstance to name of the KeystoneAPI CR to select the Service - // instance used by the Nova services to authenticate. - KeystoneInstance string `json:"keystoneInstance"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=openstack - // APIDatabaseInstance is the name of the MariaDB CR to select the DB - // Service instance used for the Nova API DB. - APIDatabaseInstance string `json:"apiDatabaseInstance"` - - // +kubebuilder:validation:Optional - // APIMessageBusInstance is the name of the RabbitMqCluster CR to select - // the Message Bus Service instance used by the Nova top level services to - // communicate. - // Deprecated: Use MessagingBus.Cluster instead - APIMessageBusInstance string `json:"apiMessageBusInstance,omitempty"` - - // +kubebuilder:validation:Optional - // MessagingBus configuration (username, vhost, and cluster) - MessagingBus rabbitmqv1.RabbitMqConfig `json:"messagingBus,omitempty"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default={cell0: {cellDatabaseAccount: nova-cell0, hasAPIAccess: true}, cell1: {cellDatabaseAccount: nova-cell1, cellDatabaseInstance: openstack-cell1, messagingBus: {cluster: rabbitmq-cell1}, hasAPIAccess: true}} - // Cells is a mapping of cell names to NovaCellTemplate objects defining - // the cells in the deployment. The "cell0" cell is a mandatory cell in - // every deployment. Moreover any real deployment needs at least one - // additional normal cell as "cell0" cannot have any computes. - CellTemplates map[string]NovaCellTemplate `json:"cellTemplates"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default="nova" - // ServiceUser - optional username used for this service to register in keystone - ServiceUser string `json:"serviceUser"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default="nova-api" - // APIDatabaseAccount - MariaDBAccount to use when accessing the API DB - APIDatabaseAccount string `json:"apiDatabaseAccount"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=60 - // +kubebuilder:validation:Minimum=10 - // APITimeout for Route and Apache - APITimeout int `json:"apiTimeout"` - - // +kubebuilder:validation:Required - // Secret is the name of the Secret instance containing password - // information for nova like the keystone service password and DB passwords - Secret string `json:"secret"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default={service: NovaPassword} - // PasswordSelectors - Selectors to identify the DB and ServiceUser - // passwords from the Secret - PasswordSelectors PasswordSelector `json:"passwordSelectors"` - - // +kubebuilder:validation:Optional - // NodeSelector to target subset of worker nodes running this service. Setting - // NodeSelector here acts as a default value and can be overridden by service - // specific NodeSelector Settings. - NodeSelector *map[string]string `json:"nodeSelector,omitempty"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=false - // PreserveJobs - do not delete jobs after they finished e.g. to check logs - PreserveJobs bool `json:"preserveJobs"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default={replicas:1} - // APIServiceTemplate - define the nova-api service - APIServiceTemplate NovaAPITemplate `json:"apiServiceTemplate"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default={replicas:1} - // SchedulerServiceTemplate- define the nova-scheduler service - SchedulerServiceTemplate NovaSchedulerTemplate `json:"schedulerServiceTemplate"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default={enabled: true} - // MetadataServiceTemplate - defines the metadata service that is global - // for the deployment serving all the cells. Note that if you want to - // deploy metadata per cell then the metadata service should be disabled - // here and enabled in the cellTemplates instead. - MetadataServiceTemplate NovaMetadataTemplate `json:"metadataServiceTemplate"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=memcached - // MemcachedInstance is the name of the Memcached CR that all nova service will use. - MemcachedInstance string `json:"memcachedInstance"` - - // +kubebuilder:validation:Optional - // TopologyRef to apply the Topology defined by the associated CR referenced - // by name - TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"` - - // +kubebuilder:validation:Optional - // NotificationsBusInstance is the name of the RabbitMqCluster CR to select - // the Message Bus Service instance used by the Nova top level services and all cells to publish notifications. - // If undefined, the value will be inherited from OpenStackControlPlane. - // An empty value "" leaves the notification drivers unconfigured and emitting no notifications at all. - // Avoid colocating it with RabbitMqClusterName, APIMessageBusInstance or CellMessageBusInstance used for RPC. - // For particular Nova cells, notifications cannot be disabled, nor configured differently. - NotificationsBusInstance *string `json:"notificationsBusInstance,omitempty" deprecated:"true" deprecatedNew:"notificationsBus.cluster"` - - // +kubebuilder:validation:Optional - // NotificationsBus configuration (username, vhost, and cluster) for notifications - NotificationsBus *rabbitmqv1.RabbitMqConfig `json:"notificationsBus,omitempty"` - - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // Auth - Parameters related to authentication (shared by all Nova services) - Auth AuthSpec `json:"auth,omitempty"` -} - -// NovaSpec defines the desired state of Nova -type NovaSpec struct { - // NOTE(bogdando): Anything that is only submitted by openstack-operator should be in NovaSpec but not in NovaSpecCore. - - NovaSpecCore `json:",inline"` - - NovaImages `json:",inline"` -} - -// NovaStatus defines the observed state of Nova -type NovaStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Conditions - Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"` - - // APIServiceReadyCount defines the number or replicas ready from nova-api - APIServiceReadyCount int32 `json:"apiServiceReadyCount,omitempty"` - - // SchedulerServiceReadyCount defines the number or replicas ready from nova-scheduler - SchedulerServiceReadyCount int32 `json:"schedulerServiceReadyCount,omitempty"` - - // MetadataReadyCount defines the number of replicas ready from - // nova-metadata service - MetadataServiceReadyCount int32 `json:"metadataServiceReadyCount,omitempty"` - - // RegisteredCells is a map keyed by cell names that are registered in the - // nova_api database with a value that is the hash of the given cell - // configuration. - RegisteredCells map[string]string `json:"registeredCells,omitempty"` - - // DiscoveredCells is a map keyed by cell names that have discovered all kubernetes managed - // computes in cell value is a hash of config from all kubernetes managed computes in cell - DiscoveredCells map[string]string `json:"discoveredCells,omitempty"` - - //ObservedGeneration - the most recent generation observed for this service. If the observed generation is less than the spec generation, then the controller has not processed the latest changes. - ObservedGeneration int64 `json:"observedGeneration,omitempty"` -} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status - -// Nova is the Schema for the nova API -type Nova struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec NovaSpec `json:"spec,omitempty"` - Status NovaStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// NovaList contains a list of Nova -type NovaList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Nova `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Nova{}, &NovaList{}) -} - -// GetConditions returns the list of conditions from the status -func (s NovaStatus) GetConditions() condition.Conditions { - return s.Conditions -} - -// IsReady returns true if Nova reconciled successfully -func (instance Nova) IsReady() bool { - return instance.Status.Conditions.IsTrue(condition.ReadyCondition) -} - -// RbacConditionsSet - set the conditions for the rbac object -func (instance Nova) RbacConditionsSet(c *condition.Condition) { - instance.Status.Conditions.Set(c) -} - -// RbacNamespace - return the namespace -func (instance Nova) RbacNamespace() string { - return instance.Namespace -} - -// RbacResourceName - return the name to be used for rbac objects (serviceaccount, role, rolebinding) -func (instance Nova) RbacResourceName() string { - return "nova-" + instance.Name -} - -// GetSecret returns the value of the Nova.Spec.Secret -func (instance Nova) GetSecret() string { - return instance.Spec.Secret -} diff --git a/api/v1beta1/nova_webhook.go b/api/v1beta1/nova_webhook.go deleted file mode 100644 index 1e5762c79..000000000 --- a/api/v1beta1/nova_webhook.go +++ /dev/null @@ -1,459 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// -// Generated by: -// -// operator-sdk create webhook --group nova --version v1beta1 --kind Nova --programmatic-validation --defaulting -// - -package v1beta1 - -import ( - "fmt" - - "github.com/google/go-cmp/cmp" - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" - service "github.com/openstack-k8s-operators/lib-common/modules/common/service" - "github.com/robfig/cron/v3" - - apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/webhook" - "sigs.k8s.io/controller-runtime/pkg/webhook/admission" -) - -// NovaDefaults - -type NovaDefaults struct { - APIContainerImageURL string - SchedulerContainerImageURL string - APITimeout int - NovaCellDefaults -} - -var novaDefaults NovaDefaults - -// log is for logging in this package. -var novalog = logf.Log.WithName("nova-resource") - -// SetupNovaDefaults - initialize Nova spec defaults for use with either internal or external webhooks -func SetupNovaDefaults(defaults NovaDefaults) { - novaDefaults = defaults - novalog.Info("Nova defaults initialized", "defaults", defaults) -} - -var _ webhook.Defaulter = &Nova{} - -// Default implements webhook.Defaulter so a webhook will be registered for the type -func (r *Nova) Default() { - novalog.Info("default", "name", r.Name) - - r.Spec.Default() -} - -// Default - set defaults for this NovaCore spec. -func (spec *NovaSpec) Default() { - spec.NovaImages.Default(novaDefaults) - spec.NovaSpecCore.Default() -} - -// Default - set defaults for this Nova spec. Expected to be called from -// the higher level meta operator. -func (spec *NovaSpecCore) Default() { - // NOTE(gibi): this cannot be expressed as kubebuilder defaults as the - // MetadataServiceTemplate is used both in the cellTemplate and in the - // NovaSpec but we need different defaults in the two places - if spec.MetadataServiceTemplate.Enabled == nil { - spec.MetadataServiceTemplate.Enabled = ptr.To(true) - } - - if spec.APITimeout == 0 { - spec.APITimeout = novaDefaults.APITimeout - } - - // Default MessagingBus.Cluster if not set - // Migration from deprecated fields is handled by openstack-operator - if spec.MessagingBus.Cluster == "" { - spec.MessagingBus.Cluster = "rabbitmq" - } - - // NotificationsBus.Cluster is not defaulted - it must be explicitly set if NotificationsBus is configured - // This ensures users make a conscious choice about which cluster to use for notifications - - for cellName, cellTemplate := range spec.CellTemplates { - - if cellTemplate.MetadataServiceTemplate.Enabled == nil { - cellTemplate.MetadataServiceTemplate.Enabled = ptr.To(false) - } - - if cellName == Cell0Name { - // in cell0 disable VNC by default - if cellTemplate.NoVNCProxyServiceTemplate.Enabled == nil { - cellTemplate.NoVNCProxyServiceTemplate.Enabled = ptr.To(false) - } - } else { - // in other cells enable VNC by default - if cellTemplate.NoVNCProxyServiceTemplate.Enabled == nil { - cellTemplate.NoVNCProxyServiceTemplate.Enabled = ptr.To(true) - } - } - - // Default MessagingBus.Cluster if not set - // Migration from deprecated fields is handled by openstack-operator - if cellTemplate.MessagingBus.Cluster == "" { - if cellName == Cell0Name { - cellTemplate.MessagingBus.Cluster = "rabbitmq" - } else { - cellTemplate.MessagingBus.Cluster = "rabbitmq-" + cellName - } - } - - // "cellTemplate" is a by-value copy, so we need to re-inject the updated version of it into the map - spec.CellTemplates[cellName] = cellTemplate - } -} - -var _ webhook.Validator = &Nova{} - -// ValidateCellTemplates validates cell templates configuration -func (spec *NovaSpecCore) ValidateCellTemplates(basePath *field.Path, namespace string) field.ErrorList { - var errors field.ErrorList - - if _, ok := spec.CellTemplates[Cell0Name]; !ok { - errors = append( - errors, - field.Required(basePath.Child("cellTemplates"), - "cell0 specification is missing, cell0 key is required in cellTemplates"), - ) - } - - cellMessageBusNames := make(map[string]string) - - for name, cell := range spec.CellTemplates { - cellPath := basePath.Child("cellTemplates").Key(name) - errors = append( - errors, - ValidateCellName(cellPath, name)..., - ) - // verify the topology namespace is valid - errors = append(errors, topologyv1.ValidateTopologyRef( - cell.TopologyRef, *basePath.Child("topologyRef"), namespace)...) - - if name != Cell0Name { - // Determine which rabbit cluster this cell is using - // Prefer the new MessagingBus.Cluster field, fall back to deprecated CellMessageBusInstance - var cellCluster string - if cell.MessagingBus.Cluster != "" { - cellCluster = cell.MessagingBus.Cluster - } else { - cellCluster = cell.CellMessageBusInstance - } - - // Check if this rabbit cluster is already used by another cell - if dupName, ok := cellMessageBusNames[cellCluster]; ok { - // Determine which field to report the error on - fieldPath := cellPath.Child("messagingBus").Child("cluster") - if cell.MessagingBus.Cluster == "" { - fieldPath = cellPath.Child("cellMessageBusInstance") - } - - errors = append(errors, field.Invalid( - fieldPath, - cellCluster, - fmt.Sprintf( - "RabbitMqCluster CR need to be uniq per cell. It's duplicated with cell: %s", - dupName), - ), - ) - } - - cellMessageBusNames[cellCluster] = name - } - if *cell.MetadataServiceTemplate.Enabled && *spec.MetadataServiceTemplate.Enabled { - errors = append( - errors, - field.Invalid( - cellPath.Child("metadataServiceTemplate").Child("enabled"), - *cell.MetadataServiceTemplate.Enabled, - "should be false as metadata is enabled on the top level too. "+ - "The metadata service can be either enabled on top "+ - "or in the cells but not in both places at the same time."), - ) - } - errors = append(errors, - cell.MetadataServiceTemplate.ValidateTopology( - cellPath.Child("metadataServiceTemplate"), - namespace)...) - - errors = append(errors, - cell.NoVNCProxyServiceTemplate.ValidateTopology( - cellPath.Child("noVNCProxyServiceTemplate"), - namespace)...) - - errors = append(errors, - cell.ConductorServiceTemplate.ValidateTopology( - cellPath.Child("conductorServiceTemplate"), - namespace)...) - - errors = append( - errors, - cell.MetadataServiceTemplate.ValidateDefaultConfigOverwrite( - cellPath.Child("metadataServiceTemplate"))...) - - errors = append( - errors, - cell.DBPurge.Validate(cellPath.Child("dbPurge"))...) - - if name == Cell0Name { - errors = append( - errors, - cell.MetadataServiceTemplate.ValidateCell0( - cellPath.Child("metadataServiceTemplate"))...) - errors = append( - errors, - cell.NoVNCProxyServiceTemplate.ValidateCell0( - cellPath.Child("noVNCProxyServiceTemplate"))...) - errors = append( - errors, - ValidateNovaComputeCell0( - cellPath.Child("novaComputeTemplates"), len(cell.NovaComputeTemplates))...) - } - - for computeName, computeTemplate := range cell.NovaComputeTemplates { - if computeTemplate.ComputeDriver == IronicDriver { - errors = append( - errors, computeTemplate.ValidateIronicDriverReplicas( - cellPath.Child("novaComputeTemplates").Key(computeName))..., - ) - } - errors = append( - errors, ValidateNovaComputeName( - cellPath.Child("novaComputeTemplates").Key(computeName), computeName)..., - ) - errors = append( - errors, computeTemplate.ValidateDefaultConfigOverwrite( - cellPath.Child("novaComputeTemplates").Key(computeName))..., - ) - errors = append( - errors, computeTemplate.ValidateTopology( - cellPath.Child("novaComputeTemplates").Key(computeName), namespace)..., - ) - } - } - - return errors -} - -// ValidateAPIServiceTemplate - -func (spec *NovaSpecCore) ValidateAPIServiceTemplate(basePath *field.Path, namespace string) field.ErrorList { - errors := field.ErrorList{} - - // validate the service override key is valid - errors = append(errors, - service.ValidateRoutedOverrides( - basePath.Child("apiServiceTemplate").Child("override").Child("service"), - spec.APIServiceTemplate.Override.Service)...) - - errors = append(errors, - ValidateAPIDefaultConfigOverwrite( - basePath.Child("apiServiceTemplate").Child("defaultConfigOverwrite"), - spec.APIServiceTemplate.DefaultConfigOverwrite)...) - - errors = append(errors, - spec.APIServiceTemplate.ValidateTopology( - basePath.Child("apiServiceTemplate"), - namespace)...) - - return errors -} - -// ValidateSchedulerServiceTemplate - -func (spec *NovaSpecCore) ValidateSchedulerServiceTemplate(basePath *field.Path, namespace string) field.ErrorList { - errors := field.ErrorList{} - // validate the referenced TopologyRef - errors = append(errors, - spec.SchedulerServiceTemplate.ValidateTopology( - basePath.Child("schedulerServiceTemplate"), - namespace)...) - return errors -} - - -// ValidateCreate validates the NovaSpec during the webhook invocation. -func (spec *NovaSpec) ValidateCreate(basePath *field.Path, namespace string) (admission.Warnings, field.ErrorList) { - return spec.NovaSpecCore.ValidateCreate(basePath, namespace) -} - -// ValidateCreate validates the NovaSpecCore during the webhook invocation. It is -// expected to be called by the validation webhook in the higher level meta -// operator -func (spec *NovaSpecCore) ValidateCreate(basePath *field.Path, namespace string) (admission.Warnings, field.ErrorList) { - var warnings admission.Warnings - - // Validate deprecated fields - deprecatedWarnings, deprecatedErrors := spec.validateDeprecatedFieldsCreate(basePath) - warnings = append(warnings, deprecatedWarnings...) - - errors := deprecatedErrors - errors = append(errors, spec.ValidateCellTemplates(basePath, namespace)...) - errors = append(errors, spec.ValidateAPIServiceTemplate(basePath, namespace)...) - errors = append(errors, spec.ValidateSchedulerServiceTemplate(basePath, namespace)...) - - // validate TopologyRef override for top-level MetadataServiceTemplate - errors = append(errors, - spec.MetadataServiceTemplate.ValidateTopology( - basePath.Child("metadataServiceTemplate"), - namespace)...) - - errors = append( - errors, - spec.MetadataServiceTemplate.ValidateDefaultConfigOverwrite( - basePath.Child("metadataServiceTemplate"))...) - - // validate top-level topology - errors = append(errors, - topologyv1.ValidateTopologyRef( - spec.TopologyRef, *basePath.Child("topologyRef"), namespace)...) - - return warnings, errors -} - -// ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *Nova) ValidateCreate() (admission.Warnings, error) { - novalog.Info("validate create", "name", r.Name) - - warnings, errors := r.Spec.ValidateCreate(field.NewPath("spec"), r.Namespace) - if len(errors) != 0 { - novalog.Info("validation failed", "name", r.Name) - return warnings, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "Nova"}, - r.Name, errors) - } - return warnings, nil -} - -// ValidateUpdate validates the NovaSpec during the webhook invocation. -func (spec *NovaSpec) ValidateUpdate(old NovaSpec, basePath *field.Path, namespace string) (admission.Warnings, field.ErrorList) { - return spec.NovaSpecCore.ValidateUpdate(old.NovaSpecCore, basePath, namespace) -} - -// ValidateUpdate validates the NovaSpecCore during the webhook invocation. It is -// expected to be called by the validation webhook in the higher level meta -// operator -func (spec *NovaSpecCore) ValidateUpdate(old NovaSpecCore, basePath *field.Path, namespace string) (admission.Warnings, field.ErrorList) { - var errors field.ErrorList - var warnings admission.Warnings - - // Validate deprecated fields - deprecatedWarnings, deprecatedErrors := spec.validateDeprecatedFieldsUpdate(old, basePath) - warnings = append(warnings, deprecatedWarnings...) - errors = append(errors, deprecatedErrors...) - - errors = append(errors, spec.ValidateCellTemplates(basePath, namespace)...) - // Validate top-level TopologyRef - errors = append(errors, topologyv1.ValidateTopologyRef( - spec.TopologyRef, *basePath.Child("topologyRef"), namespace)...) - - errors = append(errors, spec.ValidateAPIServiceTemplate(basePath, namespace)...) - errors = append(errors, spec.ValidateSchedulerServiceTemplate(basePath, namespace)...) - - // validate TopologyRef override for top-level MetadataServiceTemplate - errors = append(errors, - spec.MetadataServiceTemplate.ValidateTopology( - basePath.Child("metadataServiceTemplate"), - namespace)...) - - errors = append( - errors, - spec.MetadataServiceTemplate.ValidateDefaultConfigOverwrite( - basePath.Child("metadataServiceTemplate"))...) - - return warnings, errors -} - -// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (r *Nova) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { - novalog.Info("validate update", "name", r.Name) - oldNova, ok := old.(*Nova) - if !ok || oldNova == nil { - return nil, apierrors.NewInternalError(fmt.Errorf("unable to convert existing object")) - } - - novalog.Info("validate update", "diff", cmp.Diff(oldNova, r)) - - warnings, errors := r.Spec.ValidateUpdate(oldNova.Spec, field.NewPath("spec"), r.Namespace) - if len(errors) != 0 { - novalog.Info("validation failed", "name", r.Name) - return warnings, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "Nova"}, - r.Name, errors) - } - return warnings, nil -} - -// ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (r *Nova) ValidateDelete() (admission.Warnings, error) { - novalog.Info("validate delete", "name", r.Name) - - // TODO(user): fill in your validation logic upon object deletion. - return nil, nil -} - -// SetDefaultRouteAnnotations sets HAProxy timeout values of the route -// NOTE: it is used by ctlplane webhook on openstack-operator -func (spec *NovaSpecCore) SetDefaultRouteAnnotations(annotations map[string]string) { - const haProxyAnno = "haproxy.router.openshift.io/timeout" - // Use a custom annotation to flag when the operator has set the default HAProxy timeout - // With the annotation func determines when to overwrite existing HAProxy timeout with the APITimeout - const novaAnno = "api.nova.openstack.org/timeout" - - valNova, okNova := annotations[novaAnno] - valHAProxy, okHAProxy := annotations[haProxyAnno] - - // Human operator set the HAProxy timeout manually - if !okNova && okHAProxy { - return - } - - // Human operator modified the HAProxy timeout manually without removing the Nova flag - if okNova && okHAProxy && valNova != valHAProxy { - delete(annotations, novaAnno) - return - } - - timeout := fmt.Sprintf("%ds", spec.APITimeout) - annotations[novaAnno] = timeout - annotations[haProxyAnno] = timeout -} - -// Validate the field values -func (r *NovaCellDBPurge) Validate(basePath *field.Path) field.ErrorList { - var errors field.ErrorList - // k8s uses the same cron lib to validate the schedule of the CronJob - // https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/batch/validation/validation.go - if _, err := cron.ParseStandard(*r.Schedule); err != nil { - errors = append( - errors, - field.Invalid( - basePath.Child("schedule"), r.Schedule, err.Error()), - ) - } - return errors -} diff --git a/api/v1beta1/novaapi_types.go b/api/v1beta1/novaapi_types.go deleted file mode 100644 index dfa416fac..000000000 --- a/api/v1beta1/novaapi_types.go +++ /dev/null @@ -1,260 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" - service "github.com/openstack-k8s-operators/lib-common/modules/common/service" - "github.com/openstack-k8s-operators/lib-common/modules/common/tls" - - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// NovaAPITemplate defines the input parameters specified by the user to -// create a NovaAPI via higher level CRDs. -// NOTE(gibi): NovaAPITemplate has the same structure than NovaServiceBase BUT -// we want to default ContainerImage for the template, therefore the structs -// are duplicated. -type NovaAPITemplate struct { - // +kubebuilder:validation:Optional - // +kubebuilder:default=1 - // +kubebuilder:validation:Maximum=32 - // +kubebuilder:validation:Minimum=0 - // Replicas of the service to run - Replicas *int32 `json:"replicas"` - - // +kubebuilder:validation:Optional - // NodeSelector to target subset of worker nodes running this service. Setting here overrides - // any global NodeSelector settings within the Nova CR. - NodeSelector *map[string]string `json:"nodeSelector,omitempty"` - - // +kubebuilder:validation:Optional - // CustomServiceConfig - customize the service config using this parameter to change service defaults, - // or overwrite rendered information using raw OpenStack config format. The content gets added to - // to /etc//.conf.d directory as custom.conf file. - CustomServiceConfig string `json:"customServiceConfig"` - - // +kubebuilder:validation:Optional - // DefaultConfigOverwrite - interface to overwrite default config files like e.g. api-paste.ini or policy.yaml. - DefaultConfigOverwrite map[string]string `json:"defaultConfigOverwrite,omitempty"` - - // +kubebuilder:validation:Optional - // Resources - Compute Resources required by this service (Limits/Requests). - // https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - Resources corev1.ResourceRequirements `json:"resources,omitempty"` - - // +kubebuilder:validation:Optional - // NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network - NetworkAttachments []string `json:"networkAttachments,omitempty"` - - // +kubebuilder:validation:Optional - // Override, provides the ability to override the generated manifest of several child resources. - Override APIOverrideSpec `json:"override,omitempty"` - - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // TLS - Parameters related to the TLS - TLS tls.API `json:"tls,omitempty"` - - // +kubebuilder:validation:Optional - // TopologyRef to apply the Topology defined by the associated CR referenced - // by name - TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"` -} - -// APIOverrideSpec to override the generated manifest of several child resources. -type APIOverrideSpec struct { - // Override configuration for the Service created to serve traffic to the cluster. - // The key must be the endpoint type (public, internal) - Service map[service.Endpoint]service.RoutedOverrideSpec `json:"service,omitempty"` -} - -// NovaAPISpec defines the desired state of NovaAPI -type NovaAPISpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // +kubebuilder:validation:Optional - // +kubebuilder:default=60 - // +kubebuilder:validation:Minimum=10 - // APITimeout for Route and Apache - APITimeout int `json:"apiTimeout"` - - // +kubebuilder:validation:Required - // Secret is the name of the Secret instance containing password - // information for the nova-api service. This secret is expected to be - // generated by the nova-operator based on the information passed to the - // Nova CR. - Secret string `json:"secret"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default="nova" - // ServiceUser - optional username used for this service to register in - // keystone - ServiceUser string `json:"serviceUser"` - - // +kubebuilder:validation:Required - // KeystoneAuthURL configures the keystone API endpoint to be used - // by the service for authentication and authorization - KeystoneAuthURL string `json:"keystoneAuthURL"` - - // +kubebuilder:validation:Required - // KeystonePublicAuthURL configures the public keystone API endpoint. This - // can be different from KeystoneAuthURL. The service uses this value - // to redirect unauthenticated users. - KeystonePublicAuthURL string `json:"keystonePublicAuthURL"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=regionOne - // Region - the region name to use for service endpoint discovery - Region string `json:"region"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default="nova-api" - // APIDatabaseAccount - MariaDBAccount to use when accessing the API DB - APIDatabaseAccount string `json:"apiDatabaseAccount"` - - // +kubebuilder:validation:Required - // APIDatabaseHostname - hostname to use when accessing the API DB - APIDatabaseHostname string `json:"apiDatabaseHostname"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default="nova-cell0" - // APIDatabaseAccount - MariaDBAccount to use when accessing the cell0 DB - Cell0DatabaseAccount string `json:"cell0DatabaseAccount"` - - // +kubebuilder:validation:Required - // APIDatabaseHostname - hostname to use when accessing the cell0 DB - Cell0DatabaseHostname string `json:"cell0DatabaseHostname"` - - // NovaServiceBase specifies the generic fields of the service - NovaServiceBase `json:",inline"` - - // +kubebuilder:validation:Optional - // Override, provides the ability to override the generated manifest of several child resources. - Override APIOverrideSpec `json:"override,omitempty"` - - // +kubebuilder:validation:Required - // ServiceAccount - service account name used internally to provide Nova services the default SA name - ServiceAccount string `json:"serviceAccount"` - - // RegisteredCells is a map keyed by cell names that are registered in the - // nova_api database with a value that is the hash of the given cell - // configuration. - // This is used to detect when a new cell is added or an existing cell is - // reconfigured to trigger refresh of the in memory cell caches of the - // service. - RegisteredCells map[string]string `json:"registeredCells"` - - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // TLS - Parameters related to the TLS - TLS tls.API `json:"tls,omitempty"` - - // +kubebuilder:validation:Optional - // DefaultConfigOverwrite - interface to overwrite default config files like e.g. api-paste.ini or policy.yaml. - DefaultConfigOverwrite map[string]string `json:"defaultConfigOverwrite,omitempty"` - - // +kubebuilder:validation:Required - // MemcachedInstance is the name of the Memcached CR that all nova service will use. - MemcachedInstance string `json:"memcachedInstance"` -} - -// NovaAPIStatus defines the observed state of NovaAPI -type NovaAPIStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Map of hashes to track e.g. job status - Hash map[string]string `json:"hash,omitempty"` - - // Conditions - Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"` - - // ReadyCount defines the number of replicas ready from nova-api - ReadyCount int32 `json:"readyCount,omitempty"` - - // NetworkAttachments status of the deployment pods - NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"` - - // ObservedGeneration - the most recent generation observed for this - // service. If the observed generation is less than the spec generation, - // then the controller has not processed the latest changes injected by - // the openstack-operator in the top-level CR (e.g. the ContainerImage) - ObservedGeneration int64 `json:"observedGeneration,omitempty"` - - // LastAppliedTopology - the last applied Topology - LastAppliedTopology *topologyv1.TopoRef `json:"lastAppliedTopology,omitempty"` -} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:printcolumn:name="NetworkAttachments",type="string",JSONPath=".spec.networkAttachments",description="NetworkAttachments" -//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status" -//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message" - -// NovaAPI is the Schema for the novaapis API -type NovaAPI struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec NovaAPISpec `json:"spec,omitempty"` - Status NovaAPIStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// NovaAPIList contains a list of NovaAPI -type NovaAPIList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []NovaAPI `json:"items"` -} - -func init() { - SchemeBuilder.Register(&NovaAPI{}, &NovaAPIList{}) -} - -// GetConditions returns the list of conditions from the status -func (s NovaAPIStatus) GetConditions() condition.Conditions { - return s.Conditions -} - -// GetSecret returns the value of the NovaAPI.Spec.Secret -func (n NovaAPI) GetSecret() string { - return n.Spec.Secret -} - -// GetSpecTopologyRef - Returns the LastAppliedTopology Set in the Status -func (n *NovaAPI) GetSpecTopologyRef() *topologyv1.TopoRef { - return n.Spec.TopologyRef -} - -// GetLastAppliedTopology - Returns the LastAppliedTopology Set in the Status -func (n *NovaAPI) GetLastAppliedTopology() *topologyv1.TopoRef { - return n.Status.LastAppliedTopology -} - -// SetLastAppliedTopology - Sets the LastAppliedTopology value in the Status -func (n *NovaAPI) SetLastAppliedTopology(topologyRef *topologyv1.TopoRef) { - n.Status.LastAppliedTopology = topologyRef -} diff --git a/api/v1beta1/novaapi_webhook.go b/api/v1beta1/novaapi_webhook.go deleted file mode 100644 index 705c398ea..000000000 --- a/api/v1beta1/novaapi_webhook.go +++ /dev/null @@ -1,164 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// -// Generated by: -// -// operator-sdk create webhook --group nova --version v1beta1 --kind NovaAPI --programmatic-validation --defaulting -// - -package v1beta1 - -import ( - "fmt" - - "github.com/google/go-cmp/cmp" - apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/validation/field" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/webhook" - "sigs.k8s.io/controller-runtime/pkg/webhook/admission" - - "github.com/openstack-k8s-operators/lib-common/modules/common/service" - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" -) - -// NovaAPIDefaults - -type NovaAPIDefaults struct { - ContainerImageURL string -} - -var novaAPIDefaults NovaAPIDefaults - -// log is for logging in this package. -var novaapilog = logf.Log.WithName("novaapi-resource") - -// SetupNovaAPIDefaults - initialize NovaAPI spec defaults for use with either internal or external webhooks -func SetupNovaAPIDefaults(defaults NovaAPIDefaults) { - novaAPIDefaults = defaults - novaapilog.Info("NovaAPI defaults initialized", "defaults", defaults) -} - -var _ webhook.Defaulter = &NovaAPI{} - -// Default implements webhook.Defaulter so a webhook will be registered for the type -func (r *NovaAPI) Default() { - novaapilog.Info("default", "name", r.Name) - - r.Spec.Default() -} - -// Default - set defaults for this NovaAPI spec -func (spec *NovaAPISpec) Default() { - if spec.ContainerImage == "" { - spec.ContainerImage = novaAPIDefaults.ContainerImageURL - } -} - -var _ webhook.Validator = &NovaAPI{} - -// ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaAPI) ValidateCreate() (admission.Warnings, error) { - novaapilog.Info("validate create", "name", r.Name) - - errors := field.ErrorList{} - basePath := field.NewPath("spec") - - // validate the service override key is valid - errors = append(errors, service.ValidateRoutedOverrides(basePath.Child("override").Child("service"), r.Spec.Override.Service)...) - - errors = append(errors, - ValidateAPIDefaultConfigOverwrite( - basePath.Child("defaultConfigOverwrite"), - r.Spec.DefaultConfigOverwrite)...) - - errors = append(errors, topologyv1.ValidateTopologyRef( - r.Spec.TopologyRef, *basePath.Child("topologyRef"), r.Namespace)...) - - if len(errors) != 0 { - novaapilog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaAPI"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaAPI) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { - novaapilog.Info("validate update", "name", r.Name) - oldNovaAPI, ok := old.(*NovaAPI) - if !ok || oldNovaAPI == nil { - return nil, apierrors.NewInternalError(fmt.Errorf("unable to convert existing object")) - } - - novaapilog.Info("validate update", "diff", cmp.Diff(oldNovaAPI, r)) - - errors := field.ErrorList{} - basePath := field.NewPath("spec") - - // validate the service override key is valid - errors = append(errors, service.ValidateRoutedOverrides(basePath.Child("override").Child("service"), r.Spec.Override.Service)...) - - errors = append(errors, - ValidateAPIDefaultConfigOverwrite( - basePath.Child("defaultConfigOverwrite"), - r.Spec.DefaultConfigOverwrite)...) - - errors = append(errors, topologyv1.ValidateTopologyRef( - r.Spec.TopologyRef, *basePath.Child("topologyRef"), r.Namespace)...) - - if len(errors) != 0 { - novaapilog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaAPI"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (r *NovaAPI) ValidateDelete() (admission.Warnings, error) { - novaapilog.Info("validate delete", "name", r.Name) - - // TODO(user): fill in your validation logic upon object deletion. - return nil, nil -} - -// ValidateAPIDefaultConfigOverwrite validates the defaultConfigOverwrite for NovaAPI -func ValidateAPIDefaultConfigOverwrite( - basePath *field.Path, - defaultConfigOverwrite map[string]string, -) field.ErrorList { - return ValidateDefaultConfigOverwrite( - basePath, - defaultConfigOverwrite, - []string{"policy.yaml", "api-paste.ini"}) -} - -// ValidateTopology validates the referenced TopoRef.Namespace. -func (r *NovaAPITemplate) ValidateTopology( - basePath *field.Path, - namespace string, -) field.ErrorList { - return topologyv1.ValidateTopologyRef( - r.TopologyRef, - *basePath.Child("topologyRef"), - namespace, - ) -} diff --git a/api/v1beta1/novacell_types.go b/api/v1beta1/novacell_types.go deleted file mode 100644 index 7b35e9ddf..000000000 --- a/api/v1beta1/novacell_types.go +++ /dev/null @@ -1,323 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1" - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" - condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" - "github.com/openstack-k8s-operators/lib-common/modules/common/tls" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -const ( - // Cell0Name is the name of Cell0 cell that is mandatory in every deployment - Cell0Name = "cell0" -) - -// NovaCellTemplate defines the input parameters specified by the user to -// create a NovaCell via higher level CRDs. -type NovaCellTemplate struct { - // +kubebuilder:validation:Optional - // +kubebuilder:default=openstack - // CellDatabaseInstance is the name of the MariaDB CR to select the DB - // Service instance used as the DB of this cell. - CellDatabaseInstance string `json:"cellDatabaseInstance"` - - // +kubebuilder:validation:Required - // CellDatabaseAccount - MariaDBAccount to use when accessing the give cell DB - CellDatabaseAccount string `json:"cellDatabaseAccount"` - - // +kubebuilder:validation:Optional - // CellMessageBusInstance is the name of the RabbitMqCluster CR to select - // the Message Bus Service instance used by the nova services to - // communicate in this cell. For cell0 it is unused. - // Deprecated: Use MessagingBus.Cluster instead - CellMessageBusInstance string `json:"cellMessageBusInstance,omitempty"` - - // +kubebuilder:validation:Optional - // MessagingBus configuration (username, vhost, and cluster) - MessagingBus rabbitmqv1.RabbitMqConfig `json:"messagingBus,omitempty"` - - // +kubebuilder:validation:Required - // HasAPIAccess defines if this Cell is configured to have access to the - // API DB and message bus. - HasAPIAccess bool `json:"hasAPIAccess"` - - // +kubebuilder:validation:Optional - // NodeSelector to target subset of worker nodes running cell. - NodeSelector *map[string]string `json:"nodeSelector,omitempty"` - - // +kubebuilder:validation:Optional - // TopologyRef to apply the Topology defined by the associated CR referenced - // by name - TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"` - - // +kubebuilder:validation:Optional - // ConductorServiceTemplate - defines the cell conductor deployment for the cell. - ConductorServiceTemplate NovaConductorTemplate `json:"conductorServiceTemplate"` - - // +kubebuilder:validation:Optional - // MetadataServiceTemplate - defines the metadata service dedicated for the - // cell. Note that for cell0 metadata service should not be deployed. Also - // if metadata service needs to be deployed per cell here then it should - // not be enabled to be deployed on the top level via the Nova CR at the - // same time. By default Nova CR deploys the metadata service at the top - // level and disables it on the cell level. - MetadataServiceTemplate NovaMetadataTemplate `json:"metadataServiceTemplate"` - - // +kubebuilder:validation:Optional - // NoVNCProxyServiceTemplate - defines the novncproxy service dedicated for - // the cell. Note that for cell0 novncproxy should not be deployed so - // the enabled field of this template is defaulted to false in cell0 but - // defaulted to true in other cells. - NoVNCProxyServiceTemplate NovaNoVNCProxyTemplate `json:"noVNCProxyServiceTemplate"` - - // +kubebuilder:validation:Optional - // NovaComputeTemplates - map of nova computes template with selected drivers in format - // compute_name: compute_template. Key from map is arbitrary name for the compute with - // a limit of 20 characters. - NovaComputeTemplates map[string]NovaComputeTemplate `json:"novaComputeTemplates,omitempty"` - - // +kubebuilder:validation:Optional - // MemcachedInstance is the name of the Memcached CR that the services in the cell will use. - // If defined then this takes precedence over Nova.Spec.MemcachedInstance for this cel - MemcachedInstance string `json:"memcachedInstance"` - - // +kubebuilder:validation:Optional - // DBPurge defines the parameters for the DB archiving and purging cron job - DBPurge NovaCellDBPurge `json:"dbPurge"` -} - -// NovaCellSpec defines the desired state of NovaCell -type NovaCellSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // +kubebuilder:validation:Required - // CellName is the name of the Nova Cell. The value "cell0" has a special - // meaning. The "cell0" Cell cannot have compute nodes associated and the - // conductor in this cell acts as the super conductor for all the cells in - // the deployment. - CellName string `json:"cellName"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=60 - // +kubebuilder:validation:Minimum=10 - // APITimeout for Route and Apache - APITimeout int `json:"apiTimeout"` - - // +kubebuilder:validation:Required - // Secret is the name of the Secret instance containing password - // information for the nova cell. This secret is expected to be - // generated by the nova-operator based on the information passed to the - // Nova CR. - Secret string `json:"secret"` - - // +kubebuilder:validation:Optional - // NodeSelector to target subset of worker nodes running this services. - NodeSelector *map[string]string `json:"nodeSelector,omitempty"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=nova - // ServiceUser - optional username used for this service to register in - // keystone - ServiceUser string `json:"serviceUser"` - - // +kubebuilder:validation:Required - // KeystoneAuthURL - the URL that the service in the cell can use to talk - // to keystone - KeystoneAuthURL string `json:"keystoneAuthURL"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=regionOne - // Region - the region name to use for service endpoint discovery - Region string `json:"region"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=nova - // APIDatabaseAccount - MariaDBAccount to use when accessing the API DB - APIDatabaseAccount string `json:"apiDatabaseAccount"` - - // +kubebuilder:validation:Optional - // APIDatabaseHostname - hostname to use when accessing the API DB. If not - // provided then up-calls will be disabled. This filed is Required for - // cell0. - // TODO(gibi): Add a webhook to validate cell0 constraint - APIDatabaseHostname string `json:"apiDatabaseHostname"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=nova - // CellDatabaseAccount - MariaDBAccount to use when accessing the cell DB - CellDatabaseAccount string `json:"cellDatabaseAccount"` - - // +kubebuilder:validation:Required - // CellDatabaseHostname - hostname to use when accessing the cell DB - CellDatabaseHostname string `json:"cellDatabaseHostname"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=false - // PreserveJobs - do not delete jobs after they finished e.g. to check logs - PreserveJobs bool `json:"preserveJobs"` - - // +kubebuilder:validation:Required - // ConductorServiceTemplate - defines the cell conductor deployment for the cell - ConductorServiceTemplate NovaConductorTemplate `json:"conductorServiceTemplate"` - - // +kubebuilder:validation:Optional - // MetadataServiceTemplate - defines the metadata service dedicated for the cell. - MetadataServiceTemplate NovaMetadataTemplate `json:"metadataServiceTemplate"` - - // +kubebuilder:validation:Required - // NoVNCProxyServiceTemplate - defines the novncproxy service dedicated for - // the cell. - NoVNCProxyServiceTemplate NovaNoVNCProxyTemplate `json:"noVNCProxyServiceTemplate"` - - // +kubebuilder:validation:Optional - // NovaComputeTemplates - map of nova computes template with selected drivers in format - // compute_name: compute_template. Key from map is arbitrary name for the compute. - // because of that there is a 20 character limit on the compute name. - NovaComputeTemplates map[string]NovaComputeTemplate `json:"novaComputeTemplates,omitempty"` - - // +kubebuilder:validation:Required - // ServiceAccount - service account name used internally to provide Nova services the default SA name - ServiceAccount string `json:"serviceAccount"` - - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // TLS - Parameters related to the TLS - TLS tls.Ca `json:"tls,omitempty"` - - // +kubebuilder:validation:Required - // MemcachedInstance is the name of the Memcached CR that all nova service will use. - MemcachedInstance string `json:"memcachedInstance"` - - // +kubebuilder:validation:Optional - // DBPurge defines the parameters for the DB archiving and purging cron job - DBPurge NovaCellDBPurge `json:"dbPurge"` - - NovaCellImages `json:",inline"` - - // +kubebuilder:validation:Optional - // TopologyRef to apply the Topology defined by the associated CR referenced - // by name - TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"` -} - -// NovaCellDBPurge defines the parameters for the DB archiving and purging -// cron job -type NovaCellDBPurge struct { - // +kubebuilder:validation:Optional - // +kubebuilder:default="0 0 * * *" - // Schedule defines when to run the DB maintenance job in a cron format. - // By default it runs every midnight. - Schedule *string `json:"schedule"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=30 - // +kubebuilder:validation:Minimum=1 - // ArchiveAge defines the minimum age of the records in days that can be - // moved to the shadow tables. - ArchiveAge *int `json:"archiveAge"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=90 - // +kubebuilder:validation:Minimum=1 - // PurgeAge defines the minimum age of the records in days that can be - // deleted from the shadow tables - PurgeAge *int `json:"purgeAge"` -} - -// NovaCellStatus defines the observed state of NovaCell -type NovaCellStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file - // Map of hashes to track e.g. job status - Hash map[string]string `json:"hash,omitempty"` - - // Conditions - Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"` - - // ConductorServiceReadyCount defines the number of replicas ready from - // nova-conductor service in the cell - ConductorServiceReadyCount int32 `json:"conductorServiceReadyCount,omitempty"` - - // MetadataServiceReadyCount defines the number of replicas ready from - // nova-metadata service in the cell - MetadataServiceReadyCount int32 `json:"metadataServiceReadyCount,omitempty"` - - // NoVNCPRoxyServiceReadyCount defines the number of replicas ready from - // nova-novncproxy service in the cell - NoVNCPRoxyServiceReadyCount int32 `json:"noVNCProxyServiceReadyCount,omitempty"` - - // NovaComputesStatus is a map with format cell_name: NovaComputeCellStatus - // where NovaComputeCellStatus tell if compute with selected name deployed successfully - // and indicates if the compute is successfully mapped to the cell in - // the nova_api database. - // When a compute is removed from the Spec the operator will delete the - // related NovaCompute CR and then remove the compute from this Status field. - NovaComputesStatus map[string]NovaComputeCellStatus `json:"novaComputesStatus,omitempty"` - - // ObservedGeneration - the most recent generation observed for this - // service. If the observed generation is less than the spec generation, - // then the controller has not processed the latest changes injected by - // the openstack-operator in the top-level CR (e.g. the ContainerImage) - ObservedGeneration int64 `json:"observedGeneration,omitempty"` -} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status - -// NovaCell is the Schema for the novacells API -type NovaCell struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec NovaCellSpec `json:"spec,omitempty"` - Status NovaCellStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// NovaCellList contains a list of NovaCell -type NovaCellList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []NovaCell `json:"items"` -} - -func init() { - SchemeBuilder.Register(&NovaCell{}, &NovaCellList{}) -} - -// GetConditions returns the list of conditions from the status -func (s NovaCellStatus) GetConditions() condition.Conditions { - return s.Conditions -} - -// IsReady returns true if the Cell reconciled successfully -func (instance NovaCell) IsReady() bool { - return instance.Status.Conditions.IsTrue(condition.ReadyCondition) -} - -// GetSecret returns the value of the NovaCell.Spec.Secret -func (instance NovaCell) GetSecret() string { - return instance.Spec.Secret -} diff --git a/api/v1beta1/novacell_webhook.go b/api/v1beta1/novacell_webhook.go deleted file mode 100644 index 96153652d..000000000 --- a/api/v1beta1/novacell_webhook.go +++ /dev/null @@ -1,249 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// -// Generated by: -// -// operator-sdk create webhook --group nova --version v1beta1 --kind NovaCell --programmatic-validation --defaulting -// - -package v1beta1 - -import ( - "fmt" - "regexp" - - "github.com/google/go-cmp/cmp" - apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/webhook" - "sigs.k8s.io/controller-runtime/pkg/webhook/admission" - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" -) - -// CRDNameRegex is the regex pattern for validating CRD names -const CRDNameRegex = "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$" - -// NovaCellDefaults - -type NovaCellDefaults struct { - ConductorContainerImageURL string - MetadataContainerImageURL string - NoVNCContainerImageURL string - NovaComputeContainerImageURL string -} - -var novaCellDefaults NovaCellDefaults - -// log is for logging in this package. -var novacelllog = logf.Log.WithName("novacell-resource") - -// SetupNovaCellDefaults - initialize NovaCell spec defaults for use with either internal or external webhooks -func SetupNovaCellDefaults(defaults NovaCellDefaults) { - novaCellDefaults = defaults - novacelllog.Info("NovaCell defaults initialized", "defaults", defaults) -} - -var _ webhook.Defaulter = &NovaCell{} - -// Default implements webhook.Defaulter so a webhook will be registered for the type -func (r *NovaCell) Default() { - novacelllog.Info("default", "name", r.Name) - - r.Spec.Default() -} - -// Default - set defaults for this NovaCell spec -func (spec *NovaCellSpec) Default() { - spec.NovaCellImages.Default(novaCellDefaults) - - if spec.MetadataServiceTemplate.Enabled == nil { - spec.MetadataServiceTemplate.Enabled = ptr.To(false) - } - - if spec.CellName == Cell0Name { - // in cell0 disable VNC by default - if spec.NoVNCProxyServiceTemplate.Enabled == nil { - spec.NoVNCProxyServiceTemplate.Enabled = ptr.To(false) - } - } else { - // in other cells enable VNC by default - if spec.NoVNCProxyServiceTemplate.Enabled == nil { - spec.NoVNCProxyServiceTemplate.Enabled = ptr.To(true) - } - } -} - -var _ webhook.Validator = &NovaCell{} - -func (spec *NovaCellSpec) validate(basePath *field.Path, namespace string) field.ErrorList { - var errors field.ErrorList - - if spec.CellName == Cell0Name { - errors = append( - errors, spec.MetadataServiceTemplate.ValidateCell0( - basePath.Child("metadataServiceTemplate"))..., - ) - errors = append( - errors, spec.NoVNCProxyServiceTemplate.ValidateCell0( - basePath.Child("noVNCProxyServiceTemplate"))..., - ) - errors = append( - errors, - ValidateNovaComputeCell0( - basePath.Child("novaComputeTemplates"), len(spec.NovaComputeTemplates))...) - } - - // validate topology if passed to the CellSpec (regardless of CellName). - // because a NovaCell CR can be created independently, TopologyRef should - // be validated for the underlying components (metadata, conductor, - // novncproxy, compute templates). - errors = append(errors, topologyv1.ValidateTopologyRef( - spec.TopologyRef, *basePath.Child("topologyRef"), namespace)...) - - errors = append(errors, - spec.MetadataServiceTemplate.ValidateTopology( - basePath.Child("metadataServiceTemplate"), - namespace)...) - - errors = append(errors, - spec.NoVNCProxyServiceTemplate.ValidateTopology( - basePath.Child("noVNCProxyServiceTemplate"), - namespace)...) - - errors = append(errors, - spec.ConductorServiceTemplate.ValidateTopology( - basePath.Child("conductorServiceTemplate"), - namespace)...) - - for computeName, computeTemplate := range spec.NovaComputeTemplates { - if computeTemplate.ComputeDriver == IronicDriver { - errors = append( - errors, computeTemplate.ValidateIronicDriverReplicas( - basePath.Child("novaComputeTemplates").Key(computeName))..., - ) - } - errors = append( - errors, ValidateNovaComputeName( - basePath.Child("novaComputeTemplates").Key(computeName), computeName)..., - ) - errors = append( - errors, computeTemplate.ValidateDefaultConfigOverwrite( - basePath.Child("novaComputeTemplates").Key(computeName))..., - ) - - errors = append( - errors, computeTemplate.ValidateTopology( - basePath.Child("novaComputeTemplates").Key(computeName), namespace)..., - ) - } - - errors = append( - errors, ValidateCellName( - basePath.Child("cellName"), spec.CellName)..., - ) - errors = append( - errors, - spec.DBPurge.Validate(basePath.Child("dbPurge"))..., - ) - - return errors -} - -// ValidateCreate validates the NovaCellSpec during the webhook invocation -func (spec *NovaCellSpec) ValidateCreate(basePath *field.Path, namespace string) field.ErrorList { - return spec.validate(basePath, namespace) -} - -// ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaCell) ValidateCreate() (admission.Warnings, error) { - novacelllog.Info("validate create", "name", r.Name) - errors := field.ErrorList{} - basePath := field.NewPath("spec") - - errors = r.Spec.ValidateCreate(basePath, r.Namespace) - - if len(errors) != 0 { - novacelllog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaCell"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateUpdate validates the NovaCellSpec during the webhook invocation -func (spec *NovaCellSpec) ValidateUpdate(old NovaCellSpec, basePath *field.Path, namespace string) field.ErrorList { - return spec.validate(basePath, namespace) -} - -// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaCell) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { - novacelllog.Info("validate update", "name", r.Name) - errors := field.ErrorList{} - basePath := field.NewPath("spec") - - oldCell, ok := old.(*NovaCell) - if !ok || oldCell == nil { - return nil, apierrors.NewInternalError(fmt.Errorf("unable to convert existing object")) - } - - novacelllog.Info("validate update", "diff", cmp.Diff(oldCell, r)) - - errors = r.Spec.ValidateUpdate(oldCell.Spec, basePath, r.Namespace) - - if len(errors) != 0 { - novacelllog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaCell"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (r *NovaCell) ValidateDelete() (admission.Warnings, error) { - novacelllog.Info("validate delete", "name", r.Name) - - // TODO(user): fill in your validation logic upon object deletion. - return nil, nil -} - -// ValidateCellName validates the cell name. It is expected to be called -// from various webhooks. -func ValidateCellName(path *field.Path, cellName string) field.ErrorList { - var errors field.ErrorList - if len(cellName) > 35 { - errors = append( - errors, - field.Invalid( - path, cellName, "should be shorter than 36 characters"), - ) - } - match, _ := regexp.MatchString(CRDNameRegex, cellName) - if !match { - errors = append( - errors, - field.Invalid( - path, cellName, - fmt.Sprintf("should match with the regex '%s'", CRDNameRegex)), - ) - } - return errors -} diff --git a/api/v1beta1/novacompute_types.go b/api/v1beta1/novacompute_types.go deleted file mode 100644 index 38e725ae7..000000000 --- a/api/v1beta1/novacompute_types.go +++ /dev/null @@ -1,261 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" - condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" - "github.com/openstack-k8s-operators/lib-common/modules/common/tls" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// NovaComputeTemplate defines the input parameters specified by the user to -// create a NovaCompute via higher level CRDs. -type NovaComputeTemplate struct { - // +kubebuilder:validation:Optional - // +kubebuilder:default=1 - // +kubebuilder:validation:Maximum=32 - // +kubebuilder:validation:Minimum=0 - // Replicas of the service to run. For ironic.IronicDriver the max replica is 1 - Replicas *int32 `json:"replicas"` - - // +kubebuilder:validation:Optional - // NodeSelector to target subset of worker nodes running this service. Setting here overrides - // any global NodeSelector settings within the Nova CR. - NodeSelector *map[string]string `json:"nodeSelector,omitempty"` - - // +kubebuilder:validation:Optional - // TopologyRef to apply the Topology defined by the associated CR referenced - // by name - TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"` - // +kubebuilder:validation:Optional - // CustomServiceConfig - customize the service config using this parameter to change service defaults, - // or overwrite rendered information using raw OpenStack config format. The content gets added to - // to /etc//.conf.d directory as custom.conf file. - CustomServiceConfig string `json:"customServiceConfig"` - - // +kubebuilder:validation:Optional - // DefaultConfigOverwrite - interface to overwrite default config files like e.g. provider.yaml - DefaultConfigOverwrite map[string]string `json:"defaultConfigOverwrite,omitempty"` - - // +kubebuilder:validation:Optional - // Resources - Compute Resources required by this service (Limits/Requests). - // https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - Resources corev1.ResourceRequirements `json:"resources,omitempty"` - - // +kubebuilder:validation:Optional - // NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network - NetworkAttachments []string `json:"networkAttachments,omitempty"` - - // +kubebuilder:validation:Required - // +kubebuilder:validation:Enum=ironic.IronicDriver;fake.FakeDriver - // ComputeDriver - defines which driver to use for controlling virtualization - ComputeDriver string `json:"computeDriver"` -} - -// NovaComputeSpec defines the desired state of NovaCompute -type NovaComputeSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // +kubebuilder:validation:Required - // CellName is the name of the Nova Cell this NovaCompute belongs to. - CellName string `json:"cellName"` - - // +kubebuilder:validation:Required - // ComputeName - compute name. - ComputeName string `json:"computeName"` - - // +kubebuilder:validation:Required - // Secret is the name of the Secret instance containing password - // information for the NovaCompute service. This secret is expected to be - // generated by the nova-operator based on the information passed to the - // Nova CR. - Secret string `json:"secret"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default="nova" - // ServiceUser - optional username used for this service to register in - // keystone - ServiceUser string `json:"serviceUser"` - - // +kubebuilder:validation:Required - KeystoneAuthURL string `json:"keystoneAuthURL"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=regionOne - // Region - the region name to use for service endpoint discovery - Region string `json:"region"` - - // NovaServiceBase specifies the generic fields of the service - NovaServiceBase `json:",inline"` - - // +kubebuilder:validation:Required - // ServiceAccount - service account name used internally to provide Nova services the default SA name - ServiceAccount string `json:"serviceAccount"` - - // +kubebuilder:validation:Required - // +kubebuilder:validation:Enum=ironic.IronicDriver;fake.FakeDriver - // ComputeDriver defines which driver to use for controlling virtualization - ComputeDriver string `json:"computeDriver"` - - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // TLS - Parameters related to the TLS - TLS tls.Ca `json:"tls,omitempty"` - - // +kubebuilder:validation:Optional - // DefaultConfigOverwrite - interface to overwrite default config files like e.g. provider.yaml - DefaultConfigOverwrite map[string]string `json:"defaultConfigOverwrite,omitempty"` -} - -// NovaComputeStatus defines the observed state of NovaCompute -type NovaComputeStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Map of hashes to track e.g. job status - Hash map[string]string `json:"hash,omitempty"` - - // Conditions - Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"` - - // ReadyCount defines the number of replicas ready from NovaCompute - ReadyCount int32 `json:"readyCount,omitempty"` - - // NetworkAttachments status of the deployment pods - NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"` - - // ObservedGeneration - the most recent generation observed for this - // service. If the observed generation is less than the spec generation, - // then the controller has not processed the latest changes injected by - // the openstack-operator in the top-level CR (e.g. the ContainerImage) - ObservedGeneration int64 `json:"observedGeneration,omitempty"` - - // LastAppliedTopology - the last applied Topology - LastAppliedTopology *topologyv1.TopoRef `json:"lastAppliedTopology,omitempty"` -} - -// NovaComputeCellStatus defines state of NovaCompute in cell -type NovaComputeCellStatus struct { - // Deployed value: true means that the compute is deployed but can still be undiscovered - Deployed bool `json:"deployed"` - // Errors value True means that during deployment, errors appear, and the user needs to check the compute for problems - Errors bool `json:"errors"` -} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:printcolumn:name="NetworkAttachments",type="string",JSONPath=".spec.networkAttachments",description="NetworkAttachments" -//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status" -//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message" - -// NovaCompute is the Schema for the NovaCompute -type NovaCompute struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec NovaComputeSpec `json:"spec,omitempty"` - Status NovaComputeStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// NovaComputeList contains a list of NovaCompute -type NovaComputeList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []NovaCompute `json:"items"` -} - -func init() { - SchemeBuilder.Register(&NovaCompute{}, &NovaComputeList{}) -} - -// GetConditions returns the list of conditions from the status -func (s NovaComputeStatus) GetConditions() condition.Conditions { - return s.Conditions -} - -// GetSecret returns the value of the NovaCompute.Spec.Secret -func (n NovaCompute) GetSecret() string { - return n.Spec.Secret -} - -// IsReady returns true if the Cell reconciled successfully -func (n NovaCompute) IsReady() bool { - return n.Status.Conditions.IsTrue(condition.ReadyCondition) -} - -// NewNovaComputeSpec constructs a NewNovaComputeSpec -func NewNovaComputeSpec( - novaCell NovaCellSpec, - computeTemplate NovaComputeTemplate, - novaComputeName string, -) NovaComputeSpec { - novaComputeSpec := NovaComputeSpec{ - CellName: novaCell.CellName, - ComputeName: novaComputeName, - Secret: novaCell.Secret, - NovaServiceBase: NovaServiceBase{ - ContainerImage: novaCell.NovaComputeContainerImageURL, - Replicas: computeTemplate.Replicas, - NodeSelector: computeTemplate.NodeSelector, - TopologyRef: computeTemplate.TopologyRef, - CustomServiceConfig: computeTemplate.CustomServiceConfig, - Resources: computeTemplate.Resources, - NetworkAttachments: computeTemplate.NetworkAttachments, - }, - KeystoneAuthURL: novaCell.KeystoneAuthURL, - ServiceUser: novaCell.ServiceUser, - Region: novaCell.Region, - ServiceAccount: novaCell.ServiceAccount, - ComputeDriver: computeTemplate.ComputeDriver, - TLS: novaCell.TLS, - DefaultConfigOverwrite: computeTemplate.DefaultConfigOverwrite, - } - - if novaComputeSpec.NodeSelector == nil { - novaComputeSpec.NodeSelector = novaCell.NodeSelector - } - - if novaComputeSpec.TopologyRef == nil { - novaComputeSpec.TopologyRef = novaCell.TopologyRef - } - - return novaComputeSpec -} - -// GetSpecTopologyRef - Returns the LastAppliedTopology Set in the Status -func (n *NovaCompute) GetSpecTopologyRef() *topologyv1.TopoRef { - return n.Spec.TopologyRef -} - -// GetLastAppliedTopology - Returns the LastAppliedTopology Set in the Status -func (n *NovaCompute) GetLastAppliedTopology() *topologyv1.TopoRef { - return n.Status.LastAppliedTopology -} - -// SetLastAppliedTopology - Sets the LastAppliedTopology value in the Status -func (n *NovaCompute) SetLastAppliedTopology(topologyRef *topologyv1.TopoRef) { - n.Status.LastAppliedTopology = topologyRef -} diff --git a/api/v1beta1/novacompute_webhook.go b/api/v1beta1/novacompute_webhook.go deleted file mode 100644 index c3d06916a..000000000 --- a/api/v1beta1/novacompute_webhook.go +++ /dev/null @@ -1,226 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// -// Generated by: -// -// operator-sdk create webhook --group nova --version v1beta1 --kind NovaCompute --programmatic-validation --defaulting -// - -package v1beta1 - -import ( - "fmt" - "regexp" - - "github.com/google/go-cmp/cmp" - apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/validation/field" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/webhook" - "sigs.k8s.io/controller-runtime/pkg/webhook/admission" - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" -) - -// NovaComputeDefaults - -type NovaComputeDefaults struct { - ContainerImageURL string -} - -var novaComputeDefaults NovaComputeDefaults - -// log is for logging in this package. -var novacomputelog = logf.Log.WithName("novacompute-resource") - -// SetupNovaComputeDefaults - initialize NovaCompute spec defaults for use with either internal or external webhooks -func SetupNovaComputeDefaults(defaults NovaComputeDefaults) { - novaComputeDefaults = defaults - novacomputelog.Info("NovaCompute defaults initialized", "defaults", defaults) -} - -var _ webhook.Defaulter = &NovaCompute{} - -// Default implements webhook.Defaulter so a webhook will be registered for the type -func (r *NovaCompute) Default() { - novacomputelog.Info("default", "name", r.Name) - - r.Spec.Default() -} - -// Default - set defaults for this novacompute spec -func (spec *NovaComputeSpec) Default() { - if spec.ContainerImage == "" { - spec.ContainerImage = novaComputeDefaults.ContainerImageURL - } -} - -var _ webhook.Validator = &NovaCompute{} - -// ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaCompute) ValidateCreate() (admission.Warnings, error) { - novacomputelog.Info("validate create", "name", r.Name) - - errors := r.Spec.ValidateCreate(field.NewPath("spec"), r.Namespace) - - if len(errors) != 0 { - novacomputelog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaCompute"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaCompute) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { - novacomputelog.Info("validate update", "name", r.Name) - oldNovaCompute, ok := old.(*NovaCompute) - if !ok || oldNovaCompute == nil { - return nil, apierrors.NewInternalError(fmt.Errorf("unable to convert existing object")) - } - - novacomputelog.Info("validate update", "diff", cmp.Diff(oldNovaCompute, r)) - - errors := r.Spec.ValidateUpdate(oldNovaCompute.Spec, field.NewPath("spec"), r.Namespace) - - if len(errors) != 0 { - novacomputelog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaCompute"}, - r.Name, errors) - } - - return nil, nil -} - -// ValidateCreate validates the NovaComputeSpec during the webhook invocation -func (spec *NovaComputeSpec) ValidateCreate(basePath *field.Path, namespace string) field.ErrorList { - return spec.validate(basePath, namespace) -} - -// ValidateUpdate validates the NovaComputeSpec during the webhook invocation -func (spec *NovaComputeSpec) ValidateUpdate(old NovaComputeSpec, basePath *field.Path, namespace string) field.ErrorList { - return spec.validate(basePath, namespace) -} - -// ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (r *NovaCompute) ValidateDelete() (admission.Warnings, error) { - novacomputelog.Info("validate delete", "name", r.Name) - - // TODO(user): fill in your validation logic upon object deletion. - return nil, nil -} - -func (spec *NovaComputeSpec) validate(basePath *field.Path, namespace string) field.ErrorList { - var errors field.ErrorList - - if spec.ComputeDriver == IronicDriver && *spec.NovaServiceBase.Replicas > 1 { - errors = append( - errors, - field.Invalid( - basePath.Child("replicas"), *spec.NovaServiceBase.Replicas, "should be max 1 for ironic.IronicDriver"), - ) - } - errors = append( - errors, - ValidateComputeDefaultConfigOverwrite( - basePath.Child("defaultConfigOverwrite"), spec.DefaultConfigOverwrite)...) - - errors = append(errors, topologyv1.ValidateTopologyRef( - spec.TopologyRef, *basePath.Child("topologyRef"), namespace)...) - - return errors -} - -// ValidateIronicDriverReplicas validates replicas depend on compute driver -func (r *NovaComputeTemplate) ValidateIronicDriverReplicas(basePath *field.Path) field.ErrorList { - var errors field.ErrorList - if *r.Replicas > 1 { - errors = append( - errors, - field.Invalid( - basePath.Child("replicas"), *r.Replicas, "should be max 1 for ironic.IronicDriver"), - ) - } - return errors -} - -// ValidateDefaultConfigOverwrite validates the defaultConfigOverwrite for NovaComputeTemplate -func (r *NovaComputeTemplate) ValidateDefaultConfigOverwrite(basePath *field.Path) field.ErrorList { - return ValidateComputeDefaultConfigOverwrite( - basePath.Child("defaultConfigOverwrite"), r.DefaultConfigOverwrite) -} - -// ValidateComputeDefaultConfigOverwrite validates the defaultConfigOverwrite for NovaCompute -func ValidateComputeDefaultConfigOverwrite( - basePath *field.Path, - defaultConfigOverwrite map[string]string, -) field.ErrorList { - return ValidateDefaultConfigOverwrite( - basePath, defaultConfigOverwrite, []string{"provider*.yaml"}) -} - -// ValidateNovaComputeName validates the compute name. It is expected to be called -// from various webhooks. -func ValidateNovaComputeName(path *field.Path, computeName string) field.ErrorList { - var errors field.ErrorList - if len(computeName) > 20 { - errors = append( - errors, - field.Invalid( - path, computeName, "should be shorter than 20 characters"), - ) - } - match, _ := regexp.MatchString(CRDNameRegex, computeName) - if !match { - errors = append( - errors, - field.Invalid( - path, computeName, - fmt.Sprintf("should match with the regex '%s'", CRDNameRegex)), - ) - } - return errors -} - -// ValidateNovaComputeCell0 validates cell0 NoVNCProxy template. This is expected to be -// called by higher level validation webhooks -func ValidateNovaComputeCell0(basePath *field.Path, mapLength int) field.ErrorList { - var errors field.ErrorList - if mapLength > 0 { - errors = append( - errors, - field.Invalid( - basePath, "novaComputeTemplates", "should have zero elements for cell0"), - ) - } - return errors -} - - -// ValidateTopology validates the referenced TopoRef.Namespace. -func (r *NovaComputeTemplate) ValidateTopology( - basePath *field.Path, - namespace string, -) field.ErrorList { - return topologyv1.ValidateTopologyRef( - r.TopologyRef, - *basePath.Child("topologyRef"), - namespace, - ) -} diff --git a/api/v1beta1/novaconductor_types.go b/api/v1beta1/novaconductor_types.go deleted file mode 100644 index bcdda55fd..000000000 --- a/api/v1beta1/novaconductor_types.go +++ /dev/null @@ -1,285 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" - condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" - "github.com/openstack-k8s-operators/lib-common/modules/common/tls" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// NovaConductorTemplate defines the input parameters specified by the user to -// create a NovaConductor via higher level CRDs. -type NovaConductorTemplate struct { - // +kubebuilder:validation:Optional - // +kubebuilder:default=1 - // +kubebuilder:validation:Maximum=32 - // +kubebuilder:validation:Minimum=0 - // Replicas of the service to run - Replicas *int32 `json:"replicas"` - - // +kubebuilder:validation:Optional - // NodeSelector to target subset of worker nodes running this service. Setting here overrides - // any global NodeSelector settings within the Nova CR. - NodeSelector *map[string]string `json:"nodeSelector,omitempty"` - - // +kubebuilder:validation:Optional - // CustomServiceConfig - customize the service config using this parameter to change service defaults, - // or overwrite rendered information using raw OpenStack config format. The content gets added to - // to /etc//.conf.d directory as custom.conf file. - CustomServiceConfig string `json:"customServiceConfig"` - - // +kubebuilder:validation:Optional - // Resources - Compute Resources required by this service (Limits/Requests). - // https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - Resources corev1.ResourceRequirements `json:"resources,omitempty"` - - // +kubebuilder:validation:Optional - // NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network - NetworkAttachments []string `json:"networkAttachments,omitempty"` - - // +kubebuilder:validation:Optional - // TopologyRef to apply the Topology defined by the associated CR referenced - // by name - TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"` -} - -// NovaConductorSpec defines the desired state of NovaConductor -type NovaConductorSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // +kubebuilder:validation:Required - // CellName is the name of the Nova Cell this conductor belongs to. - CellName string `json:"cellName"` - - // +kubebuilder:validation:Required - // Secret is the name of the Secret instance containing password - // information for the nova-conductor service. This secret is expected to - // be generated by the nova-operator based on the information passed to the - // Nova CR. - Secret string `json:"secret"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=nova - // ServiceUser - optional username used for this service to register in - // keystone - ServiceUser string `json:"serviceUser"` - - // +kubebuilder:validation:Required - // KeystoneAuthURL - the URL that the nova-conductor service can use to - // talk to keystone - KeystoneAuthURL string `json:"keystoneAuthURL"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=regionOne - // Region - the region name to use for service endpoint discovery - Region string `json:"region"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=nova - // APIDatabaseAccount - MariaDBAccount to use when accessing the API DB - APIDatabaseAccount string `json:"apiDatabaseAccount"` - - // +kubebuilder:validation:Optional - // APIDatabaseHostname - hostname to use when accessing the API DB. If not - // provided then up-calls will be disabled. This filed is Required for - // cell0. - // TODO(gibi): Add a webhook to validate cell0 constraint - APIDatabaseHostname string `json:"apiDatabaseHostname"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=nova - // CellDatabaseAccount - MariaDBAccount to use when accessing the cell DB - CellDatabaseAccount string `json:"cellDatabaseAccount"` - - // +kubebuilder:validation:Optional - // NOTE(gibi): This should be Required, see notes in KeystoneAuthURL - // CellDatabaseHostname - hostname to use when accessing the cell DB - CellDatabaseHostname string `json:"cellDatabaseHostname"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=false - // PreserveJobs - do not delete jobs after they finished e.g. to check logs - PreserveJobs bool `json:"preserveJobs"` - - // NovaServiceBase specifies the generic fields of the service - NovaServiceBase `json:",inline"` - - // +kubebuilder:validation:Required - // ServiceAccount - service account name used internally to provide Nova services the default SA name - ServiceAccount string `json:"serviceAccount"` - - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // TLS - Parameters related to the TLS - TLS tls.Ca `json:"tls,omitempty"` - - // +kubebuilder:validation:Required - // MemcachedInstance is the name of the Memcached CR that all nova service will use. - MemcachedInstance string `json:"memcachedInstance"` - - // +kubebuilder:validation:Optional - // DBPurge defines the parameters for the DB archiving and purging cron job - DBPurge NovaCellDBPurge `json:"dbPurge"` -} - -// NovaConductorStatus defines the observed state of NovaConductor -type NovaConductorStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Map of hashes to track e.g. job status - Hash map[string]string `json:"hash,omitempty"` - - // Conditions - Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"` - - // ReadyCount defines the number of replicas ready from nova-conductor - ReadyCount int32 `json:"readyCount,omitempty"` - - // NetworkAttachments status of the deployment pods - NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"` - - // ObservedGeneration - the most recent generation observed for this - // service. If the observed generation is less than the spec generation, - // then the controller has not processed the latest changes injected by - // the openstack-operator in the top-level CR (e.g. the ContainerImage) - ObservedGeneration int64 `json:"observedGeneration,omitempty"` - - // LastAppliedTopology - the last applied Topology - LastAppliedTopology *topologyv1.TopoRef `json:"lastAppliedTopology,omitempty"` -} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:printcolumn:name="NetworkAttachments",type="string",JSONPath=".spec.networkAttachments",description="NetworkAttachments" -//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status" -//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message" - -// NovaConductor is the Schema for the novaconductors API -type NovaConductor struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec NovaConductorSpec `json:"spec,omitempty"` - Status NovaConductorStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// NovaConductorList contains a list of NovaConductor -type NovaConductorList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []NovaConductor `json:"items"` -} - -func init() { - SchemeBuilder.Register(&NovaConductor{}, &NovaConductorList{}) -} - -// GetConditions returns the list of conditions from the status -func (s NovaConductorStatus) GetConditions() condition.Conditions { - return s.Conditions -} - -// NewNovaConductorSpec constructs a NovaConductorSpec -func NewNovaConductorSpec( - novaCell NovaCellSpec, -) NovaConductorSpec { - conductorSpec := NovaConductorSpec{ - CellName: novaCell.CellName, - Secret: novaCell.Secret, - CellDatabaseHostname: novaCell.CellDatabaseHostname, - CellDatabaseAccount: novaCell.CellDatabaseAccount, - APIDatabaseHostname: novaCell.APIDatabaseHostname, - APIDatabaseAccount: novaCell.APIDatabaseAccount, - NovaServiceBase: NovaServiceBase{ - ContainerImage: novaCell.ConductorContainerImageURL, - Replicas: novaCell.ConductorServiceTemplate.Replicas, - NodeSelector: novaCell.ConductorServiceTemplate.NodeSelector, - TopologyRef: novaCell.ConductorServiceTemplate.TopologyRef, - CustomServiceConfig: novaCell.ConductorServiceTemplate.CustomServiceConfig, - Resources: novaCell.ConductorServiceTemplate.Resources, - NetworkAttachments: novaCell.ConductorServiceTemplate.NetworkAttachments, - }, - KeystoneAuthURL: novaCell.KeystoneAuthURL, - ServiceUser: novaCell.ServiceUser, - Region: novaCell.Region, - ServiceAccount: novaCell.ServiceAccount, - TLS: novaCell.TLS, - PreserveJobs: novaCell.PreserveJobs, - MemcachedInstance: novaCell.MemcachedInstance, - DBPurge: novaCell.DBPurge, - } - - if conductorSpec.NodeSelector == nil { - conductorSpec.NodeSelector = novaCell.NodeSelector - } - - if conductorSpec.TopologyRef == nil { - conductorSpec.TopologyRef = novaCell.TopologyRef - } - - return conductorSpec -} - -// GetSecret returns the value of the NovaConductor.Spec.Secret -func (n NovaConductor) GetSecret() string { - return n.Spec.Secret -} - -// GetKeystoneAuthURL returns the KeystoneAuthURL from the Spec -func (n NovaConductor) GetKeystoneAuthURL() string { - return n.Spec.KeystoneAuthURL -} - -// GetKeystoneUser returns the Service user from the Spec -func (n NovaConductor) GetKeystoneUser() string { - return n.Spec.ServiceUser -} - -// GetCABundleSecretName returns the TLS CA bundle name from the Spec -func (n NovaConductor) GetCABundleSecretName() string { - return n.Spec.TLS.CaBundleSecretName -} - -// GetRegion returns the Region from the Spec -func (n NovaConductor) GetRegion() string { - return n.Spec.Region -} - -// GetSpecTopologyRef - Returns the LastAppliedTopology Set in the Status -func (n *NovaConductor) GetSpecTopologyRef() *topologyv1.TopoRef { - return n.Spec.TopologyRef -} - -// GetLastAppliedTopology - Returns the LastAppliedTopology Set in the Status -func (n *NovaConductor) GetLastAppliedTopology() *topologyv1.TopoRef { - return n.Status.LastAppliedTopology -} - -// SetLastAppliedTopology - Sets the LastAppliedTopology value in the Status -func (n *NovaConductor) SetLastAppliedTopology(topologyRef *topologyv1.TopoRef) { - n.Status.LastAppliedTopology = topologyRef -} diff --git a/api/v1beta1/novaconductor_webhook.go b/api/v1beta1/novaconductor_webhook.go deleted file mode 100644 index 26c23e9a8..000000000 --- a/api/v1beta1/novaconductor_webhook.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// -// Generated by: -// -// operator-sdk create webhook --group nova --version v1beta1 --kind NovaConductor --programmatic-validation --defaulting -// - -package v1beta1 - -import ( - "fmt" - - "github.com/google/go-cmp/cmp" - apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/validation/field" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/webhook" - "sigs.k8s.io/controller-runtime/pkg/webhook/admission" - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" -) - -// NovaConductorDefaults - -type NovaConductorDefaults struct { - ContainerImageURL string -} - -var novaConductorDefaults NovaConductorDefaults - -// log is for logging in this package. -var novaconductorlog = logf.Log.WithName("novaconductor-resource") - -// SetupNovaConductorDefaults - initialize NovaConductor spec defaults for use with either internal or external webhooks -func SetupNovaConductorDefaults(defaults NovaConductorDefaults) { - novaConductorDefaults = defaults - novaconductorlog.Info("NovaConductor defaults initialized", "defaults", defaults) -} - -var _ webhook.Defaulter = &NovaConductor{} - -// Default implements webhook.Defaulter so a webhook will be registered for the type -func (r *NovaConductor) Default() { - novaconductorlog.Info("default", "name", r.Name) - - r.Spec.Default() -} - -// Default - set defaults for this NovaConductor spec -func (spec *NovaConductorSpec) Default() { - if spec.ContainerImage == "" { - spec.ContainerImage = novaConductorDefaults.ContainerImageURL - } -} - -var _ webhook.Validator = &NovaConductor{} - -// ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaConductor) ValidateCreate() (admission.Warnings, error) { - novaconductorlog.Info("validate create", "name", r.Name) - errors := field.ErrorList{} - basePath := field.NewPath("spec") - - errors = append(errors,r.Spec.DBPurge.Validate( - basePath.Child("dbPurge"))...) - - errors = append(errors, topologyv1.ValidateTopologyRef( - r.Spec.TopologyRef, *basePath.Child("topologyRef"), r.Namespace)...) - - if len(errors) != 0 { - novaconductorlog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaConductor"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaConductor) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { - novaconductorlog.Info("validate update", "name", r.Name) - errors := field.ErrorList{} - basePath := field.NewPath("spec") - - oldConductor, ok := old.(*NovaConductor) - if !ok || oldConductor == nil { - return nil, apierrors.NewInternalError(fmt.Errorf("unable to convert existing object")) - } - - novaconductorlog.Info("validate update", "diff", cmp.Diff(oldConductor, r)) - - errors = append(errors, r.Spec.DBPurge.Validate( - basePath.Child("dbPurge"))...) - - errors = append(errors, topologyv1.ValidateTopologyRef( - r.Spec.TopologyRef, *basePath.Child("topologyRef"), r.Namespace)...) - - if len(errors) != 0 { - novaconductorlog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaConductor"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (r *NovaConductor) ValidateDelete() (admission.Warnings, error) { - novaconductorlog.Info("validate delete", "name", r.Name) - - // TODO(user): fill in your validation logic upon object deletion. - return nil, nil -} - -// ValidateTopology validates the referenced TopoRef.Namespace. -func (r *NovaConductorTemplate) ValidateTopology( - basePath *field.Path, - namespace string, -) field.ErrorList { - return topologyv1.ValidateTopologyRef( - r.TopologyRef, - *basePath.Child("topologyRef"), - namespace, - ) -} diff --git a/api/v1beta1/novametadata_types.go b/api/v1beta1/novametadata_types.go deleted file mode 100644 index a39595201..000000000 --- a/api/v1beta1/novametadata_types.go +++ /dev/null @@ -1,321 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" - condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" - service "github.com/openstack-k8s-operators/lib-common/modules/common/service" - "github.com/openstack-k8s-operators/lib-common/modules/common/tls" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// NovaMetadataTemplate defines the input parameters specified by the user to -// create a NovaMetadata via higher level CRDs. -type NovaMetadataTemplate struct { - // +kubebuilder:validation:Optional - // Enabled - Whether NovaMetadata services should be deployed and managed. - // If it is set to false then the related NovaMetadata CR will be deleted - // if exists and owned by a higher level nova CR (Nova or NovaCell). If it - // exist but not owned by a higher level nova CR then the NovaMetadata CR - // will not be touched. - // If it is set to true the a NovaMetadata CR will be created. - // If there is already a manually created NovaMetadata CR with the relevant - // name then this operator will not try to update that CR, instead - // the higher level nova CR will be in error state until the manually - // create NovaMetadata CR is deleted manually. - Enabled *bool `json:"enabled"` - // NOTE(gibi): the default value of enabled depends on the context so - // it is set by webhooks - - // +kubebuilder:validation:Optional - // +kubebuilder:default=1 - // +kubebuilder:validation:Maximum=32 - // +kubebuilder:validation:Minimum=0 - // Replicas of the service to run - Replicas *int32 `json:"replicas"` - - // +kubebuilder:validation:Optional - // NodeSelector to target subset of worker nodes running this service. Setting here overrides - // any global NodeSelector settings within the Nova CR. - NodeSelector *map[string]string `json:"nodeSelector,omitempty"` - - // +kubebuilder:validation:Optional - // CustomServiceConfig - customize the service config using this parameter to change service defaults, - // or overwrite rendered information using raw OpenStack config format. The content gets added to - // to /etc//.conf.d directory as custom.conf file. - CustomServiceConfig string `json:"customServiceConfig"` - - // +kubebuilder:validation:Optional - // DefaultConfigOverwrite - interface to overwrite default config files like e.g. api-paste.ini. - DefaultConfigOverwrite map[string]string `json:"defaultConfigOverwrite,omitempty"` - - // +kubebuilder:validation:Optional - // Resources - Compute Resources required by this service (Limits/Requests). - // https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - Resources corev1.ResourceRequirements `json:"resources,omitempty"` - - // +kubebuilder:validation:Optional - // NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network - NetworkAttachments []string `json:"networkAttachments,omitempty"` - - // +kubebuilder:validation:Optional - // Override, provides the ability to override the generated manifest of several child resources. - Override MetadataOverrideSpec `json:"override,omitempty"` - - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // TLS - Parameters related to the TLS - TLS tls.SimpleService `json:"tls,omitempty"` - - // +kubebuilder:validation:Optional - // TopologyRef to apply the Topology defined by the associated CR referenced - // by name - TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"` -} - -// MetadataOverrideSpec to override the generated manifest of several child resources. -type MetadataOverrideSpec struct { - // Override configuration for the Service created to serve traffic to the cluster for internal - // communication. - Service *service.OverrideSpec `json:"service,omitempty"` -} - -// NovaMetadataSpec defines the desired state of NovaMetadata -type NovaMetadataSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // +kubebuilder:validation:Optional - // CellName is the name of the Nova Cell this metadata service belongs to. - // If not provided then the metadata serving every cells in the deployment - CellName string `json:"cellName,omitempty"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=60 - // +kubebuilder:validation:Minimum=10 - // APITimeout for Route and Apache - APITimeout int `json:"apiTimeout"` - - // +kubebuilder:validation:Required - // Secret is the name of the Secret instance containing password - // information for the nova-conductor service. This secret is expected to - // be generated by the nova-operator based on the information passed to the - // Nova CR. - Secret string `json:"secret"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=nova - // ServiceUser - optional username used for this service to register in - // keystone - ServiceUser string `json:"serviceUser"` - - // +kubebuilder:validation:Required - // KeystoneAuthURL - the URL that the nova-metadata service can use to talk - // to keystone - // TODO(ksambor) Add checking if dynamic vendor data is configured - KeystoneAuthURL string `json:"keystoneAuthURL"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=regionOne - // Region - the region name to use for service endpoint discovery - Region string `json:"region"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default="nova-api" - // APIDatabaseAccount - MariaDBAccount to use when accessing the API DB - APIDatabaseAccount string `json:"apiDatabaseAccount"` - - // +kubebuilder:validation:Optional - // APIDatabaseHostname - hostname to use when accessing the API DB. - // This filed is Required if the CellName is not provided - // TODO(gibi): Add a webhook to validate the CellName constraint - APIDatabaseHostname string `json:"apiDatabaseHostname"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=nova - // CellDatabaseAccount - MariaDBAccount to use when accessing the cell DB - CellDatabaseAccount string `json:"cellDatabaseAccount"` - - // +kubebuilder:validation:Optional - // CellDatabaseHostname - hostname to use when accessing the cell DB - // This is unused if CellName is not provided. But if it is provided then - // CellDatabaseHostName is also Required. - // TODO(gibi): add webhook to validate this CellName constraint - CellDatabaseHostname string `json:"cellDatabaseHostname"` - - // NovaServiceBase specifies the generic fields of the service - NovaServiceBase `json:",inline"` - - // +kubebuilder:validation:Optional - // Override, provides the ability to override the generated manifest of several child resources. - Override MetadataOverrideSpec `json:"override,omitempty"` - - // +kubebuilder:validation:Required - // ServiceAccount - service account name used internally to provide Nova services the default SA name - ServiceAccount string `json:"serviceAccount"` - - // +kubebuilder:validation:Optional - // RegisteredCells is a map keyed by cell names that are registered in the - // nova_api database with a value that is the hash of the given cell - // configuration. - // This is used to detect when a new cell is added or an existing cell is - // reconfigured to trigger refresh of the in memory cell caches of the - // service. - // This is empty for the case when nova-metadata runs within the cell. - RegisteredCells map[string]string `json:"registeredCells,omitempty"` - - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // TLS - Parameters related to the TLS - TLS tls.SimpleService `json:"tls,omitempty"` - - // +kubebuilder:validation:Optional - // DefaultConfigOverwrite - interface to overwrite default config files like e.g. api-paste.ini. - DefaultConfigOverwrite map[string]string `json:"defaultConfigOverwrite,omitempty"` - - // +kubebuilder:validation:Required - // MemcachedInstance is the name of the Memcached CR that all nova service will use. - MemcachedInstance string `json:"memcachedInstance"` -} - -// NovaMetadataStatus defines the observed state of NovaMetadata -type NovaMetadataStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Map of hashes to track e.g. job status - Hash map[string]string `json:"hash,omitempty"` - - // Conditions - Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"` - - // ReadyCount defines the number of replicas ready from nova-metadata - ReadyCount int32 `json:"readyCount,omitempty"` - - // NetworkAttachments status of the deployment pods - NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"` - - // ObservedGeneration - the most recent generation observed for this - // service. If the observed generation is less than the spec generation, - // then the controller has not processed the latest changes injected by - // the openstack-operator in the top-level CR (e.g. the ContainerImage) - ObservedGeneration int64 `json:"observedGeneration,omitempty"` - - // LastAppliedTopology - the last applied Topology - LastAppliedTopology *topologyv1.TopoRef `json:"lastAppliedTopology,omitempty"` -} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:printcolumn:name="NetworkAttachments",type="string",JSONPath=".spec.networkAttachments",description="NetworkAttachments" -//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status" -//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message" - -// NovaMetadata is the Schema for the novametadata API -type NovaMetadata struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec NovaMetadataSpec `json:"spec,omitempty"` - Status NovaMetadataStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// NovaMetadataList contains a list of NovaMetadata -type NovaMetadataList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []NovaMetadata `json:"items"` -} - -func init() { - SchemeBuilder.Register(&NovaMetadata{}, &NovaMetadataList{}) -} - -// GetConditions returns the list of conditions from the status -func (s NovaMetadataStatus) GetConditions() condition.Conditions { - return s.Conditions -} - -// NewNovaMetadataSpec constructs a NovaMetadataSpec -func NewNovaMetadataSpec( - novaCell NovaCellSpec, -) NovaMetadataSpec { - - metadataSpec := NovaMetadataSpec{ - CellName: novaCell.CellName, - Secret: novaCell.Secret, - CellDatabaseHostname: novaCell.CellDatabaseHostname, - CellDatabaseAccount: novaCell.CellDatabaseAccount, - APIDatabaseHostname: novaCell.APIDatabaseHostname, - APIDatabaseAccount: novaCell.APIDatabaseAccount, - NovaServiceBase: NovaServiceBase{ - ContainerImage: novaCell.MetadataContainerImageURL, - Replicas: novaCell.MetadataServiceTemplate.Replicas, - NodeSelector: novaCell.MetadataServiceTemplate.NodeSelector, - TopologyRef: novaCell.MetadataServiceTemplate.TopologyRef, - CustomServiceConfig: novaCell.MetadataServiceTemplate.CustomServiceConfig, - Resources: novaCell.MetadataServiceTemplate.Resources, - NetworkAttachments: novaCell.MetadataServiceTemplate.NetworkAttachments, - }, - KeystoneAuthURL: novaCell.KeystoneAuthURL, - ServiceUser: novaCell.ServiceUser, - Region: novaCell.Region, - ServiceAccount: novaCell.ServiceAccount, - Override: novaCell.MetadataServiceTemplate.Override, - TLS: novaCell.MetadataServiceTemplate.TLS, - DefaultConfigOverwrite: novaCell.MetadataServiceTemplate.DefaultConfigOverwrite, - MemcachedInstance: novaCell.MemcachedInstance, - APITimeout: novaCell.APITimeout, - } - - if metadataSpec.NodeSelector == nil { - metadataSpec.NodeSelector = novaCell.NodeSelector - } - - if metadataSpec.TopologyRef == nil { - metadataSpec.TopologyRef = novaCell.TopologyRef - } - - return metadataSpec -} - -// GetSecret returns the value of the NovaMetadata.Spec.Secret -func (n NovaMetadata) GetSecret() string { - return n.Spec.Secret -} - -// GetSpecTopologyRef - Returns the LastAppliedTopology Set in the Status -func (n *NovaMetadata) GetSpecTopologyRef() *topologyv1.TopoRef { - return n.Spec.TopologyRef -} - -// GetLastAppliedTopology - Returns the LastAppliedTopology Set in the Status -func (n *NovaMetadata) GetLastAppliedTopology() *topologyv1.TopoRef { - return n.Status.LastAppliedTopology -} - -// SetLastAppliedTopology - Sets the LastAppliedTopology value in the Status -func (n *NovaMetadata) SetLastAppliedTopology(topologyRef *topologyv1.TopoRef) { - n.Status.LastAppliedTopology = topologyRef -} diff --git a/api/v1beta1/novametadata_webhook.go b/api/v1beta1/novametadata_webhook.go deleted file mode 100644 index de0f1cfb3..000000000 --- a/api/v1beta1/novametadata_webhook.go +++ /dev/null @@ -1,172 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// -// Generated by: -// -// operator-sdk create webhook --group nova --version v1beta1 --kind NovaMetadata --programmatic-validation --defaulting -// - -package v1beta1 - -import ( - "fmt" - - "github.com/google/go-cmp/cmp" - apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/validation/field" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/webhook" - "sigs.k8s.io/controller-runtime/pkg/webhook/admission" - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" -) - -// NovaMetadataDefaults - -type NovaMetadataDefaults struct { - ContainerImageURL string -} - -var novaMetadataDefaults NovaMetadataDefaults - -// log is for logging in this package. -var novametadatalog = logf.Log.WithName("novametadata-resource") - -// SetupNovaMetadataDefaults - initialize NovaMetadata spec defaults for use with either internal or external webhooks -func SetupNovaMetadataDefaults(defaults NovaMetadataDefaults) { - novaMetadataDefaults = defaults - novametadatalog.Info("NovaMetadata defaults initialized", "defaults", defaults) -} - -var _ webhook.Defaulter = &NovaMetadata{} - -// Default implements webhook.Defaulter so a webhook will be registered for the type -func (r *NovaMetadata) Default() { - novametadatalog.Info("default", "name", r.Name) - - r.Spec.Default() -} - -// Default - set defaults for this NovaMetadata spec -func (spec *NovaMetadataSpec) Default() { - if spec.ContainerImage == "" { - spec.ContainerImage = novaMetadataDefaults.ContainerImageURL - } -} - -var _ webhook.Validator = &NovaMetadata{} - -// ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaMetadata) ValidateCreate() (admission.Warnings, error) { - novametadatalog.Info("validate create", "name", r.Name) - errors := field.ErrorList{} - basePath := field.NewPath("spec") - - errors = append(errors, ValidateMetadataDefaultConfigOverwrite( - basePath.Child("defaultConfigOverwrite"), - r.Spec.DefaultConfigOverwrite)...) - - errors = append(errors, topologyv1.ValidateTopologyRef( - r.Spec.TopologyRef, *basePath.Child("topologyRef"), r.Namespace)...) - - if len(errors) != 0 { - novametadatalog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaMetadata"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaMetadata) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { - novametadatalog.Info("validate update", "name", r.Name) - errors := field.ErrorList{} - basePath := field.NewPath("spec") - - oldMetadata, ok := old.(*NovaMetadata) - if !ok || oldMetadata == nil { - return nil, apierrors.NewInternalError(fmt.Errorf("unable to convert existing object")) - } - - novametadatalog.Info("validate update", "diff", cmp.Diff(oldMetadata, r)) - - errors = append(errors, ValidateMetadataDefaultConfigOverwrite( - basePath.Child("defaultConfigOverwrite"), - r.Spec.DefaultConfigOverwrite)...) - - errors = append(errors, topologyv1.ValidateTopologyRef( - r.Spec.TopologyRef, *basePath.Child("topologyRef"), r.Namespace)...) - - if len(errors) != 0 { - novametadatalog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaMetadata"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (r *NovaMetadata) ValidateDelete() (admission.Warnings, error) { - novametadatalog.Info("validate delete", "name", r.Name) - - // TODO(user): fill in your validation logic upon object deletion. - return nil, nil -} - -// ValidateCell0 validates cell0 Metadata template. This is expected to be called -// by higher level validation webhooks -func (r *NovaMetadataTemplate) ValidateCell0(basePath *field.Path) field.ErrorList { - var errors field.ErrorList - if *r.Enabled { - errors = append( - errors, - field.Invalid( - basePath.Child("enabled"), *r.Enabled, "should be false for cell0"), - ) - } - return errors -} - -// ValidateDefaultConfigOverwrite validates the defaultConfigOverwrite for NovaMetadataTemplate -func (r *NovaMetadataTemplate) ValidateDefaultConfigOverwrite(basePath *field.Path) field.ErrorList { - return ValidateMetadataDefaultConfigOverwrite( - basePath.Child("defaultConfigOverwrite"), - r.DefaultConfigOverwrite) -} - -// ValidateMetadataDefaultConfigOverwrite validates the defaultConfigOverwrite for NovaMetadata -func ValidateMetadataDefaultConfigOverwrite( - basePath *field.Path, - defaultConfigOverwrite map[string]string, -) field.ErrorList { - return ValidateDefaultConfigOverwrite( - basePath, defaultConfigOverwrite, []string{"api-paste.ini"}) -} - -// ValidateTopology validates the referenced TopoRef.Namespace. -func (r *NovaMetadataTemplate) ValidateTopology( - basePath *field.Path, - namespace string, -) field.ErrorList { - return topologyv1.ValidateTopologyRef( - r.TopologyRef, - *basePath.Child("topologyRef"), - namespace, - ) -} diff --git a/api/v1beta1/novanovncproxy_types.go b/api/v1beta1/novanovncproxy_types.go deleted file mode 100644 index 33b7f2566..000000000 --- a/api/v1beta1/novanovncproxy_types.go +++ /dev/null @@ -1,292 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" - condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" - service "github.com/openstack-k8s-operators/lib-common/modules/common/service" - "github.com/openstack-k8s-operators/lib-common/modules/common/tls" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// NovaNoVNCProxyTemplate defines the input parameters specified by the user to -// create a NovaNoVNCProxy via higher level CRDs. -type NovaNoVNCProxyTemplate struct { - // +kubebuilder:validation:Optional - // Enabled - Whether NovaNoVNCProxy services should be deployed and managed. - // If it is set to false then the related NovaNoVNCProxy CR will be deleted - // if exists and owned by the NovaCell. If it exist but not owned by the - // NovaCell then the NovaNoVNCProxy will not be touched. - // If it is set to true the a NovaNoVNCProxy CR will be created. - // If there is already a manually created NovaNoVNCProxy CR with the - // relevant name then the cell will not try to update that CR, instead the - // NovaCell be in error state until the manually create NovaNoVNCProxy CR - // is deleted by the operator. - Enabled *bool `json:"enabled"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=1 - // +kubebuilder:validation:Maximum=32 - // +kubebuilder:validation:Minimum=0 - // Replicas of the service to run - Replicas *int32 `json:"replicas"` - - // +kubebuilder:validation:Optional - // NodeSelector to target subset of worker nodes running this service - NodeSelector *map[string]string `json:"nodeSelector,omitempty"` - - // +kubebuilder:validation:Optional - // CustomServiceConfig - customize the service config using this parameter to change service defaults, - // or overwrite rendered information using raw OpenStack config format. The content gets added to - // to /etc//.conf.d directory as custom.conf file. - CustomServiceConfig string `json:"customServiceConfig"` - - // +kubebuilder:validation:Optional - // Resources - Compute Resources required by this service (Limits/Requests). - // https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - Resources corev1.ResourceRequirements `json:"resources,omitempty"` - - // +kubebuilder:validation:Optional - // NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network - NetworkAttachments []string `json:"networkAttachments,omitempty"` - - // +kubebuilder:validation:Optional - // Override, provides the ability to override the generated manifest of several child resources. - Override VNCProxyOverrideSpec `json:"override,omitempty"` - - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // TLS - Parameters related to the TLS - TLS TLSSection `json:"tls"` - - // +kubebuilder:validation:Optional - // TopologyRef to apply the Topology defined by the associated CR referenced - // by name - TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"` -} - -// TLSSection defines the desired state of TLS configuration -type TLSSection struct { - // +kubebuilder:validation:optional - //+operator-sdk:csv:customresourcedefinitions:type=spec - // Service - Cert secret used for the nova novnc service endpoint - Service tls.GenericService `json:"service,omitempty"` - - // +kubebuilder:validation:optional - //+operator-sdk:csv:customresourcedefinitions:type=spec - // Vencrypt - cert secret containing the x509 certificate to be presented to the VNC server. - // The CommonName field should match the primary hostname of the controller node. If using a HA deployment, - // the Organization field can also be configured to a value that is common across all console proxy instances in the deployment. - // https://docs.openstack.org/nova/latest/admin/remote-console-access.html#novnc-proxy-server-configuration - Vencrypt tls.GenericService `json:"vencrypt,omitempty"` - - // +kubebuilder:validation:optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // Secret containing CA bundle - tls.Ca `json:",inline"` -} - -// VNCProxyOverrideSpec to override the generated manifest of several child resources. -type VNCProxyOverrideSpec struct { - // Override configuration for the Service created to serve traffic to the cluster. - Service *service.RoutedOverrideSpec `json:"service,omitempty"` -} - -// NovaNoVNCProxySpec defines the desired state of NovaNoVNCProxy -type NovaNoVNCProxySpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // +kubebuilder:validation:Required - // CellName is the name of the Nova Cell this novncproxy belongs to. - CellName string `json:"cellName"` - - // +kubebuilder:validation:Required - // Secret is the name of the Secret instance containing password - // information for the nova-novncproxy service. This secret is expected to - // be generated by the nova-operator based on the information passed to the - // Nova CR. - Secret string `json:"secret"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=nova - // ServiceUser - optional username used for this service to register in - // keystone - ServiceUser string `json:"serviceUser"` - - // +kubebuilder:validation:Required - // KeystoneAuthURL - the URL that the nova-novncproxy service can use to - // talk to keystone - KeystoneAuthURL string `json:"keystoneAuthURL"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=regionOne - // Region - the region name to use for service endpoint discovery - Region string `json:"region"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=nova - // CellDatabaseAccount - MariaDBAccount to use when accessing the cell DB - CellDatabaseAccount string `json:"cellDatabaseAccount"` - - // +kubebuilder:validation:Required - // CellDatabaseHostname - hostname to use when accessing the cell DB - CellDatabaseHostname string `json:"cellDatabaseHostname"` - - // NovaServiceBase specifies the generic fields of the service - NovaServiceBase `json:",inline"` - - // +kubebuilder:validation:Optional - // Override, provides the ability to override the generated manifest of several child resources. - Override VNCProxyOverrideSpec `json:"override,omitempty"` - - // +kubebuilder:validation:Required - // ServiceAccount - service account name used internally to provide Nova services the default SA name - ServiceAccount string `json:"serviceAccount"` - - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // TLS - Parameters related to the TLS - TLS TLSSection `json:"tls"` - - // +kubebuilder:validation:Required - // MemcachedInstance is the name of the Memcached CR that all nova service will use. - MemcachedInstance string `json:"memcachedInstance"` -} - -// NovaNoVNCProxyStatus defines the observed state of NovaNoVNCProxy -type NovaNoVNCProxyStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Map of hashes to track e.g. job status - Hash map[string]string `json:"hash,omitempty"` - - // Conditions - Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"` - - // ReadyCount defines the number of replicas ready from nova-novncproxy - ReadyCount int32 `json:"readyCount,omitempty"` - - // NetworkAttachments status of the deployment pods - NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"` - - // ObservedGeneration - the most recent generation observed for this - // service. If the observed generation is less than the spec generation, - // then the controller has not processed the latest changes injected by - // the openstack-operator in the top-level CR (e.g. the ContainerImage) - ObservedGeneration int64 `json:"observedGeneration,omitempty"` - - // LastAppliedTopology - the last applied Topology - LastAppliedTopology *topologyv1.TopoRef `json:"lastAppliedTopology,omitempty"` -} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:printcolumn:name="NetworkAttachments",type="string",JSONPath=".spec.networkAttachments",description="NetworkAttachments" -//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status" -//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message" - -// NovaNoVNCProxy is the Schema for the novanovncproxies API -type NovaNoVNCProxy struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec NovaNoVNCProxySpec `json:"spec,omitempty"` - Status NovaNoVNCProxyStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// NovaNoVNCProxyList contains a list of NovaNoVNCProxy -type NovaNoVNCProxyList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []NovaNoVNCProxy `json:"items"` -} - -func init() { - SchemeBuilder.Register(&NovaNoVNCProxy{}, &NovaNoVNCProxyList{}) -} - -// GetConditions returns the list of conditions from the status -func (s NovaNoVNCProxyStatus) GetConditions() condition.Conditions { - return s.Conditions -} - -// NewNovaNoVNCProxySpec constructs a NewNovaNoVNCProxySpec -func NewNovaNoVNCProxySpec( - novaCell NovaCellSpec, -) NovaNoVNCProxySpec { - noVNCProxSpec := NovaNoVNCProxySpec{ - CellName: novaCell.CellName, - Secret: novaCell.Secret, - CellDatabaseHostname: novaCell.CellDatabaseHostname, - CellDatabaseAccount: novaCell.CellDatabaseAccount, - NovaServiceBase: NovaServiceBase{ - ContainerImage: novaCell.NoVNCContainerImageURL, - Replicas: novaCell.NoVNCProxyServiceTemplate.Replicas, - NodeSelector: novaCell.NoVNCProxyServiceTemplate.NodeSelector, - CustomServiceConfig: novaCell.NoVNCProxyServiceTemplate.CustomServiceConfig, - Resources: novaCell.NoVNCProxyServiceTemplate.Resources, - NetworkAttachments: novaCell.NoVNCProxyServiceTemplate.NetworkAttachments, - TopologyRef: novaCell.NoVNCProxyServiceTemplate.TopologyRef, - }, - KeystoneAuthURL: novaCell.KeystoneAuthURL, - ServiceUser: novaCell.ServiceUser, - Region: novaCell.Region, - ServiceAccount: novaCell.ServiceAccount, - Override: novaCell.NoVNCProxyServiceTemplate.Override, - TLS: novaCell.NoVNCProxyServiceTemplate.TLS, - MemcachedInstance: novaCell.MemcachedInstance, - } - - if noVNCProxSpec.NodeSelector == nil { - noVNCProxSpec.NodeSelector = novaCell.NodeSelector - } - - if noVNCProxSpec.TopologyRef == nil { - noVNCProxSpec.TopologyRef = novaCell.TopologyRef - } - - return noVNCProxSpec -} - -// GetSecret returns the value of the NovaMetadata.Spec.Secret -func (n NovaNoVNCProxy) GetSecret() string { - return n.Spec.Secret -} - -// GetSpecTopologyRef - Returns the LastAppliedTopology Set in the Status -func (n *NovaNoVNCProxy) GetSpecTopologyRef() *topologyv1.TopoRef { - return n.Spec.TopologyRef -} - -// GetLastAppliedTopology - Returns the LastAppliedTopology Set in the Status -func (n *NovaNoVNCProxy) GetLastAppliedTopology() *topologyv1.TopoRef { - return n.Status.LastAppliedTopology -} - -// SetLastAppliedTopology - Sets the LastAppliedTopology value in the Status -func (n *NovaNoVNCProxy) SetLastAppliedTopology(topologyRef *topologyv1.TopoRef) { - n.Status.LastAppliedTopology = topologyRef -} diff --git a/api/v1beta1/novanovncproxy_webhook.go b/api/v1beta1/novanovncproxy_webhook.go deleted file mode 100644 index 6d9ea0090..000000000 --- a/api/v1beta1/novanovncproxy_webhook.go +++ /dev/null @@ -1,150 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// -// Generated by: -// -// operator-sdk create webhook --group nova --version v1beta1 --kind NovaNoVNCProxy --programmatic-validation --defaulting -// - -package v1beta1 - -import ( - "fmt" - - "github.com/google/go-cmp/cmp" - apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/validation/field" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/webhook" - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/webhook/admission" - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" -) - -// NovaNoVNCProxyDefaults - -type NovaNoVNCProxyDefaults struct { - ContainerImageURL string -} - -var novaNoVNCProxyDefaults NovaNoVNCProxyDefaults - -// log is for logging in this package. -var novanovncproxylog = logf.Log.WithName("novanovncproxy-resource") - -// SetupNovaNoVNCProxyDefaults - initialize NovaNoVNCProxy spec defaults for use with either internal or external webhooks -func SetupNovaNoVNCProxyDefaults(defaults NovaNoVNCProxyDefaults) { - novaNoVNCProxyDefaults = defaults - novanovncproxylog.Info("NovaNoVNCProxy defaults initialized", "defaults", defaults) -} - -var _ webhook.Defaulter = &NovaNoVNCProxy{} - -// Default implements webhook.Defaulter so a webhook will be registered for the type -func (r *NovaNoVNCProxy) Default() { - novanovncproxylog.Info("default", "name", r.Name) - - r.Spec.Default() -} - -// Default - set defaults for this NovaNoVNCProxy spec -func (spec *NovaNoVNCProxySpec) Default() { - if spec.ContainerImage == "" { - spec.ContainerImage = novaNoVNCProxyDefaults.ContainerImageURL - } -} - -var _ webhook.Validator = &NovaNoVNCProxy{} - -// ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaNoVNCProxy) ValidateCreate() (admission.Warnings, error) { - novanovncproxylog.Info("validate create", "name", r.Name) - - errors := field.ErrorList{} - basePath := field.NewPath("spec") - - errors = append(errors, topologyv1.ValidateTopologyRef( - r.Spec.TopologyRef, *basePath.Child("topologyRef"), r.Namespace)...) - - if len(errors) != 0 { - novanovncproxylog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaNoVNCProxy"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaNoVNCProxy) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { - novanovncproxylog.Info("validate update", "name", r.Name) - errors := field.ErrorList{} - basePath := field.NewPath("spec") - - - oldProxy, ok := old.(*NovaNoVNCProxy) - if !ok || oldProxy == nil { - return nil, apierrors.NewInternalError(fmt.Errorf("unable to convert existing object")) - } - - novanovncproxylog.Info("validate update", "diff", cmp.Diff(oldProxy, r)) - - errors = append(errors, topologyv1.ValidateTopologyRef( - r.Spec.TopologyRef, *basePath.Child("topologyRef"), r.Namespace)...) - - if len(errors) != 0 { - novanovncproxylog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaNoVNCProxy"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (r *NovaNoVNCProxy) ValidateDelete() (admission.Warnings, error) { - novanovncproxylog.Info("validate delete", "name", r.Name) - - // TODO(user): fill in your validation logic upon object deletion. - return nil, nil -} - -// ValidateCell0 validates cell0 NoVNCProxy template. This is expected to be -// called by higher level validation webhooks -func (r *NovaNoVNCProxyTemplate) ValidateCell0(basePath *field.Path) field.ErrorList { - var errors field.ErrorList - if *r.Enabled { - errors = append( - errors, - field.Invalid( - basePath.Child("enabled"), *r.Enabled, "should be false for cell0"), - ) - } - return errors -} - -// ValidateTopology validates the referenced TopoRef.Namespace. -func (r *NovaNoVNCProxyTemplate) ValidateTopology( - basePath *field.Path, - namespace string, -) field.ErrorList { - return topologyv1.ValidateTopologyRef( - r.TopologyRef, - *basePath.Child("topologyRef"), - namespace, - ) -} diff --git a/api/v1beta1/novascheduler_types.go b/api/v1beta1/novascheduler_types.go deleted file mode 100644 index 75d79d5f3..000000000 --- a/api/v1beta1/novascheduler_types.go +++ /dev/null @@ -1,234 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" - condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" - "github.com/openstack-k8s-operators/lib-common/modules/common/tls" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// NovaSchedulerTemplate defines the input parameters specified by the user to -// create a NovaScheduler via higher level CRDs. -type NovaSchedulerTemplate struct { - // +kubebuilder:validation:Optional - // +kubebuilder:default=1 - // +kubebuilder:validation:Maximum=32 - // +kubebuilder:validation:Minimum=0 - // Replicas of the service to run - Replicas *int32 `json:"replicas"` - - // +kubebuilder:validation:Optional - // NodeSelector to target subset of worker nodes running this service. Setting here overrides - // any global NodeSelector settings within the Nova CR. - NodeSelector *map[string]string `json:"nodeSelector,omitempty"` - - // +kubebuilder:validation:Optional - // CustomServiceConfig - customize the service config using this parameter to change service defaults, - // or overwrite rendered information using raw OpenStack config format. The content gets added to - // to /etc//.conf.d directory as custom.conf file. - CustomServiceConfig string `json:"customServiceConfig"` - - // +kubebuilder:validation:Optional - // Resources - Compute Resources required by this service (Limits/Requests). - // https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - Resources corev1.ResourceRequirements `json:"resources,omitempty"` - - // +kubebuilder:validation:Optional - // NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network - NetworkAttachments []string `json:"networkAttachments,omitempty"` - - // +kubebuilder:validation:Optional - // TopologyRef to apply the Topology defined by the associated CR referenced - // by name - TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"` -} - -// NovaSchedulerSpec defines the desired state of NovaScheduler -type NovaSchedulerSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // +kubebuilder:validation:Required - // Secret is the name of the Secret instance containing password - // information for the nova-scheduler service. This secret is expected to - // be generated by the nova-operator based on the information passed to the - // Nova CR. - Secret string `json:"secret"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=nova - // ServiceUser - optional username used for this service to register in - // keystone - ServiceUser string `json:"serviceUser"` - - // +kubebuilder:validation:Required - // KeystoneAuthURL - the URL that the nova-scheduler service can use to - // talk to keystone - KeystoneAuthURL string `json:"keystoneAuthURL"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=regionOne - // Region - the region name to use for service endpoint discovery - Region string `json:"region"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default=nova-api - // APIDatabaseAccount - MariaDBAccount to use when accessing the API DB - APIDatabaseAccount string `json:"apiDatabaseAccount"` - - // +kubebuilder:validation:Required - // APIDatabaseHostname - hostname to use when accessing the API DB - APIDatabaseHostname string `json:"apiDatabaseHostname"` - - // +kubebuilder:validation:Optional - // +kubebuilder:default="nova-cell0" - // Cell0DatabaseAccount - MariaDBAccount to use when accessing the cell0 DB - Cell0DatabaseAccount string `json:"cell0DatabaseAccount"` - - // +kubebuilder:validation:Required - // Cell0DatabaseHostname - hostname to use when accessing the cell0 DB - Cell0DatabaseHostname string `json:"cell0DatabaseHostname"` - - // NovaServiceBase specifies the generic fields of the service - NovaServiceBase `json:",inline"` - - // +kubebuilder:validation:Required - // ServiceAccount - service account name used internally to provide Nova services the default SA name - ServiceAccount string `json:"serviceAccount"` - - // RegisteredCells is a map keyed by cell names that are registered in the - // nova_api database with a value that is the hash of the given cell - // configuration. - // This is used to detect when a new cell is added or an existing cell is - // reconfigured to trigger refresh of the in memory cell caches of the - // service. - RegisteredCells map[string]string `json:"registeredCells"` - - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec - // TLS - Parameters related to the TLS - TLS tls.Ca `json:"tls,omitempty"` - - // +kubebuilder:validation:Required - // MemcachedInstance is the name of the Memcached CR that all nova service will use. - MemcachedInstance string `json:"memcachedInstance"` -} - -// NovaSchedulerStatus defines the observed state of NovaScheduler -type NovaSchedulerStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file - // Map of hashes to track e.g. job status - Hash map[string]string `json:"hash,omitempty"` - - // Conditions - Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"` - - // ReadyCount defines the number of replicas ready from nova-scheduler - ReadyCount int32 `json:"readyCount,omitempty"` - - // NetworkAttachments status of the deployment pods - NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"` - - // ObservedGeneration - the most recent generation observed for this - // service. If the observed generation is less than the spec generation, - // then the controller has not processed the latest changes injected by - // the openstack-operator in the top-level CR (e.g. the ContainerImage) - ObservedGeneration int64 `json:"observedGeneration,omitempty"` - - // LastAppliedTopology - the last applied Topology - LastAppliedTopology *topologyv1.TopoRef `json:"lastAppliedTopology,omitempty"` -} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:printcolumn:name="NetworkAttachments",type="string",JSONPath=".spec.networkAttachments",description="NetworkAttachments" -//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status" -//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message" - -// NovaScheduler is the Schema for the novaschedulers API -type NovaScheduler struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec NovaSchedulerSpec `json:"spec,omitempty"` - Status NovaSchedulerStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// NovaSchedulerList contains a list of NovaScheduler -type NovaSchedulerList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []NovaScheduler `json:"items"` -} - -func init() { - SchemeBuilder.Register(&NovaScheduler{}, &NovaSchedulerList{}) -} - -// GetConditions returns the list of conditions from the status -func (s NovaSchedulerStatus) GetConditions() condition.Conditions { - return s.Conditions -} - -// GetSecret returns the value of the NovaScheduler.Spec.Secret -func (n NovaScheduler) GetSecret() string { - return n.Spec.Secret -} - -// GetKeystoneAuthURL returns the KeystoneAuthURL from the Spec -func (n NovaScheduler) GetKeystoneAuthURL() string { - return n.Spec.KeystoneAuthURL -} - -// GetKeystoneUser returns the Service user from the Spec -func (n NovaScheduler) GetKeystoneUser() string { - return n.Spec.ServiceUser -} - -// GetCABundleSecretName returns the TLS CA bundle name from the Spec -func (n NovaScheduler) GetCABundleSecretName() string { - return n.Spec.TLS.CaBundleSecretName -} - -// GetRegion returns the Region from the Spec -func (n NovaScheduler) GetRegion() string { - return n.Spec.Region -} - -// GetSpecTopologyRef - Returns the LastAppliedTopology Set in the Status -func (n *NovaScheduler) GetSpecTopologyRef() *topologyv1.TopoRef { - return n.Spec.TopologyRef -} - -// GetLastAppliedTopology - Returns the LastAppliedTopology Set in the Status -func (n *NovaScheduler) GetLastAppliedTopology() *topologyv1.TopoRef { - return n.Status.LastAppliedTopology -} - -// SetLastAppliedTopology - Sets the LastAppliedTopology value in the Status -func (n *NovaScheduler) SetLastAppliedTopology(topologyRef *topologyv1.TopoRef) { - n.Status.LastAppliedTopology = topologyRef -} diff --git a/api/v1beta1/novascheduler_webhook.go b/api/v1beta1/novascheduler_webhook.go deleted file mode 100644 index febb47dde..000000000 --- a/api/v1beta1/novascheduler_webhook.go +++ /dev/null @@ -1,134 +0,0 @@ -/* -Copyright 2023. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// -// Generated by: -// -// operator-sdk create webhook --group nova --version v1beta1 --kind NovaScheduler --programmatic-validation --defaulting -// - -package v1beta1 - -import ( - "fmt" - - "github.com/google/go-cmp/cmp" - apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/webhook" - "sigs.k8s.io/controller-runtime/pkg/webhook/admission" - "k8s.io/apimachinery/pkg/util/validation/field" - topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// NovaSchedulerDefaults - -type NovaSchedulerDefaults struct { - ContainerImageURL string -} - -var novaSchedulerDefaults NovaSchedulerDefaults - -// log is for logging in this package. -var novaschedulerlog = logf.Log.WithName("novascheduler-resource") - -// SetupNovaSchedulerDefaults - initialize NovaScheduler spec defaults for use with either internal or external webhooks -func SetupNovaSchedulerDefaults(defaults NovaSchedulerDefaults) { - novaSchedulerDefaults = defaults - novaschedulerlog.Info("NovaScheduler defaults initialized", "defaults", defaults) -} - -var _ webhook.Defaulter = &NovaScheduler{} - -// Default implements webhook.Defaulter so a webhook will be registered for the type -func (r *NovaScheduler) Default() { - novaschedulerlog.Info("default", "name", r.Name) - - r.Spec.Default() -} - -// Default - set defaults for this NovaScheduler spec -func (spec *NovaSchedulerSpec) Default() { - if spec.ContainerImage == "" { - spec.ContainerImage = novaSchedulerDefaults.ContainerImageURL - } -} - -var _ webhook.Validator = &NovaScheduler{} - -// ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaScheduler) ValidateCreate() (admission.Warnings, error) { - novaschedulerlog.Info("validate create", "name", r.Name) - errors := field.ErrorList{} - basePath := field.NewPath("spec") - - errors = append(errors, topologyv1.ValidateTopologyRef( - r.Spec.TopologyRef, *basePath.Child("topologyRef"), r.Namespace)...) - - if len(errors) != 0 { - novaschedulerlog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaScheduler"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (r *NovaScheduler) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { - novaschedulerlog.Info("validate update", "name", r.Name) - errors := field.ErrorList{} - basePath := field.NewPath("spec") - - oldScheduler, ok := old.(*NovaScheduler) - if !ok || oldScheduler == nil { - return nil, apierrors.NewInternalError(fmt.Errorf("unable to convert existing object")) - } - - novaschedulerlog.Info("validate update", "diff", cmp.Diff(oldScheduler, r)) - - errors = append(errors, topologyv1.ValidateTopologyRef( - r.Spec.TopologyRef, *basePath.Child("topologyRef"), r.Namespace)...) - - if len(errors) != 0 { - novaschedulerlog.Info("validation failed", "name", r.Name) - return nil, apierrors.NewInvalid( - schema.GroupKind{Group: "nova.openstack.org", Kind: "NovaScheduler"}, - r.Name, errors) - } - return nil, nil -} - -// ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (r *NovaScheduler) ValidateDelete() (admission.Warnings, error) { - novaschedulerlog.Info("validate delete", "name", r.Name) - - // TODO(user): fill in your validation logic upon object deletion. - return nil, nil -} - -// ValidateTopology validates the referenced TopoRef.Namespace. -func (r *NovaSchedulerTemplate) ValidateTopology( - basePath *field.Path, - namespace string, -) field.ErrorList { - return topologyv1.ValidateTopologyRef( - r.TopologyRef, - *basePath.Child("topologyRef"), - namespace, - ) -} diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go deleted file mode 100644 index 0da528695..000000000 --- a/api/v1beta1/zz_generated.deepcopy.go +++ /dev/null @@ -1,1817 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1beta1 - -import ( - rabbitmqv1beta1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1" - topologyv1beta1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1" - "github.com/openstack-k8s-operators/lib-common/modules/common/condition" - "github.com/openstack-k8s-operators/lib-common/modules/common/service" - "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *APIOverrideSpec) DeepCopyInto(out *APIOverrideSpec) { - *out = *in - if in.Service != nil { - in, out := &in.Service, &out.Service - *out = make(map[service.Endpoint]service.RoutedOverrideSpec, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIOverrideSpec. -func (in *APIOverrideSpec) DeepCopy() *APIOverrideSpec { - if in == nil { - return nil - } - out := new(APIOverrideSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AuthSpec) DeepCopyInto(out *AuthSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthSpec. -func (in *AuthSpec) DeepCopy() *AuthSpec { - if in == nil { - return nil - } - out := new(AuthSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MetadataOverrideSpec) DeepCopyInto(out *MetadataOverrideSpec) { - *out = *in - if in.Service != nil { - in, out := &in.Service, &out.Service - *out = new(service.OverrideSpec) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetadataOverrideSpec. -func (in *MetadataOverrideSpec) DeepCopy() *MetadataOverrideSpec { - if in == nil { - return nil - } - out := new(MetadataOverrideSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Nova) DeepCopyInto(out *Nova) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Nova. -func (in *Nova) DeepCopy() *Nova { - if in == nil { - return nil - } - out := new(Nova) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Nova) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaAPI) DeepCopyInto(out *NovaAPI) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaAPI. -func (in *NovaAPI) DeepCopy() *NovaAPI { - if in == nil { - return nil - } - out := new(NovaAPI) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaAPI) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaAPIDefaults) DeepCopyInto(out *NovaAPIDefaults) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaAPIDefaults. -func (in *NovaAPIDefaults) DeepCopy() *NovaAPIDefaults { - if in == nil { - return nil - } - out := new(NovaAPIDefaults) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaAPIList) DeepCopyInto(out *NovaAPIList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]NovaAPI, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaAPIList. -func (in *NovaAPIList) DeepCopy() *NovaAPIList { - if in == nil { - return nil - } - out := new(NovaAPIList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaAPIList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaAPISpec) DeepCopyInto(out *NovaAPISpec) { - *out = *in - in.NovaServiceBase.DeepCopyInto(&out.NovaServiceBase) - in.Override.DeepCopyInto(&out.Override) - if in.RegisteredCells != nil { - in, out := &in.RegisteredCells, &out.RegisteredCells - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - in.TLS.DeepCopyInto(&out.TLS) - if in.DefaultConfigOverwrite != nil { - in, out := &in.DefaultConfigOverwrite, &out.DefaultConfigOverwrite - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaAPISpec. -func (in *NovaAPISpec) DeepCopy() *NovaAPISpec { - if in == nil { - return nil - } - out := new(NovaAPISpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaAPIStatus) DeepCopyInto(out *NovaAPIStatus) { - *out = *in - if in.Hash != nil { - in, out := &in.Hash, &out.Hash - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(condition.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make(map[string][]string, len(*in)) - for key, val := range *in { - var outVal []string - if val == nil { - (*out)[key] = nil - } else { - inVal := (*in)[key] - in, out := &inVal, &outVal - *out = make([]string, len(*in)) - copy(*out, *in) - } - (*out)[key] = outVal - } - } - if in.LastAppliedTopology != nil { - in, out := &in.LastAppliedTopology, &out.LastAppliedTopology - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaAPIStatus. -func (in *NovaAPIStatus) DeepCopy() *NovaAPIStatus { - if in == nil { - return nil - } - out := new(NovaAPIStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaAPITemplate) DeepCopyInto(out *NovaAPITemplate) { - *out = *in - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - *out = new(int32) - **out = **in - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(map[string]string) - if **in != nil { - in, out := *in, *out - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - } - if in.DefaultConfigOverwrite != nil { - in, out := &in.DefaultConfigOverwrite, &out.DefaultConfigOverwrite - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - in.Resources.DeepCopyInto(&out.Resources) - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make([]string, len(*in)) - copy(*out, *in) - } - in.Override.DeepCopyInto(&out.Override) - in.TLS.DeepCopyInto(&out.TLS) - if in.TopologyRef != nil { - in, out := &in.TopologyRef, &out.TopologyRef - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaAPITemplate. -func (in *NovaAPITemplate) DeepCopy() *NovaAPITemplate { - if in == nil { - return nil - } - out := new(NovaAPITemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaCell) DeepCopyInto(out *NovaCell) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaCell. -func (in *NovaCell) DeepCopy() *NovaCell { - if in == nil { - return nil - } - out := new(NovaCell) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaCell) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaCellDBPurge) DeepCopyInto(out *NovaCellDBPurge) { - *out = *in - if in.Schedule != nil { - in, out := &in.Schedule, &out.Schedule - *out = new(string) - **out = **in - } - if in.ArchiveAge != nil { - in, out := &in.ArchiveAge, &out.ArchiveAge - *out = new(int) - **out = **in - } - if in.PurgeAge != nil { - in, out := &in.PurgeAge, &out.PurgeAge - *out = new(int) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaCellDBPurge. -func (in *NovaCellDBPurge) DeepCopy() *NovaCellDBPurge { - if in == nil { - return nil - } - out := new(NovaCellDBPurge) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaCellDefaults) DeepCopyInto(out *NovaCellDefaults) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaCellDefaults. -func (in *NovaCellDefaults) DeepCopy() *NovaCellDefaults { - if in == nil { - return nil - } - out := new(NovaCellDefaults) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaCellImages) DeepCopyInto(out *NovaCellImages) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaCellImages. -func (in *NovaCellImages) DeepCopy() *NovaCellImages { - if in == nil { - return nil - } - out := new(NovaCellImages) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaCellList) DeepCopyInto(out *NovaCellList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]NovaCell, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaCellList. -func (in *NovaCellList) DeepCopy() *NovaCellList { - if in == nil { - return nil - } - out := new(NovaCellList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaCellList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaCellSpec) DeepCopyInto(out *NovaCellSpec) { - *out = *in - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(map[string]string) - if **in != nil { - in, out := *in, *out - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - } - in.ConductorServiceTemplate.DeepCopyInto(&out.ConductorServiceTemplate) - in.MetadataServiceTemplate.DeepCopyInto(&out.MetadataServiceTemplate) - in.NoVNCProxyServiceTemplate.DeepCopyInto(&out.NoVNCProxyServiceTemplate) - if in.NovaComputeTemplates != nil { - in, out := &in.NovaComputeTemplates, &out.NovaComputeTemplates - *out = make(map[string]NovaComputeTemplate, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - out.TLS = in.TLS - in.DBPurge.DeepCopyInto(&out.DBPurge) - out.NovaCellImages = in.NovaCellImages - if in.TopologyRef != nil { - in, out := &in.TopologyRef, &out.TopologyRef - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaCellSpec. -func (in *NovaCellSpec) DeepCopy() *NovaCellSpec { - if in == nil { - return nil - } - out := new(NovaCellSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaCellStatus) DeepCopyInto(out *NovaCellStatus) { - *out = *in - if in.Hash != nil { - in, out := &in.Hash, &out.Hash - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(condition.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.NovaComputesStatus != nil { - in, out := &in.NovaComputesStatus, &out.NovaComputesStatus - *out = make(map[string]NovaComputeCellStatus, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaCellStatus. -func (in *NovaCellStatus) DeepCopy() *NovaCellStatus { - if in == nil { - return nil - } - out := new(NovaCellStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaCellTemplate) DeepCopyInto(out *NovaCellTemplate) { - *out = *in - out.MessagingBus = in.MessagingBus - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(map[string]string) - if **in != nil { - in, out := *in, *out - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - } - if in.TopologyRef != nil { - in, out := &in.TopologyRef, &out.TopologyRef - *out = new(topologyv1beta1.TopoRef) - **out = **in - } - in.ConductorServiceTemplate.DeepCopyInto(&out.ConductorServiceTemplate) - in.MetadataServiceTemplate.DeepCopyInto(&out.MetadataServiceTemplate) - in.NoVNCProxyServiceTemplate.DeepCopyInto(&out.NoVNCProxyServiceTemplate) - if in.NovaComputeTemplates != nil { - in, out := &in.NovaComputeTemplates, &out.NovaComputeTemplates - *out = make(map[string]NovaComputeTemplate, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - in.DBPurge.DeepCopyInto(&out.DBPurge) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaCellTemplate. -func (in *NovaCellTemplate) DeepCopy() *NovaCellTemplate { - if in == nil { - return nil - } - out := new(NovaCellTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaCompute) DeepCopyInto(out *NovaCompute) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaCompute. -func (in *NovaCompute) DeepCopy() *NovaCompute { - if in == nil { - return nil - } - out := new(NovaCompute) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaCompute) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaComputeCellStatus) DeepCopyInto(out *NovaComputeCellStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaComputeCellStatus. -func (in *NovaComputeCellStatus) DeepCopy() *NovaComputeCellStatus { - if in == nil { - return nil - } - out := new(NovaComputeCellStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaComputeDefaults) DeepCopyInto(out *NovaComputeDefaults) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaComputeDefaults. -func (in *NovaComputeDefaults) DeepCopy() *NovaComputeDefaults { - if in == nil { - return nil - } - out := new(NovaComputeDefaults) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaComputeList) DeepCopyInto(out *NovaComputeList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]NovaCompute, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaComputeList. -func (in *NovaComputeList) DeepCopy() *NovaComputeList { - if in == nil { - return nil - } - out := new(NovaComputeList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaComputeList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaComputeSpec) DeepCopyInto(out *NovaComputeSpec) { - *out = *in - in.NovaServiceBase.DeepCopyInto(&out.NovaServiceBase) - out.TLS = in.TLS - if in.DefaultConfigOverwrite != nil { - in, out := &in.DefaultConfigOverwrite, &out.DefaultConfigOverwrite - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaComputeSpec. -func (in *NovaComputeSpec) DeepCopy() *NovaComputeSpec { - if in == nil { - return nil - } - out := new(NovaComputeSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaComputeStatus) DeepCopyInto(out *NovaComputeStatus) { - *out = *in - if in.Hash != nil { - in, out := &in.Hash, &out.Hash - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(condition.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make(map[string][]string, len(*in)) - for key, val := range *in { - var outVal []string - if val == nil { - (*out)[key] = nil - } else { - inVal := (*in)[key] - in, out := &inVal, &outVal - *out = make([]string, len(*in)) - copy(*out, *in) - } - (*out)[key] = outVal - } - } - if in.LastAppliedTopology != nil { - in, out := &in.LastAppliedTopology, &out.LastAppliedTopology - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaComputeStatus. -func (in *NovaComputeStatus) DeepCopy() *NovaComputeStatus { - if in == nil { - return nil - } - out := new(NovaComputeStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaComputeTemplate) DeepCopyInto(out *NovaComputeTemplate) { - *out = *in - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - *out = new(int32) - **out = **in - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(map[string]string) - if **in != nil { - in, out := *in, *out - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - } - if in.TopologyRef != nil { - in, out := &in.TopologyRef, &out.TopologyRef - *out = new(topologyv1beta1.TopoRef) - **out = **in - } - if in.DefaultConfigOverwrite != nil { - in, out := &in.DefaultConfigOverwrite, &out.DefaultConfigOverwrite - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - in.Resources.DeepCopyInto(&out.Resources) - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaComputeTemplate. -func (in *NovaComputeTemplate) DeepCopy() *NovaComputeTemplate { - if in == nil { - return nil - } - out := new(NovaComputeTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaConductor) DeepCopyInto(out *NovaConductor) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaConductor. -func (in *NovaConductor) DeepCopy() *NovaConductor { - if in == nil { - return nil - } - out := new(NovaConductor) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaConductor) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaConductorDefaults) DeepCopyInto(out *NovaConductorDefaults) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaConductorDefaults. -func (in *NovaConductorDefaults) DeepCopy() *NovaConductorDefaults { - if in == nil { - return nil - } - out := new(NovaConductorDefaults) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaConductorList) DeepCopyInto(out *NovaConductorList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]NovaConductor, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaConductorList. -func (in *NovaConductorList) DeepCopy() *NovaConductorList { - if in == nil { - return nil - } - out := new(NovaConductorList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaConductorList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaConductorSpec) DeepCopyInto(out *NovaConductorSpec) { - *out = *in - in.NovaServiceBase.DeepCopyInto(&out.NovaServiceBase) - out.TLS = in.TLS - in.DBPurge.DeepCopyInto(&out.DBPurge) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaConductorSpec. -func (in *NovaConductorSpec) DeepCopy() *NovaConductorSpec { - if in == nil { - return nil - } - out := new(NovaConductorSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaConductorStatus) DeepCopyInto(out *NovaConductorStatus) { - *out = *in - if in.Hash != nil { - in, out := &in.Hash, &out.Hash - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(condition.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make(map[string][]string, len(*in)) - for key, val := range *in { - var outVal []string - if val == nil { - (*out)[key] = nil - } else { - inVal := (*in)[key] - in, out := &inVal, &outVal - *out = make([]string, len(*in)) - copy(*out, *in) - } - (*out)[key] = outVal - } - } - if in.LastAppliedTopology != nil { - in, out := &in.LastAppliedTopology, &out.LastAppliedTopology - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaConductorStatus. -func (in *NovaConductorStatus) DeepCopy() *NovaConductorStatus { - if in == nil { - return nil - } - out := new(NovaConductorStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaConductorTemplate) DeepCopyInto(out *NovaConductorTemplate) { - *out = *in - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - *out = new(int32) - **out = **in - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(map[string]string) - if **in != nil { - in, out := *in, *out - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - } - in.Resources.DeepCopyInto(&out.Resources) - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.TopologyRef != nil { - in, out := &in.TopologyRef, &out.TopologyRef - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaConductorTemplate. -func (in *NovaConductorTemplate) DeepCopy() *NovaConductorTemplate { - if in == nil { - return nil - } - out := new(NovaConductorTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaDefaults) DeepCopyInto(out *NovaDefaults) { - *out = *in - out.NovaCellDefaults = in.NovaCellDefaults -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaDefaults. -func (in *NovaDefaults) DeepCopy() *NovaDefaults { - if in == nil { - return nil - } - out := new(NovaDefaults) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaImages) DeepCopyInto(out *NovaImages) { - *out = *in - out.NovaCellImages = in.NovaCellImages -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaImages. -func (in *NovaImages) DeepCopy() *NovaImages { - if in == nil { - return nil - } - out := new(NovaImages) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaList) DeepCopyInto(out *NovaList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Nova, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaList. -func (in *NovaList) DeepCopy() *NovaList { - if in == nil { - return nil - } - out := new(NovaList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaMetadata) DeepCopyInto(out *NovaMetadata) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaMetadata. -func (in *NovaMetadata) DeepCopy() *NovaMetadata { - if in == nil { - return nil - } - out := new(NovaMetadata) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaMetadata) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaMetadataDefaults) DeepCopyInto(out *NovaMetadataDefaults) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaMetadataDefaults. -func (in *NovaMetadataDefaults) DeepCopy() *NovaMetadataDefaults { - if in == nil { - return nil - } - out := new(NovaMetadataDefaults) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaMetadataList) DeepCopyInto(out *NovaMetadataList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]NovaMetadata, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaMetadataList. -func (in *NovaMetadataList) DeepCopy() *NovaMetadataList { - if in == nil { - return nil - } - out := new(NovaMetadataList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaMetadataList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaMetadataSpec) DeepCopyInto(out *NovaMetadataSpec) { - *out = *in - in.NovaServiceBase.DeepCopyInto(&out.NovaServiceBase) - in.Override.DeepCopyInto(&out.Override) - if in.RegisteredCells != nil { - in, out := &in.RegisteredCells, &out.RegisteredCells - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - in.TLS.DeepCopyInto(&out.TLS) - if in.DefaultConfigOverwrite != nil { - in, out := &in.DefaultConfigOverwrite, &out.DefaultConfigOverwrite - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaMetadataSpec. -func (in *NovaMetadataSpec) DeepCopy() *NovaMetadataSpec { - if in == nil { - return nil - } - out := new(NovaMetadataSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaMetadataStatus) DeepCopyInto(out *NovaMetadataStatus) { - *out = *in - if in.Hash != nil { - in, out := &in.Hash, &out.Hash - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(condition.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make(map[string][]string, len(*in)) - for key, val := range *in { - var outVal []string - if val == nil { - (*out)[key] = nil - } else { - inVal := (*in)[key] - in, out := &inVal, &outVal - *out = make([]string, len(*in)) - copy(*out, *in) - } - (*out)[key] = outVal - } - } - if in.LastAppliedTopology != nil { - in, out := &in.LastAppliedTopology, &out.LastAppliedTopology - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaMetadataStatus. -func (in *NovaMetadataStatus) DeepCopy() *NovaMetadataStatus { - if in == nil { - return nil - } - out := new(NovaMetadataStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaMetadataTemplate) DeepCopyInto(out *NovaMetadataTemplate) { - *out = *in - if in.Enabled != nil { - in, out := &in.Enabled, &out.Enabled - *out = new(bool) - **out = **in - } - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - *out = new(int32) - **out = **in - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(map[string]string) - if **in != nil { - in, out := *in, *out - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - } - if in.DefaultConfigOverwrite != nil { - in, out := &in.DefaultConfigOverwrite, &out.DefaultConfigOverwrite - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - in.Resources.DeepCopyInto(&out.Resources) - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make([]string, len(*in)) - copy(*out, *in) - } - in.Override.DeepCopyInto(&out.Override) - in.TLS.DeepCopyInto(&out.TLS) - if in.TopologyRef != nil { - in, out := &in.TopologyRef, &out.TopologyRef - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaMetadataTemplate. -func (in *NovaMetadataTemplate) DeepCopy() *NovaMetadataTemplate { - if in == nil { - return nil - } - out := new(NovaMetadataTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaNoVNCProxy) DeepCopyInto(out *NovaNoVNCProxy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaNoVNCProxy. -func (in *NovaNoVNCProxy) DeepCopy() *NovaNoVNCProxy { - if in == nil { - return nil - } - out := new(NovaNoVNCProxy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaNoVNCProxy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaNoVNCProxyDefaults) DeepCopyInto(out *NovaNoVNCProxyDefaults) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaNoVNCProxyDefaults. -func (in *NovaNoVNCProxyDefaults) DeepCopy() *NovaNoVNCProxyDefaults { - if in == nil { - return nil - } - out := new(NovaNoVNCProxyDefaults) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaNoVNCProxyList) DeepCopyInto(out *NovaNoVNCProxyList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]NovaNoVNCProxy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaNoVNCProxyList. -func (in *NovaNoVNCProxyList) DeepCopy() *NovaNoVNCProxyList { - if in == nil { - return nil - } - out := new(NovaNoVNCProxyList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaNoVNCProxyList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaNoVNCProxySpec) DeepCopyInto(out *NovaNoVNCProxySpec) { - *out = *in - in.NovaServiceBase.DeepCopyInto(&out.NovaServiceBase) - in.Override.DeepCopyInto(&out.Override) - in.TLS.DeepCopyInto(&out.TLS) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaNoVNCProxySpec. -func (in *NovaNoVNCProxySpec) DeepCopy() *NovaNoVNCProxySpec { - if in == nil { - return nil - } - out := new(NovaNoVNCProxySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaNoVNCProxyStatus) DeepCopyInto(out *NovaNoVNCProxyStatus) { - *out = *in - if in.Hash != nil { - in, out := &in.Hash, &out.Hash - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(condition.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make(map[string][]string, len(*in)) - for key, val := range *in { - var outVal []string - if val == nil { - (*out)[key] = nil - } else { - inVal := (*in)[key] - in, out := &inVal, &outVal - *out = make([]string, len(*in)) - copy(*out, *in) - } - (*out)[key] = outVal - } - } - if in.LastAppliedTopology != nil { - in, out := &in.LastAppliedTopology, &out.LastAppliedTopology - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaNoVNCProxyStatus. -func (in *NovaNoVNCProxyStatus) DeepCopy() *NovaNoVNCProxyStatus { - if in == nil { - return nil - } - out := new(NovaNoVNCProxyStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaNoVNCProxyTemplate) DeepCopyInto(out *NovaNoVNCProxyTemplate) { - *out = *in - if in.Enabled != nil { - in, out := &in.Enabled, &out.Enabled - *out = new(bool) - **out = **in - } - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - *out = new(int32) - **out = **in - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(map[string]string) - if **in != nil { - in, out := *in, *out - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - } - in.Resources.DeepCopyInto(&out.Resources) - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make([]string, len(*in)) - copy(*out, *in) - } - in.Override.DeepCopyInto(&out.Override) - in.TLS.DeepCopyInto(&out.TLS) - if in.TopologyRef != nil { - in, out := &in.TopologyRef, &out.TopologyRef - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaNoVNCProxyTemplate. -func (in *NovaNoVNCProxyTemplate) DeepCopy() *NovaNoVNCProxyTemplate { - if in == nil { - return nil - } - out := new(NovaNoVNCProxyTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaScheduler) DeepCopyInto(out *NovaScheduler) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaScheduler. -func (in *NovaScheduler) DeepCopy() *NovaScheduler { - if in == nil { - return nil - } - out := new(NovaScheduler) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaScheduler) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaSchedulerDefaults) DeepCopyInto(out *NovaSchedulerDefaults) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaSchedulerDefaults. -func (in *NovaSchedulerDefaults) DeepCopy() *NovaSchedulerDefaults { - if in == nil { - return nil - } - out := new(NovaSchedulerDefaults) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaSchedulerList) DeepCopyInto(out *NovaSchedulerList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]NovaScheduler, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaSchedulerList. -func (in *NovaSchedulerList) DeepCopy() *NovaSchedulerList { - if in == nil { - return nil - } - out := new(NovaSchedulerList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NovaSchedulerList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaSchedulerSpec) DeepCopyInto(out *NovaSchedulerSpec) { - *out = *in - in.NovaServiceBase.DeepCopyInto(&out.NovaServiceBase) - if in.RegisteredCells != nil { - in, out := &in.RegisteredCells, &out.RegisteredCells - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - out.TLS = in.TLS -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaSchedulerSpec. -func (in *NovaSchedulerSpec) DeepCopy() *NovaSchedulerSpec { - if in == nil { - return nil - } - out := new(NovaSchedulerSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaSchedulerStatus) DeepCopyInto(out *NovaSchedulerStatus) { - *out = *in - if in.Hash != nil { - in, out := &in.Hash, &out.Hash - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(condition.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make(map[string][]string, len(*in)) - for key, val := range *in { - var outVal []string - if val == nil { - (*out)[key] = nil - } else { - inVal := (*in)[key] - in, out := &inVal, &outVal - *out = make([]string, len(*in)) - copy(*out, *in) - } - (*out)[key] = outVal - } - } - if in.LastAppliedTopology != nil { - in, out := &in.LastAppliedTopology, &out.LastAppliedTopology - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaSchedulerStatus. -func (in *NovaSchedulerStatus) DeepCopy() *NovaSchedulerStatus { - if in == nil { - return nil - } - out := new(NovaSchedulerStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaSchedulerTemplate) DeepCopyInto(out *NovaSchedulerTemplate) { - *out = *in - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - *out = new(int32) - **out = **in - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(map[string]string) - if **in != nil { - in, out := *in, *out - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - } - in.Resources.DeepCopyInto(&out.Resources) - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.TopologyRef != nil { - in, out := &in.TopologyRef, &out.TopologyRef - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaSchedulerTemplate. -func (in *NovaSchedulerTemplate) DeepCopy() *NovaSchedulerTemplate { - if in == nil { - return nil - } - out := new(NovaSchedulerTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaServiceBase) DeepCopyInto(out *NovaServiceBase) { - *out = *in - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - *out = new(int32) - **out = **in - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(map[string]string) - if **in != nil { - in, out := *in, *out - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - } - in.Resources.DeepCopyInto(&out.Resources) - if in.NetworkAttachments != nil { - in, out := &in.NetworkAttachments, &out.NetworkAttachments - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.TopologyRef != nil { - in, out := &in.TopologyRef, &out.TopologyRef - *out = new(topologyv1beta1.TopoRef) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaServiceBase. -func (in *NovaServiceBase) DeepCopy() *NovaServiceBase { - if in == nil { - return nil - } - out := new(NovaServiceBase) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaSpec) DeepCopyInto(out *NovaSpec) { - *out = *in - in.NovaSpecCore.DeepCopyInto(&out.NovaSpecCore) - out.NovaImages = in.NovaImages -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaSpec. -func (in *NovaSpec) DeepCopy() *NovaSpec { - if in == nil { - return nil - } - out := new(NovaSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaSpecCore) DeepCopyInto(out *NovaSpecCore) { - *out = *in - out.MessagingBus = in.MessagingBus - if in.CellTemplates != nil { - in, out := &in.CellTemplates, &out.CellTemplates - *out = make(map[string]NovaCellTemplate, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - out.PasswordSelectors = in.PasswordSelectors - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(map[string]string) - if **in != nil { - in, out := *in, *out - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - } - in.APIServiceTemplate.DeepCopyInto(&out.APIServiceTemplate) - in.SchedulerServiceTemplate.DeepCopyInto(&out.SchedulerServiceTemplate) - in.MetadataServiceTemplate.DeepCopyInto(&out.MetadataServiceTemplate) - if in.TopologyRef != nil { - in, out := &in.TopologyRef, &out.TopologyRef - *out = new(topologyv1beta1.TopoRef) - **out = **in - } - if in.NotificationsBusInstance != nil { - in, out := &in.NotificationsBusInstance, &out.NotificationsBusInstance - *out = new(string) - **out = **in - } - if in.NotificationsBus != nil { - in, out := &in.NotificationsBus, &out.NotificationsBus - *out = new(rabbitmqv1beta1.RabbitMqConfig) - **out = **in - } - out.Auth = in.Auth -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaSpecCore. -func (in *NovaSpecCore) DeepCopy() *NovaSpecCore { - if in == nil { - return nil - } - out := new(NovaSpecCore) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NovaStatus) DeepCopyInto(out *NovaStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(condition.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.RegisteredCells != nil { - in, out := &in.RegisteredCells, &out.RegisteredCells - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.DiscoveredCells != nil { - in, out := &in.DiscoveredCells, &out.DiscoveredCells - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NovaStatus. -func (in *NovaStatus) DeepCopy() *NovaStatus { - if in == nil { - return nil - } - out := new(NovaStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PasswordSelector) DeepCopyInto(out *PasswordSelector) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PasswordSelector. -func (in *PasswordSelector) DeepCopy() *PasswordSelector { - if in == nil { - return nil - } - out := new(PasswordSelector) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TLSSection) DeepCopyInto(out *TLSSection) { - *out = *in - in.Service.DeepCopyInto(&out.Service) - in.Vencrypt.DeepCopyInto(&out.Vencrypt) - out.Ca = in.Ca -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSSection. -func (in *TLSSection) DeepCopy() *TLSSection { - if in == nil { - return nil - } - out := new(TLSSection) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VNCProxyOverrideSpec) DeepCopyInto(out *VNCProxyOverrideSpec) { - *out = *in - if in.Service != nil { - in, out := &in.Service, &out.Service - *out = new(service.RoutedOverrideSpec) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VNCProxyOverrideSpec. -func (in *VNCProxyOverrideSpec) DeepCopy() *VNCProxyOverrideSpec { - if in == nil { - return nil - } - out := new(VNCProxyOverrideSpec) - in.DeepCopyInto(out) - return out -}