diff --git a/README.md b/README.md index 79ca9cde5d..7c468eed9d 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ currently fall in this category are: services * [Percona MongoDB](https://operatorhub.io/operator/percona-server-mongodb-operator): - bindable with `PerconaServerMongoDB.psmdb.percona.com/v1-9-0` and `v1-10-0` + bindable with `PerconaServerMongoDB.psmdb.percona.com/v1-9-0`, `v1-10-0` and `v1` services * NOTE: Provides administrative access to the cluster by default * [RabbitMQ Cluster](https://github.com/rabbitmq/cluster-operator): bindable diff --git a/pkg/binding/registry/registry.go b/pkg/binding/registry/registry.go index 982e3dbc79..5222fbc65a 100644 --- a/pkg/binding/registry/registry.go +++ b/pkg/binding/registry/registry.go @@ -75,6 +75,14 @@ func New() Registry { "service.binding/password": "path={.spec.secrets.users},objectType=Secret,sourceKey=MONGODB_USER_ADMIN_PASSWORD", "service.binding/host": "path={.status.host}", }, + schema.GroupVersionKind{Group: "psmdb.percona.com", Version: "v1", Kind: "PerconaServerMongoDB"}: { + "service.binding/type": "mongodb", + "service.binding/provider": "percona", + "service.binding": "path={.spec.secrets.users},objectType=Secret", + "service.binding/username": "path={.spec.secrets.users},objectType=Secret,sourceKey=MONGODB_USER_ADMIN_USER", + "service.binding/password": "path={.spec.secrets.users},objectType=Secret,sourceKey=MONGODB_USER_ADMIN_PASSWORD", + "service.binding/host": "path={.status.host}", + }, schema.GroupVersionKind{Group: "postgresql.k8s.enterprisedb.io", Version: "v1", Kind: "Cluster"}: { "service.binding/type": "postgresql", "service.binding/host": "path={.status.writeService}", diff --git a/test/acceptance/features/supportExistingOperatorBackedServices.feature b/test/acceptance/features/supportExistingOperatorBackedServices.feature index 07ad3356df..167a4741a6 100644 --- a/test/acceptance/features/supportExistingOperatorBackedServices.feature +++ b/test/acceptance/features/supportExistingOperatorBackedServices.feature @@ -445,22 +445,25 @@ Feature: Support a number of existing operator-backed services out of the box """ And File "/bindings/$scenario_id/password" exists in application pod - @crdv1beta1 - Scenario: Bind test application to MongoDB provisioned by Percona's MongoDB operator + @disable-openshift-4.9 + @disable-openshift-4.10 + @disable-openshift-4.11 + @disable-openshift-4.12 + Scenario: Bind test application to MongoDB provisioned by Percona's MongoDB operator on Kubernetes Given Percona MongoDB operator is running * Generic test application is running * The Custom Resource is present """ - apiVersion: psmdb.percona.com/v1-9-0 + apiVersion: psmdb.percona.com/v1 kind: PerconaServerMongoDB metadata: name: mongo-cluster spec: - crVersion: 1.9.0 - image: percona/percona-server-mongodb:4.4.8-9 + crVersion: 1.13.0 + image: percona/percona-server-mongodb:4.4.9-10 allowUnsafeConfigurations: true upgradeOptions: - apply: 4.4-recommended + apply: disabled schedule: "0 2 * * *" secrets: users: mongo-cluster-secrets @@ -472,8 +475,6 @@ Feature: Support a number of existing operator-backed services out of the box resources: requests: storage: 1Gi - sharding: - enabled: false """ When Service Binding is applied """ @@ -484,7 +485,7 @@ Feature: Support a number of existing operator-backed services out of the box spec: services: - group: psmdb.percona.com - version: v1-9-0 + version: v1 kind: PerconaServerMongoDB name: mongo-cluster application: @@ -494,7 +495,7 @@ Feature: Support a number of existing operator-backed services out of the box resource: deployments """ Then Service Binding is ready - And Kind PerconaServerMongoDB with apiVersion psmdb.percona.com/v1-9-0 is listed in bindable kinds + And Kind PerconaServerMongoDB with apiVersion psmdb.percona.com/v1 is listed in bindable kinds And Content of file "/bindings/$scenario_id/type" in application pod is """ mongodb @@ -508,3 +509,66 @@ Feature: Support a number of existing operator-backed services out of the box """ mongo-cluster-rs0.$NAMESPACE.svc.cluster.local """ + + @disable-github-actions + Scenario: Bind test application to MongoDB provisioned by Percona's MongoDB operator on OpenShift + Given Percona MongoDB operator is running + * Generic test application is running + * The Custom Resource is present + """ + apiVersion: psmdb.percona.com/v1 + kind: PerconaServerMongoDB + metadata: + name: mongo-cluster + spec: + platform: openshift + crVersion: 1.13.0 + image: percona/percona-server-mongodb:4.4.9-10 + allowUnsafeConfigurations: true + upgradeOptions: + apply: disabled + schedule: "0 2 * * *" + secrets: + users: mongo-cluster-secrets + replsets: + - name: rs0 + size: 1 + volumeSpec: + persistentVolumeClaim: + resources: + requests: + storage: 1Gi + """ + When Service Binding is applied + """ + apiVersion: binding.operators.coreos.com/v1alpha1 + kind: ServiceBinding + metadata: + name: $scenario_id + spec: + services: + - group: psmdb.percona.com + version: v1 + kind: PerconaServerMongoDB + name: mongo-cluster + application: + name: $scenario_id + group: apps + version: v1 + resource: deployments + """ + Then Service Binding is ready + And Kind PerconaServerMongoDB with apiVersion psmdb.percona.com/v1 is listed in bindable kinds + And Content of file "/bindings/$scenario_id/type" in application pod is + """ + mongodb + """ + And Content of file "/bindings/$scenario_id/username" in application pod is + """ + userAdmin + """ + And File "/bindings/$scenario_id/password" exists in application pod + And Content of file "/bindings/$scenario_id/host" in application pod is + """ + mongo-cluster-rs0.$NAMESPACE.svc.cluster.local + """ \ No newline at end of file