Skip to content

Commit a5a8c74

Browse files
feat: upgrade aks (#59)
* wip: fix bots * fix: update aks cluster version * feat: update azurerm to 4.23.0 (fixing problems) * fix: use rg name and location from variable * chore: format * ci: fix
1 parent 6c67f24 commit a5a8c74

File tree

22 files changed

+321
-75
lines changed

22 files changed

+321
-75
lines changed

.github/workflows/tf-plan-apply.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ jobs:
2424
terraform-plan:
2525
name: 'Terraform Plan'
2626
runs-on: ubuntu-latest
27-
env:
28-
#this is needed since we are running terraform with read-only permissions
29-
ARM_SKIP_PROVIDER_REGISTRATION: true
3027
outputs:
3128
tfplanExitCode: ${{ steps.tf-plan.outputs.exitcode }}
3229

.terraform.lock.hcl

Lines changed: 14 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

access_key.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export ARM_SUBSCRIPTION_ID=$(az account show --query 'id' -o tsv)
12
export ARM_ACCESS_KEY=$(az storage account keys list --resource-group rg-polinetwork --account-name polinetworksa --query '[0].value' -o tsv)

argocd-applications.yaml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,29 @@ applications:
4242
info:
4343
- name: url
4444
value: https://argoproj.github.io/
45-
bot-mat:
46-
name: bot-mat
47-
namespace: argocd
48-
project: default
49-
source:
50-
repoURL: https://github.com/poliNetworkOrg/polinetwork-cd
51-
targetRevision: HEAD
52-
path: bot-mat
53-
directory:
54-
recurse: true
55-
destination:
56-
server: https://kubernetes.default.svc
57-
namespace: bot-mat
58-
syncPolicy:
59-
automated:
60-
prune: true
61-
selfHeal: true
62-
syncOptions:
63-
- CreateNamespace=false
64-
- Replace=true
65-
info:
66-
- name: url
67-
value: https://argoproj.github.io/
45+
# bot-mat:
46+
# name: bot-mat
47+
# namespace: argocd
48+
# project: default
49+
# source:
50+
# repoURL: https://github.com/poliNetworkOrg/polinetwork-cd
51+
# targetRevision: HEAD
52+
# path: bot-mat
53+
# directory:
54+
# recurse: true
55+
# destination:
56+
# server: https://kubernetes.default.svc
57+
# namespace: bot-mat
58+
# syncPolicy:
59+
# automated:
60+
# prune: true
61+
# selfHeal: true
62+
# syncOptions:
63+
# - CreateNamespace=false
64+
# - Replace=true
65+
# info:
66+
# - name: url
67+
# value: https://argoproj.github.io/
6868
mariadb:
6969
name: mariadb
7070
namespace: argocd

features.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
provider "azurerm" {
22
features {}
3-
skip_provider_registration = true
4-
use_oidc = true
3+
resource_provider_registrations = "none"
4+
use_oidc = true
55
}

main.tf

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ locals {
1616
}
1717

1818
module "aks" {
19-
source = "./modules/aks/"
19+
depends_on = [module.keyvault]
20+
source = "./modules/aks/"
2021

2122
ca_tls_key = data.azurerm_key_vault_secret.ca_tls_key.value
2223
ca_tls_crt = data.azurerm_key_vault_secret.ca_tls_crt.value
@@ -33,10 +34,10 @@ module "aks" {
3334
}
3435
]
3536

36-
location = azurerm_resource_group.rg.location
37-
rg_name = azurerm_resource_group.rg.name
37+
rg_location = azurerm_resource_group.rg.location
38+
rg_name = azurerm_resource_group.rg.name
3839

39-
kubernetes_orchestrator_version = "1.26.3"
40+
kubernetes_orchestrator_version = "1.29.13"
4041

4142
}
4243

@@ -55,6 +56,15 @@ module "argo-cd" {
5556
]
5657
}
5758

