Skip to content

Commit

Permalink
conditional cluster definition
Browse files Browse the repository at this point in the history
ocp_cluster_name=leogit6

delete_ocp_cluster=true
  • Loading branch information
leiicamundi committed May 16, 2024
1 parent d13bd45 commit 9cdbd1d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .github/actions/rosa-create-cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,17 @@ runs:
id: cluster_info
run: |
rosa describe cluster --output=json -c "${{ steps.apply.outputs.cluster_id }}"
export server_api=$(rosa describe cluster --output=json -c "${{ steps.apply.outputs.cluster_id }}" | jq -r '.api.url')
echo "server_api=$server_api"
echo "server_api=$server_api" >> "$GITHUB_OUTPUT"
- name: Generate kubeconfig
shell: bash
id: kube_config
run: |
export server_api=$(rosa describe cluster --output=json -c "${{ steps.apply.outputs.cluster_id }}" | jq -r '.api.url')
echo "server_api=$server_api"
echo "server_api=$server_api" >> "$GITHUB_OUTPUT"
echo "oc login --username '${{ inputs.admin-username }}' --password '${{ inputs.admin-password }}'" > login_command.txt
oc login $server_api --username="${{ inputs.admin-username }}" --password="${{ inputs.admin-password }}" --loglevel=10
oc login --username ${{ inputs.admin-username }} --password ${{ inputs.admin-password }} "${{ steps.cluster_info.outputs.server_api }}"
oc whoami
kubectl config rename-context $(oc config current-context) "${{ inputs.cluster-name }}"
kubectl config use "${{ inputs.cluster-name }}"
Expand Down
12 changes: 11 additions & 1 deletion .github/actions/rosa-delete-cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ runs:
- name: Install Terraform
uses: hashicorp/setup-terraform@v3

- name: Install aws-cli
shell: bash
run: |
python3 -m pip install "awscli==${{ inputs.awscli-version }}"
- name: Set Terraform variables
shell: bash
id: set-terraform-variables
Expand Down Expand Up @@ -69,10 +74,15 @@ runs:
working-directory: "${{ inputs.tf-modules-path }}/modules/rosa-hcp/"
run: |
terraform plan -destroy -no-color -out rosa-destroy.plan -var "cluster_name=${{ inputs.cluster-name }}" -var "offline_access_token=${{ inputs.rh-token }}" -var "htpasswd_password=dUmmyPassword$123!"
# TODO: remove s3
- name: Terraform Apply Destroy
shell: bash
id: apply-destroy
working-directory: "${{ inputs.tf-modules-path }}/modules/rosa-hcp/"
run: |
terraform apply -destroy -no-color rosa-destroy.plan
- name: Delete Terraform State
shell: bash
run: |
aws s3 rm s3://${{ steps.set-terraform-variables.outputs.TFSTATE_BUCKET }}/${{ steps.set-terraform-variables.outputs.TFSTATE_KEY }}
4 changes: 1 addition & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ jobs:
rh-token: ${{ steps.secrets.outputs.RH_OPENSHIFT_TOKEN }}
cluster-name: "${{ steps.commit_info.outputs.cluster_name }}"
admin-username: "cluster-admin"
#admin-password: "${{ steps.secrets.outputs.CI_OPENSHIFT_MAIN_PASSWORD }}"
# TODO: change this
admin-password: "myUnsecure1234567!pass"
admin-password: "${{ steps.secrets.outputs.CI_OPENSHIFT_MAIN_PASSWORD }}"
aws-region: ${{ env.AWS_REGION }}
namespace: "myns"
s3-backend-bucket: ${{ env.TF_S3_BUCKET }}
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ rosa verify quota --region="$AWS_REGION"
# this may fail due to org policy
rosa verify permissions --region="$AWS_REGION"
# TODO: check if this one is required:
rosa create account-roles --mode auto
```
5. Enable HCP ROSA on [AWS MarkePlace](https://docs.openshift.com/rosa/cloud_experts_tutorials/cloud-experts-rosa-hcp-activation-and-account-linking-tutorial.html)
Expand Down

0 comments on commit 9cdbd1d

Please sign in to comment.