Skip to content

Commit

Permalink
fix(pytest): test_csi_encrypted_block_volume for GKE COS (longhorn#2228)
Browse files Browse the repository at this point in the history
* fix(pytest): flaky reset_longhorn_node_zone for COS

longhorn/longhorn-1819

Signed-off-by: Chin-Ya Huang <[email protected]>

* fix(pytest): test_csi_encrypted_block_volume for COS

longhorn/longhorn-10049

Signed-off-by: Chin-Ya Huang <[email protected]>

---------

Signed-off-by: Chin-Ya Huang <[email protected]>
  • Loading branch information
c3y1huang authored Dec 30, 2024
1 parent e23e21e commit c1c04a5
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions manager/integration/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c1c04a5

Please sign in to comment.