Skip to content

GKE Bootstrap

GKE Bootstrap #8

name: "GKE Bootstrap"
on:
workflow_dispatch:
inputs:
cluster-name:
description: 'Name of GKE cluster to create'
default: "demo-cluster"
gcp-region:
description: 'GCP region to create cluster'
default: "us-central1"
env:
CLUSTER_NAME: ${{ github.event.inputs.cluster-name || 'demo-cluster' }}
GCP_REGION: ${{ github.event.inputs.gcp-region || 'us-central1' }}
GCP_ZONE: ${{ github.event.inputs.gcp-region || 'us-central1' }}-b
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT }}
TF_VAR_project: ${{ secrets.GCP_PROJECT }}
TF_VAR_cluster_name: ${{ github.event.inputs.cluster-name || 'demo-cluster' }}
TF_VAR_region: ${{ github.event.inputs.gcp-region || 'us-central1' }}
TF_VAR_zone: ${{ github.event.inputs.gcp-region || 'us-central1' }}-b
GCP_SA_EMAIL: ${{ secrets.SA_EMAIL }}
jobs:
bootstrap:
name: bootstrap-cluster
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: google-github-actions/[email protected]
with:
create_credentials_file: 'true'
workload_identity_provider: ${{ secrets.WIF_POOL }}
service_account: ${{ env.GCP_SA_EMAIL }}
- id: get-credentials
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ env.CLUSTER_NAME }}
location: ${{ env.GCP_ZONE }}
project_id: ${{ env.GCP_PROJECT_ID }}
- id: get-pods
run: kubectl get pods -A
- name: test helm
run: |
helm env
helm list --all-namespaces
- id: install-komodor-watcher
env:
KOMODOR_API_KEY: ${{ secrets.KOMODOR_API_KEY }}
run: |
helm repo add komodorio https://helm-charts.komodor.io
helm repo update
helm upgrade --install k8s-watcher komodorio/k8s-watcher --set watcher.actions.basic=true --set watcher.actions.advanced=true \
--set watcher.actions.podExec=true --set metrics.enabled=true \
--set apiKey=$KOMODOR_API_KEY \
--set watcher.clusterName=default \
--set watcher.actions.portforward=true --set watcher.resources.secret=true \
--set watcher.enableHelm=true --set helm.enableActions=true --wait -n k8s-watcher --create-namespace
- id: install-ingress-nginx
run: |
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm upgrade --install --wait ingress-nginx ingress-nginx/ingress-nginx \
-n ingress-nginx --create-namespace --version 4.7.1 --wait
- id: get-pods-after-bootstrap
run: kubectl get pods -A