Skip to content

CLOUDP-310820: Resolve post 1.0.0 to do items #121

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

Merged
merged 2 commits into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .evergreen-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ tasks:
- func: "e2e_test"

- name: e2e_olm_operator_upgrade
# TODO: CLOUDP-310820 - After 1.0.0 release we need re-enable this
disable: true
tags: [ "patch-run" ]
commands:
- func: "e2e_test"
Expand All @@ -212,8 +210,6 @@ tasks:
- func: "e2e_test"

- name: e2e_olm_operator_upgrade_with_resources
# TODO: CLOUDP-310820 - After 1.0.0 release we need re-enable this
disable: true
tags: [ "patch-run" ]
commands:
- func: "e2e_test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
from kubernetes.client.rest import ApiException
from kubetester import MongoDB, read_service, wait_for_webhook
from kubetester.kubetester import fixture as yaml_fixture
from kubetester.kubetester import (
get_default_architecture,
is_default_architecture_static,
)
from kubetester.kubetester import get_default_architecture
from kubetester.opsmanager import MongoDBOpsManager
from tests.conftest import OPERATOR_NAME
from tests.olm.olm_test_commons import (
get_catalog_image,
get_catalog_source_resource,
Expand Down Expand Up @@ -37,11 +35,11 @@ def test_upgrade_operator_only(namespace: str, version_id: str):

static_value = get_default_architecture()
subscription = get_subscription_custom_object(
"mongodb-kubernetes",
OPERATOR_NAME,
namespace,
{
"channel": "stable", # stable channel contains latest released operator in RedHat's certified repository
"name": "mongodb-enterprise",
"name": "mongodb-kubernetes",
"source": catalog_source_resource.name,
"sourceNamespace": namespace,
"installPlanApproval": "Automatic",
Expand All @@ -60,13 +58,13 @@ def test_upgrade_operator_only(namespace: str, version_id: str):

subscription.update()

wait_for_operator_ready(namespace, "mongodb-kubernetes", f"mongodb-kubernetes.v{latest_released_operator_version}")
wait_for_operator_ready(namespace, OPERATOR_NAME, f"mongodb-kubernetes.v{latest_released_operator_version}")

subscription.load()
subscription["spec"]["channel"] = "fast" # fast channel contains operator build from the current branch
subscription.update()

wait_for_operator_ready(namespace, "mongodb-kubernetes", f"mongodb-kubernetes.v{incremented_operator_version}")
wait_for_operator_ready(namespace, OPERATOR_NAME, f"mongodb-kubernetes.v{incremented_operator_version}")


@pytest.mark.e2e_olm_operator_upgrade
Expand All @@ -80,7 +78,7 @@ def test_operator_webhook_is_deleted_and_not_installed_anymore(namespace: str):

@pytest.mark.e2e_olm_operator_upgrade
def test_wait_for_webhook(namespace: str):
wait_for_webhook(namespace=namespace, service_name="mongodb-enterprise-operator-service")
wait_for_webhook(namespace=namespace, service_name="mongodb-kubernetes-operator-service")


@pytest.mark.e2e_olm_operator_upgrade
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@
from kubetester.certs import create_sharded_cluster_certs
from kubetester.kubetester import ensure_ent_version
from kubetester.kubetester import fixture as yaml_fixture
from kubetester.kubetester import (
get_default_architecture,
is_default_architecture_static,
run_periodically,
)
from kubetester.kubetester import get_default_architecture, run_periodically
from kubetester.mongodb import Phase
from kubetester.mongodb_user import MongoDBUser
from kubetester.opsmanager import MongoDBOpsManager
from pytest import fixture
from tests.conftest import OPERATOR_NAME
from tests.olm.olm_test_commons import (
get_catalog_image,
get_catalog_source_resource,
Expand Down Expand Up @@ -64,11 +61,11 @@ def catalog_source(namespace: str, version_id: str):
def subscription(namespace: str, catalog_source: CustomObject):
static_value = get_default_architecture()
return get_subscription_custom_object(
"mongodb-kubernetes",
OPERATOR_NAME,
namespace,
{
"channel": "stable", # stable channel contains latest released operator in RedHat's certified repository
"name": "mongodb-enterprise",
"name": "mongodb-kubernetes",
"source": catalog_source.name,
"sourceNamespace": namespace,
"installPlanApproval": "Automatic",
Expand Down Expand Up @@ -100,7 +97,7 @@ def test_install_stable_operator_version(
subscription: CustomObject,
):
subscription.update()
wait_for_operator_ready(namespace, "mongodb-kubernetes", f"mongodb-kubernetes.v{current_operator_version}")
wait_for_operator_ready(namespace, OPERATOR_NAME, f"mongodb-kubernetes.v{current_operator_version}")


# install resources on the latest released version of the operator
Expand Down Expand Up @@ -368,7 +365,7 @@ def update_subscription() -> bool:

run_periodically(update_subscription, timeout=100, msg="Subscription to be updated")

wait_for_operator_ready(namespace, "mongodb-kubernetes", f"mongodb-kubernetes.v{incremented_operator_version}")
wait_for_operator_ready(namespace, OPERATOR_NAME, f"mongodb-kubernetes.v{incremented_operator_version}")


@pytest.mark.e2e_olm_operator_upgrade_with_resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,44 +111,33 @@ function generate_mck_catalog_metadata() {

echo "Generating catalog metadata for ${mck_package_name} in ${catalog_yaml}"

# TODO: CLOUDP-310820 - After 1.0.0 release we need to clean this up: always use stable.
default_channel="migration"
if [[ -n "${latest_bundle_version}" ]]; then
default_channel="stable"
fi

opm init "${mck_package_name}" \
--default-channel="${default_channel}" \
--default-channel="stable" \
--output=yaml \
>"${catalog_yaml}"

echo "Adding current unreleased ${current_bundle_image} to the catalog"
opm render "${current_bundle_image}" --output=yaml >>"${catalog_yaml}"

# TODO: CLOUDP-310820 - After 1.0.0 release we need to clean this up: always run it.
if [[ -n "${latest_bundle_version}" ]]; then
echo "Adding latest release ${latest_bundle_image} to the catalog"
opm render "${latest_bundle_image}" --output=yaml >>"${catalog_yaml}"
echo "Adding latest release ${latest_bundle_image} to the catalog"
opm render "${latest_bundle_image}" --output=yaml >>"${catalog_yaml}"

echo "Adding latest MCK release into STABLE channel to ${catalog_yaml}"
echo "---
echo "Adding latest MCK release into STABLE channel to ${catalog_yaml}"
echo "---
schema: olm.channel
package: ${mck_package_name}
name: stable
entries:
- name: ${mck_package_name}.v${latest_bundle_version}" >>"${catalog_yaml}"

echo "Adding current MCK version replacing the latest MCK version into FAST channel to ${catalog_yaml}"
echo "---
echo "Adding current MCK version replacing the latest MCK version into FAST channel to ${catalog_yaml}"
echo "---
schema: olm.channel
package: ${mck_package_name}
name: fast
entries:
- name: ${mck_package_name}.v${current_bundle_version}
replaces: ${mck_package_name}.v${latest_bundle_version}" >>"${catalog_yaml}"
else
echo "Skipping addition of latest MCK release as we haven't published MCK 1.0.0 yet"
fi

echo "Adding current MCK version replacing the latest MEKO version into MIGRATION channel to ${catalog_yaml}"
echo "---
Expand Down Expand Up @@ -217,15 +206,7 @@ current_incremented_operator_version_from_release_json_with_version_id="${curren
test_catalog_image="${base_repo_url}/mongodb-kubernetes-test-catalog:${current_incremented_operator_version_from_release_json_with_version_id}"
certified_repo_cloned="$(clone_git_repo_into_temp ${certified_operators_repo})"

# TODO: CLOUDP-310820 - After 1.0.0 release we need to clean this up: always run it.
# if [[ "${current_operator_version_from_release_json}" =~ ^0\. ]]; then
# Version is < 1.0.0 (0.y.z)
mck_latest_released_operator_version=""
echo "Skipping MCK bundle lookup as we haven't published MCK 1.0.0 yet (${current_operator_version_from_release_json} is < 1.0.0)"
# else
# # Version is >= 1.0.0
# mck_latest_released_operator_version="$(find_the_latest_certified_operator "${certified_repo_cloned}" "${mck_package_name}")"
# fi
mck_latest_released_operator_version="$(find_the_latest_certified_operator "${certified_repo_cloned}" "${mck_package_name}")"
meko_latest_released_operator_version="$(find_the_latest_certified_operator "${certified_repo_cloned}" "${meko_package_name}")"

meko_latest_certified_bundle_image="${base_repo_url}/mongodb-enterprise-operator-certified-bundle:${meko_latest_released_operator_version}"
Expand All @@ -248,12 +229,7 @@ echo "DOCKER_PLATFORM: ${DOCKER_PLATFORM}"

# Build latest published bundles form RedHat's certified operators repository.
header "Building MCK bundle:"
if [[ -n "${mck_latest_released_operator_version}" ]]; then
build_bundle_from_git_repo "${certified_repo_cloned}" "${mck_package_name}" "${mck_latest_released_operator_version}" "${mck_latest_certified_bundle_image}"
else
# TODO: CLOUDP-310820 - After 1.0.0 release we need to clean this up: always run it.
echo "Skipping MCK bundle build as we haven't published MCK 1.0.0 yet"
fi
build_bundle_from_git_repo "${certified_repo_cloned}" "${mck_package_name}" "${mck_latest_released_operator_version}" "${mck_latest_certified_bundle_image}"

header "Building MEKO bundle:"
build_bundle_from_git_repo "${certified_repo_cloned}" "${meko_package_name}" "${meko_latest_released_operator_version}" "${meko_latest_certified_bundle_image}"
Expand Down
13 changes: 2 additions & 11 deletions scripts/evergreen/release/update_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,12 @@ def get_latest_om_versions_from_evergreen_yml():
return data["variables"][0], data["variables"][1]


def trim_versions(versions_list, number_of_versions=3, always_keep=None):
def trim_versions(versions_list, number_of_versions=3):
"""
Keep only the latest number_of_versions versions per major version in a versions list,
plus any versions specified in always_keep.
Keep only the latest number_of_versions versions per major version in a versions list.
Returns a sorted list with trimmed versions.
"""

# TODO: CLOUDP-310820 - After 1.0.0 we need to remove this condition
if always_keep is None:
always_keep = ["0.1.0"]

major_version_groups = defaultdict(list)
for v in versions_list:
try:
Expand All @@ -40,10 +35,6 @@ def trim_versions(versions_list, number_of_versions=3, always_keep=None):
continue

trimmed_versions = []
# Add versions that should always be kept
for v in always_keep:
if v in versions_list and v not in trimmed_versions:
trimmed_versions.append(v)

for major_version, versions in major_version_groups.items():
versions.sort(key=lambda x: version.parse(x), reverse=True)
Expand Down