Skip to content

Commit

Permalink
taking out need for az cli to be installed
Browse files Browse the repository at this point in the history
rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED

Signed-off-by: Paige Rubendall <[email protected]>
  • Loading branch information
paigerube14 authored and chaitanyaenr committed Jul 5, 2024
1 parent d8f54b8 commit ef1a554
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
3 changes: 0 additions & 3 deletions containers/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ RUN dnf update && dnf install -y --setopt=install_weak_deps=False \
git python39 jq yq gettext wget which &&\
dnf clean all

# Install azure cli
RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc && dnf install -y https://packages.microsoft.com/config/rhel/9.0/packages-microsoft-prod.rpm && dnf install -y azure-cli

# copy oc client binary from oc-build image
COPY --from=oc-build /tmp/oc/oc /usr/bin/oc

Expand Down
5 changes: 0 additions & 5 deletions containers/Dockerfile-ppc64le
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@

FROM ppc64le/centos:8

FROM mcr.microsoft.com/azure-cli:latest as azure-cli

LABEL org.opencontainers.image.authors="Red Hat OpenShift Chaos Engineering"

ENV KUBECONFIG /root/.kube/config

# Copy azure client binary from azure-cli image
COPY --from=azure-cli /usr/local/bin/az /usr/bin/az

# Install dependencies
RUN yum install -y git python39 python3-pip jq gettext wget && \
python3.9 -m pip install -U pip && \
Expand Down
6 changes: 2 additions & 4 deletions docs/cloud_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ After creating the service account you will need to enable the account using the

## Azure

**NOTE**: For Azure node killing scenarios, make sure [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) is installed.

You will also need to create a service principal and give it the correct access, see [here](https://docs.openshift.com/container-platform/4.5/installing/installing_azure/installing-azure-account.html) for creating the service principal and setting the proper permissions.
**NOTE**: You will need to create a service principal and give it the correct access, see [here](https://docs.openshift.com/container-platform/4.5/installing/installing_azure/installing-azure-account.html) for creating the service principal and setting the proper permissions.

To properly run the service principal requires “Azure Active Directory Graph/Application.ReadWrite.OwnedBy” api permission granted and “User Access Administrator”.

Before running you will need to set the following:
1. Login using ```az login```
1. ```export AZURE_SUBSCRIPTION_ID=<subscription_id>```

2. ```export AZURE_TENANT_ID=<tenant_id>```

Expand Down
8 changes: 4 additions & 4 deletions kraken/node_actions/az_node_scenarios.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import time
import yaml
import os
import kraken.invoke.command as runcommand
import logging
import kraken.node_actions.common_node_functions as nodeaction
Expand All @@ -17,9 +17,9 @@ def __init__(self):
# Acquire a credential object using CLI-based authentication.
credentials = DefaultAzureCredential()
logging.info("credential " + str(credentials))
az_account = runcommand.invoke("az account list -o yaml")
az_account_yaml = yaml.safe_load(az_account, Loader=yaml.FullLoader)
subscription_id = az_account_yaml[0]["id"]
# az_account = runcommand.invoke("az account list -o yaml")
# az_account_yaml = yaml.safe_load(az_account, Loader=yaml.FullLoader)
subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")
self.compute_client = ComputeManagementClient(credentials, subscription_id)

# Get the instance ID of the node
Expand Down

0 comments on commit ef1a554

Please sign in to comment.