-
Notifications
You must be signed in to change notification settings - Fork 23
[CLOUDP-352109] Run MCK E2E tests against OCI published helm chart #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 18 commits
dfbc534
982c77d
0daaf61
4c753fc
8b511e5
4f50441
087e06a
cb2a8d2
b1162ec
8a50020
c04e43a
4132fc6
82bf02e
6e641ce
e96e180
93f3e12
eb65be5
5cb41a0
8f50012
1068518
829393f
3aa3fce
ca7881c
084b8f2
e1700ca
2cc7bbd
f53071f
c482251
1ee164a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| OPERATOR_VERSION_ENV_VAR_NAME = "OPERATOR_VERSION" | ||
|
|
||
| OCI_HELM_REGISTRY_ENV_VAR_NAME = "OCI_HELM_REGISTRY" | ||
| OCI_HELM_REPOSITORY_ENV_VAR_NAME = "OCI_HELM_REPOSITORY" | ||
| OCI_HELM_REGION_ENV_VAR_NAME = "OCI_HELM_REGION" | ||
|
|
||
| LEGACY_OPERATOR_CHART = "mongodb/enterprise-operator" | ||
| MCK_HELM_CHART = "mongodb/mongodb-kubernetes" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import logging | ||
| import os | ||
| import time | ||
| from typing import Dict, List, Optional | ||
|
|
||
|
|
@@ -9,13 +10,17 @@ | |
| from kubernetes.client import V1CustomResourceDefinition, V1Deployment, V1Pod | ||
| from kubernetes.client.rest import ApiException | ||
| from kubetester import wait_for_webhook | ||
| from kubetester.consts import * | ||
| from kubetester.create_or_replace_from_yaml import create_or_replace_from_yaml | ||
| from kubetester.helm import ( | ||
| helm_chart_path_and_version, | ||
| helm_install, | ||
| helm_repo_add, | ||
| helm_template, | ||
| helm_uninstall, | ||
| helm_upgrade, | ||
| oci_chart_info, | ||
| oci_helm_registry_login, | ||
| ) | ||
| from tests import test_logger | ||
|
|
||
|
|
@@ -25,6 +30,7 @@ | |
| "opsmanagers.mongodb.com", | ||
| ) | ||
|
|
||
|
|
||
| logger = test_logger.get_test_logger(__name__) | ||
|
|
||
|
|
||
|
|
@@ -43,14 +49,16 @@ def __init__( | |
| namespace: str, | ||
| helm_args: Optional[Dict] = None, | ||
| helm_options: Optional[List[str]] = None, | ||
| helm_chart_path: Optional[str] = "helm_chart", | ||
| helm_chart_path: Optional[str] = None, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. q: how can we instruct this function to use local helm charts for local tests? Ideally we should be able to set this somewhere in the context files and override it by default locally, for example by specifying it in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's the plan. I am working on the change that will make sure that we are able to run the tests locally. Will push the changes soon. |
||
| name: Optional[str] = "mongodb-kubernetes-operator", | ||
| api_client: Optional[client.api_client.ApiClient] = None, | ||
| operator_version: Optional[str] = None, | ||
| ): | ||
|
|
||
| # The Operator will be installed from the following repo, so adding it first | ||
| helm_repo_add("mongodb", "https://mongodb.github.io/helm-charts") | ||
|
|
||
| helm_chart_path, operator_version = helm_chart_path_and_version(helm_chart_path, operator_version) | ||
|
|
||
| if helm_args is None: | ||
| helm_args = {} | ||
|
|
||
|
|
@@ -69,6 +77,7 @@ def __init__( | |
| self.helm_chart_path = helm_chart_path | ||
| self.name = name | ||
| self.api_client = api_client | ||
| self.operator_version = operator_version | ||
|
|
||
| def install_from_template(self): | ||
| """Uses helm to generate yaml specification and then uses python K8s client to apply them to the cluster | ||
|
|
@@ -82,6 +91,9 @@ def install_from_template(self): | |
|
|
||
| def install(self, custom_operator_version: Optional[str] = None) -> Operator: | ||
| """Installs the Operator to Kubernetes cluster using 'helm install', waits until it's running""" | ||
| if not custom_operator_version: | ||
| custom_operator_version = self.operator_version | ||
|
|
||
| helm_install( | ||
| self.name, | ||
| self.namespace, | ||
|
|
@@ -99,6 +111,9 @@ def upgrade( | |
| self, multi_cluster: bool = False, custom_operator_version: Optional[str] = None, apply_crds_first: bool = False | ||
| ) -> Operator: | ||
| """Upgrades the Operator in Kubernetes cluster using 'helm upgrade', waits until it's running""" | ||
| if not custom_operator_version: | ||
| custom_operator_version = self.operator_version | ||
|
|
||
| helm_upgrade( | ||
| self.name, | ||
| self.namespace, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.