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.sum b/go.sum index 5abf1f57..72c3e965 100644 --- a/go.sum +++ b/go.sum @@ -2,7 +2,10 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -24,6 +27,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= +github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -37,9 +41,11 @@ github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCv github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= @@ -76,6 +82,7 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -95,8 +102,11 @@ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLe github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= github.com/gophercloud/gophercloud v1.8.0 h1:TM3Jawprb2NrdOnvcHhWJalmKmAmOGgfZElM/3oBYCk= github.com/gophercloud/gophercloud v1.8.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= @@ -104,8 +114,10 @@ github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+h github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 h1:VzM3TYHDgqPkettiP6I6q2jOeQFL4nrJM+UcAc4f6Fs= github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0/go.mod h1:nqCI7aelBJU61wiBeeZWJ6oi4bJy5nrjkM6lWIMA4j0= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -122,6 +134,7 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -129,6 +142,10 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo/v2 v2.14.0 h1:vSmGj2Z5YPb9JwCWT6z6ihcUvDhuXLc3sJiqd3jMKAY= github.com/onsi/ginkgo/v2 v2.14.0/go.mod h1:JkUdW7JkN0V6rFvsHcJ478egV3XH9NxpD27Hal/PhZw= github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= @@ -151,6 +168,7 @@ github.com/openstack-k8s-operators/lib-common/modules/test v0.3.1-0.202401291510 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/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= 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 +206,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= @@ -321,6 +341,7 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 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",