From d0326ff848e16ee677b0ca56290591a82b820f68 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 29 Jan 2024 13:13:16 -0500 Subject: [PATCH] interim migrate to MariaDBAccount generation --- .../glance.openstack.org_glanceapis.yaml | 6 +- api/bases/glance.openstack.org_glances.yaml | 6 +- api/v1beta1/glance_types.go | 12 ++-- api/v1beta1/glanceapi_types.go | 9 ++- .../glance.openstack.org_glanceapis.yaml | 6 +- .../bases/glance.openstack.org_glances.yaml | 6 +- config/samples/backends/ceph/ceph.yaml | 2 +- .../backends/multistore/multistore.yaml | 2 +- config/samples/glance_v1beta1_glance.yaml | 2 +- config/samples/glance_v1beta1_glanceapi.yaml | 23 +++++++- config/samples/image_cache/image-cache.yaml | 2 +- .../image_conversion/image_conversion.yaml | 2 +- .../image_decompression.yaml | 2 +- .../inject_metadata/inject_metadata.yaml | 2 +- .../layout/base/glance_v1beta1_glance.yaml | 2 +- .../layout/edge/glance_v1beta1_glance.yaml | 2 +- .../multiple/glance_v1beta1_glance.yaml | 2 +- .../layout/single/glance_v1beta1_glance.yaml | 2 +- .../single_tls/glance_v1beta1_glance.yaml | 2 +- .../glance_v1beta_glance_apply_policy.yaml | 2 +- .../quotas/glance_v1beta1_glance_quota.yaml | 2 +- controllers/glance_controller.go | 56 ++++++++++++++----- controllers/glanceapi_controller.go | 15 ++++- go.mod | 2 + go.sum | 4 +- test/functional/base_test.go | 4 +- test/functional/glance_controller_test.go | 2 +- test/functional/glance_test_data.go | 7 ++- 28 files changed, 130 insertions(+), 56 deletions(-) diff --git a/api/bases/glance.openstack.org_glanceapis.yaml b/api/bases/glance.openstack.org_glanceapis.yaml index 302d5561..777c4feb 100644 --- a/api/bases/glance.openstack.org_glanceapis.yaml +++ b/api/bases/glance.openstack.org_glanceapis.yaml @@ -55,11 +55,11 @@ spec: items: type: string type: array - databaseHostname: - type: string - databaseUser: + databaseAccount: default: glance type: string + databaseHostname: + type: string extraMounts: items: properties: diff --git a/api/bases/glance.openstack.org_glances.yaml b/api/bases/glance.openstack.org_glances.yaml index f1c7eb91..047d92b4 100644 --- a/api/bases/glance.openstack.org_glances.yaml +++ b/api/bases/glance.openstack.org_glances.yaml @@ -44,11 +44,11 @@ spec: items: type: string type: array - databaseInstance: - type: string - databaseUser: + databaseAccount: default: glance type: string + databaseInstance: + type: string dbPurge: properties: age: diff --git a/api/v1beta1/glance_types.go b/api/v1beta1/glance_types.go index 9616f8be..f553c145 100644 --- a/api/v1beta1/glance_types.go +++ b/api/v1beta1/glance_types.go @@ -52,12 +52,16 @@ type GlanceSpec struct { // +kubebuilder:validation:Optional // +kubebuilder:default=glance - // DatabaseUser - optional username used for glance DB, defaults to glance - // TODO: -> implement needs work in mariadb-operator, right now only glance - DatabaseUser string `json:"databaseUser"` + // DatabaseAccount - name of MariaDBAccount which will be used to connect. + // As an interim solution, glance-controller will + // generate the MariaDBAccount object of the given name if it's not + // present in the cluster. Later, openstack-operator will perform this + // generation and also populate this field for the Glance objects it creates + DatabaseAccount string `json:"databaseAccount"` // +kubebuilder:validation:Required - // Secret containing OpenStack password information for glance GlanceDatabasePassword + // Secret containing OpenStack password information for glance's keystone + // password; no longer used for database password Secret string `json:"secret"` // +kubebuilder:validation:Optional diff --git a/api/v1beta1/glanceapi_types.go b/api/v1beta1/glanceapi_types.go index c3eda7c2..817235ac 100644 --- a/api/v1beta1/glanceapi_types.go +++ b/api/v1beta1/glanceapi_types.go @@ -55,9 +55,12 @@ type GlanceAPISpec struct { // +kubebuilder:validation:Optional // +kubebuilder:default=glance - // DatabaseUser - optional username used for glance DB, defaults to glance - // TODO: -> implement needs work in mariadb-operator, right now only glance - DatabaseUser string `json:"databaseUser"` + // DatabaseAccount - name of MariaDBAccount which will be used to connect. + // As an interim solution, glance-controller will + // generate the MariaDBAccount object of the given name if it's not + // present in the cluster. Later, openstack-operator will perform this + // generation and also populate this field for the Glance objects it creates + DatabaseAccount string `json:"databaseAccount"` // +kubebuilder:validation:Required // Secret containing OpenStack password information for glance AdminPassword diff --git a/config/crd/bases/glance.openstack.org_glanceapis.yaml b/config/crd/bases/glance.openstack.org_glanceapis.yaml index 302d5561..777c4feb 100644 --- a/config/crd/bases/glance.openstack.org_glanceapis.yaml +++ b/config/crd/bases/glance.openstack.org_glanceapis.yaml @@ -55,11 +55,11 @@ spec: items: type: string type: array - databaseHostname: - type: string - databaseUser: + databaseAccount: default: glance type: string + databaseHostname: + type: string extraMounts: items: properties: diff --git a/config/crd/bases/glance.openstack.org_glances.yaml b/config/crd/bases/glance.openstack.org_glances.yaml index f1c7eb91..047d92b4 100644 --- a/config/crd/bases/glance.openstack.org_glances.yaml +++ b/config/crd/bases/glance.openstack.org_glances.yaml @@ -44,11 +44,11 @@ spec: items: type: string type: array - databaseInstance: - type: string - databaseUser: + databaseAccount: default: glance type: string + databaseInstance: + type: string dbPurge: properties: age: diff --git a/config/samples/backends/ceph/ceph.yaml b/config/samples/backends/ceph/ceph.yaml index c48a49b4..e159b23d 100644 --- a/config/samples/backends/ceph/ceph.yaml +++ b/config/samples/backends/ceph/ceph.yaml @@ -19,7 +19,7 @@ spec: rbd_store_pool = images rbd_store_user = openstack databaseInstance: openstack - databaseUser: glance + databaseAccount: glance secret: osp-secret storageClass: "" storageRequest: 1G diff --git a/config/samples/backends/multistore/multistore.yaml b/config/samples/backends/multistore/multistore.yaml index d571942f..7497755b 100644 --- a/config/samples/backends/multistore/multistore.yaml +++ b/config/samples/backends/multistore/multistore.yaml @@ -30,7 +30,7 @@ spec: swift_store_user = service:glance swift_store_endpoint_type = internalURL databaseInstance: openstack - databaseUser: glance + databaseAccount: glance glanceAPIs: default: debug: diff --git a/config/samples/glance_v1beta1_glance.yaml b/config/samples/glance_v1beta1_glance.yaml index ba194636..e203abbe 100644 --- a/config/samples/glance_v1beta1_glance.yaml +++ b/config/samples/glance_v1beta1_glance.yaml @@ -9,7 +9,7 @@ spec: debug = true enabled_backends=foo:bar,foo1:bar1 databaseInstance: openstack - databaseUser: glance + databaseAccount: glance secret: osp-secret storageClass: local-storage storageRequest: 10G diff --git a/config/samples/glance_v1beta1_glanceapi.yaml b/config/samples/glance_v1beta1_glanceapi.yaml index e2ff668c..2f2cf97e 100644 --- a/config/samples/glance_v1beta1_glanceapi.yaml +++ b/config/samples/glance_v1beta1_glanceapi.yaml @@ -15,7 +15,7 @@ spec: here-foo-config [foo1] here-foo1-config - databaseUser: glance + databaseAccount: glance databaseHostname: glance debug: dbSync: false @@ -34,3 +34,24 @@ spec: # secretName: cert-public-svc # # secret holding the tls-ca-bundle.pem to be used as a deploymend env CA bundle # caBundleSecretName: combined-ca-bundle + +--- + +apiVersion: mariadb.openstack.org/v1beta1 +kind: MariaDBAccount +metadata: + name: glance +spec: + userName: glance + secret: glancedb-secret + +--- + +apiVersion: v1 +data: + # neutron123 + DatabasePassword: bmV1dHJvbjEyMw== +kind: Secret +metadata: + name: glancedb-secret +type: Opaque diff --git a/config/samples/image_cache/image-cache.yaml b/config/samples/image_cache/image-cache.yaml index 3105abab..a8886a89 100644 --- a/config/samples/image_cache/image-cache.yaml +++ b/config/samples/image_cache/image-cache.yaml @@ -21,7 +21,7 @@ spec: store_description = "RBD backend" rbd_store_pool = images rbd_store_user = openstack - databaseUser: glance + databaseAccount: glance glanceAPIs: default: debug: diff --git a/config/samples/import_plugins/image_conversion/image_conversion.yaml b/config/samples/import_plugins/image_conversion/image_conversion.yaml index fe68ea97..ed5a20ca 100644 --- a/config/samples/import_plugins/image_conversion/image_conversion.yaml +++ b/config/samples/import_plugins/image_conversion/image_conversion.yaml @@ -24,7 +24,7 @@ spec: [image_conversion] output_format = raw databaseInstance: openstack - databaseUser: glance + databaseAccount: glance glanceAPI: debug: service: false diff --git a/config/samples/import_plugins/image_decompression/image_decompression.yaml b/config/samples/import_plugins/image_decompression/image_decompression.yaml index a027eb8e..d3f57eca 100644 --- a/config/samples/import_plugins/image_decompression/image_decompression.yaml +++ b/config/samples/import_plugins/image_decompression/image_decompression.yaml @@ -21,7 +21,7 @@ spec: [image_import_opts] image_import_plugins = [image_decompression] databaseInstance: openstack - databaseUser: glance + databaseAccount: glance glanceAPI: debug: service: false diff --git a/config/samples/import_plugins/inject_metadata/inject_metadata.yaml b/config/samples/import_plugins/inject_metadata/inject_metadata.yaml index e45ce9bf..6315aa3d 100644 --- a/config/samples/import_plugins/inject_metadata/inject_metadata.yaml +++ b/config/samples/import_plugins/inject_metadata/inject_metadata.yaml @@ -24,7 +24,7 @@ spec: ignore_user_roles = admin,user1 inject = "property1":"value1","property2":"value2" databaseInstance: openstack - databaseUser: glance + databaseAccount: glance glanceAPI: debug: service: false diff --git a/config/samples/layout/base/glance_v1beta1_glance.yaml b/config/samples/layout/base/glance_v1beta1_glance.yaml index e0167f03..7291a575 100644 --- a/config/samples/layout/base/glance_v1beta1_glance.yaml +++ b/config/samples/layout/base/glance_v1beta1_glance.yaml @@ -9,7 +9,7 @@ spec: debug = true enabled_backends=foo:bar databaseInstance: openstack - databaseUser: glance + databaseAccount: glance secret: osp-secret storageClass: local-storage storageRequest: 10G diff --git a/config/samples/layout/edge/glance_v1beta1_glance.yaml b/config/samples/layout/edge/glance_v1beta1_glance.yaml index e9cb3d06..5e17c88e 100644 --- a/config/samples/layout/edge/glance_v1beta1_glance.yaml +++ b/config/samples/layout/edge/glance_v1beta1_glance.yaml @@ -8,7 +8,7 @@ spec: [DEFAULT] debug = true databaseInstance: openstack - databaseUser: glance + databaseAccount: glance keystoneEndpoint: central glanceAPIs: central: diff --git a/config/samples/layout/multiple/glance_v1beta1_glance.yaml b/config/samples/layout/multiple/glance_v1beta1_glance.yaml index 378b5368..aac61f1c 100644 --- a/config/samples/layout/multiple/glance_v1beta1_glance.yaml +++ b/config/samples/layout/multiple/glance_v1beta1_glance.yaml @@ -8,7 +8,7 @@ spec: [DEFAULT] debug = true databaseInstance: openstack - databaseUser: glance + databaseAccount: glance keystoneEndpoint: api1 glanceAPIs: api1: diff --git a/config/samples/layout/single/glance_v1beta1_glance.yaml b/config/samples/layout/single/glance_v1beta1_glance.yaml index 4f39130f..4c866059 100644 --- a/config/samples/layout/single/glance_v1beta1_glance.yaml +++ b/config/samples/layout/single/glance_v1beta1_glance.yaml @@ -5,7 +5,7 @@ metadata: spec: serviceUser: glance databaseInstance: openstack - databaseUser: glance + databaseAccount: glance keystoneEndpoint: default customServiceConfig: | [DEFAULT] diff --git a/config/samples/layout/single_tls/glance_v1beta1_glance.yaml b/config/samples/layout/single_tls/glance_v1beta1_glance.yaml index 6e441b8d..3d1d98c8 100644 --- a/config/samples/layout/single_tls/glance_v1beta1_glance.yaml +++ b/config/samples/layout/single_tls/glance_v1beta1_glance.yaml @@ -5,7 +5,7 @@ metadata: spec: serviceUser: glance databaseInstance: openstack - databaseUser: glance + databaseAccount: glance keystoneEndpoint: default customServiceConfig: | [DEFAULT] diff --git a/config/samples/policy/glance_v1beta_glance_apply_policy.yaml b/config/samples/policy/glance_v1beta_glance_apply_policy.yaml index 91e4d6a0..4e0e2dfc 100644 --- a/config/samples/policy/glance_v1beta_glance_apply_policy.yaml +++ b/config/samples/policy/glance_v1beta_glance_apply_policy.yaml @@ -10,7 +10,7 @@ spec: enforce_scope=true enforce_new_defaults=true databaseInstance: openstack - databaseUser: glance + databaseAccount: glance glanceAPI: preserveJobs: false replicas: 1 diff --git a/config/samples/quotas/glance_v1beta1_glance_quota.yaml b/config/samples/quotas/glance_v1beta1_glance_quota.yaml index fa783205..80ea7468 100644 --- a/config/samples/quotas/glance_v1beta1_glance_quota.yaml +++ b/config/samples/quotas/glance_v1beta1_glance_quota.yaml @@ -6,7 +6,7 @@ metadata: spec: serviceUser: glance databaseInstance: openstack - databaseUser: glance + databaseAccount: glance keystoneEndpoint: default glanceAPIs: default: diff --git a/controllers/glance_controller.go b/controllers/glance_controller.go index 3307bb5d..24a17c8d 100644 --- a/controllers/glance_controller.go +++ b/controllers/glance_controller.go @@ -210,6 +210,7 @@ func (r *GlanceReconciler) SetupWithManager(mgr ctrl.Manager) error { For(&glancev1.Glance{}). Owns(&glancev1.GlanceAPI{}). Owns(&mariadbv1.MariaDBDatabase{}). + Owns(&mariadbv1.MariaDBAccount{}). Owns(&keystonev1.KeystoneService{}). Owns(&corev1.PersistentVolumeClaim{}). Owns(&batchv1.Job{}). @@ -263,7 +264,7 @@ func (r *GlanceReconciler) reconcileDelete(ctx context.Context, instance *glance r.Log.Info(fmt.Sprintf("Reconciling Service '%s' delete", instance.Name)) // remove db finalizer first - db, err := mariadbv1.GetDatabaseByName(ctx, helper, instance.Name) + db, err := mariadbv1.GetDatabaseByNameAndAccount(ctx, helper, instance.Name, instance.Spec.DatabaseAccount, instance.Namespace) if err != nil && !k8s_errors.IsNotFound(err) { return ctrl.Result{}, err } @@ -364,19 +365,21 @@ func (r *GlanceReconciler) reconcileInit( // // create service DB instance // - db := mariadbv1.NewDatabase( - instance.Name, - instance.Spec.DatabaseUser, - instance.Spec.Secret, - map[string]string{ - "dbName": instance.Spec.DatabaseInstance, - }, + db := mariadbv1.NewDatabaseForAccount( + instance.Spec.DatabaseInstance, // mariadb/galera service to target + instance.Name, // name used in CREATE DATABASE in mariadb + instance.Name, // CR name for MariaDBDatabase + instance.Spec.DatabaseAccount, // CR name for MariaDBAccount + instance.Namespace, // namespace ) + // create or patch the DB - ctrlResult, err := db.CreateOrPatchDB( + ctrlResult, err := db.CreateOrPatchDBByName( ctx, helper, + instance.Spec.DatabaseInstance, ) + if err != nil { instance.Status.Conditions.Set(condition.FalseCondition( condition.DBReadyCondition, @@ -806,7 +809,7 @@ func (r *GlanceReconciler) apiDeploymentCreateOrUpdate( GlanceAPITemplate: apiTemplate, APIType: apiType, DatabaseHostname: instance.Status.DatabaseHostname, - DatabaseUser: instance.Spec.DatabaseUser, + DatabaseAccount: instance.Spec.DatabaseAccount, Secret: instance.Spec.Secret, ExtraMounts: instance.Spec.ExtraMounts, PasswordSelectors: instance.Spec.PasswordSelectors, @@ -886,7 +889,34 @@ func (r *GlanceReconciler) generateServiceConfig( ) error { labels := labels.GetLabels(instance, labels.GetGroupLabel(glance.ServiceName), serviceLabels) - ospSecret, _, err := secret.GetSecret(ctx, h, instance.Spec.Secret, instance.Namespace) + // create a new MariaDBAccount CR to be populated here. + // + // Note that we are only looking for a MariaDBAccount CR with a name + // and associated Secret, but **not** an actual mariadb username in a galera + // database. The account + // has not yet been linked to a MariaDBDatabase, so it will only exist as a + // CR in the cluster. Once linked to a MariaDBDatabase, the mariadb-operator + // will ensure it exists with rights for that database. + // + // This is an **interim** step, where later openstack-operator will + // ensure that MariaDBAccounts are created for all the services it + // initializes, and this block would no longer be present here. + // At that point the DatabaseAccount field can be set to be required. + err := mariadbv1.InterimCreateNewAccount( + ctx, h, instance.Spec.DatabaseAccount, "glance", instance.Namespace, + ) + + if err != nil { + return err + } + // end section that would be done by openstack-operator eventually + + databaseAccount, err := mariadbv1.GetAccount(ctx, h, instance.Spec.DatabaseAccount, instance.Namespace) + if err != nil { + return err + } + + dbSecret, _, err := secret.GetSecret(ctx, h, databaseAccount.Spec.Secret, instance.Namespace) if err != nil { return err } @@ -896,8 +926,8 @@ func (r *GlanceReconciler) generateServiceConfig( templateParameters := map[string]interface{}{ "MinimalConfig": true, // This tells the template to generate a minimal config "DatabaseConnection": fmt.Sprintf("mysql+pymysql://%s:%s@%s/%s", - instance.Spec.DatabaseUser, - string(ospSecret.Data[instance.Spec.PasswordSelectors.Database]), + databaseAccount.Spec.UserName, + string(dbSecret.Data["DatabasePassword"]), instance.Status.DatabaseHostname, glance.DatabaseName, ), diff --git a/controllers/glanceapi_controller.go b/controllers/glanceapi_controller.go index 3daca50c..8b07f363 100644 --- a/controllers/glanceapi_controller.go +++ b/controllers/glanceapi_controller.go @@ -22,6 +22,7 @@ import ( "strings" "time" + mariadbv1 "github.com/openstack-k8s-operators/mariadb-operator/api/v1beta1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/fields" @@ -809,6 +810,16 @@ func (r *GlanceAPIReconciler) generateServiceConfig( return err } + databaseAccount, err := mariadbv1.GetAccount(ctx, h, instance.Spec.DatabaseAccount, instance.Namespace) + if err != nil { + return err + } + + dbSecret, _, err := secret.GetSecret(ctx, h, databaseAccount.Spec.Secret, instance.Namespace) + if err != nil { + return err + } + glanceEndpoints := glanceapi.GetGlanceEndpoints(instance.Spec.APIType) httpdVhostConfig := map[string]interface{}{} for endpt := range glanceEndpoints { @@ -829,8 +840,8 @@ func (r *GlanceAPIReconciler) generateServiceConfig( "KeystoneInternalURL": keystoneInternalURL, "KeystonePublicURL": keystonePublicURL, "DatabaseConnection": fmt.Sprintf("mysql+pymysql://%s:%s@%s/%s", - instance.Spec.DatabaseUser, - string(ospSecret.Data[instance.Spec.PasswordSelectors.Database]), + databaseAccount.Spec.UserName, + string(dbSecret.Data["DatabasePassword"]), instance.Spec.DatabaseHostname, glance.DatabaseName, ), diff --git a/go.mod b/go.mod index 8b8cb05e..bce4c23d 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module github.com/openstack-k8s-operators/glance-operator go 1.19 +replace github.com/openstack-k8s-operators/mariadb-operator/api => github.com/zzzeek/mariadb-operator/api v0.3.0-integrateooaccounts + require ( github.com/go-logr/logr v1.4.1 github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 diff --git a/go.sum b/go.sum index 5abf1f57..7ad056c2 100644 --- a/go.sum +++ b/go.sum @@ -149,8 +149,6 @@ github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.202401291 github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20240129151020-c9467a8fbbfc/go.mod h1:lf4VSkNgy2mPyf4tR5xBXs8wQU9TJ9BYfY/Ay9/JkP0= github.com/openstack-k8s-operators/lib-common/modules/test v0.3.1-0.20240129151020-c9467a8fbbfc h1:1vqB6G8qvXH030JyVsx4acl5xtbCqwdbTHivc9f4vvY= github.com/openstack-k8s-operators/lib-common/modules/test v0.3.1-0.20240129151020-c9467a8fbbfc/go.mod h1:ni4mvKeubWsTjKmcToJ+hIo7pJipM9hwiUv8qhm1R6Y= -github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240124160436-36095347284f h1:01HrDX32rjFdvbSOMfz0fBCfxK6Kqthv0BgvimWL7Vc= -github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240124160436-36095347284f/go.mod h1:gAIo5SMvTTgUomxGC51T3PHIyremhe8xUvz2xpbuCsI= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -188,6 +186,8 @@ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/zzzeek/mariadb-operator/api v0.3.0-integrateooaccounts h1:vAPbkSK9JmakWaq4CQL0CVQCdL2XOfx7Vwv3f1kCHOQ= +github.com/zzzeek/mariadb-operator/api v0.3.0-integrateooaccounts/go.mod h1:D4sr4UipU4qjyrcO2mjW8YlSm48AdkY69dloASUbNYE= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= diff --git a/test/functional/base_test.go b/test/functional/base_test.go index 9c807a51..a9f3a710 100644 --- a/test/functional/base_test.go +++ b/test/functional/base_test.go @@ -90,7 +90,7 @@ func GetGlanceDefaultSpec() map[string]interface{} { return map[string]interface{}{ "keystoneEndpoint": "default", "databaseInstance": "openstack", - "databaseUser": glanceTest.GlanceDatabaseUser, + "databaseAccount": glanceTest.GlanceDatabaseAccount, "serviceUser": glanceName.Name, "secret": SecretName, "glanceAPIs": GetAPIList(), @@ -102,7 +102,7 @@ func GetGlanceDefaultSpecWithQuota() map[string]interface{} { return map[string]interface{}{ "keystoneEndpoint": "default", "databaseInstance": "openstack", - "databaseUser": glanceTest.GlanceDatabaseUser, + "databaseAccount": glanceTest.GlanceDatabaseAccount, "serviceUser": glanceName.Name, "secret": SecretName, "glanceAPIs": GetAPIList(), diff --git a/test/functional/glance_controller_test.go b/test/functional/glance_controller_test.go index 62618c94..08a4bc81 100644 --- a/test/functional/glance_controller_test.go +++ b/test/functional/glance_controller_test.go @@ -54,7 +54,7 @@ var _ = Describe("Glance controller", func() { It("initializes Spec fields", func() { Glance := GetGlance(glanceTest.Instance) Expect(Glance.Spec.DatabaseInstance).Should(Equal("openstack")) - Expect(Glance.Spec.DatabaseUser).Should(Equal(glanceTest.GlanceDatabaseUser)) + Expect(Glance.Spec.DatabaseAccount).Should(Equal(glanceTest.GlanceDatabaseAccount)) Expect(Glance.Spec.ServiceUser).Should(Equal(glanceTest.GlanceServiceUser)) // No Keystone Quota is present, check the default is 0 Expect(Glance.Spec.Quotas.ImageCountUpload).To(Equal(int(0))) diff --git a/test/functional/glance_test_data.go b/test/functional/glance_test_data.go index 91154bfd..9fba13c5 100644 --- a/test/functional/glance_test_data.go +++ b/test/functional/glance_test_data.go @@ -43,7 +43,7 @@ const ( // GlanceTestData is the data structure used to provide input data to envTest type GlanceTestData struct { ContainerImage string - GlanceDatabaseUser string + GlanceDatabaseAccount types.NamespacedName GlancePassword string GlanceServiceUser string GlancePVCSize string @@ -151,7 +151,10 @@ func GetGlanceTestData(glanceName types.NamespacedName) GlanceTestData { Namespace: glanceName.Namespace, Name: "internalapi", }, - GlanceDatabaseUser: "glance", + GlanceDatabaseAccount: types.NamespacedName{ + Namespace: glanceName.Namespace, + Name: "glance", + }, // Password used for both db and service GlancePassword: "12345678", GlanceServiceUser: "glance",