Rotating HyperShift CI Credentials
This guide explains how to rotate HyperShift CI credentials when migrating to a new management cluster or when credentials need to be refreshed.
Overview
The rotation process:
- Generates new AWS IAM users/keys with scoped permissions
- Creates a new Kubernetes service account on the management cluster
- Extracts the management cluster kubeconfig
- Tests the credentials locally
- Pushes all secrets to GitHub Actions in one operation
Prerequisites
- Logged into AWS:
aws sts get-caller-identity - Logged into OpenShift management cluster:
oc whoami - Authenticated with GitHub CLI:
gh auth status
Step-by-Step Process
1. Generate Fresh Credentials
Run the setup script with --rotate to delete old keys and create new ones:
MANAGED_BY_TAG=rossoctl-hypershift-ci \
./.github/scripts/hypershift/setup-hypershift-ci-credentials.sh --rotate
This creates:
- AWS IAM users:
rossoctl-hypershift-ci(CI) androssoctl-hypershift-ci-debug(read-only) - AWS IAM role:
rossoctl-hypershift-ci-role(for hcp CLI) - Kubernetes service account:
rossoctl-hypershift-ciin namespacerossoctl-hypershift-ci - Local file:
.env.rossoctl-hypershift-ci(credentials) - Kubeconfig:
~/.kube/rossoctl-hypershift-ci-mgmt.kubeconfig
Output:
✅ All pre-flight checks passed
✅ AWS Region: us-east-1 (auto-detected from cluster)
✅ OIDC S3 bucket: hyperocto (auto-detected from operator)
✅ Setup Complete
2. Push Secrets to GitHub
Run the script to test credentials locally and push all secrets to GitHub Actions:
./.github/scripts/hypershift/generate-gh-secrets.sh
This will:
- Test AWS credentials locally
- Push all 8 secrets to GitHub Actions
- Verify the secrets were set
Output:
╔════════════════════════════════════════════════════════════════╗
║ Pushing GitHub Secrets for HyperShift CI ║
╚════════════════════════════════════════════════════════════════╝
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Step 1: Testing AWS credentials locally...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
{
"UserId": "AIDA6NU5MYLAKXXFVDBPD",
"Account": "991393792704",
"Arn": "arn:aws:iam::991393792704:user/rossoctl-hypershift-ci"
}
✅ AWS credentials verified successfully
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Step 2: Pushing secrets to GitHub...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ Set Actions secret AWS_ACCESS_KEY_ID
✓ Set Actions secret AWS_SECRET_ACCESS_KEY
✓ Set Actions secret AWS_REGION
✓ Set Actions secret HCP_ROLE_NAME
✓ Set Actions secret BASE_DOMAIN
✓ Set Actions secret MANAGED_BY_TAG
✓ Set Actions secret PULL_SECRET
✓ Set Actions secret HYPERSHIFT_MGMT_KUBECONFIG_BASE64
✅ All secrets pushed to GitHub
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Verification:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GitHub Secrets set:
AWS_ACCESS_KEY_ID Updated 2026-03-24
AWS_SECRET_ACCESS_KEY Updated 2026-03-24
AWS_REGION Updated 2026-03-24
BASE_DOMAIN Updated 2026-03-24
HCP_ROLE_NAME Updated 2026-03-24
HYPERSHIFT_MGMT_KUBECONFIG_BASE64 Updated 2026-03-24
MANAGED_BY_TAG Updated 2026-03-24
PULL_SECRET Updated 2026-03-24
╔════════════════════════════════════════════════════════════════╗
║ Setup Complete! ║
╚════════════════════════════════════════════════════════════════╝
3. Test CI Workflow
Trigger a CI workflow to verify the new credentials work:
# Trigger the HyperShift E2E workflow
gh workflow run e2e-hypershift.yaml --ref main
Monitor the workflow:
gh run list --workflow=e2e-hypershift.yaml --limit 1
gh run watch
Secrets Configured
The following GitHub Actions secrets are set:
| Secret Name | Description |
|---|---|
AWS_ACCESS_KEY_ID | AWS CI user access key (full permissions) |
AWS_SECRET_ACCESS_KEY | AWS CI user secret key |
AWS_REGION | AWS region (us-east-1) |
HCP_ROLE_NAME | IAM role name for hcp CLI |
BASE_DOMAIN | Route53 public zone for cluster DNS |
MANAGED_BY_TAG | Resource tagging identifier |
PULL_SECRET | Red Hat pull secret for OpenShift images |
HYPERSHIFT_MGMT_KUBECONFIG_BASE64 | Base64-encoded kubeconfig for management cluster |
Troubleshooting
AWS credentials test fails
If aws sts get-caller-identity fails in the script:
- Check your current AWS credentials:
aws sts get-caller-identity - Verify you have permissions to create IAM users/roles
- Re-run the setup script:
./.github/scripts/hypershift/setup-hypershift-ci-credentials.sh --rotate
GitHub secrets push fails
If gh secret set fails:
- Check GitHub authentication:
gh auth status - Verify you have admin access to the repository
- Re-authenticate:
gh auth login
CI workflow fails with new credentials
If the CI workflow fails after updating secrets:
- Check the workflow logs:
gh run view --log - Verify the AWS credentials work:
source .env.rossoctl-hypershift-ci && aws sts get-caller-identity - Test kubeconfig:
kubectl --kubeconfig ~/.kube/rossoctl-hypershift-ci-mgmt.kubeconfig get nodes
Security Notes
- The
.env.rossoctl-hypershift-cifile contains sensitive credentials and is gitignored - AWS IAM policies use tag-based scoping to limit permissions to
rossoctl-hypershift-ci-*resources - The service account has cluster-scoped permissions for HyperShift operations
- Credentials should be rotated whenever:
- Moving to a new management cluster
- Suspected credential compromise
- Periodic security rotation (quarterly recommended)