Skip to content

Commit 20517fd

Browse files
authored
Merge pull request #947 from CecileRobertMichon/crs-dev
🔧 Apply calico ClusterResourceSet to tilt and dev clusters
2 parents 7a23372 + 111a0de commit 20517fd

16 files changed

+134
-2
lines changed

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST)
430430
kubectl wait --for=condition=Available --timeout=5m -n capi-kubeadm-bootstrap-system deployment -l cluster.x-k8s.io/provider=bootstrap-kubeadm
431431
kubectl wait --for=condition=Available --timeout=5m -n capi-kubeadm-control-plane-system deployment -l cluster.x-k8s.io/provider=control-plane-kubeadm
432432

433+
# apply CNI ClusterResourceSets
434+
kubectl create configmap calico-addon --from-file=templates/addons/calico.yaml
435+
kubectl create configmap calico-ipv6-addon --from-file=templates/addons/calico-ipv6.yaml
436+
kubectl apply -f templates/addons/calico-resource-set.yaml
437+
433438
# Wait for CAPZ deployments
434439
kubectl wait --for=condition=Available --timeout=5m -n capz-system deployment -l cluster.x-k8s.io/provider=infrastructure-azure
435440

@@ -473,7 +478,12 @@ create-aks-cluster: $(KUSTOMIZE) $(ENVSUBST)
473478

474479

475480
.PHONY: create-cluster
476-
create-cluster: create-management-cluster create-workload-cluster ## Create a workload development Kubernetes cluster on Azure in a kind management cluster.
481+
create-cluster: ## Create a workload development Kubernetes cluster on Azure in a kind management cluster.
482+
EXP_CLUSTER_RESOURCE_SET=true \
483+
EXP_AKS=true \
484+
EXP_MACHINE_POOL=true \
485+
$(MAKE) create-management-cluster \
486+
$(MAKE) create-workload-cluster
477487

478488
.PHONY: delete-workload-cluster
479489
delete-workload-cluster: ## Deletes the example workload Kubernetes cluster
@@ -490,7 +500,7 @@ kind-create: ## create capz kind cluster if needed
490500

491501
.PHONY: tilt-up
492502
tilt-up: $(ENVSUBST) $(KUSTOMIZE) kind-create ## start tilt and build kind cluster if needed
493-
tilt up
503+
EXP_CLUSTER_RESOURCE_SET=true EXP_AKS=true EXP_MACHINE_POOL=true tilt up
494504

495505
.PHONY: delete-cluster
496506
delete-cluster: delete-workload-cluster ## Deletes the example kind cluster "capz"

Tiltfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ def capz():
258258

259259
k8s_yaml(blob(yaml))
260260

261+
def calico_crs():
262+
local("kubectl delete configmaps calico-addon --ignore-not-found=true")
263+
local("kubectl create configmap calico-addon --from-file=templates/addons/calico.yaml")
264+
local("kubectl delete configmaps calico-ipv6-addon --ignore-not-found=true")
265+
local("kubectl create configmap calico-ipv6-addon --from-file=templates/addons/calico-ipv6.yaml")
266+
local("kubectl apply -f templates/addons/calico-resource-set.yaml")
261267

262268
# run worker clusters specified from 'tilt up' or in 'tilt_config.json'
263269
def flavors():
@@ -385,4 +391,6 @@ deploy_capi()
385391

386392
capz()
387393

394+
calico_crs()
395+
388396
flavors()
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: addons.cluster.x-k8s.io/v1alpha3
2+
kind: ClusterResourceSet
3+
metadata:
4+
name: crs-calico
5+
namespace: default
6+
spec:
7+
strategy: "ApplyOnce"
8+
clusterSelector:
9+
matchLabels:
10+
cni: calico
11+
resources:
12+
- name: calico-addon
13+
kind: ConfigMap
14+
---
15+
apiVersion: addons.cluster.x-k8s.io/v1alpha3
16+
kind: ClusterResourceSet
17+
metadata:
18+
name: crs-calico-ipv6
19+
namespace: default
20+
spec:
21+
strategy: "ApplyOnce"
22+
clusterSelector:
23+
matchLabels:
24+
cni: calico-ipv6
25+
resources:
26+
- name: calico-ipv6-addon
27+
kind: ConfigMap

templates/cluster-template-ephemeral.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
apiVersion: cluster.x-k8s.io/v1alpha3
22
kind: Cluster
33
metadata:
4+
labels:
5+
cni: calico
46
name: ${CLUSTER_NAME}
57
namespace: default
68
spec:

templates/cluster-template-external-cloud-provider.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
apiVersion: cluster.x-k8s.io/v1alpha3
22
kind: Cluster
33
metadata:
4+
labels:
5+
cni: calico
46
name: ${CLUSTER_NAME}
57
namespace: default
68
spec:

templates/cluster-template-ipv6.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
apiVersion: cluster.x-k8s.io/v1alpha3
22
kind: Cluster
33
metadata:
4+
labels:
5+
cni: calico-ipv6
46
name: ${CLUSTER_NAME}
57
namespace: default
68
spec:

templates/cluster-template-machinepool.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
apiVersion: cluster.x-k8s.io/v1alpha3
22
kind: Cluster
33
metadata:
4+
labels:
5+
cni: calico
46
name: ${CLUSTER_NAME}
57
namespace: default
68
spec:

templates/cluster-template-system-assigned-identity.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
apiVersion: cluster.x-k8s.io/v1alpha3
22
kind: Cluster
33
metadata:
4+
labels:
5+
cni: calico
46
name: ${CLUSTER_NAME}
57
namespace: default
68
spec:

templates/cluster-template-user-assigned-identity.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
apiVersion: cluster.x-k8s.io/v1alpha3
22
kind: Cluster
33
metadata:
4+
labels:
5+
cni: calico
46
name: ${CLUSTER_NAME}
57
namespace: default
68
spec:

templates/cluster-template.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
apiVersion: cluster.x-k8s.io/v1alpha3
22
kind: Cluster
33
metadata:
4+
labels:
5+
cni: calico
46
name: ${CLUSTER_NAME}
57
namespace: default
68
spec:

0 commit comments

Comments
 (0)