Skip to content
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

rosa create account roles #36

Merged
merged 1 commit into from
Dec 19, 2024
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
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ RUN python3 -m pip install --upgrade pip || true
RUN yes | pip3 install openshift elasticsearch==7.13.4 gitpython packaging --upgrade || true
RUN apt-get -y update
RUN apt-get -y install jq groff uuid-runtime
RUN curl -L $(curl -s https://api.github.com/repos/openshift/rosa/releases/latest | jq -r ".assets[] | select(.name == \"rosa-linux-amd64\") | .browser_download_url") --output /usr/local/bin/rosa
RUN curl -L $(curl -s https://api.github.com/repos/openshift/rosa/releases/latest | jq -r ".assets[] | select(.name == \"rosa_Linux_x86_64.tar.gz\") | .browser_download_url") --output rosa.tar.gz
RUN tar -xzf rosa.tar.gz -C /usr/local/bin/
RUN curl -L $(curl -s https://api.github.com/repos/openshift-online/ocm-cli/releases/latest | jq -r ".assets[] | select(.name == \"ocm-linux-amd64\") | .browser_download_url") --output /usr/local/bin/ocm
RUN curl -L https://releases.hashicorp.com/terraform/1.8.0/terraform_1.8.0_linux_amd64.zip -o terraform_1.8.0_linux_amd64.zip
RUN unzip terraform_1.8.0_linux_amd64.zip -d /usr/local/bin/
Expand Down
4 changes: 4 additions & 0 deletions libs/platforms/rosa/hypershift/hypershift.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def initialize(self):
self.logging.info("Verifying OIDC config")
sys.exit("Exiting") if not self._set_oidc_config() else self.logging.info(f"Using {self.environment['oidc_config_id']} as OIDC config ID")

# Create Account roles
self.logging.info("Creating ROSA Account roles")
sys.exit("Exiting") if not self._create_rosa_account_roles() else self.logging.info("Created Account roles successfully")

# Set Operator Roles
self.logging.info("Verifying Operator Roles")
if self.environment["common_operator_roles"]:
Expand Down
12 changes: 12 additions & 0 deletions libs/platforms/rosa/rosa.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ def _delete_oidc_config(self):
self.logging.info(f"Deleted oidc-config ID {self.environment['oidc_config_id']}")
return True

def _create_rosa_account_roles(self):
hc_acc_rol_code, hc_acc_rol_out, hc_acc_rol_err = self.utils.subprocess_exec(
"rosa create account-roles --hosted-cp --prefix ManagedOpenShift -y --mode auto",
extra_params={"universal_newlines": True}
)
if hc_acc_rol_code != 0:
self.logging.error("Failed to create rosa account roles")
return False
else:
self.logging.info("Create account roles successfully")
return True

def _create_operator_roles(self):
self.logging.info("Finding latest installer Role ARN")
roles_code, roles_out, roles_err = self.utils.subprocess_exec("rosa list account-roles -o json")
Expand Down
Loading