Skip to content

Commit

Permalink
Merge pull request #110 from kartverket/enable_onprem
Browse files Browse the repository at this point in the history
Enable onprem clusters
  • Loading branch information
martinhny authored Oct 17, 2024
2 parents 3cac854 + 1accb8d commit f1dba5a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
30 changes: 17 additions & 13 deletions .github/workflows/run-kubectl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ on:
required: true
description: 'Project service account to use for authentication. Full address is expected. Example: [email protected]'
type: string
commands:
namespace:
required: true
description: 'Multiline string of commands to run with kubectl. Example: "get pods\nget services".'
description: 'Kubernetes namespace to use for kubectl commands. Example: default'
type: string
namespace:
commands:
required: true
description: 'Namespace to run the command in. Example: my-namespace'
description: 'Multiline string of commands to run with kubectl. Example: "get pods\nget services".'
type: string
kubectl_version:
required: false
Expand All @@ -37,8 +37,8 @@ env:
SERVICE_ACCOUNT: ${{ inputs.service_account }}
CLUSTER_NAME: ${{ inputs.cluster_name }}
KUBERNETES_PROJECT_ID: ${{ inputs.kubernetes_project_id }}
NAMESPACE: ${{ inputs.namespace }}
KUBECTL_VERSION: ${{ inputs.kubectl_version }}
NAMESPACE: ${{ inputs.namespace }}

jobs:
deploy:
Expand Down Expand Up @@ -70,15 +70,19 @@ jobs:
with:
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.SERVICE_ACCOUNT }}

- id: 'get-credentials'
uses: google-github-actions/get-gke-credentials@v2
with:
cluster_name: ${{ env.CLUSTER_NAME }}
location: 'europe-north1'
use_connect_gateway: 'true'
project_id: ${{ env.KUBERNETES_PROJECT_ID }}
namespace: ${{ env.NAMESPACE }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2

- name: Authenticate with Kubernetes
run: |
gcloud components install gke-gcloud-auth-plugin
gcloud container hub memberships get-credentials $CLUSTER_NAME --verbosity debug
- name: Set kubectl namespace
run: |
kubectl config set-context --current --namespace=$NAMESPACE
- name: 'Execute kubectl commands'
run: |
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ jobs:
service_account: [email protected]
kubernetes_project_id: kube-dev-4329023
kubernetes_project_number: 43290432893
command: restart deployment my-deployment
namespace: default
command: |
restart deployment my-deployment
```
### Inputs
Expand Down

0 comments on commit f1dba5a

Please sign in to comment.