Skip to content

Commit

Permalink
Deploy tugger to replace images (#165)
Browse files Browse the repository at this point in the history
* Deploy tugger to replace images

Signed-off-by: Jorge Turrado <[email protected]>

* Deploy tugger to replace images

Signed-off-by: Jorge Turrado <[email protected]>

* Deploy tugger to replace images

Signed-off-by: Jorge Turrado <[email protected]>

* Deploy tugger to replace images

Signed-off-by: Jorge Turrado <[email protected]>

---------

Signed-off-by: Jorge Turrado <[email protected]>
  • Loading branch information
JorTurFer authored Oct 31, 2024
1 parent 3fba9b9 commit 1984330
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 3 deletions.
6 changes: 4 additions & 2 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ module "azure_aks_pr" {
module.azuread_applications.identity_2
]

azure_container_registry_id = module.acr_proxy.id
azure_container_registry_id = module.acr_proxy.id
azure_container_registry_enpoint = module.acr_proxy.endpoint

tags = local.tags
}
Expand All @@ -134,7 +135,8 @@ module "azure_aks_nightly" {
module.azuread_applications.identity_2
]

azure_container_registry_id = module.acr_proxy.id
azure_container_registry_id = module.acr_proxy.id
azure_container_registry_enpoint = module.acr_proxy.endpoint

tags = local.tags
}
Expand Down
40 changes: 40 additions & 0 deletions terraform/modules/azure/aks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ resource "azurerm_kubernetes_cluster" "aks" {
vm_size = var.default_node_pool_instance_type
orchestrator_version = data.azurerm_kubernetes_service_versions.current.latest_version
tags = var.tags

upgrade_settings {
drain_timeout_in_minutes = 0
max_surge = "10%"
node_soak_duration_in_minutes = 0
}
}

identity {
Expand Down Expand Up @@ -368,4 +374,38 @@ TEMPLATE

// NOTE: whilst we show an inline template here, we recommend
// sourcing this from a file for readability/editor support
}

## Deploy the image proxy

provider "helm" {
kubernetes {
host = azurerm_kubernetes_cluster.aks.kube_config.0.host
client_certificate = base64decode(azurerm_kubernetes_cluster.aks.kube_config.0.client_certificate)
client_key = base64decode(azurerm_kubernetes_cluster.aks.kube_config.0.client_key)
cluster_ca_certificate = base64decode(azurerm_kubernetes_cluster.aks.kube_config.0.cluster_ca_certificate)

}
}

resource "helm_release" "tugger" {
name = "tugger"
namespace = "tugger"
repository = "https://jainishshah17.github.io/tugger"
chart = "tugger"

values = [
<<EOF
createMutatingWebhook: true
replicaCount: 2
rules:
- pattern: ^docker.io/(.*)
replacement: ${var.azure_container_registry_enpoint}/$1
whitelistNamespaces:
- kube-system
- kube-public
- calico-system
- tigera-operator
EOF
]
}
5 changes: 5 additions & 0 deletions terraform/modules/azure/aks/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ variable "azure_container_registry_id" {
description = "Azure Container Registry ID"
}

variable "azure_container_registry_enpoint" {
type = string
description = "Azure Container Registry Endpoint"
}

variable "default_node_pool_count" {
type = number
default = 3
Expand Down
7 changes: 6 additions & 1 deletion terraform/modules/azure/registry/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
output "id" {
value = azurerm_container_registry.acr.id
}
}

output "endpoint" {
value = azurerm_container_registry.acr.login_server
}

0 comments on commit 1984330

Please sign in to comment.