-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eea84b8
commit 722dd09
Showing
13 changed files
with
1,053 additions
and
807 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Delete ROSA Clusters | ||
|
||
## Description | ||
|
||
This GitHub Action automates the deletion of ROSA (Red Hat OpenShift Service on AWS) clusters using a shell script. | ||
|
||
|
||
## Inputs | ||
|
||
| name | description | required | default | | ||
| --- | --- | --- | --- | | ||
| `tf-bucket` | <p>Bucket containing the clusters states</p> | `true` | `""` | | ||
| `tf-bucket-region` | <p>Region of the bucket containing the resources states, if not set, will fallback on AWS_REGION</p> | `false` | `""` | | ||
| `max-age-hours-cluster` | <p>Maximum age of clusters in hours</p> | `false` | `20` | | ||
|
||
|
||
## Runs | ||
|
||
This action is a `composite` action. | ||
|
||
## Usage | ||
|
||
```yaml | ||
- uses: camunda/camunda-tf-rosa/.github/actions/rosa-cleanup-clusters@main | ||
with: | ||
tf-bucket: | ||
# Bucket containing the clusters states | ||
# | ||
# Required: true | ||
# Default: "" | ||
|
||
tf-bucket-region: | ||
# Region of the bucket containing the resources states, if not set, will fallback on AWS_REGION | ||
# | ||
# Required: false | ||
# Default: "" | ||
|
||
max-age-hours-cluster: | ||
# Maximum age of clusters in hours | ||
# | ||
# Required: false | ||
# Default: 20 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
--- | ||
name: Delete ROSA Clusters | ||
|
||
description: | | ||
This GitHub Action automates the deletion of ROSA (Red Hat OpenShift Service on AWS) clusters using a shell script. | ||
This GitHub Action automates the deletion of ROSA (Red Hat OpenShift Service on AWS) clusters using a shell script. | ||
inputs: | ||
tf-bucket: | ||
description: 'Bucket containing the clusters states' | ||
required: true | ||
tf-bucket-region: | ||
description: 'Region of the bucket containing the resources states, if not set, will fallback on AWS_REGION' | ||
max-age-hours-cluster: | ||
description: 'Maximum age of clusters in hours' | ||
required: false | ||
default: "20" | ||
tf-bucket: | ||
description: Bucket containing the clusters states | ||
required: true | ||
tf-bucket-region: | ||
description: Region of the bucket containing the resources states, if not set, will fallback on AWS_REGION | ||
max-age-hours-cluster: | ||
description: Maximum age of clusters in hours | ||
required: false | ||
default: '20' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Delete clusters | ||
id: delete_clusters | ||
shell: bash | ||
run: | | ||
if [ -n "${{ inputs.tf-bucket-region }}" ]; then | ||
export AWS_S3_REGION="${{ inputs.tf-bucket-region }}" | ||
fi | ||
using: composite | ||
steps: | ||
- name: Delete clusters | ||
id: delete_clusters | ||
shell: bash | ||
run: | | ||
if [ -n "${{ inputs.tf-bucket-region }}" ]; then | ||
export AWS_S3_REGION="${{ inputs.tf-bucket-region }}" | ||
fi | ||
${{ github.action_path }}/scripts/destroy-clusters.sh "${{ inputs.tf-bucket }}" ${{ github.action_path }}/../../../modules/rosa-hcp/ /tmp/rosa/ ${{ inputs.max-age-hours-cluster }} | ||
${{ github.action_path }}/scripts/destroy-clusters.sh "${{ inputs.tf-bucket }}" \ | ||
${{ github.action_path }}/../../../modules/rosa-hcp/ /tmp/rosa/ ${{ inputs.max-age-hours-cluster }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,164 @@ | ||
# Deploy ROSA HCP Cluster GitHub Action | ||
# Deploy ROSA HCP Cluster | ||
|
||
## Description | ||
|
||
This GitHub Action automates the deployment of a ROSA (Red Hat OpenShift Service on AWS) cluster using Terraform. | ||
This action will also install oc, awscli, rosa cli. | ||
The kube context will be set on the created cluster. | ||
|
||
This GitHub Action automates the deployment of a ROSA (Red Hat OpenShift Service on AWS) cluster using Terraform. It also installs `oc`, `awscli`, and `rosa` CLI tools. | ||
|
||
## Inputs | ||
|
||
| Input | Description | Required | Default | | ||
|---------------------|--------------------------------------------------------------|----------|------------------| | ||
| `rh-token` | Red Hat Hybrid Cloud Console Token | true | | | ||
| `cluster-name` | Name of the ROSA cluster to deploy | true | | | ||
| `admin-password` | Admin password for the ROSA cluster | true | | | ||
| `admin-username` | Admin username for the ROSA cluster | false | `kube-admin` | | ||
| `aws-region` | AWS region where the ROSA cluster will be deployed | true | | | ||
| `rosa-cli-version` | Version of the ROSA CLI to use | false | `latest` | | ||
| `awscli-version` | Version of the AWS CLI to use | false | __see `action.yml`__ | | ||
| `openshift-version` | Version of the OpenShift to install | false | __see `action.yml`__ | | ||
| `replicas` | Number of replicas for the ROSA cluster | false | `2` | | ||
| `s3-backend-bucket` | Name of the S3 bucket to store Terraform state | true | | | ||
| `s3-bucket-region` | Region of the bucket containing the resources states, if not set, will fallback on `aws-region` | false | | | ||
| `tf-modules-revision`| Git revision of the Terraform modules to use | false | `main` | | ||
| `tf-modules-path` | Path where the Terraform ROSA modules will be cloned | false | `./.action-tf-modules/rosa/` | | ||
| `login` | Authenticate the current kube context on the created cluster | false | `true` | | ||
| `tf-cli-config-credentials-hostname` | The hostname of a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration file. Defaults to `app.terraform.io`. | false | `app.terraform.io` | | ||
| `tf-cli-config-credentials-token` | The API token for a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration file. | false | | | ||
| `tf-terraform-version` | The version of Terraform CLI to install. Defaults to `latest`. | false | `latest` | | ||
| `tf-terraform-wrapper` | Whether or not to install a wrapper to wrap subsequent calls of the `terraform` binary and expose its STDOUT, STDERR, and exit code as outputs named `stdout`, `stderr`, and `exitcode` respectively. Defaults to `true`. | false | `true` | | ||
| name | description | required | default | | ||
| --- | --- | --- | --- | | ||
| `rh-token` | <p>Red Hat Hybrid Cloud Console Token</p> | `true` | `""` | | ||
| `cluster-name` | <p>Name of the ROSA cluster to deploy</p> | `true` | `""` | | ||
| `admin-password` | <p>Admin password for the ROSA cluster</p> | `true` | `""` | | ||
| `admin-username` | <p>Admin username for the ROSA cluster</p> | `true` | `kube-admin` | | ||
| `aws-region` | <p>AWS region where the ROSA cluster will be deployed</p> | `true` | `""` | | ||
| `rosa-cli-version` | <p>Version of the ROSA CLI to use</p> | `true` | `latest` | | ||
| `awscli-version` | <p>Version of the aws cli to use</p> | `true` | `2.15.52` | | ||
| `openshift-version` | <p>Version of the OpenShift to install</p> | `true` | `4.16.10` | | ||
| `replicas` | <p>Number of replicas for the ROSA cluster</p> | `true` | `2` | | ||
| `s3-backend-bucket` | <p>Name of the S3 bucket to store Terraform state</p> | `true` | `""` | | ||
| `s3-bucket-region` | <p>Region of the bucket containing the resources states, if not set, will fallback on aws-region</p> | `false` | `""` | | ||
| `tf-modules-revision` | <p>Git revision of the tf modules to use</p> | `true` | `main` | | ||
| `tf-modules-path` | <p>Path where the tf rosa modules will be cloned</p> | `true` | `./.action-tf-modules/rosa/` | | ||
| `login` | <p>Authenticate the current kube context on the created cluster</p> | `true` | `true` | | ||
| `tf-cli-config-credentials-hostname` | <p>The hostname of a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration file. Defaults to <code>app.terraform.io</code>.</p> | `false` | `app.terraform.io` | | ||
| `tf-cli-config-credentials-token` | <p>The API token for a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration file.</p> | `false` | `""` | | ||
| `tf-terraform-version` | <p>The version of Terraform CLI to install. Instead of full version string you can also specify constraint string starting with "<" (for example <code><1.13.0</code>) to install the latest version satisfying the constraint. A value of <code>latest</code> will install the latest version of Terraform CLI. Defaults to <code>latest</code>.</p> | `false` | `latest` | | ||
| `tf-terraform-wrapper` | <p>Whether or not to install a wrapper to wrap subsequent calls of the <code>terraform</code> binary and expose its STDOUT, STDERR, and exit code as outputs named <code>stdout</code>, <code>stderr</code>, and <code>exitcode</code> respectively. Defaults to <code>true</code>.</p> | `false` | `true` | | ||
|
||
|
||
## Outputs | ||
|
||
| Output | Description | | ||
|--------------------------|------------------------------------------------------------| | ||
| `openshift-server-api` | The server API URL of the deployed ROSA cluster | | ||
| `openshift-cluster-id` | The ID of the deployed ROSA cluster | | ||
| `terraform-state-url` | URL of the Terraform state file in the S3 bucket | | ||
| name | description | | ||
| --- | --- | | ||
| `openshift-server-api` | <p>The server API URL of the deployed ROSA cluster</p> | | ||
| `openshift-cluster-id` | <p>The ID of the deployed ROSA cluster</p> | | ||
| `terraform-state-url` | <p>URL of the Terraform state file in the S3 bucket</p> | | ||
|
||
## Usage | ||
|
||
This action is idempotent and can be re-run without affecting the existing cluster, following the principles of Terraform. | ||
## Runs | ||
|
||
This action is a `composite` action. | ||
|
||
Create a file in your repository's `.github/workflows` directory, for example `deploy-rosa-hcp.yml`, with the following content: | ||
## Usage | ||
|
||
```yaml | ||
name: Deploy ROSA HCP Cluster | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Add profile credentials to ~/.aws/credentials | ||
run: | | ||
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY }} --profile ${{ env.AWS_PROFILE }} | ||
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_KEY }} --profile ${{ env.AWS_PROFILE }} | ||
aws configure set region ${{ env.AWS_REGION }} --profile ${{ env.AWS_PROFILE }} | ||
- name: Deploy ROSA HCP Cluster | ||
uses: camunda/camunda-tf-rosa/.github/actions/rosa-create-cluster@main | ||
id: create_cluster | ||
with: | ||
rh-token: ${{ secrets.RH_OPENSHIFT_TOKEN }} | ||
cluster-name: "my-ocp-cluster" | ||
admin-username: "kube-admin" | ||
admin-password: ${{ secrets.CI_OPENSHIFT_MAIN_PASSWORD }} | ||
aws-region: "us-west-2" | ||
s3-backend-bucket: ${{ secrets.TF_S3_BUCKET }} | ||
- uses: camunda/camunda-tf-rosa/.github/actions/rosa-create-cluster@main | ||
with: | ||
rh-token: | ||
# Red Hat Hybrid Cloud Console Token | ||
# | ||
# Required: true | ||
# Default: "" | ||
|
||
cluster-name: | ||
# Name of the ROSA cluster to deploy | ||
# | ||
# Required: true | ||
# Default: "" | ||
|
||
admin-password: | ||
# Admin password for the ROSA cluster | ||
# | ||
# Required: true | ||
# Default: "" | ||
|
||
admin-username: | ||
# Admin username for the ROSA cluster | ||
# | ||
# Required: true | ||
# Default: kube-admin | ||
|
||
aws-region: | ||
# AWS region where the ROSA cluster will be deployed | ||
# | ||
# Required: true | ||
# Default: "" | ||
|
||
rosa-cli-version: | ||
# Version of the ROSA CLI to use | ||
# | ||
# Required: true | ||
# Default: latest | ||
|
||
awscli-version: | ||
# Version of the aws cli to use | ||
# | ||
# Required: true | ||
# Default: 2.15.52 | ||
|
||
openshift-version: | ||
# Version of the OpenShift to install | ||
# | ||
# Required: true | ||
# Default: 4.16.10 | ||
|
||
replicas: | ||
# Number of replicas for the ROSA cluster | ||
# | ||
# Required: true | ||
# Default: 2 | ||
|
||
s3-backend-bucket: | ||
# Name of the S3 bucket to store Terraform state | ||
# | ||
# Required: true | ||
# Default: "" | ||
|
||
s3-bucket-region: | ||
# Region of the bucket containing the resources states, if not set, will fallback on aws-region | ||
# | ||
# Required: false | ||
# Default: "" | ||
|
||
tf-modules-revision: | ||
# Git revision of the tf modules to use | ||
# | ||
# Required: true | ||
# Default: main | ||
|
||
tf-modules-path: | ||
# Path where the tf rosa modules will be cloned | ||
# | ||
# Required: true | ||
# Default: ./.action-tf-modules/rosa/ | ||
|
||
login: | ||
# Authenticate the current kube context on the created cluster | ||
# | ||
# Required: true | ||
# Default: true | ||
|
||
tf-cli-config-credentials-hostname: | ||
# The hostname of a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration | ||
# file. Defaults to `app.terraform.io`. | ||
# | ||
# Required: false | ||
# Default: app.terraform.io | ||
|
||
tf-cli-config-credentials-token: | ||
# The API token for a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration | ||
# file. | ||
# | ||
# Required: false | ||
# Default: "" | ||
|
||
tf-terraform-version: | ||
# The version of Terraform CLI to install. Instead of full version string you can also specify constraint string starting with "<" (for | ||
# example `<1.13.0`) to install the latest version satisfying the constraint. A value of `latest` will install the latest version of Terraform | ||
# CLI. Defaults to `latest`. | ||
# | ||
# Required: false | ||
# Default: latest | ||
|
||
tf-terraform-wrapper: | ||
# Whether or not to install a wrapper to wrap subsequent calls of the `terraform` binary and expose its STDOUT, STDERR, and exit code | ||
# as outputs named `stdout`, `stderr`, and `exitcode` respectively. Defaults to `true`. | ||
# | ||
# Required: false | ||
# Default: true | ||
``` |
Oops, something went wrong.