Skip to content
This repository was archived by the owner on Jun 26, 2024. It is now read-only.

Commit c908e8b

Browse files
Fix Percona MongoDB operator support (#1284) (#1290)
Signed-off-by: Pavel Macík <[email protected]> Signed-off-by: Pavel Macík <[email protected]> Signed-off-by: Pavel Macík <[email protected]> Co-authored-by: Pavel Macík <[email protected]>
1 parent ae32312 commit c908e8b

File tree

3 files changed

+83
-11
lines changed

3 files changed

+83
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ currently fall in this category are:
108108
services
109109
* [Percona
110110
MongoDB](https://operatorhub.io/operator/percona-server-mongodb-operator):
111-
bindable with `PerconaServerMongoDB.psmdb.percona.com/v1-9-0` and `v1-10-0`
111+
bindable with `PerconaServerMongoDB.psmdb.percona.com/v1-9-0`, `v1-10-0` and `v1`
112112
services
113113
* NOTE: Provides administrative access to the cluster by default
114114
* [RabbitMQ Cluster](https://github.com/rabbitmq/cluster-operator): bindable

pkg/binding/registry/registry.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ func New() Registry {
7575
"service.binding/password": "path={.spec.secrets.users},objectType=Secret,sourceKey=MONGODB_USER_ADMIN_PASSWORD",
7676
"service.binding/host": "path={.status.host}",
7777
},
78+
schema.GroupVersionKind{Group: "psmdb.percona.com", Version: "v1", Kind: "PerconaServerMongoDB"}: {
79+
"service.binding/type": "mongodb",
80+
"service.binding/provider": "percona",
81+
"service.binding": "path={.spec.secrets.users},objectType=Secret",
82+
"service.binding/username": "path={.spec.secrets.users},objectType=Secret,sourceKey=MONGODB_USER_ADMIN_USER",
83+
"service.binding/password": "path={.spec.secrets.users},objectType=Secret,sourceKey=MONGODB_USER_ADMIN_PASSWORD",
84+
"service.binding/host": "path={.status.host}",
85+
},
7886
schema.GroupVersionKind{Group: "postgresql.k8s.enterprisedb.io", Version: "v1", Kind: "Cluster"}: {
7987
"service.binding/type": "postgresql",
8088
"service.binding/host": "path={.status.writeService}",

test/acceptance/features/supportExistingOperatorBackedServices.feature

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -445,22 +445,25 @@ Feature: Support a number of existing operator-backed services out of the box
445445
"""
446446
And File "/bindings/$scenario_id/password" exists in application pod
447447

448-
@crdv1beta1
449-
Scenario: Bind test application to MongoDB provisioned by Percona's MongoDB operator
448+
@disable-openshift-4.9
449+
@disable-openshift-4.10
450+
@disable-openshift-4.11
451+
@disable-openshift-4.12
452+
Scenario: Bind test application to MongoDB provisioned by Percona's MongoDB operator on Kubernetes
450453
Given Percona MongoDB operator is running
451454
* Generic test application is running
452455
* The Custom Resource is present
453456
"""
454-
apiVersion: psmdb.percona.com/v1-9-0
457+
apiVersion: psmdb.percona.com/v1
455458
kind: PerconaServerMongoDB
456459
metadata:
457460
name: mongo-cluster
458461
spec:
459-
crVersion: 1.9.0
460-
image: percona/percona-server-mongodb:4.4.8-9
462+
crVersion: 1.13.0
463+
image: percona/percona-server-mongodb:4.4.9-10
461464
allowUnsafeConfigurations: true
462465
upgradeOptions:
463-
apply: 4.4-recommended
466+
apply: disabled
464467
schedule: "0 2 * * *"
465468
secrets:
466469
users: mongo-cluster-secrets
@@ -472,8 +475,6 @@ Feature: Support a number of existing operator-backed services out of the box
472475
resources:
473476
requests:
474477
storage: 1Gi
475-
sharding:
476-
enabled: false
477478
"""
478479
When Service Binding is applied
479480
"""
@@ -484,7 +485,7 @@ Feature: Support a number of existing operator-backed services out of the box
484485
spec:
485486
services:
486487
- group: psmdb.percona.com
487-
version: v1-9-0
488+
version: v1
488489
kind: PerconaServerMongoDB
489490
name: mongo-cluster
490491
application:
@@ -494,7 +495,7 @@ Feature: Support a number of existing operator-backed services out of the box
494495
resource: deployments
495496
"""
496497
Then Service Binding is ready
497-
And Kind PerconaServerMongoDB with apiVersion psmdb.percona.com/v1-9-0 is listed in bindable kinds
498+
And Kind PerconaServerMongoDB with apiVersion psmdb.percona.com/v1 is listed in bindable kinds
498499
And Content of file "/bindings/$scenario_id/type" in application pod is
499500
"""
500501
mongodb
@@ -508,3 +509,66 @@ Feature: Support a number of existing operator-backed services out of the box
508509
"""
509510
mongo-cluster-rs0.$NAMESPACE.svc.cluster.local
510511
"""
512+
513+
@disable-github-actions
514+
Scenario: Bind test application to MongoDB provisioned by Percona's MongoDB operator on OpenShift
515+
Given Percona MongoDB operator is running
516+
* Generic test application is running
517+
* The Custom Resource is present
518+
"""
519+
apiVersion: psmdb.percona.com/v1
520+
kind: PerconaServerMongoDB
521+
metadata:
522+
name: mongo-cluster
523+
spec:
524+
platform: openshift
525+
crVersion: 1.13.0
526+
image: percona/percona-server-mongodb:4.4.9-10
527+
allowUnsafeConfigurations: true
528+
upgradeOptions:
529+
apply: disabled
530+
schedule: "0 2 * * *"
531+
secrets:
532+
users: mongo-cluster-secrets
533+
replsets:
534+
- name: rs0
535+
size: 1
536+
volumeSpec:
537+
persistentVolumeClaim:
538+
resources:
539+
requests:
540+
storage: 1Gi
541+
"""
542+
When Service Binding is applied
543+
"""
544+
apiVersion: binding.operators.coreos.com/v1alpha1
545+
kind: ServiceBinding
546+
metadata:
547+
name: $scenario_id
548+
spec:
549+
services:
550+
- group: psmdb.percona.com
551+
version: v1
552+
kind: PerconaServerMongoDB
553+
name: mongo-cluster
554+
application:
555+
name: $scenario_id
556+
group: apps
557+
version: v1
558+
resource: deployments
559+
"""
560+
Then Service Binding is ready
561+
And Kind PerconaServerMongoDB with apiVersion psmdb.percona.com/v1 is listed in bindable kinds
562+
And Content of file "/bindings/$scenario_id/type" in application pod is
563+
"""
564+
mongodb
565+
"""
566+
And Content of file "/bindings/$scenario_id/username" in application pod is
567+
"""
568+
userAdmin
569+
"""
570+
And File "/bindings/$scenario_id/password" exists in application pod
571+
And Content of file "/bindings/$scenario_id/host" in application pod is
572+
"""
573+
mongo-cluster-rs0.$NAMESPACE.svc.cluster.local
574+
"""

0 commit comments

Comments
 (0)