Skip to content

Commit

Permalink
Enable azure rbac deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
RMcVelia committed Jan 29, 2024
1 parent a3252e3 commit a6d6e82
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ runs:
${{ env.key_vault_app_secret_name }}
${{ env.key_vault_infra_secret_name }}
- uses: DFE-Digital/github-actions/set-arm-environment-variables@master
- uses: DFE-Digital/github-actions/set-kubelogin-environment@master
with:
azure-credentials: ${{ inputs.azure-credentials }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/database-backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: K8 setup
shell: bash
run: |
az aks get-credentials -g s189p01-tsc-pd-rg -n s189p01-tsc-production-aks
make ci production get-cluster-credentials
make install-konduit
- name: Setup postgres client
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/delete-review-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
# ${{ env.key_vault_app_secret_name }}
# ${{ env.key_vault_infra_secret_name }}

- uses: DFE-Digital/github-actions/set-arm-environment-variables@master
- uses: DFE-Digital/github-actions/set-kubelogin-environment@master
if: env.TF_STATE_EXISTS == 'true'
with:
azure-credentials: ${{ secrets.AZURE_CREDENTIALS_REVIEW }}
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ print-infra-secrets: read-tf-config install-fetch-config set-azure-account

get-cluster-credentials: read-cluster-config set-azure-account ## make <config> get-cluster-credentials [ENVIRONMENT=<clusterX>]
az aks get-credentials --overwrite-existing -g ${AZURE_RESOURCE_PREFIX}-tsc-${CLUSTER_SHORT}-rg -n ${AZURE_RESOURCE_PREFIX}-tsc-${CLUSTER}-aks
kubelogin convert-kubeconfig -l $(if ${GITHUB_ACTIONS},spn,azurecli)

console: get-cluster-credentials
$(if $(APP_NAME), $(eval export APP_ID=$(APP_NAME)) , $(eval export APP_ID=$(CONFIG_LONG)))
Expand Down
4 changes: 2 additions & 2 deletions docs/aks-cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ $ az account set -s s189-teacher-services-cloud-test
```

Get access credentials for a managed Kubernetes cluster (passing the
resource group and the name):
register environment):

```
$ az aks get-credentials -g s189t01-tsc-ts-rg -n s189t01-tsc-test-aks
$ make qa get-cluster-credentials
```

When you have multiple cluster credentials loaded, you can switch between clusters
Expand Down
9 changes: 9 additions & 0 deletions terraform/aks/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ provider "kubernetes" {
client_certificate = module.cluster_data.kubernetes_client_certificate
client_key = module.cluster_data.kubernetes_client_key
cluster_ca_certificate = module.cluster_data.kubernetes_cluster_ca_certificate

dynamic "exec" {
for_each = module.cluster_data.azure_RBAC_enabled ? [1] : []
content {
api_version = "client.authentication.k8s.io/v1beta1"
command = "kubelogin"
args = module.cluster_data.kubelogin_args
}
}
}

provider "statuscake" {
Expand Down

0 comments on commit a6d6e82

Please sign in to comment.