Skip to content

Commit e8412ac

Browse files
committed
Adding artifaact cache entries to capz/container-registry for calico
images to avoid throtteling during large cluster deployments
1 parent d518ad5 commit e8412ac

File tree

3 files changed

+72
-6
lines changed

3 files changed

+72
-6
lines changed

infra/azure/terraform/capz/capz-monitoring/main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ resource "azurerm_role_assignment" "monitoring_reader" {
4646
principal_id = azurerm_user_assigned_identity.capz_monitoring_user_identity.principal_id
4747
role_definition_name = "Monitoring Reader"
4848
scope = "/subscriptions/${var.subscription_id}"
49-
depends_on = [ azurerm_user_assigned_identity.capz_monitoring_user_identity ]
49+
depends_on = [azurerm_user_assigned_identity.capz_monitoring_user_identity]
5050
}
5151

5252
resource "azurerm_kubernetes_cluster" "capz-monitoring" {
53-
dns_prefix = var.resource_group_name
54-
location = var.location
55-
name = var.resource_group_name
56-
resource_group_name = var.resource_group_name
53+
dns_prefix = var.resource_group_name
54+
location = var.location
55+
name = var.resource_group_name
56+
resource_group_name = var.resource_group_name
5757
tags = {
5858
DO-NOT-DELETE = "contact capz"
5959
creationTimestamp = timestamp()
@@ -66,7 +66,7 @@ resource "azurerm_kubernetes_cluster" "capz-monitoring" {
6666
user_assigned_identity_id = azurerm_user_assigned_identity.capz_monitoring_user_identity.id
6767
}
6868
identity {
69-
type = "UserAssigned"
69+
type = "UserAssigned"
7070
identity_ids = [
7171
azurerm_user_assigned_identity.capz_monitoring_user_identity.id
7272
]

infra/azure/terraform/capz/container-registry/main.tf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,41 @@ resource "azurerm_management_lock" "registry_lock" {
4646
notes = "Contact Capz"
4747
}
4848

49+
resource "azurerm_container_registry_cache_rule" "tigera_operator" {
50+
name = "tigera-operator-cache"
51+
container_registry_id = azurerm_container_registry.capzci_registry.id
52+
source_repo = "quay.io/tigera/operator"
53+
target_repo = "tigera/operator"
54+
}
55+
56+
resource "azurerm_container_registry_cache_rule" "calico_node" {
57+
name = "calico-node-cache"
58+
container_registry_id = azurerm_container_registry.capzci_registry.id
59+
source_repo = "quay.io/calico/node"
60+
target_repo = "calico/node"
61+
}
62+
63+
resource "azurerm_container_registry_cache_rule" "calico_cni" {
64+
name = "calico-cni-cache"
65+
container_registry_id = azurerm_container_registry.capzci_registry.id
66+
source_repo = "quay.io/calico/cni"
67+
target_repo = "calico/cni"
68+
}
69+
70+
resource "azurerm_container_registry_cache_rule" "calico_kube_controllers" {
71+
name = "calico-kube-controllers-cache"
72+
container_registry_id = azurerm_container_registry.capzci_registry.id
73+
source_repo = "quay.io/calico/kube-controllers"
74+
target_repo = "calico/kube-controllers"
75+
}
76+
77+
resource "azurerm_container_registry_cache_rule" "calico_ctl" {
78+
name = "calico-ctl-cache"
79+
container_registry_id = azurerm_container_registry.capzci_registry.id
80+
source_repo = "quay.io/calico/ctl"
81+
target_repo = "calico/ctl"
82+
}
83+
4984
resource "azurerm_container_registry_task" "registry_task" {
5085
container_registry_id = azurerm_container_registry.capzci_registry.id
5186
name = "midnight_capz_purge"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
terraform {
18+
required_version = ">= 1.4.0"
19+
20+
required_providers {
21+
azurerm = {
22+
source = "hashicorp/azurerm"
23+
# Pin to a 3.x release: supports container_registry.retention_policy and container_registry_cache_rule
24+
version = ">= 3.75.0, < 4.0.0"
25+
}
26+
}
27+
}
28+
29+
provider "azurerm" {
30+
features {}
31+
}

0 commit comments

Comments
 (0)