Skip to content

Commit

Permalink
install: update helm templates to add HA capabilities for operator
Browse files Browse the repository at this point in the history
[ upstream commit 930bde7 ]

Signed-off-by: Deepesh Pathak <deepshpathak@gmail.com>
Signed-off-by: André Martins <andre@cilium.io>
  • Loading branch information
fristonio authored and tklauser committed Aug 7, 2020
1 parent 8fa829b commit 976337b
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/helm-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ jobs:
run: |
sed -i 's;pullPolicy: Always;pullPolicy: Never;g' install/kubernetes/cilium/values.yaml
- name: Run a single operator replica since it's a single node cluster
run: |
sed -i 's; numReplicas: 2; numReplicas: 1;g' install/kubernetes/cilium/values.yaml
- name: Create kind cluster
uses: helm/kind-action@v1.0.0-rc.1
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,22 @@ rules:
- get
- list
- watch
# For cilium-operator running in HA mode.
#
# Cilium operator running in HA mode requires the use of ResourceLock for Leader Election
# between mulitple running instances.
# The preferred way of doing this is to use LeasesResourceLock as edits to Leases are less
# common and fewer objects in the cluster watch "all Leases".
# The support for leases was introduced in coordination.k8s.io/v1 during Kubernetes 1.14 release.
# In Cilium we currently don't support HA mode for K8s version < 1.14. This condition make sure
# that we only authorize access to leases resources in supported K8s versions.
{{- if or (ge .Capabilities.KubeVersion.Minor "14") (gt .Capabilities.KubeVersion.Major "1") }}
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- get
- update
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ metadata:
name: cilium-operator
namespace: {{ .Release.Namespace }}
spec:
# We support HA mode only for Kubernetes version > 1.14
# See docs on ServerCapabilities.LeasesResourceLock in file pkg/k8s/version/version.go
# for more details.
{{- if or (ge .Capabilities.KubeVersion.Minor "14") (gt .Capabilities.KubeVersion.Major "1") }}
replicas: {{ .Values.numReplicas }}
{{- else }}
replicas: 1
{{- end }}
selector:
matchLabels:
io.cilium/app: operator
Expand Down
5 changes: 5 additions & 0 deletions install/kubernetes/cilium/charts/operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ serviceAccount:

# Specifies the resources for the operator container
resources: {}


# Number of replicas to run for cilium operator deployment.
numReplicas: 2

3 changes: 3 additions & 0 deletions install/kubernetes/cilium/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ config:
operator:
enabled: true

# Number of replicas to run for cilium-operator deployment.
numReplicas: 2

# Include the PreFlight DaemonSet
preflight:
enabled: false
Expand Down
22 changes: 21 additions & 1 deletion install/kubernetes/experimental-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,23 @@ rules:
- get
- list
- watch
# For cilium-operator running in HA mode.
#
# Cilium operator running in HA mode requires the use of ResourceLock for Leader Election
# between mulitple running instances.
# The preferred way of doing this is to use LeasesResourceLock as edits to Leases are less
# common and fewer objects in the cluster watch "all Leases".
# The support for leases was introduced in coordination.k8s.io/v1 during Kubernetes 1.14 release.
# In Cilium we currently don't support HA mode for K8s version < 1.14. This condition make sure
# that we only authorize access to leases resources in supported K8s versions.
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- get
- update
---
# Source: cilium/charts/agent/templates/clusterrolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -793,7 +810,10 @@ metadata:
name: cilium-operator
namespace: kube-system
spec:
replicas: 1
# We support HA mode only for Kubernetes version > 1.14
# See docs on ServerCapabilities.LeasesResourceLock in file pkg/k8s/version/version.go
# for more details.
replicas: 2
selector:
matchLabels:
io.cilium/app: operator
Expand Down
22 changes: 21 additions & 1 deletion install/kubernetes/quick-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,23 @@ rules:
- get
- list
- watch
# For cilium-operator running in HA mode.
#
# Cilium operator running in HA mode requires the use of ResourceLock for Leader Election
# between mulitple running instances.
# The preferred way of doing this is to use LeasesResourceLock as edits to Leases are less
# common and fewer objects in the cluster watch "all Leases".
# The support for leases was introduced in coordination.k8s.io/v1 during Kubernetes 1.14 release.
# In Cilium we currently don't support HA mode for K8s version < 1.14. This condition make sure
# that we only authorize access to leases resources in supported K8s versions.
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- get
- update
---
# Source: cilium/charts/agent/templates/clusterrolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -539,7 +556,10 @@ metadata:
name: cilium-operator
namespace: kube-system
spec:
replicas: 1
# We support HA mode only for Kubernetes version > 1.14
# See docs on ServerCapabilities.LeasesResourceLock in file pkg/k8s/version/version.go
# for more details.
replicas: 2
selector:
matchLabels:
io.cilium/app: operator
Expand Down

0 comments on commit 976337b

Please sign in to comment.