Skip to content

Commit

Permalink
Fix AWS Infra node deployment (#9858)
Browse files Browse the repository at this point in the history
* Fix AWS Infra node deployment

Fixes: #9857
* Fix subnet name for AWS

Signed-off-by: Petr Balogh <[email protected]>
  • Loading branch information
petr-balogh committed May 29, 2024
1 parent 087df7d commit 5926362
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ocs_ci/ocs/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from ocs_ci.utility import templating
from ocs_ci.framework import config
from ocs_ci.ocs import constants
from ocs_ci.utility import version
from ocs_ci.utility.utils import TimeoutSampler
from ocs_ci.ocs.exceptions import (
TimeoutExpiredError,
Expand Down Expand Up @@ -260,6 +261,12 @@ def create_custom_machineset(
.get("id")
)
if aws_zone == f"{region}{zone}":
ocp_version = version.get_semantic_ocp_version_from_config()
sg_name = f"{cls_id}-node"
subnet_name = f"{cls_id}-subnet-private-{aws_zone}"
if ocp_version < version.VERSION_4_16:
sg_name = f"{cls_id}-worker-sg"
subnet_name = f"{cls_id}-private-{aws_zone}"
machineset_yaml = templating.load_yaml(constants.MACHINESET_YAML)

# Update machineset_yaml with required values.
Expand Down Expand Up @@ -302,10 +309,10 @@ def create_custom_machineset(
]["region"] = region
machineset_yaml["spec"]["template"]["spec"]["providerSpec"]["value"][
"securityGroups"
][0]["filters"][0]["values"][0] = f"{cls_id}-worker-sg"
][0]["filters"][0]["values"][0] = sg_name
machineset_yaml["spec"]["template"]["spec"]["providerSpec"]["value"][
"subnet"
]["filters"][0]["values"][0] = f"{cls_id}-private-{aws_zone}"
]["filters"][0]["values"][0] = subnet_name
machineset_yaml["spec"]["template"]["spec"]["providerSpec"]["value"][
"tags"
][0]["name"] = f"kubernetes.io/cluster/{cls_id}"
Expand Down

0 comments on commit 5926362

Please sign in to comment.