Skip to content

Commit

Permalink
Bump Cilium to 1.7 for k8s 1.12+
Browse files Browse the repository at this point in the history
Cilium 1.7 requires K8s 1.12 minimum. Changed the templates so that we
can have different cilium versions for different k8s versions.

This also mean that this addon will behave similar to other addons wrt
upgrades. Cilium used to add a fixed version to the cluster spec on cluster creation so
upgrades were slightly more manual. Now, for new clusters, upgrades will
happen implicitly with kops updates unless the .Version is added
manually to the cluster spec.
  • Loading branch information
Ole Markus With committed Feb 24, 2020
1 parent c3847b9 commit 7dc4952
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 16 deletions.
3 changes: 0 additions & 3 deletions pkg/apis/kops/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,6 @@ func (c *Cluster) FillDefaults() error {
} else if c.Spec.Networking.AmazonVPC != nil {
// OK
} else if c.Spec.Networking.Cilium != nil {
if c.Spec.Networking.Cilium.Version == "" {
c.Spec.Networking.Cilium.Version = CiliumDefaultVersion
}
// OK
} else if c.Spec.Networking.LyftVPC != nil {
// OK
Expand Down
2 changes: 0 additions & 2 deletions pkg/apis/kops/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ type AmazonVPCNetworkingSpec struct {
ImageName string `json:"imageName,omitempty"`
}

const CiliumDefaultVersion = "v1.6.6"

// CiliumNetworkingSpec declares that we want Cilium networking
type CiliumNetworkingSpec struct {
Version string `json:"version,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ rules:
- get
- list
- watch
- apiGroups:
- discovery.k8s.io
resources:
- endpointslices
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down Expand Up @@ -207,6 +215,8 @@ rules:
resources:
- ciliumnetworkpolicies
- ciliumnetworkpolicies/status
- ciliumclusterwidenetworkpolicies
- ciliumclusterwidenetworkpolicies/status
- ciliumendpoints
- ciliumendpoints/status
- ciliumnodes
Expand Down Expand Up @@ -234,6 +244,14 @@ rules:
- list
- watch
- delete
- apiGroups:
- discovery.k8s.io
resources:
- endpointslices
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand All @@ -255,6 +273,8 @@ rules:
resources:
- ciliumnetworkpolicies
- ciliumnetworkpolicies/status
- ciliumclusterwidenetworkpolicies
- ciliumclusterwidenetworkpolicies/status
- ciliumendpoints
- ciliumendpoints/status
- ciliumnodes
Expand Down Expand Up @@ -316,7 +336,6 @@ spec:
# gets priority scheduling.
# https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/
scheduler.alpha.kubernetes.io/critical-pod: ""
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"dedicated","operator":"Equal","value":"master","effect":"NoSchedule"}]'
labels:
k8s-app: cilium
kubernetes.io/cluster-service: "true"
Expand Down Expand Up @@ -368,7 +387,7 @@ spec:
value: {{ . }}
{{ end }}
{{ with .Networking.Cilium }}
image: "docker.io/cilium/cilium:{{ .Version }}"
image: "docker.io/cilium/cilium:{{- or .Version "v.1.7.0" }}"
imagePullPolicy: IfNotPresent
lifecycle:
postStart:
Expand Down Expand Up @@ -421,6 +440,7 @@ spec:
volumeMounts:
- mountPath: /sys/fs/bpf
name: bpf-maps
mountPropagation: HostToContainer
- mountPath: /var/run/cilium
name: cilium-run
- mountPath: /host/opt/cni/bin
Expand Down Expand Up @@ -462,7 +482,7 @@ spec:
key: wait-bpf-mount
name: cilium-config
optional: true
image: "docker.io/cilium/cilium:{{ .Version }}"
image: "docker.io/cilium/cilium:{{- or .Version "v1.7.0" }}"
## end of `with .Networking.Cilium`
#{{ end }}
imagePullPolicy: IfNotPresent
Expand Down Expand Up @@ -642,7 +662,7 @@ spec:
key: AWS_DEFAULT_REGION
name: cilium-aws
optional: true
image: "docker.io/cilium/operator:{{ .Version }}"
image: "docker.io/cilium/operator:{{- if eq .Version "" -}}v1.7.0{{- else -}}{{ .Version }}{{- end -}}"
imagePullPolicy: IfNotPresent
name: cilium-operator
{{ if .EnablePrometheusMetrics }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ spec:
value: {{ . }}
{{ end }}
{{ with .Networking.Cilium }}
image: "docker.io/cilium/cilium:{{ .Version }}"
image: "docker.io/cilium/cilium:{{- or .Version "v1.6.6" }}"
imagePullPolicy: IfNotPresent
lifecycle:
postStart:
Expand Down Expand Up @@ -634,7 +634,7 @@ spec:
key: AWS_DEFAULT_REGION
name: cilium-aws
optional: true
image: "docker.io/cilium/operator:{{ .Version }}"
image: "docker.io/cilium/operator:{{- or .Version "v1.6.6" }}"
imagePullPolicy: IfNotPresent
name: cilium-operator
{{ if .EnablePrometheusMetrics }}
Expand Down
2 changes: 1 addition & 1 deletion upup/pkg/fi/cloudup/bootstrapchannelbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ func (b *BootstrapChannelBuilder) buildAddons() *channelsapi.Addons {

if b.cluster.Spec.Networking.Cilium != nil {
key := "networking.cilium.io"
version := "1.6.4-kops.3"
version := "1.7.0-kops.1"

{
id := "k8s-1.7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,16 @@ spec:
- id: k8s-1.7
kubernetesVersion: '>=1.7.0 <1.12.0'
manifest: networking.cilium.io/k8s-1.7.yaml
manifestHash: 6928e95ec4b8359075e3dfb069f74e290e2e6eb2
manifestHash: 66318e232bf165b6af5da546e711ac3b9444afdc
name: networking.cilium.io
selector:
role.kubernetes.io/networking: "1"
version: 1.6.4-kops.3
version: 1.7.0-kops.1
- id: k8s-1.12
kubernetesVersion: '>=1.12.0'
manifest: networking.cilium.io/k8s-1.12.yaml
manifestHash: 84295d293c8a461f7d510721c48b969cd1d99e54
manifestHash: e5c3b42382746bb66bc302cd0c162489c8650187
name: networking.cilium.io
selector:
role.kubernetes.io/networking: "1"
version: 1.6.4-kops.3
version: 1.7.0-kops.1

0 comments on commit 7dc4952

Please sign in to comment.