From c1c04a5151fb6de582f4ab149277101e560df6f1 Mon Sep 17 00:00:00 2001 From: c3y1huang Date: Mon, 30 Dec 2024 17:32:23 +0800 Subject: [PATCH] fix(pytest): test_csi_encrypted_block_volume for GKE COS (#2228) * fix(pytest): flaky reset_longhorn_node_zone for COS longhorn/longhorn-1819 Signed-off-by: Chin-Ya Huang * fix(pytest): test_csi_encrypted_block_volume for COS longhorn/longhorn-10049 Signed-off-by: Chin-Ya Huang --------- Signed-off-by: Chin-Ya Huang --- manager/integration/tests/common.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/manager/integration/tests/common.py b/manager/integration/tests/common.py index 2541d8ac8a..4703b025ea 100644 --- a/manager/integration/tests/common.py +++ b/manager/integration/tests/common.py @@ -1595,6 +1595,8 @@ def finalizer(): @pytest.fixture def crypto_secret(request): + core_api = get_core_api_client() + def get_crypto_secret(namespace=LONGHORN_NAMESPACE): crypto_secret.manifest = { 'apiVersion': 'v1', @@ -1608,12 +1610,18 @@ def get_crypto_secret(namespace=LONGHORN_NAMESPACE): 'CRYPTO_KEY_PROVIDER': 'secret' } } + + if is_k8s_node_gke_cos(core_api): + # GKE COS's cryptsetup does not natively support "argon2i" and + # "argon2id". + # https://github.com/longhorn/longhorn/issues/10049 + crypto_secret.manifest['stringData']['CRYPTO_PBKDF'] = 'pbkdf2' + return crypto_secret.manifest def finalizer(): - api = get_core_api_client() try: - api.delete_namespaced_secret( + core_api.delete_namespaced_secret( name=crypto_secret.manifest['metadata']['name'], namespace=crypto_secret.manifest['metadata']['namespace']) except ApiException as e: @@ -3446,6 +3454,12 @@ def reset_node(client, core_api): def reset_longhorn_node_zone(client): core_api = get_core_api_client() + # No need to reset zone label for GKE COS node as the node zone label is + # periodically updated with the actual GCP zone. + # https://github.com/longhorn/longhorn-tests/pull/1819 + if is_k8s_node_gke_cos(core_api): + return + nodes = client.list_node() for n in nodes: set_k8s_node_zone_label(core_api, n.name, None)