Skip to content

Commit 0c3b3c2

Browse files
Julien-Benfealebenpaenammn
authored
CLOUDP-309402: MEKO MCK migration + rename enterprise resources (#18)
# Summary ## Short Summary This PR contains 2 main set of changes: - A new upgrade test, from MEKO to MCK. It runs in single and multi cluster mode. The test deploys a replicaset, and perform the upgrade steps recommended for migration. - A rename of most components created by the operator, such as service accounts, to make the upgrade possible without conflict between old and new resources. When the MCK helm chart is installed, new service accounts are created and the operator updates the stateful sets so that the pods use the new ones. ## List of changes ### Renaming - Introduced many variables for resource names. - Service Accounts, RBAC Resources, Services - Operator name, deployment name - Selectors and labels stay the same (`mongodb-enterprise-operator`) because for some resources it is impossible to change them without deleting it. - Some components kept their old names such as config map and secrets for multi-cluster. ### Tests - New helper functions to install the new MCK operator, to handle the two deployments. - Updated all existing upgrade tests to handle both deployments running concurrently (scale down first operator before installing the second one). This means that our existing tests are all testing a MEKO to MCK upgrade, and some specific ones are testing other paths, such as the sharded cluster upgrade which is doing 1.27 -> MCK. - New MEKO to MCK dedicated test, working in both single and multi cluster setting. Deploys a replica set and ensure the migration happens correctly. ## Note It is hard to ensure the renaming is completely exhaustive. The upgrade tests ensure we renamed necessary resources to ensure a smooth upgrade with no conflicts. Follow up PRs are/will be opened to rename smaller things like file names. There is still one e2e test failing that we are currently investigating, but we preferred to open the PR early for review. ## Proof of Work E2E test ## Checklist - [X] Have you linked a jira ticket and/or is the ticket in the title? - [X] Have you checked whether your jira ticket required DOCSP changes? --------- Co-authored-by: Yavor Georgiev <[email protected]> Co-authored-by: Nam Nguyen <[email protected]>
1 parent f8668d2 commit 0c3b3c2

File tree

82 files changed

+735
-374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+735
-374
lines changed

.evergreen-tasks.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ tasks:
185185
commands:
186186
- func: "e2e_test"
187187

188+
- name: e2e_meko_mck_upgrade
189+
tags: [ "patch-run" ]
190+
commands:
191+
- func: "e2e_test"
192+
188193
- name: e2e_olm_operator_upgrade
189194
# TODO: CLOUDP-310820 - After 1.0.0 release we need re-enable this
190195
disable: true

.evergreen.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ task_groups:
793793
- e2e_operator_clusterwide
794794
- e2e_operator_multi_namespaces
795795
- e2e_operator_upgrade_appdb_tls
796+
- e2e_meko_mck_upgrade
796797
<<: *teardown_group
797798

798799
# e2e_operator_race_with_telemetry_task_group includes the tests for testing the operator with race detector enabled
@@ -820,6 +821,7 @@ task_groups:
820821
- e2e_operator_clusterwide
821822
- e2e_operator_multi_namespaces
822823
- e2e_operator_upgrade_appdb_tls
824+
- e2e_meko_mck_upgrade
823825
<<: *teardown_group
824826

825827
- name: e2e_multi_cluster_kind_task_group
@@ -887,6 +889,7 @@ task_groups:
887889
- e2e_tls_sc_additional_certs
888890
- e2e_tls_x509_configure_all_options_sc
889891
- e2e_tls_x509_sc
892+
- e2e_meko_mck_upgrade
890893

891894
<<: *teardown_group
892895

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,5 +399,9 @@ dockerfiles:
399399
prepare-local-e2e: reset-mco # prepares the local environment to run a local operator
400400
scripts/dev/prepare_local_e2e_run.sh
401401

402+
prepare-local-olm-e2e:
403+
DIGEST_PINNING_ENABLED=false VERSION_ID=latest scripts/evergreen/operator-sdk/prepare-openshift-bundles-for-e2e.sh
404+
scripts/dev/prepare_local_e2e_olm_run.sh
405+
402406
prepare-operator-configmap: # prepares the local environment to run a local operator
403407
source scripts/dev/set_env_context.sh && source scripts/funcs/printing && source scripts/funcs/operator_deployment && prepare_operator_config_map "$(kubectl config current-context)"

api/v1/mdb/mongodb_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (m *MongoDB) GetResourceName() string {
158158

159159
func (m *MongoDB) GetOwnerLabels() map[string]string {
160160
return map[string]string{
161-
util.OperatorLabelName: util.OperatorName,
161+
util.OperatorLabelName: util.OperatorLabelValue,
162162
LabelResourceOwner: m.Name,
163163
}
164164
}

api/v1/mdbmulti/mongodb_multi_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func (m *MongoDBMultiCluster) ObjectKey() client.ObjectKey {
169169

170170
func (m *MongoDBMultiCluster) GetOwnerLabels() map[string]string {
171171
return map[string]string{
172-
util.OperatorLabelName: util.OperatorName,
172+
util.OperatorLabelName: util.OperatorLabelValue,
173173
LabelResourceOwner: fmt.Sprintf("%s-%s", m.Namespace, m.Name),
174174
}
175175
}

api/v1/om/appdb_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (m *AppDBSpec) ObjectKey() client.ObjectKey {
128128

129129
func (m *AppDBSpec) GetOwnerLabels() map[string]string {
130130
return map[string]string{
131-
util.OperatorLabelName: util.OperatorName,
131+
util.OperatorLabelName: util.OperatorLabelValue,
132132
LabelResourceOwner: m.OpsManagerName,
133133
}
134134
}

api/v1/om/opsmanager_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ func (om *MongoDBOpsManager) AppDBStatefulSetObjectKey(memberClusterNum int) cli
344344

345345
func (om *MongoDBOpsManager) GetOwnerLabels() map[string]string {
346346
return map[string]string{
347-
util.OperatorLabelName: util.OperatorName,
347+
util.OperatorLabelName: util.OperatorLabelValue,
348348
LabelResourceOwner: om.Name,
349349
}
350350
}

config/manager/manager.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
apiVersion: apps/v1
44
kind: Deployment
55
metadata:
6-
name: mongodb-enterprise-operator
6+
name: mongodb-kubernetes-operator
77
namespace: mongodb
88
spec:
99
replicas: 1
1010
selector:
1111
matchLabels:
1212
app.kubernetes.io/component: controller
13-
app.kubernetes.io/name: mongodb-enterprise-operator
14-
app.kubernetes.io/instance: mongodb-enterprise-operator
13+
app.kubernetes.io/name: mongodb-kubernetes-operator
14+
app.kubernetes.io/instance: mongodb-kubernetes-operator
1515
template:
1616
metadata:
1717
labels:
1818
app.kubernetes.io/component: controller
19-
app.kubernetes.io/name: mongodb-enterprise-operator
20-
app.kubernetes.io/instance: mongodb-enterprise-operator
19+
app.kubernetes.io/name: mongodb-kubernetes-operator
20+
app.kubernetes.io/instance: mongodb-kubernetes-operator
2121
spec:
22-
serviceAccountName: mongodb-enterprise-operator
22+
serviceAccountName: mongodb-kubernetes-operator
2323
containers:
24-
- name: mongodb-enterprise-operator
24+
- name: mongodb-kubernetes-operator
2525
image: "quay.io/mongodb/mongodb-kubernetes:0.1.0"
2626
imagePullPolicy: Always
2727
args:
@@ -104,7 +104,7 @@ spec:
104104
fieldRef:
105105
fieldPath: metadata.name
106106
- name: OPERATOR_NAME
107-
value: mongodb-enterprise-operator
107+
value: mongodb-kubernetes-operator
108108
# Community Env Vars Start
109109
- name: MDB_COMMUNITY_AGENT_IMAGE
110110
value: "quay.io/mongodb/mongodb-agent-ubi:108.0.2.8729-1"

config/rbac/database-roles.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
apiVersion: v1
44
kind: ServiceAccount
55
metadata:
6-
name: mongodb-enterprise-appdb
6+
name: mongodb-kubernetes-appdb
77
namespace: mongodb
88
---
99
# Source: mongodb-kubernetes/templates/database-roles.yaml
1010
apiVersion: v1
1111
kind: ServiceAccount
1212
metadata:
13-
name: mongodb-enterprise-database-pods
13+
name: mongodb-kubernetes-database-pods
1414
namespace: mongodb
1515
---
1616
# Source: mongodb-kubernetes/templates/database-roles.yaml
1717
apiVersion: v1
1818
kind: ServiceAccount
1919
metadata:
20-
name: mongodb-enterprise-ops-manager
20+
name: mongodb-kubernetes-ops-manager
2121
namespace: mongodb
2222
---
2323
# Source: mongodb-kubernetes/templates/database-roles.yaml
2424
kind: Role
2525
apiVersion: rbac.authorization.k8s.io/v1
2626
metadata:
27-
name: mongodb-enterprise-appdb
27+
name: mongodb-kubernetes-appdb
2828
namespace: mongodb
2929
rules:
3030
- apiGroups:
@@ -46,13 +46,13 @@ rules:
4646
kind: RoleBinding
4747
apiVersion: rbac.authorization.k8s.io/v1
4848
metadata:
49-
name: mongodb-enterprise-appdb
49+
name: mongodb-kubernetes-appdb
5050
namespace: mongodb
5151
roleRef:
5252
apiGroup: rbac.authorization.k8s.io
5353
kind: Role
54-
name: mongodb-enterprise-appdb
54+
name: mongodb-kubernetes-appdb
5555
subjects:
5656
- kind: ServiceAccount
57-
name: mongodb-enterprise-appdb
57+
name: mongodb-kubernetes-appdb
5858
namespace: mongodb

config/rbac/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ patchesJson6902:
1111
version: v1
1212
group: rbac.authorization.k8s.io
1313
kind: RoleBinding
14-
name: mongodb-enterprise-appdb
14+
name: mongodb-kubernetes-appdb
1515
path: database-roles-patch-namespace.yaml
1616

0 commit comments

Comments
 (0)