Skip to content

Commit f4c855d

Browse files
CLOUDP-315085: Rename member list cm (#66)
# Summary ## Why The multi cluster member-list configmap is created by both the helm chart and kubectl tool. It should not be created by helm. E.g one drawback is that the configmap can be removed upon release uninstallation, which leads to a panic in the currently running operator. This is also confusing and it should be the responsibility of a single tool to create that map. The name of that configmap is mongodb-enterprise-operator-member-list and we should take the opportunity to rename it to mongodb-kubernetes-operator-member-list, to stay consistent with our new naming conventions. Customers deploying multi cluster resources must run the kubectl plugin when upgrading, so we can safely rename it. ## How The config map name was mostly defined by constants so it's a small renaming. ## Proof of Work E2E tests pass (including upgrade tests) --------- Co-authored-by: Mircea Cosbuc <[email protected]>
1 parent e9d8d69 commit f4c855d

File tree

18 files changed

+74
-66
lines changed

18 files changed

+74
-66
lines changed

api/v1/om/opsmanager_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ type Logging struct {
186186
// ClusterSpecOMItem defines members cluster details for Ops Manager multi-cluster deployment.
187187
type ClusterSpecOMItem struct {
188188
// ClusterName is name of the cluster where the Ops Manager Statefulset will be scheduled.
189-
// The operator is using ClusterName to find API credentials in `mongodb-enterprise-operator-member-list` config map to use for this member cluster.
189+
// The operator is using ClusterName to find API credentials in `mongodb-kubernetes-operator-member-list` config map to use for this member cluster.
190190
// If the credentials are not found, then the member cluster is considered unreachable and ignored in the reconcile process.
191191
// +kubebuilder:validation:Required
192192
ClusterName string `json:"clusterName,omitempty"`

config/crd/bases/mongodb.com_opsmanagers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ spec:
14201420
clusterName:
14211421
description: |-
14221422
ClusterName is name of the cluster where the Ops Manager Statefulset will be scheduled.
1423-
The operator is using ClusterName to find API credentials in `mongodb-enterprise-operator-member-list` config map to use for this member cluster.
1423+
The operator is using ClusterName to find API credentials in `mongodb-kubernetes-operator-member-list` config map to use for this member cluster.
14241424
If the credentials are not found, then the member cluster is considered unreachable and ignored in the reconcile process.
14251425
type: string
14261426
configuration:

docker/mongodb-kubernetes-tests/tests/conftest.py

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
DATABASE_SA_NAME = "mongodb-kubernetes-database-pods"
7171
OM_SA_NAME = "mongodb-kubernetes-ops-manager"
7272
TELEMETRY_CONFIGMAP_NAME = LEGACY_OPERATOR_NAME + "-telemetry"
73-
MULTI_CLUSTER_MEMBER_LIST_CONFIGMAP = LEGACY_OPERATOR_NAME + "-member-list"
73+
MULTI_CLUSTER_MEMBER_LIST_CONFIGMAP = OPERATOR_NAME + "-member-list"
7474

7575
logger = test_logger.get_test_logger(__name__)
7676

@@ -856,7 +856,28 @@ def official_operator(
856856
central_cluster_client,
857857
member_cluster_clients,
858858
member_cluster_names,
859-
None,
859+
)
860+
861+
862+
@fixture(scope="module")
863+
def official_meko_operator(
864+
namespace: str,
865+
managed_security_context: str,
866+
operator_installation_config: Dict[str, str],
867+
central_cluster_name: str,
868+
central_cluster_client: client.ApiClient,
869+
member_cluster_clients: List[MultiClusterClient],
870+
member_cluster_names: List[str],
871+
) -> Operator:
872+
return install_official_operator(
873+
namespace,
874+
managed_security_context,
875+
operator_installation_config,
876+
central_cluster_name,
877+
central_cluster_client,
878+
member_cluster_clients,
879+
member_cluster_names,
880+
operator_name=LEGACY_OPERATOR_NAME,
860881
)
861882

862883

@@ -869,6 +890,7 @@ def install_official_operator(
869890
member_cluster_clients: Optional[List[MultiClusterClient]],
870891
member_cluster_names: Optional[List[str]],
871892
custom_operator_version: Optional[str] = None,
893+
operator_name: Optional[str] = OPERATOR_NAME,
872894
) -> Operator:
873895
"""
874896
Installs the Operator from the official Helm Chart.
@@ -887,8 +909,6 @@ def install_official_operator(
887909
"operator.mdbDefaultArchitecture": operator_installation_config["operator.mdbDefaultArchitecture"],
888910
}
889911

890-
operator_name = "mongodb-enterprise-operator"
891-
892912
# Note, that we don't intend to install the official Operator to standalone clusters (kops/openshift) as we want to
893913
# avoid damaged CRDs. But we may need to install the "openshift like" environment to Kind instead of the "ubi"
894914
# images are used for installing the dev Operator
@@ -925,6 +945,7 @@ def install_official_operator(
925945
namespace,
926946
member_cluster_names,
927947
service_account_name=operator_name + "-multi-cluster",
948+
operator_name=operator_name,
928949
)
929950
operator_name = operator_name + "-multi-cluster"
930951
helm_args.update(
@@ -1203,6 +1224,7 @@ def run_kube_config_creation_tool(
12031224
member_cluster_names: List[str],
12041225
cluster_scoped: Optional[bool] = False,
12051226
service_account_name: Optional[str] = "mongodb-kubernetes-operator-multi-cluster",
1227+
operator_name: Optional[str] = OPERATOR_NAME,
12061228
):
12071229
central_cluster = _read_multi_cluster_config_value("central_cluster")
12081230
member_clusters_str = ",".join(member_clusters)
@@ -1223,6 +1245,8 @@ def run_kube_config_creation_tool(
12231245
central_namespace,
12241246
"--service-account",
12251247
service_account_name,
1248+
"--operator-name",
1249+
operator_name,
12261250
]
12271251

12281252
if os.getenv("MULTI_CLUSTER_CREATE_SERVICE_ACCOUNT_TOKEN_SECRETS") == "true":
@@ -1279,6 +1303,7 @@ def run_multi_cluster_recovery_tool(
12791303
member_namespace: str,
12801304
cluster_scoped: Optional[bool] = False,
12811305
service_account_name: Optional[str] = "mongodb-kubernetes-operator-multi-cluster",
1306+
operator_name: Optional[str] = OPERATOR_NAME,
12821307
) -> int:
12831308
central_cluster = _read_multi_cluster_config_value("central_cluster")
12841309
member_clusters_str = ",".join(member_clusters)
@@ -1303,6 +1328,8 @@ def run_multi_cluster_recovery_tool(
13031328
member_clusters[0],
13041329
"--service-account",
13051330
service_account_name,
1331+
"--operator-name",
1332+
operator_name,
13061333
]
13071334
if os.getenv("MULTI_CLUSTER_CREATE_SERVICE_ACCOUNT_TOKEN_SECRETS") == "true":
13081335
args.append("--create-service-account-secrets")

docker/mongodb-kubernetes-tests/tests/multicluster/multi_cluster_recover_clusterwide.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from pytest import fixture, mark
2323
from tests.conftest import (
2424
MULTI_CLUSTER_OPERATOR_NAME,
25+
OPERATOR_NAME,
2526
_install_multi_cluster_operator,
2627
run_kube_config_creation_tool,
2728
run_multi_cluster_recovery_tool,
@@ -97,6 +98,7 @@ def install_operator(
9798
member_cluster_names,
9899
True,
99100
service_account_name=MULTI_CLUSTER_OPERATOR_NAME,
101+
operator_name=OPERATOR_NAME,
100102
)
101103

102104
return _install_multi_cluster_operator(
@@ -218,7 +220,6 @@ def test_prepare_namespace(
218220
def test_copy_configmap_and_secret_across_ns(
219221
namespace: str,
220222
central_cluster_client: client.ApiClient,
221-
multi_cluster_operator_installation_config: Dict[str, str],
222223
mdba_ns: str,
223224
mdbb_ns: str,
224225
):

docker/mongodb-kubernetes-tests/tests/multicluster_appdb/multicluster_appdb_state_operator_upgrade_downgrade.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
from typing import Dict, List, Optional
33

44
import kubernetes.client
5-
from kubernetes import client
6-
from kubetester import create_or_update_configmap, get_deployments, read_configmap
5+
from kubetester import read_configmap
76
from kubetester.kubetester import fixture as yaml_fixture
87
from kubetester.mongodb import Phase
98
from kubetester.operator import Operator
@@ -15,12 +14,10 @@
1514
LEGACY_MULTI_CLUSTER_OPERATOR_NAME,
1615
LEGACY_OPERATOR_NAME,
1716
MULTI_CLUSTER_OPERATOR_NAME,
18-
OPERATOR_NAME,
1917
create_appdb_certs,
2018
get_central_cluster_name,
2119
get_custom_appdb_version,
2220
install_official_operator,
23-
local_operator,
2421
log_deployments_info,
2522
)
2623
from tests.multicluster.conftest import cluster_spec_list
@@ -200,7 +197,8 @@ def test_install_legacy_state_official_operator(
200197
central_cluster_client,
201198
member_cluster_clients,
202199
member_cluster_names,
203-
LEGACY_DEPLOYMENT_STATE_VERSION,
200+
custom_operator_version=LEGACY_DEPLOYMENT_STATE_VERSION,
201+
operator_name=LEGACY_OPERATOR_NAME,
204202
)
205203
operator.assert_is_running()
206204
# Dumping deployments in logs ensure we are using the correct operator version
@@ -317,7 +315,8 @@ def test_install_legacy_state_official_operator(
317315
central_cluster_client,
318316
member_cluster_clients,
319317
member_cluster_names,
320-
LEGACY_DEPLOYMENT_STATE_VERSION,
318+
custom_operator_version=LEGACY_DEPLOYMENT_STATE_VERSION,
319+
operator_name=LEGACY_OPERATOR_NAME,
321320
)
322321
operator.assert_is_running()
323322
# Dumping deployments in logs ensure we are using the correct operator version

docker/mongodb-kubernetes-tests/tests/upgrades/meko_mck_upgrade.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ def replica_set(
9898

9999
# Installs the latest officially released version of MEKO, from Quay
100100
@mark.e2e_meko_mck_upgrade
101-
def test_install_latest_official_operator(official_operator: Operator, namespace: str):
102-
official_operator.assert_is_running()
101+
def test_install_latest_official_operator(official_meko_operator: Operator, namespace: str):
102+
official_meko_operator.assert_is_running()
103103
# Dumping deployments in logs ensures we are using the correct operator version
104104
log_deployments_info(namespace)
105105

@@ -141,7 +141,7 @@ def test_upgrade_operator(
141141
namespace=namespace,
142142
helm_args=operator_installation_config,
143143
helm_chart_path="helm_chart",
144-
name="mongodb-kubernetes-operator",
144+
name=OPERATOR_NAME,
145145
)
146146
operator.install()
147147
operator.assert_is_running()
@@ -156,7 +156,7 @@ def test_replicaset_reconciled(replica_set: MongoDB):
156156

157157
@mark.e2e_meko_mck_upgrade
158158
def test_uninstall_latest_official_operator(namespace: str):
159-
helm_uninstall("mongodb-enterprise-operator-multi-cluster" if is_multi_cluster() else "mongodb-enterprise-operator")
159+
helm_uninstall(LEGACY_MULTI_CLUSTER_OPERATOR_NAME if is_multi_cluster() else LEGACY_OPERATOR_NAME)
160160
log_deployments_info(namespace)
161161

162162

docker/mongodb-kubernetes-tests/tests/upgrades/operator_upgrade_appdb_tls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def test_install_latest_official_operator(
8989
central_cluster_client,
9090
member_cluster_clients,
9191
member_cluster_names,
92-
"1.32.0", # latest operator version before fixing the appdb hostnames
92+
custom_operator_version="1.32.0", # latest operator version before fixing the appdb hostnames
93+
operator_name=LEGACY_OPERATOR_NAME,
9394
)
9495
operator.assert_is_running()
9596

docker/mongodb-kubernetes-tests/tests/upgrades/operator_upgrade_ops_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def some_mdb_health_checker(some_mdb: MongoDB) -> MongoDBBackgroundTester:
100100

101101

102102
@mark.e2e_operator_upgrade_ops_manager
103-
def test_install_latest_official_operator(official_operator: Operator):
104-
official_operator.assert_is_running()
103+
def test_install_latest_official_operator(official_meko_operator: Operator):
104+
official_meko_operator.assert_is_running()
105105

106106

107107
@mark.e2e_operator_upgrade_ops_manager

docker/mongodb-kubernetes-tests/tests/upgrades/operator_upgrade_replica_set.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def replica_set_user(replica_set: MongoDB) -> MongoDBUser:
8282

8383

8484
@mark.e2e_operator_upgrade_replica_set
85-
def test_install_latest_official_operator(official_operator: Operator):
86-
official_operator.assert_is_running()
85+
def test_install_latest_official_operator(official_meko_operator: Operator):
86+
official_meko_operator.assert_is_running()
8787

8888

8989
@mark.e2e_operator_upgrade_replica_set

docker/mongodb-kubernetes-tests/tests/upgrades/operator_upgrade_sharded_cluster.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def test_install_latest_official_operator(
106106
member_cluster_clients=None,
107107
member_cluster_names=None,
108108
custom_operator_version=LEGACY_DEPLOYMENT_STATE_VERSION,
109+
operator_name=LEGACY_OPERATOR_NAME,
109110
)
110111
operator.assert_is_running()
111112
# Dumping deployments in logs ensures we are using the correct operator version
@@ -179,6 +180,7 @@ def test_downgrade_operator(
179180
member_cluster_clients=None,
180181
member_cluster_names=None,
181182
custom_operator_version=LEGACY_DEPLOYMENT_STATE_VERSION,
183+
operator_name=LEGACY_OPERATOR_NAME,
182184
)
183185
operator.assert_is_running()
184186
# Dumping deployments in logs ensures we are using the correct operator version

0 commit comments

Comments
 (0)