Skip to content

Commit

Permalink
Allow AKS preview versions (#155)
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <[email protected]>
  • Loading branch information
JorTurFer authored Jul 25, 2024
1 parent a49f606 commit a2b9e1f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 40 deletions.
76 changes: 39 additions & 37 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: 'Deploy infrastucture'
name: "Deploy infrastucture"

on:
push:
branches:
- main
paths:
- '**.tf'
- '.github/workflows/terraform.yaml'
- "**.tf"
- ".github/workflows/terraform.yaml"
schedule: # Scheduling the job we will update AKS automatically
- cron: "0 7 * * 1" # Mondays at 7:00 AM
workflow_dispatch:

concurrency: terraform
Expand All @@ -17,7 +19,7 @@ permissions:

jobs:
terraform:
name: 'Terraform'
name: "Terraform"
runs-on: ubuntu-latest
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
Expand All @@ -29,43 +31,43 @@ jobs:
GRAFANA_CLOUD_API_KEY: ${{ secrets.GRAFANA_CLOUD_API_KEY }}

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Log into Azure using OIDC
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Log into Azure using OIDC
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Log into AWS using OIDC
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: eu-west-2
- name: Log into AWS using OIDC
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: eu-west-2

- name: Log into GCP using OIDC
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- name: Log into GCP using OIDC
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}

- name: Setup Terraform
uses: hashicorp/[email protected]
- name: Setup Terraform
uses: hashicorp/[email protected]

- name: Terraform Init
run: |
terraform init \
-backend-config=storage_account_name=${{ secrets.BACKEND_STORAGE_ACCOUNT_NAME}} \
-backend-config=container_name=${{ secrets.BACKEND_STORAGE_CONTAINER_NAME}} \
-backend-config=resource_group_name=${{ secrets.BACKEND_STORAGE_RESOURCE_GROUP_NAME}}
working-directory: terraform
- name: Terraform Init
run: |
terraform init \
-backend-config=storage_account_name=${{ secrets.BACKEND_STORAGE_ACCOUNT_NAME}} \
-backend-config=container_name=${{ secrets.BACKEND_STORAGE_CONTAINER_NAME}} \
-backend-config=resource_group_name=${{ secrets.BACKEND_STORAGE_RESOURCE_GROUP_NAME}}
working-directory: terraform

- name: Terraform Plan
run: terraform plan -out=plan.tfplan
working-directory: terraform
- name: Terraform Plan
run: terraform plan -out=plan.tfplan
working-directory: terraform

- name: Terraform Apply
run: terraform apply -input=false -auto-approve plan.tfplan
working-directory: terraform
- name: Terraform Apply
run: terraform apply -input=false -auto-approve plan.tfplan
working-directory: terraform
4 changes: 2 additions & 2 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module "azuread_applications" {
module "azure_aks_pr" {
source = "./modules/azure/aks"
resource_group_name = var.azure_resource_group_name
kubernetes_version = "1.29"
kubernetes_version = "1.30"
cluster_name = local.pr_cluster_name
unique_project_name = var.unique_project_name

Expand All @@ -103,7 +103,7 @@ module "azure_aks_pr" {
module "azure_aks_nightly" {
source = "./modules/azure/aks"
resource_group_name = var.azure_resource_group_name
kubernetes_version = "1.29"
kubernetes_version = "1.30"
cluster_name = local.main_cluster_name
unique_project_name = var.unique_project_name

Expand Down
2 changes: 1 addition & 1 deletion terraform/modules/azure/aks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ data "azurerm_resource_group" "rg" {

data "azurerm_kubernetes_service_versions" "current" {
location = data.azurerm_resource_group.rg.location
include_preview = false
include_preview = true
version_prefix = var.kubernetes_version
}

Expand Down

0 comments on commit a2b9e1f

Please sign in to comment.