59+
module "aule_bot" {
60+
depends_on = [
61+
module.mariadb
62+
]
63+
64+
source = "./modules/bots-migration/"
65+
bot_namespace = "bot-rooms"
66+
}
67+
5868
module "cloudflare" {
5969
depends_on = [
6070
module.aks
@@ -127,22 +137,13 @@ module "bot_mat_migration" {
127137
module.mariadb
128138
]
129139

130-
source = "./modules/bots/"
140+
source = "./modules/bots-migration/"
131141

132142
bot_namespace = "bot-mat"
133-
bot_token = data.azurerm_key_vault_secret.prod_mat_token.value
134-
bot_onMessage = "mat"
135-
db_database = "polinetwork_materials"
136-
db_host = local.mariadb_internal_ip
137-
db_password = data.azurerm_key_vault_secret.prod_mat_db_password.value
138-
db_user = data.azurerm_key_vault_secret.prod_mat_db_user.value
139143
persistent_storage = true
140144
persistent_storage_size_gi = "250"
141145
persistent_storage_location = azurerm_resource_group.rg.location
142146
persistent_storage_rg_name = azurerm_resource_group.rg.name
143-
144-
material_password = data.azurerm_key_vault_secret.dev_mat_config_password.value
145-
material_root_dir = "/Repos/"
146147
}
147148

148149
module "keyvault" {

modules/aks/k8s.tf

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ data "azurerm_subscription" "primary" {
33

44
# tfsec:ignore:azure-container-limit-authorized-ips
55
resource "azurerm_kubernetes_cluster" "k8s" {
6-
location = "westeurope"
76
name = "aks-polinetwork"
8-
resource_group_name = var.rg_name
97
dns_prefix = "aks-polinetwork"
8+
location = var.rg_location
9+
resource_group_name = var.rg_name
1010
role_based_access_control_enabled = true
1111
http_application_routing_enabled = false // replaced by az aks approuting enable -g <ResourceGroupName> -n <ClusterName>
1212

@@ -15,7 +15,6 @@ resource "azurerm_kubernetes_cluster" "k8s" {
1515
}
1616

1717
azure_active_directory_role_based_access_control {
18-
managed = true
1918
azure_rbac_enabled = true
2019
admin_group_object_ids = [
2120
"57561933-3873-400d-be92-cdad68d57c1f",
@@ -37,7 +36,7 @@ resource "azurerm_kubernetes_cluster" "k8s" {
3736
os_disk_type = "Managed"
3837
os_disk_size_gb = 30
3938
orchestrator_version = var.kubernetes_orchestrator_version
40-
enable_auto_scaling = true
39+
auto_scaling_enabled = true
4140
max_count = 1
4241
min_count = 1
4342
node_count = 1
@@ -68,7 +67,7 @@ resource "azurerm_kubernetes_cluster_node_pool" "systempool" {
6867
mode = each.value.mode == null ? "User" : each.value.mode
6968
tags = each.value.tags
7069
orchestrator_version = var.kubernetes_orchestrator_version
71-
enable_auto_scaling = each.value.enable_auto_scaling
70+
auto_scaling_enabled = each.value.enable_auto_scaling
7271
max_count = each.value.max_count
7372
min_count = each.value.min_count
7473
}

modules/aks/providers.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ terraform {
77
}
88
azurerm = {
99
source = "hashicorp/azurerm"
10-
version = "3.63.0"
10+
version = "=4.23.0"
1111
}
1212
helm = {
1313
source = "hashicorp/helm"

modules/aks/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
variable "location" {
1+
variable "rg_location" {
22
type = string
33
nullable = false
44
}

modules/app/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ terraform {
33
required_providers {
44
azurerm = {
55
source = "hashicorp/azurerm"
6-
version = "3.63.0"
6+
version = "=4.23.0"
77
}
88
kubernetes = {
99
source = "hashicorp/kubernetes"

0 commit comments

Comments
 (0)