diff --git a/.evergreen-snippets.yml b/.evergreen-snippets.yml index 4175e6f320..6815882265 100644 --- a/.evergreen-snippets.yml +++ b/.evergreen-snippets.yml @@ -54,6 +54,11 @@ variables: variant: init_test_run - name: build_agent_images_ubi variant: init_test_run + # Wait for OM images to be published to quay.io on commit builds (staging). + # On patch builds, this dependency is skipped (task doesn't exist). + - name: release_om_and_agents + variant: release_om_and_agents + patch_optional: true functions: upload_code_snippets_logs: diff --git a/.evergreen.yml b/.evergreen.yml index 1795e0dc10..34a8d7ec12 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -13,7 +13,7 @@ include: variables: - &ops_manager_60_latest 6.0.27 # The order/index is important, since these are anchors. Please do not change - - &ops_manager_70_latest 7.0.20 # The order/index is important, since these are anchors. Please do not change + - &ops_manager_70_latest 7.0.21 # The order/index is important, since these are anchors. Please do not change - &ops_manager_80_latest 8.0.18 # The order/index is important, since these are anchors. Please do not change @@ -146,6 +146,11 @@ variables: variant: init_test_run - name: publish_helm_chart variant: init_test_run + # Wait for OM images to be published to quay.io on commit builds (staging). + # On patch builds, this dependency is skipped (task doesn't exist). + - name: release_om_and_agents + variant: release_om_and_agents + patch_optional: true - &base_om7_dependency_with_race depends_on: @@ -185,6 +190,11 @@ variables: variant: init_test_run - name: publish_helm_chart variant: init_test_run + # Wait for OM images to be published to quay.io on commit builds (staging). + # On patch builds, this dependency is skipped (task doesn't exist). + - name: release_om_and_agents + variant: release_om_and_agents + patch_optional: true parameters: - key: evergreen_retry diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index d415ec05a5..19ecfca903 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -142,6 +142,8 @@ spec: value: "quay.io/mongodb/mongodb-agent:107.0.19.8805-1" - name: RELATED_IMAGE_AGENT_IMAGE_107_0_20_8807_1 value: "quay.io/mongodb/mongodb-agent:107.0.20.8807-1" + - name: RELATED_IMAGE_AGENT_IMAGE_107_0_21_8817_1 + value: "quay.io/mongodb/mongodb-agent:107.0.21.8817-1" - name: RELATED_IMAGE_AGENT_IMAGE_108_0_1_8718_1 value: "quay.io/mongodb/mongodb-agent:108.0.1.8718-1" - name: RELATED_IMAGE_AGENT_IMAGE_108_0_11_8830_1 @@ -192,6 +194,8 @@ spec: value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:7.0.19" - name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_7_0_20 value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:7.0.20" + - name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_7_0_21 + value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:7.0.21" - name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_8_0_0 value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:8.0.0" - name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_8_0_1 diff --git a/docker/mongodb-kubernetes-tests/tests/conftest.py b/docker/mongodb-kubernetes-tests/tests/conftest.py index 4af1db0b41..58beae9dbf 100644 --- a/docker/mongodb-kubernetes-tests/tests/conftest.py +++ b/docker/mongodb-kubernetes-tests/tests/conftest.py @@ -961,6 +961,25 @@ def install_official_operator( "operator.mdbDefaultArchitecture": operator_installation_config["operator.mdbDefaultArchitecture"], } + # For upgrade tests in patch builds, we need to use ECR registries for workload images + # (OpsManager, Agent, etc.) since new versions may not be released to quay.io yet. + # The operator itself still comes from the official helm chart, but resources it creates + # should use the dev registries where unreleased images are available. + # For staging/release builds, images are already published to quay.io, so we use quay.io + # to verify the actual public release path. + build_scenario = operator_installation_config.get("buildScenario", "") + if build_scenario == "patch": + logger.debug("Patch build detected: using ECR registries for workload images in upgrade tests") + # Override OM registry for ALL operators (including legacy) - OM version tags are standard (e.g., 7.0.21) + if "registry.opsManager" in operator_installation_config: + helm_args["registry.opsManager"] = operator_installation_config["registry.opsManager"] + + # Only override Agent registry for current operator (not legacy) because legacy operators + # use different agent tag formats (e.g., 13.21.0.9059-1_1.27.0) that don't exist in ECR. + # Init images are already released to quay.io and don't need ECR override. + if custom_operator_version is None and "registry.agent" in operator_installation_config: + helm_args["registry.agent"] = operator_installation_config["registry.agent"] + # Note, that we don't intend to install the official Operator to standalone clusters (kops/openshift) as we want to # avoid damaged CRDs. But we may need to install the "openshift like" environment to Kind instead of the "ubi" # images are used for installing the dev Operator @@ -1008,9 +1027,9 @@ def install_official_operator( "multiCluster.clusters": operator_installation_config["multiCluster.clusters"], } ) - # The "official" Operator will be installed, from the Helm Repo ("mongodb/enterprise-operator") - # We pass helm_args as operator installation config below instead of the full configmap data, otherwise - # it overwrites registries and image versions, and we wouldn't use the official images but the dev ones + # The "official" Operator will be installed from the Helm Repo ("mongodb/enterprise-operator") + # but workload images (OpsManager, Agent, etc.) will use dev registries from operator_installation_config + # to support testing unreleased versions in patch builds. return _install_multi_cluster_operator( namespace, helm_args, diff --git a/docker/mongodb-kubernetes-tests/tests/olm/olm_meko_operator_upgrade_with_resources.py b/docker/mongodb-kubernetes-tests/tests/olm/olm_meko_operator_upgrade_with_resources.py index 033ee7f9ba..55bf1a47e9 100644 --- a/docker/mongodb-kubernetes-tests/tests/olm/olm_meko_operator_upgrade_with_resources.py +++ b/docker/mongodb-kubernetes-tests/tests/olm/olm_meko_operator_upgrade_with_resources.py @@ -20,6 +20,7 @@ get_current_operator_version, get_latest_released_operator_version, get_operator_group_resource, + get_registry_env_vars_for_subscription, get_subscription_custom_object, increment_patch_version, wait_for_operator_ready, @@ -60,11 +61,21 @@ def catalog_source(namespace: str, version_id: str): @fixture -def meko_subscription(namespace: str, catalog_source: CustomObject): +def meko_subscription(namespace: str, catalog_source: CustomObject, operator_installation_config: dict[str, str]): """ Create subscription for the MEKO operator. """ static_value = get_default_architecture() + base_env_vars = [ + {"name": "MANAGED_SECURITY_CONTEXT", "value": "false"}, + {"name": "OPERATOR_ENV", "value": "dev"}, + {"name": "MDB_DEFAULT_ARCHITECTURE", "value": static_value}, + {"name": "MDB_OPERATOR_TELEMETRY_SEND_ENABLED", "value": "false"}, + ] + # Add registry env vars for patch builds (ECR registries for unreleased images) + registry_env_vars = get_registry_env_vars_for_subscription(operator_installation_config) + all_env_vars = base_env_vars + registry_env_vars + return get_subscription_custom_object( LEGACY_OPERATOR_NAME, namespace, @@ -76,24 +87,29 @@ def meko_subscription(namespace: str, catalog_source: CustomObject): "installPlanApproval": "Automatic", # In certified OpenShift bundles we have this enabled, so the operator is not defining security context (it's managed globally by OpenShift). # In Kind this will result in empty security contexts and problems deployments with filesystem permissions. - "config": { - "env": [ - {"name": "MANAGED_SECURITY_CONTEXT", "value": "false"}, - {"name": "OPERATOR_ENV", "value": "dev"}, - {"name": "MDB_DEFAULT_ARCHITECTURE", "value": static_value}, - {"name": "MDB_OPERATOR_TELEMETRY_SEND_ENABLED", "value": "false"}, - ] - }, + "config": {"env": all_env_vars}, }, ) -def get_mck_subscription_object(namespace: str, catalog_source: CustomObject): +def get_mck_subscription_object( + namespace: str, catalog_source: CustomObject, operator_installation_config: dict[str, str] +): """ Create a subscription object for the MCK operator. This is a separate function (not a fixture) so it can be called after uninstalling MEKO. """ static_value = get_default_architecture() + base_env_vars = [ + {"name": "MANAGED_SECURITY_CONTEXT", "value": "false"}, + {"name": "OPERATOR_ENV", "value": "dev"}, + {"name": "MDB_DEFAULT_ARCHITECTURE", "value": static_value}, + {"name": "MDB_OPERATOR_TELEMETRY_SEND_ENABLED", "value": "false"}, + ] + # Add registry env vars for patch builds (ECR registries for unreleased images) + registry_env_vars = get_registry_env_vars_for_subscription(operator_installation_config) + all_env_vars = base_env_vars + registry_env_vars + return get_subscription_custom_object( OPERATOR_NAME, namespace, @@ -103,14 +119,7 @@ def get_mck_subscription_object(namespace: str, catalog_source: CustomObject): "source": catalog_source.name, "sourceNamespace": namespace, "installPlanApproval": "Automatic", - "config": { - "env": [ - {"name": "MANAGED_SECURITY_CONTEXT", "value": "false"}, - {"name": "OPERATOR_ENV", "value": "dev"}, - {"name": "MDB_DEFAULT_ARCHITECTURE", "value": static_value}, - {"name": "MDB_OPERATOR_TELEMETRY_SEND_ENABLED", "value": "false"}, - ] - }, + "config": {"env": all_env_vars}, }, ) @@ -464,12 +473,13 @@ def test_connectivity_after_meko_uninstall( def test_install_mck_operator( namespace: str, catalog_source: CustomObject, + operator_installation_config: dict[str, str], ): current_operator_version = get_current_operator_version() incremented_operator_version = increment_patch_version(current_operator_version) # Create MCK subscription - mck_subscription = get_mck_subscription_object(namespace, catalog_source) + mck_subscription = get_mck_subscription_object(namespace, catalog_source, operator_installation_config) mck_subscription.update() wait_for_operator_ready(namespace, OPERATOR_NAME, f"mongodb-kubernetes.v{incremented_operator_version}") diff --git a/docker/mongodb-kubernetes-tests/tests/olm/olm_operator_upgrade_with_resources.py b/docker/mongodb-kubernetes-tests/tests/olm/olm_operator_upgrade_with_resources.py index 4ffadd915d..6df164a8a9 100644 --- a/docker/mongodb-kubernetes-tests/tests/olm/olm_operator_upgrade_with_resources.py +++ b/docker/mongodb-kubernetes-tests/tests/olm/olm_operator_upgrade_with_resources.py @@ -19,6 +19,7 @@ get_current_operator_version, get_latest_released_operator_version, get_operator_group_resource, + get_registry_env_vars_for_subscription, get_subscription_custom_object, increment_patch_version, wait_for_operator_ready, @@ -54,8 +55,21 @@ def catalog_source(namespace: str, version_id: str): @fixture -def subscription(namespace: str, catalog_source: CustomObject): +def subscription(namespace: str, catalog_source: CustomObject, operator_installation_config: dict[str, str]): static_value = get_default_architecture() + base_env_vars = [ + {"name": "MANAGED_SECURITY_CONTEXT", "value": "false"}, + {"name": "OPERATOR_ENV", "value": "dev"}, + {"name": "MDB_DEFAULT_ARCHITECTURE", "value": static_value}, + {"name": "MDB_OPERATOR_TELEMETRY_SEND_ENABLED", "value": "false"}, + ] + # Add registry env vars for patch builds (ECR registries for unreleased images) + # MCK-to-MCK upgrades use non-suffixed agent versions that exist in ECR + registry_env_vars = get_registry_env_vars_for_subscription( + operator_installation_config, include_agent_registry=True + ) + all_env_vars = base_env_vars + registry_env_vars + return get_subscription_custom_object( OPERATOR_NAME, namespace, @@ -67,14 +81,7 @@ def subscription(namespace: str, catalog_source: CustomObject): "installPlanApproval": "Automatic", # In certified OpenShift bundles we have this enabled, so the operator is not defining security context (it's managed globally by OpenShift). # In Kind this will result in empty security contexts and problems deployments with filesystem permissions. - "config": { - "env": [ - {"name": "MANAGED_SECURITY_CONTEXT", "value": "false"}, - {"name": "OPERATOR_ENV", "value": "dev"}, - {"name": "MDB_DEFAULT_ARCHITECTURE", "value": static_value}, - {"name": "MDB_OPERATOR_TELEMETRY_SEND_ENABLED", "value": "false"}, - ] - }, + "config": {"env": all_env_vars}, }, ) diff --git a/docker/mongodb-kubernetes-tests/tests/olm/olm_test_commons.py b/docker/mongodb-kubernetes-tests/tests/olm/olm_test_commons.py index b60d7939f7..212aea1e3b 100644 --- a/docker/mongodb-kubernetes-tests/tests/olm/olm_test_commons.py +++ b/docker/mongodb-kubernetes-tests/tests/olm/olm_test_commons.py @@ -2,13 +2,10 @@ import os import re import tempfile -import time -from typing import Callable +from typing import Dict, List import kubetester -import pytest import requests -import yaml from kubeobject import CustomObject from kubernetes import client from kubetester import run_periodically @@ -182,3 +179,46 @@ def wait_for_operator_ready_fn(): timeout=120, msg=f"operator ready and with {expected_operator_version} version", ) + + +def get_registry_env_vars_for_subscription( + operator_installation_config: Dict[str, str], + include_agent_registry: bool = False, +) -> List[Dict[str, str]]: + """ + Returns registry env vars to add to OLM subscription config for patch builds. + + For upgrade tests in patch builds, we need to use ECR registries for OpsManager + since new versions may not be released to quay.io yet. + For staging/release builds, images are already published to quay.io, so we use quay.io + to verify the actual public release path. + + Args: + operator_installation_config: The operator installation config from ConfigMap. + include_agent_registry: Whether to include agent registry override. Set to True + for MCK-to-MCK upgrades (non-suffixed agent versions exist in ECR). Set to + False for MEKO-to-MCK migrations (suffixed agent versions only on quay.io). + + This function returns the env vars in the format expected by OLM subscription config: + [{"name": "ENV_VAR_NAME", "value": "value"}, ...] + """ + build_scenario = operator_installation_config.get("buildScenario", "") + + if build_scenario != "patch": + return [] + + env_vars = [] + + # Override OM registry for patch builds (unreleased versions not on quay.io) + if "registry.opsManager" in operator_installation_config: + ops_manager_name = operator_installation_config.get("opsManager.name", "mongodb-enterprise-ops-manager-ubi") + registry = operator_installation_config["registry.opsManager"] + env_vars.append({"name": "OPS_MANAGER_IMAGE_REPOSITORY", "value": f"{registry}/{ops_manager_name}"}) + + # Override agent registry only for MCK-to-MCK upgrades (non-suffixed agent versions) + # MEKO uses suffixed agent versions (e.g., 107.0.15.8741-1_1.33.0) that only exist on quay.io + if include_agent_registry and "registry.agent" in operator_installation_config: + registry = operator_installation_config["registry.agent"] + env_vars.append({"name": "MDB_AGENT_IMAGE_REPOSITORY", "value": f"{registry}/mongodb-agent"}) + + return env_vars diff --git a/helm_chart/values-openshift.yaml b/helm_chart/values-openshift.yaml index afe949e88c..05befc3c51 100644 --- a/helm_chart/values-openshift.yaml +++ b/helm_chart/values-openshift.yaml @@ -41,6 +41,7 @@ relatedImages: - 7.0.18 - 7.0.19 - 7.0.20 + - 7.0.21 - 8.0.0 - 8.0.1 - 8.0.2 @@ -115,6 +116,7 @@ relatedImages: - 107.0.18.8784-1 - 107.0.19.8805-1 - 107.0.20.8807-1 + - 107.0.21.8817-1 - 108.0.1.8718-1 - 108.0.11.8830-1 - 108.0.12.8846-1 diff --git a/public/mongodb-kubernetes-openshift.yaml b/public/mongodb-kubernetes-openshift.yaml index dfb55f1238..423f49b51c 100644 --- a/public/mongodb-kubernetes-openshift.yaml +++ b/public/mongodb-kubernetes-openshift.yaml @@ -446,6 +446,8 @@ spec: value: "quay.io/mongodb/mongodb-agent:107.0.19.8805-1" - name: RELATED_IMAGE_AGENT_IMAGE_107_0_20_8807_1 value: "quay.io/mongodb/mongodb-agent:107.0.20.8807-1" + - name: RELATED_IMAGE_AGENT_IMAGE_107_0_21_8817_1 + value: "quay.io/mongodb/mongodb-agent:107.0.21.8817-1" - name: RELATED_IMAGE_AGENT_IMAGE_108_0_1_8718_1 value: "quay.io/mongodb/mongodb-agent:108.0.1.8718-1" - name: RELATED_IMAGE_AGENT_IMAGE_108_0_11_8830_1 @@ -496,6 +498,8 @@ spec: value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:7.0.19" - name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_7_0_20 value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:7.0.20" + - name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_7_0_21 + value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:7.0.21" - name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_8_0_0 value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:8.0.0" - name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_8_0_1 diff --git a/release.json b/release.json index 5301adadb2..5d575b3f09 100644 --- a/release.json +++ b/release.json @@ -51,6 +51,7 @@ "7.0.18", "7.0.19", "7.0.20", + "7.0.21", "8.0.0", "8.0.1", "8.0.2", @@ -217,6 +218,10 @@ "agent_version": "108.0.16.8895-1", "tools_version": "100.13.0" }, + "7.0.21": { + "agent_version": "107.0.21.8817-1", + "tools_version": "100.13.0" + }, "8.0.18": { "agent_version": "108.0.18.8921-1", "tools_version": "100.13.0" diff --git a/scripts/funcs/operator_deployment b/scripts/funcs/operator_deployment index 7ea588922c..5922086299 100644 --- a/scripts/funcs/operator_deployment +++ b/scripts/funcs/operator_deployment @@ -9,6 +9,7 @@ get_operator_helm_values() { declare -a config=( "managedSecurityContext=${MANAGED_SECURITY_CONTEXT:-false}" + "buildScenario=${BUILD_SCENARIO:-}" "registry.operator=${OPERATOR_REGISTRY}" "registry.imagePullSecrets=image-registries-secret" "registry.initOpsManager=${INIT_OPS_MANAGER_REGISTRY}"