Skip to content

Commit

Permalink
Upgrade Calico from v3.5.2 to v3.6.0
Browse files Browse the repository at this point in the history
* Add calico-ipam CRDs and RBAC permissions
* Switch IPAM from host-local to calico-ipam!
  * `calico-ipam` subnets `ippools` (defaults to pod CIDR) into
`ipamblocks` (defaults to /26, but set to /24 in Typhoon)
  * `host-local` subnets the pod CIDR based on the node PodCIDR
field (set via kube-controller-manager as /24's)
* Create a custom default IPv4 IPPool to ensure the block size
is kept at /24 to allow 110 pods per node (Kubernetes default)
* Retaining host-local was slightly preferred, but Calico v3.6
is migrating all usage to calico-ipam. The codepath that skipped
calico-ipam for KDD was removed
*  https://docs.projectcalico.org/v3.6/release-notes/
  • Loading branch information
dghubble committed Mar 19, 2019
1 parent 6cda319 commit 23f81a5
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 12 deletions.
12 changes: 12 additions & 0 deletions resources/calico/blockaffinities-crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: blockaffinities.crd.projectcalico.org
spec:
scope: Cluster
group: crd.projectcalico.org
version: v1
names:
kind: BlockAffinity
plural: blockaffinities
singular: blockaffinity
24 changes: 23 additions & 1 deletion resources/calico/cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ rules:
- globalbgpconfigs
- bgpconfigurations
- ippools
- ipamblocks
- globalnetworkpolicies
- globalnetworksets
- networkpolicies
Expand All @@ -81,4 +82,25 @@ rules:
verbs:
- create
- update

# Calico may perform IPAM allocations (not yet used)
- apiGroups: ["crd.projectcalico.org"]
resources:
- blockaffinities
- ipamblocks
- ipamhandles
verbs:
- get
- list
- create
- update
- delete
- apiGroups: ["crd.projectcalico.org"]
resources:
- ipamconfigs
verbs:
- get
- apiGroups: ["crd.projectcalico.org"]
resources:
- blockaffinities
verbs:
- watch
3 changes: 1 addition & 2 deletions resources/calico/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ data:
"nodename": "__KUBERNETES_NODE_NAME__",
"mtu": __CNI_MTU__,
"ipam": {
"type": "host-local",
"subnet": "usePodCidr"
"type": "calico-ipam"
},
"policy": {
"type": "k8s"
Expand Down
8 changes: 2 additions & 6 deletions resources/calico/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ spec:
value: "autodetect"
- name: IP_AUTODETECTION_METHOD
value: "${network_ip_autodetection_method}"
# Enable IPIP
- name: CALICO_IPV4POOL_IPIP
value: "Always"
# Enable IP-in-IP within Felix.
- name: FELIX_IPINIPENABLED
value: "true"
Expand All @@ -111,9 +108,8 @@ spec:
configMapKeyRef:
name: calico-config
key: veth_mtu
# The Calico IPv4 pool CIDR (should match `--cluster-cidr`).
- name: CALICO_IPV4POOL_CIDR
value: "${pod_cidr}"
- name: NO_DEFAULT_POOLS
value: "true"
# Disable file logging so `kubectl logs` works.
- name: CALICO_DISABLE_FILE_LOGGING
value: "true"
Expand Down
10 changes: 10 additions & 0 deletions resources/calico/default-ipv4-ippool.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: crd.projectcalico.org/v1
kind: IPPool
metadata:
name: default-ipv4-ippool
spec:
blockSize: 24
cidr: ${pod_cidr}
ipipMode: Always
natOutgoing: true
nodeSelector: all()
2 changes: 1 addition & 1 deletion resources/calico/felixconfigurations-crd.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: felixconfigurations.crd.projectcalico.org
name: felixconfigurations.crd.projectcalico.org
spec:
scope: Cluster
group: crd.projectcalico.org
Expand Down
12 changes: 12 additions & 0 deletions resources/calico/ipamblocks.crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: ipamblocks.crd.projectcalico.org
spec:
scope: Cluster
group: crd.projectcalico.org
version: v1
names:
kind: IPAMBlock
plural: ipamblocks
singular: ipamblock
12 changes: 12 additions & 0 deletions resources/calico/ipamconfigs-crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: ipamconfigs.crd.projectcalico.org
spec:
scope: Cluster
group: crd.projectcalico.org
version: v1
names:
kind: IPAMConfig
plural: ipamconfigs
singular: ipamconfig
12 changes: 12 additions & 0 deletions resources/calico/ipamhandles-crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: ipamhandles.crd.projectcalico.org
spec:
scope: Cluster
group: crd.projectcalico.org
version: v1
names:
kind: IPAMHandle
plural: ipamhandles
singular: ipamhandle
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ variable "container_images" {
type = "map"

default = {
calico = "quay.io/calico/node:v3.5.2"
calico_cni = "quay.io/calico/cni:v3.5.2"
calico = "quay.io/calico/node:v3.6.0"
calico_cni = "quay.io/calico/cni:v3.6.0"
flannel = "quay.io/coreos/flannel:v0.11.0-amd64"
flannel_cni = "quay.io/coreos/flannel-cni:v0.3.0"
kube_router = "cloudnativelabs/kube-router:v0.2.5"
Expand Down

0 comments on commit 23f81a5

Please sign in to comment.