Skip to content

Commit

Permalink
Merge pull request #947 from CecileRobertMichon/crs-dev
Browse files Browse the repository at this point in the history
🔧  Apply calico ClusterResourceSet to tilt and dev clusters
  • Loading branch information
k8s-ci-robot authored Sep 28, 2020
2 parents 7a23372 + 111a0de commit 20517fd
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,11 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST)
kubectl wait --for=condition=Available --timeout=5m -n capi-kubeadm-bootstrap-system deployment -l cluster.x-k8s.io/provider=bootstrap-kubeadm
kubectl wait --for=condition=Available --timeout=5m -n capi-kubeadm-control-plane-system deployment -l cluster.x-k8s.io/provider=control-plane-kubeadm

# apply CNI ClusterResourceSets
kubectl create configmap calico-addon --from-file=templates/addons/calico.yaml
kubectl create configmap calico-ipv6-addon --from-file=templates/addons/calico-ipv6.yaml
kubectl apply -f templates/addons/calico-resource-set.yaml

# Wait for CAPZ deployments
kubectl wait --for=condition=Available --timeout=5m -n capz-system deployment -l cluster.x-k8s.io/provider=infrastructure-azure

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


.PHONY: create-cluster
create-cluster: create-management-cluster create-workload-cluster ## Create a workload development Kubernetes cluster on Azure in a kind management cluster.
create-cluster: ## Create a workload development Kubernetes cluster on Azure in a kind management cluster.
EXP_CLUSTER_RESOURCE_SET=true \
EXP_AKS=true \
EXP_MACHINE_POOL=true \
$(MAKE) create-management-cluster \
$(MAKE) create-workload-cluster

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

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

.PHONY: delete-cluster
delete-cluster: delete-workload-cluster ## Deletes the example kind cluster "capz"
Expand Down
8 changes: 8 additions & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ def capz():

k8s_yaml(blob(yaml))

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

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

capz()

calico_crs()

flavors()
27 changes: 27 additions & 0 deletions templates/addons/calico-resource-set.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: addons.cluster.x-k8s.io/v1alpha3
kind: ClusterResourceSet
metadata:
name: crs-calico
namespace: default
spec:
strategy: "ApplyOnce"
clusterSelector:
matchLabels:
cni: calico
resources:
- name: calico-addon
kind: ConfigMap
---
apiVersion: addons.cluster.x-k8s.io/v1alpha3
kind: ClusterResourceSet
metadata:
name: crs-calico-ipv6
namespace: default
spec:
strategy: "ApplyOnce"
clusterSelector:
matchLabels:
cni: calico-ipv6
resources:
- name: calico-ipv6-addon
kind: ConfigMap
2 changes: 2 additions & 0 deletions templates/cluster-template-ephemeral.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
metadata:
labels:
cni: calico
name: ${CLUSTER_NAME}
namespace: default
spec:
Expand Down
2 changes: 2 additions & 0 deletions templates/cluster-template-external-cloud-provider.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
metadata:
labels:
cni: calico
name: ${CLUSTER_NAME}
namespace: default
spec:
Expand Down
2 changes: 2 additions & 0 deletions templates/cluster-template-ipv6.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
metadata:
labels:
cni: calico-ipv6
name: ${CLUSTER_NAME}
namespace: default
spec:
Expand Down
2 changes: 2 additions & 0 deletions templates/cluster-template-machinepool.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
metadata:
labels:
cni: calico
name: ${CLUSTER_NAME}
namespace: default
spec:
Expand Down
2 changes: 2 additions & 0 deletions templates/cluster-template-system-assigned-identity.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
metadata:
labels:
cni: calico
name: ${CLUSTER_NAME}
namespace: default
spec:
Expand Down
2 changes: 2 additions & 0 deletions templates/cluster-template-user-assigned-identity.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
metadata:
labels:
cni: calico
name: ${CLUSTER_NAME}
namespace: default
spec:
Expand Down
2 changes: 2 additions & 0 deletions templates/cluster-template.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
metadata:
labels:
cni: calico
name: ${CLUSTER_NAME}
namespace: default
spec:
Expand Down
2 changes: 2 additions & 0 deletions templates/flavors/base/cluster-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
labels:
cni: "calico"
spec:
clusterNetwork:
pods:
Expand Down
2 changes: 2 additions & 0 deletions templates/flavors/ipv6/patches/ipv6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
labels:
cni: "calico-ipv6"
spec:
clusterNetwork:
pods:
Expand Down
23 changes: 23 additions & 0 deletions templates/test/cluster-template-prow-machine-pool-ci-version.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
metadata:
labels:
cni: ${CLUSTER_NAME}-crs-0
name: ${CLUSTER_NAME}
namespace: default
spec:
Expand Down Expand Up @@ -358,3 +360,24 @@ spec:
preKubeadmCommands:
- bash -c /tmp/kubeadm-bootstrap.sh
useExperimentalRetryJoin: true
---
apiVersion: v1
data: ${CNI_RESOURCES}
kind: ConfigMap
metadata:
name: cni-${CLUSTER_NAME}-crs-0
namespace: default
---
apiVersion: addons.cluster.x-k8s.io/v1alpha3
kind: ClusterResourceSet
metadata:
name: ${CLUSTER_NAME}-crs-0
namespace: default
spec:
clusterSelector:
matchLabels:
cni: ${CLUSTER_NAME}-crs-0
resources:
- kind: ConfigMap
name: cni-${CLUSTER_NAME}-crs-0
strategy: ApplyOnce
23 changes: 23 additions & 0 deletions templates/test/cluster-template-prow-machine-pool.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
metadata:
labels:
cni: ${CLUSTER_NAME}-crs-0
name: ${CLUSTER_NAME}
namespace: default
spec:
Expand Down Expand Up @@ -193,3 +195,24 @@ spec:
cloud-provider: azure
name: '{{ ds.meta_data["local_hostname"] }}'
useExperimentalRetryJoin: true
---
apiVersion: v1
data: ${CNI_RESOURCES}
kind: ConfigMap
metadata:
name: cni-${CLUSTER_NAME}-crs-0
namespace: default
---
apiVersion: addons.cluster.x-k8s.io/v1alpha3
kind: ClusterResourceSet
metadata:
name: ${CLUSTER_NAME}-crs-0
namespace: default
spec:
clusterSelector:
matchLabels:
cni: ${CLUSTER_NAME}-crs-0
resources:
- kind: ConfigMap
name: cni-${CLUSTER_NAME}-crs-0
strategy: ApplyOnce
21 changes: 21 additions & 0 deletions templates/test/prow-machine-pool/cni-resource-set.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: v1
data: ${CNI_RESOURCES}
kind: ConfigMap
metadata:
name: cni-${CLUSTER_NAME}-crs-0
namespace: default
---
apiVersion: addons.cluster.x-k8s.io/v1alpha3
kind: ClusterResourceSet
metadata:
name: ${CLUSTER_NAME}-crs-0
namespace: default
spec:
clusterSelector:
matchLabels:
cni: ${CLUSTER_NAME}-crs-0
resources:
- kind: ConfigMap
name: cni-${CLUSTER_NAME}-crs-0
strategy: ApplyOnce
2 changes: 2 additions & 0 deletions templates/test/prow-machine-pool/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ kind: Kustomization
namespace: default
resources:
- ../../flavors/machinepool
- cni-resource-set.yaml
patchesStrategicMerge:
- ../patches/tags.yaml
- ../patches/cni-resource-set.yaml

0 comments on commit 20517fd

Please sign in to comment.