Add cilium chart
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
{{- if (and (.Values.preflight.enabled) (not (.Values.agent)) (not (.Values.operator.enabled))) }}
|
||||
You have successfully ran the preflight check.
|
||||
Now make sure to check the number of READY pods is the same as the number of running cilium pods.
|
||||
Then make sure the cilium preflight deployment is also marked READY 1/1.
|
||||
If you have an issues please refer to the CNP Validation section in the upgrade guide.
|
||||
{{- else if (and (.Values.hubble.enabled) (.Values.hubble.relay.enabled)) }}
|
||||
{{- if (.Values.hubble.ui.enabled) }}
|
||||
You have successfully installed {{ title .Chart.Name }} with Hubble Relay and Hubble UI.
|
||||
{{- else }}
|
||||
You have successfully installed {{ title .Chart.Name }} with Hubble Relay.
|
||||
{{- end }}
|
||||
{{- else if .Values.hubble.enabled }}
|
||||
You have successfully installed {{ title .Chart.Name }} with Hubble.
|
||||
{{- else if (and (.Values.hubble.ui.enabled) (.Values.hubble.ui.standalone.enabled)) }}
|
||||
You have successfully installed {{ title .Chart.Name }} with standalone Hubble UI.
|
||||
{{- else }}
|
||||
You have successfully installed {{ title .Chart.Name }}.
|
||||
{{- end }}
|
||||
|
||||
Your release version is {{ .Chart.Version }}.
|
||||
|
||||
For any further help, visit https://docs.cilium.io/en/v{{ (semver .Chart.Version).Major }}.{{ (semver .Chart.Version).Minor }}/gettinghelp
|
||||
@@ -0,0 +1,156 @@
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "cilium.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Render full image name from given values, e.g:
|
||||
```
|
||||
image:
|
||||
repository: quay.io/cilium/cilium
|
||||
tag: v1.10.1
|
||||
useDigest: true
|
||||
digest: abcdefgh
|
||||
```
|
||||
then `include "cilium.image" .Values.image`
|
||||
will return `quay.io/cilium/cilium:v1.10.1@abcdefgh`
|
||||
*/}}
|
||||
{{- define "cilium.image" -}}
|
||||
{{- $digest := (.useDigest | default false) | ternary (printf "@%s" .digest) "" -}}
|
||||
{{- if .override -}}
|
||||
{{- printf "%s" .override -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s:%s%s" .repository .tag $digest -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return user specify priorityClass or default criticalPriorityClass
|
||||
Usage:
|
||||
include "cilium.priorityClass" (list $ <priorityClass> <criticalPriorityClass>)
|
||||
where:
|
||||
* `priorityClass`: is user specify priorityClass e.g `.Values.operator.priorityClassName`
|
||||
* `criticalPriorityClass`: default criticalPriorityClass, e.g `"system-cluster-critical"`
|
||||
This value is used when `priorityClass` is `nil` and
|
||||
`.Values.enableCriticalPriorityClass=true` and kubernetes supported it.
|
||||
*/}}
|
||||
{{- define "cilium.priorityClass" -}}
|
||||
{{- $root := index . 0 -}}
|
||||
{{- $priorityClass := index . 1 -}}
|
||||
{{- $criticalPriorityClass := index . 2 -}}
|
||||
{{- if $priorityClass }}
|
||||
{{- $priorityClass }}
|
||||
{{- else if and $root.Values.enableCriticalPriorityClass $criticalPriorityClass -}}
|
||||
{{- if and (eq $root.Release.Namespace "kube-system") (semverCompare ">=1.10-0" $root.Capabilities.KubeVersion.Version) -}}
|
||||
{{- $criticalPriorityClass }}
|
||||
{{- else if semverCompare ">=1.17-0" $root.Capabilities.KubeVersion.Version -}}
|
||||
{{- $criticalPriorityClass }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for ingress.
|
||||
*/}}
|
||||
{{- define "ingress.apiVersion" -}}
|
||||
{{- if semverCompare ">=1.16-0, <1.19-0" .Capabilities.KubeVersion.Version -}}
|
||||
{{- print "networking.k8s.io/v1beta1" -}}
|
||||
{{- else if semverCompare "^1.19-0" .Capabilities.KubeVersion.Version -}}
|
||||
{{- print "networking.k8s.io/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate backend for Hubble UI ingress.
|
||||
*/}}
|
||||
{{- define "ingress.paths" -}}
|
||||
{{ if semverCompare ">=1.4-0, <1.19-0" .Capabilities.KubeVersion.Version -}}
|
||||
backend:
|
||||
serviceName: hubble-ui
|
||||
servicePort: http
|
||||
{{- else if semverCompare "^1.19-0" .Capabilities.KubeVersion.Version -}}
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: hubble-ui
|
||||
port:
|
||||
name: http
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for cronjob.
|
||||
*/}}
|
||||
{{- define "cronjob.apiVersion" -}}
|
||||
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.Version -}}
|
||||
{{- print "batch/v1" -}}
|
||||
{{- else -}}
|
||||
{{- print "batch/v1beta1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for podDisruptionBudget.
|
||||
*/}}
|
||||
{{- define "podDisruptionBudget.apiVersion" -}}
|
||||
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.Version -}}
|
||||
{{- print "policy/v1" -}}
|
||||
{{- else -}}
|
||||
{{- print "policy/v1beta1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Generate TLS CA for Cilium
|
||||
Note: Always use this template as follows:
|
||||
{{- $_ := include "cilium.ca.setup" . -}}
|
||||
|
||||
The assignment to `$_` is required because we store the generated CI in a global `commonCA`
|
||||
and `commonCASecretName` variables.
|
||||
|
||||
*/}}
|
||||
{{- define "cilium.ca.setup" }}
|
||||
{{- if not .commonCA -}}
|
||||
{{- $ca := "" -}}
|
||||
{{- $secretName := "cilium-ca" -}}
|
||||
{{- $crt := .Values.tls.ca.cert -}}
|
||||
{{- $key := .Values.tls.ca.key -}}
|
||||
{{- if and $crt $key }}
|
||||
{{- $ca = buildCustomCert $crt $key -}}
|
||||
{{- else }}
|
||||
{{- with lookup "v1" "Secret" .Release.Namespace $secretName }}
|
||||
{{- $crt := index .data "ca.crt" }}
|
||||
{{- $key := index .data "ca.key" }}
|
||||
{{- $ca = buildCustomCert $crt $key -}}
|
||||
{{- else }}
|
||||
{{- $validity := ( .Values.tls.ca.certValidityDuration | int) -}}
|
||||
{{- $ca = genCA "Cilium CA" $validity -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- $_ := set (set . "commonCA" $ca) "commonCASecretName" $secretName -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Check if duration is non zero value, return duration, empty when zero.
|
||||
*/}}
|
||||
{{- define "hasDuration" }}
|
||||
{{- $now := now }}
|
||||
{{- if ne $now ($now | dateModify (toString .)) }}
|
||||
{{- . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Validate duration field, return validated duration, 0s when provided duration is empty.
|
||||
*/}}
|
||||
{{- define "validateDuration" }}
|
||||
{{- if . }}
|
||||
{{- $_ := now | mustDateModify (toString .) }}
|
||||
{{- . }}
|
||||
{{- else -}}
|
||||
0s
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,150 @@
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) }}
|
||||
{{- /*
|
||||
Keep file in sync with cilium-preflight/clusterrole.yaml
|
||||
*/ -}}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: cilium
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- networkpolicies
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- discovery.k8s.io
|
||||
resources:
|
||||
- endpointslices
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- namespaces
|
||||
- services
|
||||
- pods
|
||||
- endpoints
|
||||
- nodes
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- if .Values.annotateK8sNode }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- nodes/status
|
||||
verbs:
|
||||
# To annotate the k8s node with Cilium's metadata
|
||||
- patch
|
||||
{{- end }}
|
||||
{{- if .Values.l2announcements.enabled }}
|
||||
- apiGroups:
|
||||
- coordination.k8s.io
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- update
|
||||
- list
|
||||
- delete
|
||||
{{- end }}
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
# This is used when validating policies in preflight. This will need to stay
|
||||
# until we figure out how to avoid "get" inside the preflight, and then
|
||||
# should be removed ideally.
|
||||
- get
|
||||
{{- if eq "k8s" .Values.tls.secretsBackend }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
{{- end }}
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumloadbalancerippools
|
||||
- ciliumbgppeeringpolicies
|
||||
- ciliumbgpnodeconfigs
|
||||
- ciliumbgpadvertisements
|
||||
- ciliumbgppeerconfigs
|
||||
- ciliumclusterwideenvoyconfigs
|
||||
- ciliumclusterwidenetworkpolicies
|
||||
- ciliumegressgatewaypolicies
|
||||
- ciliumendpoints
|
||||
- ciliumendpointslices
|
||||
- ciliumenvoyconfigs
|
||||
- ciliumidentities
|
||||
- ciliumlocalredirectpolicies
|
||||
- ciliumnetworkpolicies
|
||||
- ciliumnodes
|
||||
- ciliumnodeconfigs
|
||||
- ciliumcidrgroups
|
||||
- ciliuml2announcementpolicies
|
||||
- ciliumpodippools
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumidentities
|
||||
- ciliumendpoints
|
||||
- ciliumnodes
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
# To synchronize garbage collection of such resources
|
||||
resources:
|
||||
- ciliumidentities
|
||||
verbs:
|
||||
- update
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumendpoints
|
||||
verbs:
|
||||
- delete
|
||||
- get
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumnodes
|
||||
- ciliumnodes/status
|
||||
verbs:
|
||||
- get
|
||||
- update
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumnetworkpolicies/status
|
||||
- ciliumclusterwidenetworkpolicies/status
|
||||
- ciliumendpoints/status
|
||||
- ciliumendpoints
|
||||
- ciliuml2announcementpolicies/status
|
||||
- ciliumbgpnodeconfigs/status
|
||||
verbs:
|
||||
- patch
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) .Values.serviceAccounts.cilium.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: cilium
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cilium
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.cilium.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,998 @@
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) }}
|
||||
|
||||
{{- /* Default values with backwards compatibility */ -}}
|
||||
{{- $defaultKeepDeprecatedProbes := true -}}
|
||||
|
||||
{{- /* Default values when 1.8 was initially deployed */ -}}
|
||||
{{- if semverCompare ">=1.8" (default "1.8" .Values.upgradeCompatibility) -}}
|
||||
{{- $defaultKeepDeprecatedProbes = false -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $kubeProxyReplacement := (coalesce .Values.kubeProxyReplacement "false") -}}
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: cilium
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: cilium
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: cilium-agent
|
||||
{{- if .Values.keepDeprecatedLabels }}
|
||||
kubernetes.io/cluster-service: "true"
|
||||
{{- if and .Values.gke.enabled (eq .Release.Namespace "kube-system" ) }}
|
||||
{{- fail "Invalid configuration: Installing Cilium on GKE with 'kubernetes.io/cluster-service' labels on 'kube-system' namespace causes Cilium DaemonSet to be removed by GKE. Either install Cilium on a different Namespace or install with '--set keepDeprecatedLabels=false'" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: cilium
|
||||
{{- if .Values.keepDeprecatedLabels }}
|
||||
kubernetes.io/cluster-service: "true"
|
||||
{{- end }}
|
||||
{{- with .Values.updateStrategy }}
|
||||
updateStrategy:
|
||||
{{- toYaml . | trim | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- if and .Values.prometheus.enabled (not .Values.prometheus.serviceMonitor.enabled) }}
|
||||
prometheus.io/port: "{{ .Values.prometheus.port }}"
|
||||
prometheus.io/scrape: "true"
|
||||
{{- end }}
|
||||
{{- if .Values.rollOutCiliumPods }}
|
||||
# ensure pods roll when configmap updates
|
||||
cilium.io/cilium-configmap-checksum: {{ include (print $.Template.BasePath "/cilium-configmap.yaml") . | sha256sum | quote }}
|
||||
{{- end }}
|
||||
{{- if not .Values.securityContext.privileged }}
|
||||
{{- if semverCompare "<1.30.0" (printf "%d.%d.0" (semver .Capabilities.KubeVersion.Version).Major (semver .Capabilities.KubeVersion.Version).Minor) }}
|
||||
# Set app AppArmor's profile to "unconfined". The value of this annotation
|
||||
# can be modified as long users know which profiles they have available
|
||||
# in AppArmor.
|
||||
container.apparmor.security.beta.kubernetes.io/cilium-agent: "unconfined"
|
||||
container.apparmor.security.beta.kubernetes.io/clean-cilium-state: "unconfined"
|
||||
{{- if .Values.cgroup.autoMount.enabled }}
|
||||
container.apparmor.security.beta.kubernetes.io/mount-cgroup: "unconfined"
|
||||
container.apparmor.security.beta.kubernetes.io/apply-sysctl-overwrites: "unconfined"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: cilium
|
||||
app.kubernetes.io/name: cilium-agent
|
||||
app.kubernetes.io/part-of: cilium
|
||||
{{- if .Values.keepDeprecatedLabels }}
|
||||
kubernetes.io/cluster-service: "true"
|
||||
{{- end }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- /* K8s version lower than 1.30.0 don't support the "appArmorProfile" field, */}}
|
||||
{{- /* thus we have to remove it. */}}
|
||||
{{- if semverCompare "<1.30.0" (printf "%d.%d.0" (semver .Capabilities.KubeVersion.Version).Major (semver .Capabilities.KubeVersion.Version).Minor) }}
|
||||
{{- $_ := unset .Values.podSecurityContext "appArmorProfile" }}
|
||||
{{- end }}
|
||||
{{- with .Values.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: cilium-agent
|
||||
image: {{ include "cilium.image" .Values.image | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if .Values.sleepAfterInit }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- --
|
||||
args:
|
||||
- |
|
||||
while true; do
|
||||
sleep 30;
|
||||
done
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- "true"
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- "true"
|
||||
{{- else }}
|
||||
command:
|
||||
- cilium-agent
|
||||
args:
|
||||
- --config-dir=/tmp/cilium/config-map
|
||||
{{- with .Values.extraArgs }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if semverCompare ">=1.20-0" .Capabilities.KubeVersion.Version }}
|
||||
startupProbe:
|
||||
httpGet:
|
||||
host: {{ .Values.ipv4.enabled | ternary "127.0.0.1" "::1" | quote }}
|
||||
path: /healthz
|
||||
port: {{ .Values.healthPort }}
|
||||
scheme: HTTP
|
||||
httpHeaders:
|
||||
- name: "brief"
|
||||
value: "true"
|
||||
failureThreshold: {{ .Values.startupProbe.failureThreshold }}
|
||||
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
|
||||
successThreshold: 1
|
||||
initialDelaySeconds: 5
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
{{- if or .Values.keepDeprecatedProbes $defaultKeepDeprecatedProbes }}
|
||||
exec:
|
||||
command:
|
||||
- cilium
|
||||
- status
|
||||
- --brief
|
||||
{{- else }}
|
||||
httpGet:
|
||||
host: {{ .Values.ipv4.enabled | ternary "127.0.0.1" "::1" | quote }}
|
||||
path: /healthz
|
||||
port: {{ .Values.healthPort }}
|
||||
scheme: HTTP
|
||||
httpHeaders:
|
||||
- name: "brief"
|
||||
value: "true"
|
||||
{{- end }}
|
||||
{{- if semverCompare "<1.20-0" .Capabilities.KubeVersion.Version }}
|
||||
# The initial delay for the liveness probe is intentionally large to
|
||||
# avoid an endless kill & restart cycle if in the event that the initial
|
||||
# bootstrapping takes longer than expected.
|
||||
# Starting from Kubernetes 1.20, we are using startupProbe instead
|
||||
# of this field.
|
||||
initialDelaySeconds: 120
|
||||
{{- end }}
|
||||
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||
successThreshold: 1
|
||||
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
||||
timeoutSeconds: 5
|
||||
readinessProbe:
|
||||
{{- if or .Values.keepDeprecatedProbes $defaultKeepDeprecatedProbes }}
|
||||
exec:
|
||||
command:
|
||||
- cilium
|
||||
- status
|
||||
- --brief
|
||||
{{- else }}
|
||||
httpGet:
|
||||
host: {{ .Values.ipv4.enabled | ternary "127.0.0.1" "::1" | quote }}
|
||||
path: /healthz
|
||||
port: {{ .Values.healthPort }}
|
||||
scheme: HTTP
|
||||
httpHeaders:
|
||||
- name: "brief"
|
||||
value: "true"
|
||||
{{- end }}
|
||||
{{- if semverCompare "<1.20-0" .Capabilities.KubeVersion.Version }}
|
||||
initialDelaySeconds: 5
|
||||
{{- end }}
|
||||
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||
successThreshold: 1
|
||||
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
||||
timeoutSeconds: 5
|
||||
{{- end }}
|
||||
env:
|
||||
- name: K8S_NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: spec.nodeName
|
||||
- name: CILIUM_K8S_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.namespace
|
||||
- name: CILIUM_CLUSTERMESH_CONFIG
|
||||
value: /var/lib/cilium/clustermesh/
|
||||
- name: GOMEMLIMIT
|
||||
valueFrom:
|
||||
resourceFieldRef:
|
||||
resource: limits.memory
|
||||
divisor: '1'
|
||||
{{- if .Values.k8sServiceHost }}
|
||||
- name: KUBERNETES_SERVICE_HOST
|
||||
value: {{ .Values.k8sServiceHost | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.k8sServicePort }}
|
||||
- name: KUBERNETES_SERVICE_PORT
|
||||
value: {{ .Values.k8sServicePort | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.cni.install }}
|
||||
lifecycle:
|
||||
{{- if ne .Values.cni.chainingMode "aws-cni" }}
|
||||
postStart:
|
||||
exec:
|
||||
command:
|
||||
- "bash"
|
||||
- "-c"
|
||||
- |
|
||||
{{- tpl (.Files.Get "files/agent/poststart-eni.bash") . | nindent 20 }}
|
||||
{{- end }}
|
||||
preStop:
|
||||
exec:
|
||||
command:
|
||||
- /cni-uninstall.sh
|
||||
{{- end }}
|
||||
{{- with .Values.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.prometheus.enabled .Values.hubble.metrics.enabled }}
|
||||
ports:
|
||||
- name: peer-service
|
||||
containerPort: {{ .Values.hubble.peerService.targetPort }}
|
||||
hostPort: {{ .Values.hubble.peerService.targetPort }}
|
||||
protocol: TCP
|
||||
{{- if .Values.prometheus.enabled }}
|
||||
- name: prometheus
|
||||
containerPort: {{ .Values.prometheus.port }}
|
||||
hostPort: {{ .Values.prometheus.port }}
|
||||
protocol: TCP
|
||||
{{- if and .Values.proxy.prometheus.enabled .Values.envoy.prometheus.enabled (not .Values.envoy.enabled) }}
|
||||
- name: envoy-metrics
|
||||
containerPort: {{ .Values.proxy.prometheus.port | default .Values.envoy.prometheus.port }}
|
||||
hostPort: {{ .Values.proxy.prometheus.port | default .Values.envoy.prometheus.port }}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.hubble.metrics.enabled }}
|
||||
- name: hubble-metrics
|
||||
containerPort: {{ .Values.hubble.metrics.port }}
|
||||
hostPort: {{ .Values.hubble.metrics.port }}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- if .Values.securityContext.privileged }}
|
||||
privileged: true
|
||||
{{- else }}
|
||||
seLinuxOptions:
|
||||
{{- with .Values.securityContext.seLinuxOptions }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
capabilities:
|
||||
add:
|
||||
{{- with .Values.securityContext.capabilities.ciliumAgent }}
|
||||
{{- toYaml . | nindent 14 }}
|
||||
{{- end }}
|
||||
drop:
|
||||
- ALL
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
volumeMounts:
|
||||
{{- if .Values.authentication.mutual.spire.enabled }}
|
||||
- name: spire-agent-socket
|
||||
mountPath: {{ dir .Values.authentication.mutual.spire.adminSocketPath }}
|
||||
readOnly: false
|
||||
{{- end }}
|
||||
{{- if .Values.envoy.enabled }}
|
||||
- name: envoy-sockets
|
||||
mountPath: /var/run/cilium/envoy/sockets
|
||||
readOnly: false
|
||||
{{- end }}
|
||||
{{- if not .Values.securityContext.privileged }}
|
||||
# Unprivileged containers need to mount /proc/sys/net from the host
|
||||
# to have write access
|
||||
- mountPath: /host/proc/sys/net
|
||||
name: host-proc-sys-net
|
||||
# Unprivileged containers need to mount /proc/sys/kernel from the host
|
||||
# to have write access
|
||||
- mountPath: /host/proc/sys/kernel
|
||||
name: host-proc-sys-kernel
|
||||
{{- end}}
|
||||
{{- /* CRI-O already mounts the BPF filesystem */ -}}
|
||||
{{- if and .Values.bpf.autoMount.enabled (not (eq .Values.containerRuntime.integration "crio")) }}
|
||||
- name: bpf-maps
|
||||
mountPath: /sys/fs/bpf
|
||||
{{- if .Values.securityContext.privileged }}
|
||||
mountPropagation: Bidirectional
|
||||
{{- else }}
|
||||
# Unprivileged containers can't set mount propagation to bidirectional
|
||||
# in this case we will mount the bpf fs from an init container that
|
||||
# is privileged and set the mount propagation from host to container
|
||||
# in Cilium.
|
||||
mountPropagation: HostToContainer
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if not (contains "/run/cilium/cgroupv2" .Values.cgroup.hostRoot) }}
|
||||
# Check for duplicate mounts before mounting
|
||||
- name: cilium-cgroup
|
||||
mountPath: {{ .Values.cgroup.hostRoot }}
|
||||
{{- end}}
|
||||
- name: cilium-run
|
||||
mountPath: /var/run/cilium
|
||||
- name: etc-cni-netd
|
||||
mountPath: {{ .Values.cni.hostConfDirMountPath }}
|
||||
{{- if .Values.etcd.enabled }}
|
||||
- name: etcd-config-path
|
||||
mountPath: /var/lib/etcd-config
|
||||
readOnly: true
|
||||
{{- if or .Values.etcd.ssl .Values.etcd.managed }}
|
||||
- name: etcd-secrets
|
||||
mountPath: /var/lib/etcd-secrets
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: clustermesh-secrets
|
||||
mountPath: /var/lib/cilium/clustermesh
|
||||
readOnly: true
|
||||
{{- if .Values.ipMasqAgent.enabled }}
|
||||
- name: ip-masq-agent
|
||||
mountPath: /etc/config
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.cni.configMap }}
|
||||
- name: cni-configuration
|
||||
mountPath: {{ .Values.cni.confFileMountPath }}
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
# Needed to be able to load kernel modules
|
||||
- name: lib-modules
|
||||
mountPath: /lib/modules
|
||||
readOnly: true
|
||||
- name: xtables-lock
|
||||
mountPath: /run/xtables.lock
|
||||
{{- if and .Values.encryption.enabled (eq .Values.encryption.type "ipsec") }}
|
||||
- name: cilium-ipsec-secrets
|
||||
mountPath: {{ .Values.encryption.ipsec.mountPath | default .Values.encryption.mountPath }}
|
||||
{{- end }}
|
||||
{{- if .Values.kubeConfigPath }}
|
||||
- name: kube-config
|
||||
mountPath: {{ .Values.kubeConfigPath }}
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.bgp.enabled }}
|
||||
- name: bgp-config-path
|
||||
mountPath: /var/lib/cilium/bgp
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if and .Values.hubble.enabled .Values.hubble.tls.enabled (hasKey .Values.hubble "listenAddress") }}
|
||||
- name: hubble-tls
|
||||
mountPath: /var/lib/cilium/tls/hubble
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
- name: tmp
|
||||
mountPath: /tmp
|
||||
{{- range .Values.extraHostPathMounts }}
|
||||
- name: {{ .name }}
|
||||
mountPath: {{ .mountPath }}
|
||||
readOnly: {{ .readOnly }}
|
||||
{{- if .mountPropagation }}
|
||||
mountPropagation: {{ .mountPropagation }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.hubble.export.dynamic.enabled }}
|
||||
- name: hubble-flowlog-config
|
||||
mountPath: /flowlog-config
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- with .Values.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.monitor.enabled }}
|
||||
- name: cilium-monitor
|
||||
image: {{ include "cilium.image" .Values.image | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- --
|
||||
args:
|
||||
- |-
|
||||
for i in {1..5}; do \
|
||||
[ -S /var/run/cilium/monitor1_2.sock ] && break || sleep 10;\
|
||||
done; \
|
||||
cilium-dbg monitor
|
||||
{{- range $type := .Values.monitor.eventTypes -}}
|
||||
{{ " " }}--type={{ $type }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
volumeMounts:
|
||||
- name: cilium-run
|
||||
mountPath: /var/run/cilium
|
||||
{{- with .Values.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.monitor.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraContainers }}
|
||||
{{- toYaml .Values.extraContainers | nindent 6 }}
|
||||
{{- end }}
|
||||
initContainers:
|
||||
- name: config
|
||||
image: {{ include "cilium.image" .Values.image | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- cilium-dbg
|
||||
- build-config
|
||||
{{- if (not (kindIs "invalid" .Values.daemon.configSources)) }}
|
||||
- "--source={{.Values.daemon.configSources}}"
|
||||
{{- end }}
|
||||
{{- if (not (kindIs "invalid" .Values.daemon.allowedConfigOverrides)) }}
|
||||
- "--allow-config-keys={{.Values.daemon.allowedConfigOverrides}}"
|
||||
{{- end }}
|
||||
{{- if (not (kindIs "invalid" .Values.daemon.blockedConfigOverrides)) }}
|
||||
- "--deny-config-keys={{.Values.daemon.blockedConfigOverrides}}"
|
||||
{{- end }}
|
||||
{{- if .Values.kubeConfigPath }}
|
||||
- "--k8s-kubeconfig-path={{ .Values.kubeConfigPath }}"
|
||||
{{- end }}
|
||||
env:
|
||||
- name: K8S_NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: spec.nodeName
|
||||
- name: CILIUM_K8S_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.namespace
|
||||
{{- if .Values.k8sServiceHost }}
|
||||
- name: KUBERNETES_SERVICE_HOST
|
||||
value: {{ .Values.k8sServiceHost | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.k8sServicePort }}
|
||||
- name: KUBERNETES_SERVICE_PORT
|
||||
value: {{ .Values.k8sServicePort | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: tmp
|
||||
mountPath: /tmp
|
||||
{{- if .Values.kubeConfigPath }}
|
||||
- name: kube-config
|
||||
mountPath: {{ .Values.kubeConfigPath }}
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- with .Values.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- if .Values.cgroup.autoMount.enabled }}
|
||||
# Required to mount cgroup2 filesystem on the underlying Kubernetes node.
|
||||
# We use nsenter command with host's cgroup and mount namespaces enabled.
|
||||
- name: mount-cgroup
|
||||
image: {{ include "cilium.image" .Values.image | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
env:
|
||||
- name: CGROUP_ROOT
|
||||
value: {{ .Values.cgroup.hostRoot }}
|
||||
- name: BIN_PATH
|
||||
value: {{ .Values.cni.binPath }}
|
||||
{{- with .Values.cgroup.autoMount.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
command:
|
||||
- sh
|
||||
- -ec
|
||||
# The statically linked Go program binary is invoked to avoid any
|
||||
# dependency on utilities like sh and mount that can be missing on certain
|
||||
# distros installed on the underlying host. Copy the binary to the
|
||||
# same directory where we install cilium cni plugin so that exec permissions
|
||||
# are available.
|
||||
- |
|
||||
cp /usr/bin/cilium-mount /hostbin/cilium-mount;
|
||||
nsenter --cgroup=/hostproc/1/ns/cgroup --mount=/hostproc/1/ns/mnt "${BIN_PATH}/cilium-mount" $CGROUP_ROOT;
|
||||
rm /hostbin/cilium-mount
|
||||
volumeMounts:
|
||||
- name: hostproc
|
||||
mountPath: /hostproc
|
||||
- name: cni-path
|
||||
mountPath: /hostbin
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
securityContext:
|
||||
{{- if .Values.securityContext.privileged }}
|
||||
privileged: true
|
||||
{{- else }}
|
||||
seLinuxOptions:
|
||||
{{- with .Values.securityContext.seLinuxOptions }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
capabilities:
|
||||
add:
|
||||
{{- with .Values.securityContext.capabilities.mountCgroup }}
|
||||
{{- toYaml . | nindent 14 }}
|
||||
{{- end }}
|
||||
drop:
|
||||
- ALL
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.sysctlfix.enabled }}
|
||||
- name: apply-sysctl-overwrites
|
||||
image: {{ include "cilium.image" .Values.image | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- with .Values.initResources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: BIN_PATH
|
||||
value: {{ .Values.cni.binPath }}
|
||||
command:
|
||||
- sh
|
||||
- -ec
|
||||
# The statically linked Go program binary is invoked to avoid any
|
||||
# dependency on utilities like sh that can be missing on certain
|
||||
# distros installed on the underlying host. Copy the binary to the
|
||||
# same directory where we install cilium cni plugin so that exec permissions
|
||||
# are available.
|
||||
- |
|
||||
cp /usr/bin/cilium-sysctlfix /hostbin/cilium-sysctlfix;
|
||||
nsenter --mount=/hostproc/1/ns/mnt "${BIN_PATH}/cilium-sysctlfix";
|
||||
rm /hostbin/cilium-sysctlfix
|
||||
volumeMounts:
|
||||
- name: hostproc
|
||||
mountPath: /hostproc
|
||||
- name: cni-path
|
||||
mountPath: /hostbin
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
securityContext:
|
||||
{{- if .Values.securityContext.privileged }}
|
||||
privileged: true
|
||||
{{- else }}
|
||||
seLinuxOptions:
|
||||
{{- with .Values.securityContext.seLinuxOptions }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
capabilities:
|
||||
add:
|
||||
{{- with .Values.securityContext.capabilities.applySysctlOverwrites }}
|
||||
{{- toYaml . | nindent 14 }}
|
||||
{{- end }}
|
||||
drop:
|
||||
- ALL
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if and .Values.bpf.autoMount.enabled (not .Values.securityContext.privileged) }}
|
||||
# Mount the bpf fs if it is not mounted. We will perform this task
|
||||
# from a privileged container because the mount propagation bidirectional
|
||||
# only works from privileged containers.
|
||||
- name: mount-bpf-fs
|
||||
image: {{ include "cilium.image" .Values.image | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- with .Values.initResources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
args:
|
||||
- 'mount | grep "/sys/fs/bpf type bpf" || mount -t bpf bpf /sys/fs/bpf'
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- --
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
securityContext:
|
||||
privileged: true
|
||||
{{- /* CRI-O already mounts the BPF filesystem */ -}}
|
||||
{{- if and .Values.bpf.autoMount.enabled (not (eq .Values.containerRuntime.integration "crio")) }}
|
||||
volumeMounts:
|
||||
- name: bpf-maps
|
||||
mountPath: /sys/fs/bpf
|
||||
mountPropagation: Bidirectional
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and .Values.nodeinit.enabled .Values.nodeinit.bootstrapFile }}
|
||||
- name: wait-for-node-init
|
||||
image: {{ include "cilium.image" .Values.image | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- with .Values.initResources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
until test -s {{ (print "/tmp/cilium-bootstrap.d/" (.Values.nodeinit.bootstrapFile | base)) | quote }}; do
|
||||
echo "Waiting on node-init to run...";
|
||||
sleep 1;
|
||||
done
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
volumeMounts:
|
||||
- name: cilium-bootstrap-file-dir
|
||||
mountPath: "/tmp/cilium-bootstrap.d"
|
||||
{{- end }}
|
||||
- name: clean-cilium-state
|
||||
image: {{ include "cilium.image" .Values.image | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- /init-container.sh
|
||||
env:
|
||||
- name: CILIUM_ALL_STATE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: cilium-config
|
||||
key: clean-cilium-state
|
||||
optional: true
|
||||
- name: CILIUM_BPF_STATE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: cilium-config
|
||||
key: clean-cilium-bpf-state
|
||||
optional: true
|
||||
- name: WRITE_CNI_CONF_WHEN_READY
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: cilium-config
|
||||
key: write-cni-conf-when-ready
|
||||
optional: true
|
||||
{{- if .Values.k8sServiceHost }}
|
||||
- name: KUBERNETES_SERVICE_HOST
|
||||
value: {{ .Values.k8sServiceHost | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.k8sServicePort }}
|
||||
- name: KUBERNETES_SERVICE_PORT
|
||||
value: {{ .Values.k8sServicePort | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
securityContext:
|
||||
{{- if .Values.securityContext.privileged }}
|
||||
privileged: true
|
||||
{{- else }}
|
||||
seLinuxOptions:
|
||||
{{- with .Values.securityContext.seLinuxOptions }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
capabilities:
|
||||
add:
|
||||
{{- with .Values.securityContext.capabilities.cleanCiliumState }}
|
||||
{{- toYaml . | nindent 14 }}
|
||||
{{- end }}
|
||||
drop:
|
||||
- ALL
|
||||
{{- end}}
|
||||
volumeMounts:
|
||||
{{- /* CRI-O already mounts the BPF filesystem */ -}}
|
||||
{{- if and .Values.bpf.autoMount.enabled (not (eq .Values.containerRuntime.integration "crio")) }}
|
||||
- name: bpf-maps
|
||||
mountPath: /sys/fs/bpf
|
||||
{{- end }}
|
||||
# Required to mount cgroup filesystem from the host to cilium agent pod
|
||||
- name: cilium-cgroup
|
||||
mountPath: {{ .Values.cgroup.hostRoot }}
|
||||
mountPropagation: HostToContainer
|
||||
- name: cilium-run
|
||||
mountPath: /var/run/cilium
|
||||
{{- with .Values.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.initResources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.waitForKubeProxy (and (ne (toString $kubeProxyReplacement) "strict") (ne (toString $kubeProxyReplacement) "true")) }}
|
||||
- name: wait-for-kube-proxy
|
||||
image: {{ include "cilium.image" .Values.image | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- with .Values.initResources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
privileged: true
|
||||
command:
|
||||
- bash
|
||||
- -c
|
||||
- |
|
||||
while true
|
||||
do
|
||||
if iptables-nft-save -t mangle | grep -E '^:(KUBE-IPTABLES-HINT|KUBE-PROXY-CANARY)'; then
|
||||
echo "Found KUBE-IPTABLES-HINT or KUBE-PROXY-CANARY iptables rule in 'iptables-nft-save -t mangle'"
|
||||
exit 0
|
||||
fi
|
||||
if ip6tables-nft-save -t mangle | grep -E '^:(KUBE-IPTABLES-HINT|KUBE-PROXY-CANARY)'; then
|
||||
echo "Found KUBE-IPTABLES-HINT or KUBE-PROXY-CANARY iptables rule in 'ip6tables-nft-save -t mangle'"
|
||||
exit 0
|
||||
fi
|
||||
if iptables-legacy-save | grep -E '^:KUBE-PROXY-CANARY'; then
|
||||
echo "Found KUBE-PROXY-CANARY iptables rule in 'iptables-legacy-save"
|
||||
exit 0
|
||||
fi
|
||||
if ip6tables-legacy-save | grep -E '^:KUBE-PROXY-CANARY'; then
|
||||
echo "KUBE-PROXY-CANARY iptables rule in 'ip6tables-legacy-save'"
|
||||
exit 0
|
||||
fi
|
||||
echo "Waiting for kube-proxy to create iptables rules...";
|
||||
sleep 1;
|
||||
done
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- end }} # wait-for-kube-proxy
|
||||
{{- if .Values.cni.install }}
|
||||
# Install the CNI binaries in an InitContainer so we don't have a writable host mount in the agent
|
||||
- name: install-cni-binaries
|
||||
image: {{ include "cilium.image" .Values.image | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- "/install-plugin.sh"
|
||||
{{- with .Values.cni.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- if .Values.securityContext.privileged }}
|
||||
privileged: true
|
||||
{{- else }}
|
||||
seLinuxOptions:
|
||||
{{- with .Values.securityContext.seLinuxOptions }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
volumeMounts:
|
||||
- name: cni-path
|
||||
mountPath: /host/opt/cni/bin
|
||||
{{- end }} # .Values.cni.install
|
||||
restartPolicy: Always
|
||||
priorityClassName: {{ include "cilium.priorityClass" (list $ .Values.priorityClassName "system-node-critical") }}
|
||||
serviceAccount: {{ .Values.serviceAccounts.cilium.name | quote }}
|
||||
serviceAccountName: {{ .Values.serviceAccounts.cilium.name | quote }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccounts.cilium.automount }}
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||
hostNetwork: true
|
||||
{{- if and .Values.etcd.managed (not .Values.etcd.k8sService) }}
|
||||
# In managed etcd mode, Cilium must be able to resolve the DNS name of
|
||||
# the etcd service
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
{{- else if .Values.dnsPolicy }}
|
||||
dnsPolicy: {{ .Values.dnsPolicy }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.clustermesh.config.enabled (not (and .Values.clustermesh.useAPIServer .Values.clustermesh.apiserver.kvstoremesh.enabled )) }}
|
||||
hostAliases:
|
||||
{{- range $cluster := .Values.clustermesh.config.clusters }}
|
||||
{{- range $ip := $cluster.ips }}
|
||||
- ip: {{ $ip }}
|
||||
hostnames: [ "{{ $cluster.name }}.{{ $.Values.clustermesh.config.domain }}" ]
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
# For sharing configuration between the "config" initContainer and the agent
|
||||
- name: tmp
|
||||
emptyDir: {}
|
||||
# To keep state between restarts / upgrades
|
||||
- name: cilium-run
|
||||
hostPath:
|
||||
path: {{ .Values.daemon.runPath }}
|
||||
type: DirectoryOrCreate
|
||||
{{- /* CRI-O already mounts the BPF filesystem */ -}}
|
||||
{{- if and .Values.bpf.autoMount.enabled (not (eq .Values.containerRuntime.integration "crio")) }}
|
||||
# To keep state between restarts / upgrades for bpf maps
|
||||
- name: bpf-maps
|
||||
hostPath:
|
||||
path: /sys/fs/bpf
|
||||
type: DirectoryOrCreate
|
||||
{{- end }}
|
||||
{{- if or .Values.cgroup.autoMount.enabled .Values.sysctlfix.enabled }}
|
||||
# To mount cgroup2 filesystem on the host or apply sysctlfix
|
||||
- name: hostproc
|
||||
hostPath:
|
||||
path: /proc
|
||||
type: Directory
|
||||
{{- end }}
|
||||
# To keep state between restarts / upgrades for cgroup2 filesystem
|
||||
- name: cilium-cgroup
|
||||
hostPath:
|
||||
path: {{ .Values.cgroup.hostRoot}}
|
||||
type: DirectoryOrCreate
|
||||
# To install cilium cni plugin in the host
|
||||
- name: cni-path
|
||||
hostPath:
|
||||
path: {{ .Values.cni.binPath }}
|
||||
type: DirectoryOrCreate
|
||||
# To install cilium cni configuration in the host
|
||||
- name: etc-cni-netd
|
||||
hostPath:
|
||||
path: {{ .Values.cni.confPath }}
|
||||
type: DirectoryOrCreate
|
||||
# To be able to load kernel modules
|
||||
- name: lib-modules
|
||||
hostPath:
|
||||
path: /lib/modules
|
||||
# To access iptables concurrently with other processes (e.g. kube-proxy)
|
||||
- name: xtables-lock
|
||||
hostPath:
|
||||
path: /run/xtables.lock
|
||||
type: FileOrCreate
|
||||
{{- if .Values.authentication.mutual.spire.enabled }}
|
||||
- name: spire-agent-socket
|
||||
hostPath:
|
||||
path: {{ dir .Values.authentication.mutual.spire.adminSocketPath }}
|
||||
type: DirectoryOrCreate
|
||||
{{- end }}
|
||||
{{- if .Values.envoy.enabled }}
|
||||
# Sharing socket with Cilium Envoy on the same node by using a host path
|
||||
- name: envoy-sockets
|
||||
hostPath:
|
||||
path: "{{ .Values.daemon.runPath }}/envoy/sockets"
|
||||
type: DirectoryOrCreate
|
||||
{{- end }}
|
||||
{{- if .Values.kubeConfigPath }}
|
||||
- name: kube-config
|
||||
hostPath:
|
||||
path: {{ .Values.kubeConfigPath }}
|
||||
type: FileOrCreate
|
||||
{{- end }}
|
||||
{{- if and .Values.nodeinit.enabled .Values.nodeinit.bootstrapFile }}
|
||||
- name: cilium-bootstrap-file-dir
|
||||
hostPath:
|
||||
path: {{ .Values.nodeinit.bootstrapFile | dir | quote }}
|
||||
type: DirectoryOrCreate
|
||||
{{- end }}
|
||||
{{- if .Values.etcd.enabled }}
|
||||
# To read the etcd config stored in config maps
|
||||
- name: etcd-config-path
|
||||
configMap:
|
||||
name: cilium-config
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
items:
|
||||
- key: etcd-config
|
||||
path: etcd.config
|
||||
# To read the k8s etcd secrets in case the user might want to use TLS
|
||||
{{- if or .Values.etcd.ssl .Values.etcd.managed }}
|
||||
- name: etcd-secrets
|
||||
secret:
|
||||
secretName: cilium-etcd-secrets
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
optional: true
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
# To read the clustermesh configuration
|
||||
- name: clustermesh-secrets
|
||||
projected:
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
sources:
|
||||
- secret:
|
||||
name: cilium-clustermesh
|
||||
optional: true
|
||||
# note: items are not explicitly listed here, since the entries of this secret
|
||||
# depend on the peers configured, and that would cause a restart of all agents
|
||||
# at every addition/removal. Leaving the field empty makes each secret entry
|
||||
# to be automatically projected into the volume as a file whose name is the key.
|
||||
- secret:
|
||||
name: clustermesh-apiserver-remote-cert
|
||||
optional: true
|
||||
items:
|
||||
- key: tls.key
|
||||
path: common-etcd-client.key
|
||||
- key: tls.crt
|
||||
path: common-etcd-client.crt
|
||||
{{- if not .Values.tls.caBundle.enabled }}
|
||||
- key: ca.crt
|
||||
path: common-etcd-client-ca.crt
|
||||
{{- else }}
|
||||
- {{ .Values.tls.caBundle.useSecret | ternary "secret" "configMap" }}:
|
||||
name: {{ .Values.tls.caBundle.name }}
|
||||
optional: true
|
||||
items:
|
||||
- key: {{ .Values.tls.caBundle.key }}
|
||||
path: common-etcd-client-ca.crt
|
||||
{{- end }}
|
||||
{{- if and .Values.ipMasqAgent .Values.ipMasqAgent.enabled }}
|
||||
- name: ip-masq-agent
|
||||
configMap:
|
||||
name: ip-masq-agent
|
||||
optional: true
|
||||
items:
|
||||
- key: config
|
||||
path: ip-masq-agent
|
||||
{{- end }}
|
||||
{{- if and .Values.encryption.enabled (eq .Values.encryption.type "ipsec") }}
|
||||
- name: cilium-ipsec-secrets
|
||||
secret:
|
||||
secretName: {{ .Values.encryption.ipsec.secretName | default .Values.encryption.secretName }}
|
||||
{{- end }}
|
||||
{{- if .Values.cni.configMap }}
|
||||
- name: cni-configuration
|
||||
configMap:
|
||||
name: {{ .Values.cni.configMap }}
|
||||
{{- end }}
|
||||
{{- if .Values.bgp.enabled }}
|
||||
- name: bgp-config-path
|
||||
configMap:
|
||||
name: bgp-config
|
||||
{{- end }}
|
||||
{{- if not .Values.securityContext.privileged }}
|
||||
- name: host-proc-sys-net
|
||||
hostPath:
|
||||
path: /proc/sys/net
|
||||
type: Directory
|
||||
- name: host-proc-sys-kernel
|
||||
hostPath:
|
||||
path: /proc/sys/kernel
|
||||
type: Directory
|
||||
{{- end }}
|
||||
{{- if and .Values.hubble.enabled .Values.hubble.tls.enabled (hasKey .Values.hubble "listenAddress") }}
|
||||
- name: hubble-tls
|
||||
projected:
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
sources:
|
||||
- secret:
|
||||
name: hubble-server-certs
|
||||
optional: true
|
||||
items:
|
||||
- key: tls.crt
|
||||
path: server.crt
|
||||
- key: tls.key
|
||||
path: server.key
|
||||
{{- if not .Values.tls.caBundle.enabled }}
|
||||
- key: ca.crt
|
||||
path: client-ca.crt
|
||||
{{- else }}
|
||||
- {{ .Values.tls.caBundle.useSecret | ternary "secret" "configMap" }}:
|
||||
name: {{ .Values.tls.caBundle.name }}
|
||||
optional: true
|
||||
items:
|
||||
- key: {{ .Values.tls.caBundle.key }}
|
||||
path: client-ca.crt
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.hubble.export.dynamic.enabled }}
|
||||
- name: hubble-flowlog-config
|
||||
configMap:
|
||||
name: {{ .Values.hubble.export.dynamic.config.configMapName }}
|
||||
optional: true
|
||||
{{- end }}
|
||||
{{- range .Values.extraHostPathMounts }}
|
||||
- name: {{ .name }}
|
||||
hostPath:
|
||||
path: {{ .hostPath }}
|
||||
{{- if .hostPathType }}
|
||||
type: {{ .hostPathType }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraVolumes }}
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,30 @@
|
||||
{{- if .Values.dashboards.enabled }}
|
||||
{{- $files := .Files.Glob "files/cilium-agent/dashboards/*.json" }}
|
||||
{{- range $path, $fileContents := $files }}
|
||||
{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ $dashboardName | trunc 63 | trimSuffix "-" }}
|
||||
namespace: {{ $.Values.dashboards.namespace | default $.Release.Namespace }}
|
||||
labels:
|
||||
k8s-app: cilium
|
||||
app.kubernetes.io/name: cilium-agent
|
||||
app.kubernetes.io/part-of: cilium
|
||||
{{- if $.Values.dashboards.label }}
|
||||
{{ $.Values.dashboards.label }}: {{ ternary $.Values.dashboards.labelValue "1" (not (empty $.Values.dashboards.labelValue)) | quote }}
|
||||
{{- end }}
|
||||
{{- if or $.Values.dashboards.annotations $.Values.annotations }}
|
||||
annotations:
|
||||
{{- with $.Values.dashboards.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,116 @@
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: cilium-config-agent
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) .Values.serviceAccounts.cilium.create .Values.ingressController.enabled .Values.ingressController.secretsNamespace.name }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: cilium-ingress-secrets
|
||||
namespace: {{ .Values.ingressController.secretsNamespace.name | quote }}
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- end }}
|
||||
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) .Values.serviceAccounts.cilium.create .Values.gatewayAPI.enabled .Values.gatewayAPI.secretsNamespace.name }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: cilium-gateway-secrets
|
||||
namespace: {{ .Values.gatewayAPI.secretsNamespace.name | quote }}
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- end}}
|
||||
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) .Values.serviceAccounts.cilium.create .Values.envoyConfig.enabled .Values.envoyConfig.secretsNamespace.name }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: cilium-envoy-config-secrets
|
||||
namespace: {{ .Values.envoyConfig.secretsNamespace.name | quote }}
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- end}}
|
||||
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) .Values.serviceAccounts.cilium.create .Values.bgpControlPlane.enabled .Values.bgpControlPlane.secretsNamespace.name }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: cilium-bgp-control-plane-secrets
|
||||
namespace: {{ .Values.bgpControlPlane.secretsNamespace.name | quote }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- end}}
|
||||
@@ -0,0 +1,110 @@
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: cilium-config-agent
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: cilium-config-agent
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.cilium.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end}}
|
||||
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) .Values.serviceAccounts.cilium.create .Values.ingressController.enabled .Values.ingressController.secretsNamespace.name}}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: cilium-secrets
|
||||
namespace: {{ .Values.ingressController.secretsNamespace.name | quote }}
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: cilium-ingress-secrets
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.cilium.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) .Values.serviceAccounts.cilium.create .Values.gatewayAPI.enabled .Values.gatewayAPI.secretsNamespace.name}}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: cilium-gateway-secrets
|
||||
namespace: {{ .Values.gatewayAPI.secretsNamespace.name | quote }}
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: cilium-gateway-secrets
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.cilium.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end}}
|
||||
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) .Values.serviceAccounts.cilium.create .Values.envoyConfig.enabled .Values.envoyConfig.secretsNamespace.name}}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: cilium-envoy-config-secrets
|
||||
namespace: {{ .Values.envoyConfig.secretsNamespace.name | quote }}
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: cilium-envoy-config-secrets
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.cilium.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end}}
|
||||
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) .Values.serviceAccounts.cilium.create .Values.bgpControlPlane.enabled .Values.bgpControlPlane.secretsNamespace.name}}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: cilium-bgp-control-plane-secrets
|
||||
namespace: {{ .Values.bgpControlPlane.secretsNamespace.name | quote }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: cilium-bgp-control-plane-secrets
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.cilium.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end}}
|
||||
@@ -0,0 +1,56 @@
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) .Values.prometheus.enabled }}
|
||||
{{- if .Values.prometheus.serviceMonitor.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cilium-agent
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: cilium
|
||||
app.kubernetes.io/name: cilium-agent
|
||||
app.kubernetes.io/part-of: cilium
|
||||
spec:
|
||||
clusterIP: None
|
||||
type: ClusterIP
|
||||
selector:
|
||||
k8s-app: cilium
|
||||
ports:
|
||||
- name: metrics
|
||||
port: {{ .Values.prometheus.port }}
|
||||
protocol: TCP
|
||||
targetPort: prometheus
|
||||
{{- if not .Values.envoy.enabled }}
|
||||
- name: envoy-metrics
|
||||
port: {{ .Values.proxy.prometheus.port | default .Values.envoy.prometheus.port }}
|
||||
protocol: TCP
|
||||
targetPort: envoy-metrics
|
||||
{{- end }}
|
||||
{{- else if and .Values.proxy.prometheus.enabled .Values.envoy.prometheus.enabled (not .Values.envoy.enabled) }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cilium-agent
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: {{ .Values.proxy.prometheus.port | default .Values.envoy.prometheus.port | quote }}
|
||||
labels:
|
||||
k8s-app: cilium
|
||||
app.kubernetes.io/name: cilium-agent
|
||||
app.kubernetes.io/part-of: cilium
|
||||
spec:
|
||||
clusterIP: None
|
||||
type: ClusterIP
|
||||
selector:
|
||||
k8s-app: cilium
|
||||
ports:
|
||||
- name: envoy-metrics
|
||||
port: {{ .Values.proxy.prometheus.port | default .Values.envoy.prometheus.port }}
|
||||
protocol: TCP
|
||||
targetPort: envoy-metrics
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) .Values.serviceAccounts.cilium.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ .Values.serviceAccounts.cilium.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or .Values.serviceAccounts.cilium.annotations .Values.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccounts.cilium.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,61 @@
|
||||
{{- if and .Values.agent (not .Values.preflight.enabled) .Values.prometheus.enabled .Values.prometheus.serviceMonitor.enabled }}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: cilium-agent
|
||||
namespace: {{ .Values.prometheus.serviceMonitor.namespace | default .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
{{- with .Values.prometheus.serviceMonitor.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.prometheus.serviceMonitor.annotations .Values.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.prometheus.serviceMonitor.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: cilium
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
endpoints:
|
||||
- port: metrics
|
||||
interval: {{ .Values.prometheus.serviceMonitor.interval | quote }}
|
||||
honorLabels: true
|
||||
path: /metrics
|
||||
{{- with .Values.prometheus.serviceMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.prometheus.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.envoy.prometheus.serviceMonitor.enabled }}
|
||||
- port: envoy-metrics
|
||||
interval: {{ .Values.envoy.prometheus.serviceMonitor.interval | quote }}
|
||||
honorLabels: true
|
||||
path: /metrics
|
||||
{{- with .Values.envoy.prometheus.serviceMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.prometheus.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
targetLabels:
|
||||
- k8s-app
|
||||
{{- if .Values.prometheus.serviceMonitor.jobLabel }}
|
||||
jobLabel: {{ .Values.prometheus.serviceMonitor.jobLabel | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- if and .Values.tls.caBundle.enabled .Values.tls.caBundle.content -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: {{ .Values.tls.caBundle.useSecret | ternary "Secret" "ConfigMap" }}
|
||||
metadata:
|
||||
name: {{ .Values.tls.caBundle.name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{ .Values.tls.caBundle.useSecret | ternary "stringData" "data" }}:
|
||||
{{ .Values.tls.caBundle.key }}: |
|
||||
{{- .Values.tls.caBundle.content | nindent 4 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if or
|
||||
(and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "helm"))
|
||||
(and (or .Values.agent .Values.hubble.relay.enabled .Values.hubble.ui.enabled) .Values.hubble.enabled .Values.hubble.tls.enabled .Values.hubble.tls.auto.enabled (eq .Values.hubble.tls.auto.method "helm"))
|
||||
(and .Values.tls.ca.key .Values.tls.ca.cert)
|
||||
-}}
|
||||
|
||||
{{- $_ := include "cilium.ca.setup" . -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ .commonCASecretName }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
data:
|
||||
ca.crt: {{ .commonCA.Cert | b64enc }}
|
||||
ca.key: {{ .commonCA.Key | b64enc }}
|
||||
{{- end }}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
{{- if and .Values.envoy.enabled (not .Values.preflight.enabled) }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: cilium-envoy-config
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.envoy.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- (tpl (.Files.Glob "files/cilium-envoy/configmap/bootstrap-config.json").AsConfig .) | nindent 2 }}
|
||||
|
||||
{{- end }}
|
||||
@@ -0,0 +1,273 @@
|
||||
{{- if and .Values.envoy.enabled (not .Values.preflight.enabled) }}
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: cilium-envoy
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.envoy.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: cilium-envoy
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: cilium-envoy
|
||||
name: cilium-envoy
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: cilium-envoy
|
||||
{{- with .Values.envoy.updateStrategy }}
|
||||
updateStrategy:
|
||||
{{- toYaml . | trim | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- if and .Values.proxy.prometheus.enabled .Values.envoy.prometheus.enabled (not .Values.envoy.prometheus.serviceMonitor.enabled) }}
|
||||
prometheus.io/port: "{{ .Values.proxy.prometheus.port | default .Values.envoy.prometheus.port }}"
|
||||
prometheus.io/scrape: "true"
|
||||
{{- end }}
|
||||
{{- if .Values.envoy.rollOutPods }}
|
||||
# ensure pods roll when configmap updates
|
||||
cilium.io/cilium-envoy-configmap-checksum: {{ include (print $.Template.BasePath "/cilium-envoy/configmap.yaml") . | sha256sum | quote }}
|
||||
{{- end }}
|
||||
{{- if not .Values.envoy.securityContext.privileged }}
|
||||
{{- if semverCompare "<1.30.0" (printf "%d.%d.0" (semver .Capabilities.KubeVersion.Version).Major (semver .Capabilities.KubeVersion.Version).Minor) }}
|
||||
# Set app AppArmor's profile to "unconfined". The value of this annotation
|
||||
# can be modified as long users know which profiles they have available
|
||||
# in AppArmor.
|
||||
container.apparmor.security.beta.kubernetes.io/cilium-envoy: "unconfined"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: cilium-envoy
|
||||
name: cilium-envoy
|
||||
app.kubernetes.io/name: cilium-envoy
|
||||
app.kubernetes.io/part-of: cilium
|
||||
{{- with .Values.envoy.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- /* K8s version lower than 1.30.0 don't support the "appArmorProfile" field, */}}
|
||||
{{- /* thus we have to remove it. */}}
|
||||
{{- if semverCompare "<1.30.0" (printf "%d.%d.0" (semver .Capabilities.KubeVersion.Version).Major (semver .Capabilities.KubeVersion.Version).Minor) }}
|
||||
{{- $_ := unset .Values.envoy.podSecurityContext "appArmorProfile" }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: cilium-envoy
|
||||
image: {{ include "cilium.image" .Values.envoy.image | quote }}
|
||||
imagePullPolicy: {{ .Values.envoy.image.pullPolicy }}
|
||||
command:
|
||||
- /usr/bin/cilium-envoy-starter
|
||||
args:
|
||||
- '-c /var/run/cilium/envoy/bootstrap-config.json'
|
||||
- '--base-id 0'
|
||||
{{- if and (.Values.debug.enabled) (hasKey .Values.debug "verbose") (.Values.debug.verbose) (has "envoy" ( splitList " " .Values.debug.verbose )) }}
|
||||
- '--log-level trace'
|
||||
{{- else if and (.Values.debug.enabled) (hasKey .Values.debug "verbose") (.Values.debug.verbose) (has "flow" ( splitList " " .Values.debug.verbose )) }}
|
||||
- '--log-level debug'
|
||||
{{- else }}
|
||||
- '--log-level info'
|
||||
{{- end }}
|
||||
- '--log-format {{ .Values.envoy.log.format }}'
|
||||
{{- if .Values.envoy.log.path }}
|
||||
- '--log-path {{ .Values.envoy.log.path }}'
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.extraArgs }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if semverCompare ">=1.20-0" .Capabilities.KubeVersion.Version }}
|
||||
startupProbe:
|
||||
httpGet:
|
||||
host: {{ .Values.ipv4.enabled | ternary "127.0.0.1" "::1" | quote }}
|
||||
path: /healthz
|
||||
port: {{ .Values.envoy.healthPort }}
|
||||
scheme: HTTP
|
||||
failureThreshold: {{ .Values.envoy.startupProbe.failureThreshold }}
|
||||
periodSeconds: {{ .Values.envoy.startupProbe.periodSeconds }}
|
||||
successThreshold: 1
|
||||
initialDelaySeconds: 5
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
host: {{ .Values.ipv4.enabled | ternary "127.0.0.1" "::1" | quote }}
|
||||
path: /healthz
|
||||
port: {{ .Values.envoy.healthPort }}
|
||||
scheme: HTTP
|
||||
{{- if semverCompare "<1.20-0" .Capabilities.KubeVersion.Version }}
|
||||
# The initial delay for the liveness probe is intentionally large to
|
||||
# avoid an endless kill & restart cycle if in the event that the initial
|
||||
# bootstrapping takes longer than expected.
|
||||
# Starting from Kubernetes 1.20, we are using startupProbe instead
|
||||
# of this field.
|
||||
initialDelaySeconds: 120
|
||||
{{- end }}
|
||||
periodSeconds: {{ .Values.envoy.livenessProbe.periodSeconds }}
|
||||
successThreshold: 1
|
||||
failureThreshold: {{ .Values.envoy.livenessProbe.failureThreshold }}
|
||||
timeoutSeconds: 5
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
host: {{ .Values.ipv4.enabled | ternary "127.0.0.1" "::1" | quote }}
|
||||
path: /healthz
|
||||
port: {{ .Values.envoy.healthPort }}
|
||||
scheme: HTTP
|
||||
{{- if semverCompare "<1.20-0" .Capabilities.KubeVersion.Version }}
|
||||
initialDelaySeconds: 5
|
||||
{{- end }}
|
||||
periodSeconds: {{ .Values.envoy.readinessProbe.periodSeconds }}
|
||||
successThreshold: 1
|
||||
failureThreshold: {{ .Values.envoy.readinessProbe.failureThreshold }}
|
||||
timeoutSeconds: 5
|
||||
env:
|
||||
- name: K8S_NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: spec.nodeName
|
||||
- name: CILIUM_K8S_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.namespace
|
||||
{{- if .Values.k8sServiceHost }}
|
||||
- name: KUBERNETES_SERVICE_HOST
|
||||
value: {{ .Values.k8sServiceHost | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.k8sServicePort }}
|
||||
- name: KUBERNETES_SERVICE_PORT
|
||||
value: {{ .Values.k8sServicePort | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.extraEnv }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.proxy.prometheus.enabled .Values.envoy.prometheus.enabled }}
|
||||
ports:
|
||||
- name: envoy-metrics
|
||||
containerPort: {{ .Values.proxy.prometheus.port | default .Values.envoy.prometheus.port }}
|
||||
hostPort: {{ .Values.proxy.prometheus.port | default .Values.envoy.prometheus.port }}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- if .Values.envoy.securityContext.privileged }}
|
||||
privileged: true
|
||||
{{- else }}
|
||||
seLinuxOptions:
|
||||
{{- with .Values.envoy.securityContext.seLinuxOptions }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
capabilities:
|
||||
add:
|
||||
{{- with .Values.envoy.securityContext.capabilities.envoy }}
|
||||
{{- toYaml . | nindent 14 }}
|
||||
{{- end }}
|
||||
drop:
|
||||
- ALL
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
volumeMounts:
|
||||
- name: envoy-sockets
|
||||
mountPath: /var/run/cilium/envoy/sockets
|
||||
readOnly: false
|
||||
- name: envoy-artifacts
|
||||
mountPath: /var/run/cilium/envoy/artifacts
|
||||
readOnly: true
|
||||
- name: envoy-config
|
||||
mountPath: /var/run/cilium/envoy/
|
||||
readOnly: true
|
||||
{{- if .Values.bpf.autoMount.enabled }}
|
||||
- name: bpf-maps
|
||||
mountPath: /sys/fs/bpf
|
||||
mountPropagation: HostToContainer
|
||||
{{- end }}
|
||||
{{- range .Values.envoy.extraHostPathMounts }}
|
||||
- name: {{ .name }}
|
||||
mountPath: {{ .mountPath }}
|
||||
readOnly: {{ .readOnly }}
|
||||
{{- if .mountPropagation }}
|
||||
mountPropagation: {{ .mountPropagation }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.envoy.extraContainers }}
|
||||
{{- toYaml .Values.envoy.extraContainers | nindent 6 }}
|
||||
{{- end }}
|
||||
restartPolicy: Always
|
||||
priorityClassName: {{ include "cilium.priorityClass" (list $ .Values.envoy.priorityClassName "system-node-critical") }}
|
||||
serviceAccount: {{ .Values.serviceAccounts.envoy.name | quote }}
|
||||
serviceAccountName: {{ .Values.serviceAccounts.envoy.name | quote }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccounts.envoy.automount }}
|
||||
terminationGracePeriodSeconds: {{ .Values.envoy.terminationGracePeriodSeconds }}
|
||||
hostNetwork: true
|
||||
{{- if .Values.envoy.dnsPolicy }}
|
||||
dnsPolicy: {{ .Values.envoy.dnsPolicy }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: envoy-sockets
|
||||
hostPath:
|
||||
path: "{{ .Values.daemon.runPath }}/envoy/sockets"
|
||||
type: DirectoryOrCreate
|
||||
- name: envoy-artifacts
|
||||
hostPath:
|
||||
path: "{{ .Values.daemon.runPath }}/envoy/artifacts"
|
||||
type: DirectoryOrCreate
|
||||
- name: envoy-config
|
||||
configMap:
|
||||
name: cilium-envoy-config
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
items:
|
||||
- key: bootstrap-config.json
|
||||
path: bootstrap-config.json
|
||||
# To keep state between restarts / upgrades
|
||||
{{- if and .Values.bpf.autoMount.enabled }}
|
||||
# To keep state between restarts / upgrades for bpf maps
|
||||
- name: bpf-maps
|
||||
hostPath:
|
||||
path: /sys/fs/bpf
|
||||
type: DirectoryOrCreate
|
||||
{{- end }}
|
||||
{{- range .Values.envoy.extraHostPathMounts }}
|
||||
- name: {{ .name }}
|
||||
hostPath:
|
||||
path: {{ .hostPath }}
|
||||
{{- if .hostPathType }}
|
||||
type: {{ .hostPathType }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.extraVolumes }}
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,32 @@
|
||||
{{- if and .Values.envoy.enabled (not .Values.preflight.enabled) .Values.proxy.prometheus.enabled .Values.envoy.prometheus.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cilium-envoy
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or (not .Values.envoy.prometheus.serviceMonitor.enabled) .Values.envoy.annotations }}
|
||||
annotations:
|
||||
{{- if not .Values.envoy.prometheus.serviceMonitor.enabled }}
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: {{ .Values.proxy.prometheus.port | default .Values.envoy.prometheus.port | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: cilium-envoy
|
||||
app.kubernetes.io/name: cilium-envoy
|
||||
app.kubernetes.io/part-of: cilium
|
||||
io.cilium/app: proxy
|
||||
spec:
|
||||
clusterIP: None
|
||||
type: ClusterIP
|
||||
selector:
|
||||
k8s-app: cilium-envoy
|
||||
ports:
|
||||
- name: envoy-metrics
|
||||
port: {{ .Values.proxy.prometheus.port | default .Values.envoy.prometheus.port }}
|
||||
protocol: TCP
|
||||
targetPort: envoy-metrics
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and .Values.envoy.enabled (not .Values.preflight.enabled) .Values.serviceAccounts.envoy.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ .Values.serviceAccounts.envoy.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or .Values.serviceAccounts.envoy.annotations .Values.envoy.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.envoy.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccounts.envoy.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,45 @@
|
||||
{{- if and .Values.envoy.enabled (not .Values.preflight.enabled) .Values.proxy.prometheus.enabled .Values.envoy.prometheus.enabled .Values.envoy.prometheus.serviceMonitor.enabled }}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: cilium-envoy
|
||||
namespace: {{ .Values.envoy.prometheus.serviceMonitor.namespace | default .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: cilium-envoy
|
||||
{{- with .Values.envoy.prometheus.serviceMonitor.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.envoy.prometheus.serviceMonitor.annotations .Values.envoy.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.envoy.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.prometheus.serviceMonitor.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: cilium-envoy
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
endpoints:
|
||||
- port: envoy-metrics
|
||||
interval: {{ .Values.envoy.prometheus.serviceMonitor.interval | quote }}
|
||||
honorLabels: true
|
||||
path: /metrics
|
||||
{{- with .Values.envoy.prometheus.serviceMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.envoy.prometheus.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
targetLabels:
|
||||
- k8s-app
|
||||
{{- end }}
|
||||
@@ -0,0 +1,12 @@
|
||||
{{- if and .Values.hubble.export.dynamic.enabled .Values.hubble.export.dynamic.config.createConfigMap }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Values.hubble.export.dynamic.config.configMapName }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
data:
|
||||
flowlogs.yaml: |
|
||||
flowLogs:
|
||||
{{ .Values.hubble.export.dynamic.config.content | toYaml | indent 4 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,10 @@
|
||||
{{- if .Values.gatewayAPI.enabled -}}
|
||||
{{- if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1/GatewayClass" }}
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: GatewayClass
|
||||
metadata:
|
||||
name: cilium
|
||||
spec:
|
||||
controllerName: io.cilium/gateway-controller
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
@@ -0,0 +1,12 @@
|
||||
{{- if .Values.ingressController.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: IngressClass
|
||||
metadata:
|
||||
name: cilium
|
||||
{{- if .Values.ingressController.default }}
|
||||
annotations:
|
||||
ingressclass.kubernetes.io/is-default-class: "true"
|
||||
{{- end}}
|
||||
spec:
|
||||
controller: cilium.io/ingress-controller
|
||||
{{- end}}
|
||||
@@ -0,0 +1,57 @@
|
||||
{{- if .Values.ingressController.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.ingressController.service.name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
cilium.io/ingress: "true"
|
||||
{{- if .Values.ingressController.service.labels }}
|
||||
{{- toYaml .Values.ingressController.service.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingressController.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml .Values.ingressController.service.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
protocol: TCP
|
||||
nodePort: {{ .Values.ingressController.service.insecureNodePort }}
|
||||
- name: https
|
||||
port: 443
|
||||
protocol: TCP
|
||||
nodePort: {{ .Values.ingressController.service.secureNodePort }}
|
||||
type: {{ .Values.ingressController.service.type }}
|
||||
{{- if semverCompare ">=1.24-0" .Capabilities.KubeVersion.Version -}}
|
||||
{{- if .Values.ingressController.service.loadBalancerClass }}
|
||||
loadBalancerClass: {{ .Values.ingressController.service.loadBalancerClass }}
|
||||
{{- end }}
|
||||
{{- if (not (kindIs "invalid" .Values.ingressController.service.allocateLoadBalancerNodePorts)) }}
|
||||
allocateLoadBalancerNodePorts: {{ .Values.ingressController.service.allocateLoadBalancerNodePorts }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- if .Values.ingressController.service.loadBalancerIP }}
|
||||
loadBalancerIP: {{ .Values.ingressController.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Endpoints
|
||||
metadata:
|
||||
name: {{ .Values.ingressController.service.name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if .Values.ingressController.service.labels }}
|
||||
labels:
|
||||
{{- toYaml .Values.ingressController.service.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingressController.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml .Values.ingressController.service.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
subsets:
|
||||
- addresses:
|
||||
- ip: "192.192.192.192"
|
||||
ports:
|
||||
- port: 9999
|
||||
{{- end }}
|
||||
@@ -0,0 +1,125 @@
|
||||
{{- if .Values.nodeinit.enabled }}
|
||||
---
|
||||
kind: DaemonSet
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: cilium-node-init
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.nodeinit.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app: cilium-node-init
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: cilium-node-init
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cilium-node-init
|
||||
{{- with .Values.nodeinit.updateStrategy }}
|
||||
updateStrategy:
|
||||
{{- toYaml . | trim | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- with .Values.nodeinit.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not .Values.securityContext.privileged }}
|
||||
{{- if semverCompare "<1.30.0" (printf "%d.%d.0" (semver .Capabilities.KubeVersion.Version).Major (semver .Capabilities.KubeVersion.Version).Minor) }}
|
||||
# Set app AppArmor's profile to "unconfined". The value of this annotation
|
||||
# can be modified as long users know which profiles they have available
|
||||
# in AppArmor.
|
||||
container.apparmor.security.beta.kubernetes.io/node-init: "unconfined"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app: cilium-node-init
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: cilium-node-init
|
||||
{{- with .Values.nodeinit.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- /* K8s version lower than 1.30.0 don't support the "appArmorProfile" field, */}}
|
||||
{{- /* thus we have to remove it. */}}
|
||||
{{- if semverCompare "<1.30.0" (printf "%d.%d.0" (semver .Capabilities.KubeVersion.Version).Major (semver .Capabilities.KubeVersion.Version).Minor) }}
|
||||
{{- $_ := unset .Values.nodeinit.podSecurityContext "appArmorProfile" }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeinit.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: node-init
|
||||
image: {{ include "cilium.image" .Values.nodeinit.image | quote }}
|
||||
imagePullPolicy: {{ .Values.nodeinit.image.pullPolicy }}
|
||||
lifecycle:
|
||||
{{- if .Values.nodeinit.revertReconfigureKubelet }}
|
||||
preStop:
|
||||
exec:
|
||||
command:
|
||||
- nsenter
|
||||
- --target=1
|
||||
- --mount
|
||||
- --
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
{{- tpl (.Files.Get "files/nodeinit/prestop.bash") . | nindent 20 }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- with .Values.nodeinit.extraEnv }}
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
# STARTUP_SCRIPT is the script run on node bootstrap. Node
|
||||
# bootstrapping can be customized in this script. This script is invoked
|
||||
# using nsenter, so it runs in the host's network and mount namespace using
|
||||
# the host's userland tools!
|
||||
- name: STARTUP_SCRIPT
|
||||
value: |
|
||||
{{- tpl (.Files.Get "files/nodeinit/startup.bash") . | nindent 14 }}
|
||||
{{- with .Values.nodeinit.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeinit.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | trim | nindent 12 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- with .Values.nodeinit.extraVolumeMounts }}
|
||||
volumeMounts:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeinit.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeinit.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeinit.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
hostPID: true
|
||||
hostNetwork: true
|
||||
priorityClassName: {{ include "cilium.priorityClass" (list $ .Values.nodeinit.priorityClassName "system-node-critical") }}
|
||||
{{- if .Values.serviceAccounts.nodeinit.enabled }}
|
||||
serviceAccount: {{ .Values.serviceAccounts.nodeinit.name | quote }}
|
||||
serviceAccountName: {{ .Values.serviceAccounts.nodeinit.name | quote }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccounts.nodeinit.automount }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeinit.extraVolumes }}
|
||||
volumes:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and .Values.nodeinit.enabled .Values.serviceAccounts.nodeinit.enabled .Values.serviceAccounts.nodeinit.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ .Values.serviceAccounts.nodeinit.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or .Values.serviceAccounts.nodeinit.annotations .Values.nodeinit.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.nodeinit.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccounts.nodeinit.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,36 @@
|
||||
{{- define "cilium.operator.cloud" -}}
|
||||
{{- $cloud := "generic" -}}
|
||||
{{- if .Values.eni.enabled -}}
|
||||
{{- $cloud = "aws" -}}
|
||||
{{- else if .Values.azure.enabled -}}
|
||||
{{- $cloud = "azure" -}}
|
||||
{{- else if .Values.alibabacloud.enabled -}}
|
||||
{{- $cloud = "alibabacloud" -}}
|
||||
{{- end -}}
|
||||
{{- $cloud -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "cilium.operator.imageDigestName" -}}
|
||||
{{- $imageDigest := (.Values.operator.image.useDigest | default false) | ternary (printf "@%s" .Values.operator.image.genericDigest) "" -}}
|
||||
{{- if .Values.eni.enabled -}}
|
||||
{{- $imageDigest = (.Values.operator.image.useDigest | default false) | ternary (printf "@%s" .Values.operator.image.awsDigest) "" -}}
|
||||
{{- else if .Values.azure.enabled -}}
|
||||
{{- $imageDigest = (.Values.operator.image.useDigest | default false) | ternary (printf "@%s" .Values.operator.image.azureDigest) "" -}}
|
||||
{{- else if .Values.alibabacloud.enabled -}}
|
||||
{{- $imageDigest = (.Values.operator.image.useDigest | default false) | ternary (printf "@%s" .Values.operator.image.alibabacloudDigest) "" -}}
|
||||
{{- end -}}
|
||||
{{- $imageDigest -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return cilium operator image
|
||||
*/}}
|
||||
{{- define "cilium.operator.image" -}}
|
||||
{{- if .Values.operator.image.override -}}
|
||||
{{- printf "%s" .Values.operator.image.override -}}
|
||||
{{- else -}}
|
||||
{{- $cloud := include "cilium.operator.cloud" . }}
|
||||
{{- $imageDigest := include "cilium.operator.imageDigestName" . }}
|
||||
{{- printf "%s-%s%s:%s%s" .Values.operator.image.repository $cloud .Values.operator.image.suffix .Values.operator.image.tag $imageDigest -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,294 @@
|
||||
{{- if and .Values.operator.enabled .Values.serviceAccounts.operator.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: cilium-operator
|
||||
{{- with .Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- if hasKey .Values "disableEndpointCRD" }}
|
||||
{{- if not .Values.disableEndpointCRD }}
|
||||
{{- if (and .Values.operator.unmanagedPodWatcher.restart (ne (.Values.operator.unmanagedPodWatcher.intervalSeconds | int64) 0 ) ) }}
|
||||
# to automatically delete [core|kube]dns pods so that are starting to being
|
||||
# managed by Cilium
|
||||
- delete
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.operator.removeNodeTaints .Values.operator.setNodeNetworkStatus (include "hasDuration" .Values.operator.endpointGCInterval) }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- nodes
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
{{- end }}
|
||||
{{- if or .Values.operator.removeNodeTaints .Values.operator.setNodeNetworkStatus }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
{{- if .Values.operator.removeNodeTaints }}
|
||||
# To remove node taints
|
||||
- nodes
|
||||
{{- end }}
|
||||
{{- if .Values.operator.setNodeNetworkStatus }}
|
||||
# To set NetworkUnavailable false on startup
|
||||
- nodes/status
|
||||
{{- end }}
|
||||
verbs:
|
||||
- patch
|
||||
{{- end }}
|
||||
- apiGroups:
|
||||
- discovery.k8s.io
|
||||
resources:
|
||||
- endpointslices
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
# to perform LB IP allocation for BGP
|
||||
- services/status
|
||||
verbs:
|
||||
- update
|
||||
- patch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
# to check apiserver connectivity
|
||||
- namespaces
|
||||
{{- if or .Values.ingressController.enabled .Values.gatewayAPI.enabled }}
|
||||
- secrets
|
||||
{{- end }}
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
# to perform the translation of a CNP that contains `ToGroup` to its endpoints
|
||||
- services
|
||||
- endpoints
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- if or .Values.ingressController.enabled .Values.gatewayAPI.enabled }}
|
||||
- create
|
||||
- update
|
||||
- delete
|
||||
- patch
|
||||
{{- end }}
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumnetworkpolicies
|
||||
- ciliumclusterwidenetworkpolicies
|
||||
verbs:
|
||||
# Create auto-generated CNPs and CCNPs from Policies that have 'toGroups'
|
||||
- create
|
||||
- update
|
||||
- deletecollection
|
||||
# To update the status of the CNPs and CCNPs
|
||||
- patch
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumnetworkpolicies/status
|
||||
- ciliumclusterwidenetworkpolicies/status
|
||||
verbs:
|
||||
# Update the auto-generated CNPs and CCNPs status.
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumendpoints
|
||||
- ciliumidentities
|
||||
verbs:
|
||||
# To perform garbage collection of such resources
|
||||
- delete
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumidentities
|
||||
verbs:
|
||||
# To synchronize garbage collection of such resources
|
||||
- update
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumnodes
|
||||
verbs:
|
||||
- create
|
||||
- update
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- if include "hasDuration" .Values.operator.nodeGCInterval }}
|
||||
# To perform CiliumNode garbage collector
|
||||
- delete
|
||||
{{- end }}
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumnodes/status
|
||||
verbs:
|
||||
- update
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumendpointslices
|
||||
- ciliumenvoyconfigs
|
||||
- ciliumbgppeerconfigs
|
||||
- ciliumbgpadvertisements
|
||||
- ciliumbgpnodeconfigs
|
||||
verbs:
|
||||
- create
|
||||
- update
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- delete
|
||||
- patch
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- update
|
||||
resourceNames:
|
||||
- ciliumloadbalancerippools.cilium.io
|
||||
- ciliumbgppeeringpolicies.cilium.io
|
||||
- ciliumbgpclusterconfigs.cilium.io
|
||||
- ciliumbgppeerconfigs.cilium.io
|
||||
- ciliumbgpadvertisements.cilium.io
|
||||
- ciliumbgpnodeconfigs.cilium.io
|
||||
- ciliumbgpnodeconfigoverrides.cilium.io
|
||||
- ciliumclusterwideenvoyconfigs.cilium.io
|
||||
- ciliumclusterwidenetworkpolicies.cilium.io
|
||||
- ciliumegressgatewaypolicies.cilium.io
|
||||
- ciliumendpoints.cilium.io
|
||||
- ciliumendpointslices.cilium.io
|
||||
- ciliumenvoyconfigs.cilium.io
|
||||
- ciliumexternalworkloads.cilium.io
|
||||
- ciliumidentities.cilium.io
|
||||
- ciliumlocalredirectpolicies.cilium.io
|
||||
- ciliumnetworkpolicies.cilium.io
|
||||
- ciliumnodes.cilium.io
|
||||
- ciliumnodeconfigs.cilium.io
|
||||
- ciliumcidrgroups.cilium.io
|
||||
- ciliuml2announcementpolicies.cilium.io
|
||||
- ciliumpodippools.cilium.io
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumloadbalancerippools
|
||||
- ciliumpodippools
|
||||
- ciliumbgpclusterconfigs
|
||||
- ciliumbgpnodeconfigoverrides
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumpodippools
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumloadbalancerippools/status
|
||||
verbs:
|
||||
- patch
|
||||
# For cilium-operator running in HA mode.
|
||||
#
|
||||
# Cilium operator running in HA mode requires the use of ResourceLock for Leader Election
|
||||
# between multiple 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".
|
||||
- apiGroups:
|
||||
- coordination.k8s.io
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- update
|
||||
{{- if .Values.ingressController.enabled }}
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- ingresses
|
||||
- ingressclasses
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- ingresses/status # To update ingress status with load balancer IP.
|
||||
verbs:
|
||||
- update
|
||||
{{- end }}
|
||||
{{- if .Values.gatewayAPI.enabled }}
|
||||
- apiGroups:
|
||||
- gateway.networking.k8s.io
|
||||
resources:
|
||||
- gatewayclasses
|
||||
- gateways
|
||||
- tlsroutes
|
||||
- httproutes
|
||||
- grpcroutes
|
||||
- referencegrants
|
||||
- referencepolicies
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- gateway.networking.k8s.io
|
||||
resources:
|
||||
- gatewayclasses/status
|
||||
- gateways/status
|
||||
- httproutes/status
|
||||
- grpcroutes/status
|
||||
- tlsroutes/status
|
||||
verbs:
|
||||
- update
|
||||
- patch
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and .Values.operator.enabled .Values.serviceAccounts.operator.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: cilium-operator
|
||||
{{- with .Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cilium-operator
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.operator.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,30 @@
|
||||
{{- if .Values.operator.dashboards.enabled }}
|
||||
{{- $files := .Files.Glob "files/cilium-operator/dashboards/*.json" }}
|
||||
{{- range $path, $fileContents := $files }}
|
||||
{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ $dashboardName | trunc 63 | trimSuffix "-" }}
|
||||
namespace: {{ $.Values.operator.dashboards.namespace | default $.Release.Namespace }}
|
||||
labels:
|
||||
k8s-app: cilium
|
||||
app.kubernetes.io/name: cilium-operator
|
||||
app.kubernetes.io/part-of: cilium
|
||||
{{- if $.Values.operator.dashboards.label }}
|
||||
{{ $.Values.operator.dashboards.label }}: {{ ternary $.Values.operator.dashboards.labelValue "1" (not (empty $.Values.operator.dashboards.labelValue)) | quote }}
|
||||
{{- end }}
|
||||
{{- if or $.Values.operator.dashboards.annotations $.Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- with $.Values.operator.dashboards.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.operator.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,337 @@
|
||||
{{- if .Values.operator.enabled }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cilium-operator
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
io.cilium/app: operator
|
||||
name: cilium-operator
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: cilium-operator
|
||||
spec:
|
||||
# See docs on ServerCapabilities.LeasesResourceLock in file pkg/k8s/version/version.go
|
||||
# for more details.
|
||||
replicas: {{ .Values.operator.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
io.cilium/app: operator
|
||||
name: cilium-operator
|
||||
# ensure operator update on single node k8s clusters, by using rolling update with maxUnavailable=100% in case
|
||||
# of one replica and no user configured Recreate strategy.
|
||||
# otherwise an update might get stuck due to the default maxUnavailable=50% in combination with the
|
||||
# podAntiAffinity which prevents deployments of multiple operator replicas on the same node.
|
||||
{{- if and (eq (.Values.operator.replicas | toString) "1") (eq .Values.operator.updateStrategy.type "RollingUpdate") }}
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: {{ .Values.operator.updateStrategy.rollingUpdate.maxSurge }}
|
||||
maxUnavailable: 100%
|
||||
type: RollingUpdate
|
||||
{{- else }}
|
||||
{{- with .Values.operator.updateStrategy }}
|
||||
strategy:
|
||||
{{- toYaml . | trim | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- if .Values.operator.rollOutPods }}
|
||||
# ensure pods roll when configmap updates
|
||||
cilium.io/cilium-configmap-checksum: {{ include (print $.Template.BasePath "/cilium-configmap.yaml") . | sha256sum | quote }}
|
||||
{{- end }}
|
||||
{{- if and .Values.operator.prometheus.enabled (not .Values.operator.prometheus.serviceMonitor.enabled) }}
|
||||
prometheus.io/port: {{ .Values.operator.prometheus.port | quote }}
|
||||
prometheus.io/scrape: "true"
|
||||
{{- end }}
|
||||
{{- with .Values.operator.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
io.cilium/app: operator
|
||||
name: cilium-operator
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: cilium-operator
|
||||
{{- with .Values.operator.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.operator.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: cilium-operator
|
||||
image: {{ include "cilium.operator.image" . | quote }}
|
||||
imagePullPolicy: {{ .Values.operator.image.pullPolicy }}
|
||||
command:
|
||||
- cilium-operator-{{ include "cilium.operator.cloud" . }}
|
||||
args:
|
||||
- --config-dir=/tmp/cilium/config-map
|
||||
- --debug=$(CILIUM_DEBUG)
|
||||
{{- with .Values.operator.extraArgs }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: K8S_NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: spec.nodeName
|
||||
- name: CILIUM_K8S_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.namespace
|
||||
- name: CILIUM_DEBUG
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: debug
|
||||
name: cilium-config
|
||||
optional: true
|
||||
{{- if and .Values.eni.enabled (not .Values.eni.iamRole ) }}
|
||||
- name: AWS_ACCESS_KEY_ID
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: cilium-aws
|
||||
key: AWS_ACCESS_KEY_ID
|
||||
optional: true
|
||||
- name: AWS_SECRET_ACCESS_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: cilium-aws
|
||||
key: AWS_SECRET_ACCESS_KEY
|
||||
optional: true
|
||||
- name: AWS_DEFAULT_REGION
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: cilium-aws
|
||||
key: AWS_DEFAULT_REGION
|
||||
optional: true
|
||||
{{- end }}
|
||||
{{- if .Values.alibabacloud.enabled }}
|
||||
- name: ALIBABA_CLOUD_ACCESS_KEY_ID
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: cilium-alibabacloud
|
||||
key: ALIBABA_CLOUD_ACCESS_KEY_ID
|
||||
optional: true
|
||||
- name: ALIBABA_CLOUD_ACCESS_KEY_SECRET
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: cilium-alibabacloud
|
||||
key: ALIBABA_CLOUD_ACCESS_KEY_SECRET
|
||||
optional: true
|
||||
{{- end }}
|
||||
{{- if .Values.k8sServiceHost }}
|
||||
- name: KUBERNETES_SERVICE_HOST
|
||||
value: {{ .Values.k8sServiceHost | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.k8sServicePort }}
|
||||
- name: KUBERNETES_SERVICE_PORT
|
||||
value: {{ .Values.k8sServicePort | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.azure.enabled }}
|
||||
{{- if .Values.azure.subscriptionID }}
|
||||
- name: AZURE_SUBSCRIPTION_ID
|
||||
value: {{ .Values.azure.subscriptionID }}
|
||||
{{- end }}
|
||||
{{- if .Values.azure.tenantID }}
|
||||
- name: AZURE_TENANT_ID
|
||||
value: {{ .Values.azure.tenantID }}
|
||||
{{- end }}
|
||||
{{- if .Values.azure.resourceGroup }}
|
||||
- name: AZURE_RESOURCE_GROUP
|
||||
value: {{ .Values.azure.resourceGroup }}
|
||||
{{- end }}
|
||||
- name: AZURE_CLIENT_ID
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: cilium-azure
|
||||
key: AZURE_CLIENT_ID
|
||||
- name: AZURE_CLIENT_SECRET
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: cilium-azure
|
||||
key: AZURE_CLIENT_SECRET
|
||||
{{- end }}
|
||||
{{- with .Values.operator.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.operator.prometheus.enabled }}
|
||||
ports:
|
||||
- name: prometheus
|
||||
containerPort: {{ .Values.operator.prometheus.port }}
|
||||
hostPort: {{ .Values.operator.prometheus.port }}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
host: {{ .Values.ipv4.enabled | ternary "127.0.0.1" "::1" | quote }}
|
||||
path: /healthz
|
||||
port: 9234
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
host: {{ .Values.ipv4.enabled | ternary "127.0.0.1" "::1" | quote }}
|
||||
path: /healthz
|
||||
port: 9234
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 5
|
||||
volumeMounts:
|
||||
- name: cilium-config-path
|
||||
mountPath: /tmp/cilium/config-map
|
||||
readOnly: true
|
||||
{{- if .Values.etcd.enabled }}
|
||||
- name: etcd-config-path
|
||||
mountPath: /var/lib/etcd-config
|
||||
readOnly: true
|
||||
{{- if or .Values.etcd.ssl .Values.etcd.managed }}
|
||||
- name: etcd-secrets
|
||||
mountPath: /var/lib/etcd-secrets
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.kubeConfigPath }}
|
||||
- name: kube-config
|
||||
mountPath: {{ .Values.kubeConfigPath }}
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.authentication.mutual.spire.enabled }}
|
||||
- name: spire-agent-socket
|
||||
mountPath: {{ dir .Values.authentication.mutual.spire.agentSocketPath }}
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- range .Values.operator.extraHostPathMounts }}
|
||||
- name: {{ .name }}
|
||||
mountPath: {{ .mountPath }}
|
||||
readOnly: {{ .readOnly }}
|
||||
{{- if .mountPropagation }}
|
||||
mountPropagation: {{ .mountPropagation }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.bgp.enabled }}
|
||||
- name: bgp-config-path
|
||||
mountPath: /var/lib/cilium/bgp
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- with .Values.operator.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.operator.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.operator.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
hostNetwork: true
|
||||
{{- if and .Values.etcd.managed (not .Values.etcd.k8sService) }}
|
||||
# In managed etcd mode, Cilium must be able to resolve the DNS name of
|
||||
# the etcd service
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
{{- else if .Values.operator.dnsPolicy }}
|
||||
dnsPolicy: {{ .Values.operator.dnsPolicy }}
|
||||
{{- end }}
|
||||
restartPolicy: Always
|
||||
priorityClassName: {{ include "cilium.priorityClass" (list $ .Values.operator.priorityClassName "system-cluster-critical") }}
|
||||
serviceAccount: {{ .Values.serviceAccounts.operator.name | quote }}
|
||||
serviceAccountName: {{ .Values.serviceAccounts.operator.name | quote }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccounts.operator.automount }}
|
||||
{{- with .Values.operator.affinity }}
|
||||
# In HA mode, cilium-operator pods must not be scheduled on the same
|
||||
# node as they will clash with each other.
|
||||
affinity:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.operator.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- range $constraint := . }}
|
||||
- {{ toYaml $constraint | nindent 8 | trim }}
|
||||
{{- if not $constraint.labelSelector }}
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
io.cilium/app: operator
|
||||
name: cilium-operator
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.operator.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.operator.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
# To read the configuration from the config map
|
||||
- name: cilium-config-path
|
||||
configMap:
|
||||
name: cilium-config
|
||||
{{- if .Values.etcd.enabled }}
|
||||
# To read the etcd config stored in config maps
|
||||
- name: etcd-config-path
|
||||
configMap:
|
||||
name: cilium-config
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
items:
|
||||
- key: etcd-config
|
||||
path: etcd.config
|
||||
{{- if or .Values.etcd.ssl .Values.etcd.managed }}
|
||||
# To read the k8s etcd secrets in case the user might want to use TLS
|
||||
- name: etcd-secrets
|
||||
secret:
|
||||
secretName: cilium-etcd-secrets
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
optional: true
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.kubeConfigPath }}
|
||||
- name: kube-config
|
||||
hostPath:
|
||||
path: {{ .Values.kubeConfigPath }}
|
||||
type: FileOrCreate
|
||||
{{- end }}
|
||||
{{- range .Values.operator.extraHostPathMounts }}
|
||||
- name: {{ .name }}
|
||||
hostPath:
|
||||
path: {{ .hostPath }}
|
||||
{{- if .hostPathType }}
|
||||
type: {{ .hostPathType }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.bgp.enabled }}
|
||||
- name: bgp-config-path
|
||||
configMap:
|
||||
name: bgp-config
|
||||
{{- end }}
|
||||
{{- if .Values.authentication.mutual.spire.enabled }}
|
||||
- name: spire-agent-socket
|
||||
hostPath:
|
||||
path: {{ dir .Values.authentication.mutual.spire.agentSocketPath }}
|
||||
type: DirectoryOrCreate
|
||||
{{- end }}
|
||||
{{- with .Values.operator.extraVolumes }}
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,28 @@
|
||||
{{- if and .Values.operator.enabled .Values.operator.podDisruptionBudget.enabled }}
|
||||
{{- $component := .Values.operator.podDisruptionBudget }}
|
||||
apiVersion: {{ include "podDisruptionBudget.apiVersion" . }}
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: cilium-operator
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
io.cilium/app: operator
|
||||
name: cilium-operator
|
||||
app.kubernetes.io/name: cilium-operator
|
||||
app.kubernetes.io/part-of: cilium
|
||||
spec:
|
||||
{{- with $component.maxUnavailable }}
|
||||
maxUnavailable: {{ . }}
|
||||
{{- end }}
|
||||
{{- with $component.minAvailable }}
|
||||
minAvailable: {{ . }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
io.cilium/app: operator
|
||||
name: cilium-operator
|
||||
{{- end }}
|
||||
@@ -0,0 +1,49 @@
|
||||
{{- if and .Values.operator.enabled .Values.serviceAccounts.operator.create .Values.ingressController.enabled .Values.ingressController.secretsNamespace.sync .Values.ingressController.secretsNamespace.name }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: cilium-operator-ingress-secrets
|
||||
namespace: {{ .Values.ingressController.secretsNamespace.name | quote }}
|
||||
{{- with .Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- update
|
||||
- patch
|
||||
{{- end }}
|
||||
|
||||
{{- if and .Values.operator.enabled .Values.serviceAccounts.operator.create .Values.gatewayAPI.enabled .Values.gatewayAPI.secretsNamespace.sync .Values.gatewayAPI.secretsNamespace.name }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: cilium-operator-gateway-secrets
|
||||
namespace: {{ .Values.gatewayAPI.secretsNamespace.name | quote }}
|
||||
{{- with .Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- update
|
||||
- patch
|
||||
{{- end }}
|
||||
@@ -0,0 +1,45 @@
|
||||
{{- if and .Values.operator.enabled .Values.serviceAccounts.operator.create .Values.ingressController.enabled .Values.ingressController.secretsNamespace.sync .Values.ingressController.secretsNamespace.name }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: cilium-operator-ingress-secrets
|
||||
namespace: {{ .Values.ingressController.secretsNamespace.name | quote }}
|
||||
{{- with .Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: cilium-operator-ingress-secrets
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.operator.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and .Values.operator.enabled .Values.serviceAccounts.operator.create .Values.gatewayAPI.enabled .Values.gatewayAPI.secretsNamespace.sync .Values.gatewayAPI.secretsNamespace.name }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: cilium-operator-gateway-secrets
|
||||
namespace: {{ .Values.gatewayAPI.secretsNamespace.name | quote }}
|
||||
{{- with .Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: cilium-operator-gateway-secrets
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.operator.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.operator.enabled }}
|
||||
{{- if .Values.azure.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: cilium-azure
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
type: Opaque
|
||||
data:
|
||||
AZURE_CLIENT_ID: {{ default "" .Values.azure.clientID | b64enc | quote }}
|
||||
AZURE_CLIENT_SECRET: {{ default "" .Values.azure.clientSecret | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,27 @@
|
||||
{{- if and .Values.operator.enabled .Values.operator.prometheus.enabled .Values.operator.prometheus.serviceMonitor.enabled }}
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: cilium-operator
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
io.cilium/app: operator
|
||||
name: cilium-operator
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: cilium-operator
|
||||
spec:
|
||||
clusterIP: None
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: metrics
|
||||
port: 9963
|
||||
protocol: TCP
|
||||
targetPort: prometheus
|
||||
selector:
|
||||
io.cilium/app: operator
|
||||
name: cilium-operator
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and .Values.operator.enabled .Values.serviceAccounts.operator.create }}
|
||||
{{- if and .Values.eni.enabled .Values.eni.iamRole }}
|
||||
{{ $_ := set .Values.serviceAccounts.operator.annotations "eks.amazonaws.com/role-arn" .Values.eni.iamRole }}
|
||||
{{- end}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ .Values.serviceAccounts.operator.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or .Values.serviceAccounts.operator.annotations .Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.operator.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccounts.operator.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,48 @@
|
||||
{{- if and .Values.operator.enabled .Values.operator.prometheus.enabled .Values.operator.prometheus.serviceMonitor.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: cilium-operator
|
||||
namespace: {{ .Values.operator.prometheus.serviceMonitor.namespace | default .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: cilium-operator
|
||||
{{- with .Values.operator.prometheus.serviceMonitor.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.operator.prometheus.serviceMonitor.annotations .Values.operator.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.operator.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.operator.prometheus.serviceMonitor.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
io.cilium/app: operator
|
||||
name: cilium-operator
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
endpoints:
|
||||
- port: metrics
|
||||
interval: {{ .Values.operator.prometheus.serviceMonitor.interval | quote }}
|
||||
honorLabels: true
|
||||
path: /metrics
|
||||
{{- with .Values.operator.prometheus.serviceMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.operator.prometheus.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
targetLabels:
|
||||
- io.cilium/app
|
||||
{{- if .Values.operator.prometheus.serviceMonitor.jobLabel }}
|
||||
jobLabel: {{ .Values.operator.prometheus.serviceMonitor.jobLabel | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,150 @@
|
||||
{{- if .Values.preflight.enabled }}
|
||||
{{- /*
|
||||
Keep file in sync with cilium-agent/clusterrole.yaml
|
||||
*/ -}}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: cilium-pre-flight
|
||||
{{- with .Values.preflight.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- networkpolicies
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- discovery.k8s.io
|
||||
resources:
|
||||
- endpointslices
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- namespaces
|
||||
- services
|
||||
- pods
|
||||
- endpoints
|
||||
- nodes
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- if .Values.annotateK8sNode }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- nodes/status
|
||||
verbs:
|
||||
# To annotate the k8s node with Cilium's metadata
|
||||
- patch
|
||||
{{- end }}
|
||||
{{- if .Values.l2announcements.enabled }}
|
||||
- apiGroups:
|
||||
- coordination.k8s.io
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- update
|
||||
- list
|
||||
- delete
|
||||
{{- end }}
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
# This is used when validating policies in preflight. This will need to stay
|
||||
# until we figure out how to avoid "get" inside the preflight, and then
|
||||
# should be removed ideally.
|
||||
- get
|
||||
{{- if eq "k8s" .Values.tls.secretsBackend }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
{{- end }}
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumloadbalancerippools
|
||||
- ciliumbgppeeringpolicies
|
||||
- ciliumbgpnodeconfigs
|
||||
- ciliumbgpadvertisements
|
||||
- ciliumbgppeerconfigs
|
||||
- ciliumclusterwideenvoyconfigs
|
||||
- ciliumclusterwidenetworkpolicies
|
||||
- ciliumegressgatewaypolicies
|
||||
- ciliumendpoints
|
||||
- ciliumendpointslices
|
||||
- ciliumenvoyconfigs
|
||||
- ciliumidentities
|
||||
- ciliumlocalredirectpolicies
|
||||
- ciliumnetworkpolicies
|
||||
- ciliumnodes
|
||||
- ciliumnodeconfigs
|
||||
- ciliumcidrgroups
|
||||
- ciliuml2announcementpolicies
|
||||
- ciliumpodippools
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumidentities
|
||||
- ciliumendpoints
|
||||
- ciliumnodes
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
# To synchronize garbage collection of such resources
|
||||
resources:
|
||||
- ciliumidentities
|
||||
verbs:
|
||||
- update
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumendpoints
|
||||
verbs:
|
||||
- delete
|
||||
- get
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumnodes
|
||||
- ciliumnodes/status
|
||||
verbs:
|
||||
- get
|
||||
- update
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumnetworkpolicies/status
|
||||
- ciliumclusterwidenetworkpolicies/status
|
||||
- ciliumendpoints/status
|
||||
- ciliumendpoints
|
||||
- ciliuml2announcementpolicies/status
|
||||
- ciliumbgpnodeconfigs/status
|
||||
verbs:
|
||||
- patch
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and .Values.preflight.enabled .Values.serviceAccounts.preflight.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: cilium-pre-flight
|
||||
{{- with .Values.preflight.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cilium-pre-flight
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.preflight.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,224 @@
|
||||
{{- if .Values.preflight.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: cilium-pre-flight-check
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.preflight.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: cilium-pre-flight-check
|
||||
kubernetes.io/cluster-service: "true"
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.preflight.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
k8s-app: cilium-pre-flight-check
|
||||
app.kubernetes.io/name: cilium-pre-flight-check
|
||||
kubernetes.io/cluster-service: "true"
|
||||
{{- with .Values.preflight.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.preflight.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
initContainers:
|
||||
- name: clean-cilium-state
|
||||
image: {{ include "cilium.image" .Values.preflight.image | quote }}
|
||||
imagePullPolicy: {{ .Values.preflight.image.pullPolicy }}
|
||||
command: ["/bin/echo"]
|
||||
args:
|
||||
- "hello"
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
containers:
|
||||
- name: cilium-pre-flight-check
|
||||
image: {{ include "cilium.image" .Values.preflight.image | quote }}
|
||||
imagePullPolicy: {{ .Values.preflight.image.pullPolicy }}
|
||||
command: ["/bin/sh"]
|
||||
args:
|
||||
- -c
|
||||
- "touch /tmp/ready; sleep 1h"
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- cat
|
||||
- /tmp/ready
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- cat
|
||||
- /tmp/ready
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
env:
|
||||
- name: K8S_NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: spec.nodeName
|
||||
{{- with .Values.preflight.extraEnv }}
|
||||
{{- toYaml . | trim | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: cilium-run
|
||||
mountPath: /var/run/cilium
|
||||
{{- if .Values.etcd.enabled }}
|
||||
- name: etcd-config-path
|
||||
mountPath: /var/lib/etcd-config
|
||||
readOnly: true
|
||||
{{- if or .Values.etcd.ssl .Values.etcd.managed }}
|
||||
- name: etcd-secrets
|
||||
mountPath: /var/lib/etcd-secrets
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | trim | nindent 14 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- if ne .Values.preflight.tofqdnsPreCache "" }}
|
||||
- name: cilium-pre-flight-fqdn-precache
|
||||
image: {{ include "cilium.image" .Values.preflight.image | quote }}
|
||||
imagePullPolicy: {{ .Values.preflight.image.pullPolicy }}
|
||||
name: cilium-pre-flight-fqdn-precache
|
||||
command: ["/bin/sh"]
|
||||
args:
|
||||
- -ec
|
||||
- |
|
||||
cilium-dbg preflight fqdn-poller --tofqdns-pre-cache {{ .Values.preflight.tofqdnsPreCache }};
|
||||
touch /tmp/ready-tofqdns-precache;
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- cat
|
||||
- /tmp/read-tofqdns-precachey
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- cat
|
||||
- /tmp/read-tofqdns-precachey
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
env:
|
||||
{{- if .Values.k8sServiceHost }}
|
||||
- name: KUBERNETES_SERVICE_HOST
|
||||
value: {{ .Values.k8sServiceHost | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.k8sServicePort }}
|
||||
- name: KUBERNETES_SERVICE_PORT
|
||||
value: {{ .Values.k8sServicePort | quote }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: cilium-run
|
||||
mountPath: /var/run/cilium
|
||||
{{- if .Values.etcd.enabled }}
|
||||
- name: etcd-config-path
|
||||
mountPath: /var/lib/etcd-config
|
||||
readOnly: true
|
||||
{{- if or .Values.etcd.ssl .Values.etcd.managed }}
|
||||
- name: etcd-secrets
|
||||
mountPath: /var/lib/etcd-secrets
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.extraEnv }}
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | trim | nindent 14 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- end }}
|
||||
hostNetwork: true
|
||||
# This is here to seamlessly allow migrate-identity to work with
|
||||
# etcd-operator setups. The assumption is that other cases would also
|
||||
# work since the cluster DNS would forward the request on.
|
||||
# This differs from the cilium-agent daemonset, where this is only
|
||||
# enabled when etcd.managed=true
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
restartPolicy: Always
|
||||
priorityClassName: {{ include "cilium.priorityClass" (list $ .Values.preflight.priorityClassName "system-node-critical") }}
|
||||
serviceAccount: {{ .Values.serviceAccounts.preflight.name | quote }}
|
||||
serviceAccountName: {{ .Values.serviceAccounts.preflight.name | quote }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccounts.preflight.automount }}
|
||||
terminationGracePeriodSeconds: {{ .Values.preflight.terminationGracePeriodSeconds }}
|
||||
{{- with .Values.preflight.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
# To keep state between restarts / upgrades
|
||||
- name: cilium-run
|
||||
hostPath:
|
||||
path: /var/run/cilium
|
||||
type: DirectoryOrCreate
|
||||
- name: bpf-maps
|
||||
hostPath:
|
||||
path: /sys/fs/bpf
|
||||
type: DirectoryOrCreate
|
||||
{{- if .Values.etcd.enabled }}
|
||||
# To read the etcd config stored in config maps
|
||||
- name: etcd-config-path
|
||||
configMap:
|
||||
name: cilium-config
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
items:
|
||||
- key: etcd-config
|
||||
path: etcd.config
|
||||
# To read the k8s etcd secrets in case the user might want to use TLS
|
||||
{{- if or .Values.etcd.ssl .Values.etcd.managed }}
|
||||
- name: etcd-secrets
|
||||
secret:
|
||||
secretName: cilium-etcd-secrets
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
optional: true
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.extraVolumes }}
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,107 @@
|
||||
{{- if and .Values.preflight.enabled .Values.preflight.validateCNPs }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cilium-pre-flight-check
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.preflight.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: cilium-pre-flight-check
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: cilium-pre-flight-check-deployment
|
||||
kubernetes.io/cluster-service: "true"
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.preflight.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
k8s-app: cilium-pre-flight-check-deployment
|
||||
kubernetes.io/cluster-service: "true"
|
||||
app.kubernetes.io/name: cilium-pre-flight-check
|
||||
{{- with .Values.preflight.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: cnp-validator
|
||||
image: {{ include "cilium.image" .Values.preflight.image | quote }}
|
||||
imagePullPolicy: {{ .Values.preflight.image.pullPolicy }}
|
||||
command: ["/bin/sh"]
|
||||
args:
|
||||
- -ec
|
||||
- |
|
||||
cilium-dbg preflight validate-cnp;
|
||||
touch /tmp/ready-validate-cnp;
|
||||
sleep 1h;
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- cat
|
||||
- /tmp/ready-validate-cnp
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- cat
|
||||
- /tmp/ready-validate-cnp
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
{{- with .Values.preflight.extraVolumeMounts }}
|
||||
volumeMounts:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if .Values.k8sServiceHost }}
|
||||
- name: KUBERNETES_SERVICE_HOST
|
||||
value: {{ .Values.k8sServiceHost | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.k8sServicePort }}
|
||||
- name: KUBERNETES_SERVICE_PORT
|
||||
value: {{ .Values.k8sServicePort | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.extraEnv }}
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 12 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- with .Values.preflight.extraVolumes }}
|
||||
volumes:
|
||||
{{- toYaml . | trim | nindent 6 }}
|
||||
{{- end }}
|
||||
hostNetwork: true
|
||||
restartPolicy: Always
|
||||
priorityClassName: {{ include "cilium.priorityClass" (list $ .Values.preflight.priorityClassName "system-cluster-critical") }}
|
||||
serviceAccount: {{ .Values.serviceAccounts.preflight.name | quote }}
|
||||
serviceAccountName: {{ .Values.serviceAccounts.preflight.name | quote }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccounts.preflight.automount }}
|
||||
terminationGracePeriodSeconds: {{ .Values.preflight.terminationGracePeriodSeconds }}
|
||||
{{- with .Values.preflight.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.preflight.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,28 @@
|
||||
{{- if and .Values.preflight.enabled .Values.preflight.validateCNPs .Values.preflight.podDisruptionBudget.enabled }}
|
||||
{{- $component := .Values.preflight.podDisruptionBudget }}
|
||||
apiVersion: {{ include "podDisruptionBudget.apiVersion" . }}
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: cilium-pre-flight-check
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.preflight.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: cilium-pre-flight-check-deployment
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: cilium-pre-flight-check
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
{{- with $component.maxUnavailable }}
|
||||
maxUnavailable: {{ . }}
|
||||
{{- end }}
|
||||
{{- with $component.minAvailable }}
|
||||
minAvailable: {{ . }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: cilium-pre-flight-check-deployment
|
||||
kubernetes.io/cluster-service: "true"
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and .Values.preflight.enabled .Values.serviceAccounts.preflight.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ .Values.serviceAccounts.preflight.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or .Values.serviceAccounts.preflight.annotations .Values.preflight.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.preflight.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccounts.preflight.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{- if or .Values.resourceQuotas.enabled (and (ne .Release.Namespace "kube-system") .Values.gke.enabled) }}
|
||||
{{- if .Values.agent }}
|
||||
apiVersion: v1
|
||||
kind: ResourceQuota
|
||||
metadata:
|
||||
name: cilium-resource-quota
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
hard:
|
||||
pods: {{ .Values.resourceQuotas.cilium.hard.pods | quote }}
|
||||
scopeSelector:
|
||||
matchExpressions:
|
||||
- operator: In
|
||||
scopeName: PriorityClass
|
||||
values:
|
||||
- system-node-critical
|
||||
{{- end }}
|
||||
{{- if .Values.operator.enabled }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ResourceQuota
|
||||
metadata:
|
||||
name: cilium-operator-resource-quota
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
hard:
|
||||
pods: {{ .Values.resourceQuotas.operator.hard.pods | quote }}
|
||||
scopeSelector:
|
||||
matchExpressions:
|
||||
- operator: In
|
||||
scopeName: PriorityClass
|
||||
values:
|
||||
- system-cluster-critical
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{- $secretNamespaces := dict -}}
|
||||
{{- range $cfg := tuple .Values.ingressController .Values.gatewayAPI .Values.envoyConfig .Values.bgpControlPlane -}}
|
||||
{{- if and $cfg.enabled $cfg.secretsNamespace.create $cfg.secretsNamespace.name -}}
|
||||
{{- $_ := set $secretNamespaces $cfg.secretsNamespace.name 1 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $name, $_ := $secretNamespaces }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: {{ $name | quote }}
|
||||
{{- end}}
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- define "clustermesh-apiserver-generate-certs.admin-common-name" -}}
|
||||
admin-{{ .Values.cluster.name }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "clustermesh-apiserver-generate-certs.remote-common-name" -}}
|
||||
{{- if eq .Values.clustermesh.apiserver.tls.authMode "cluster" -}}
|
||||
remote-{{ .Values.cluster.name }}
|
||||
{{- else -}}
|
||||
remote
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,72 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.serviceAccounts.clustermeshApiserver.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: clustermesh-apiserver
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumnodes
|
||||
- ciliumendpoints
|
||||
- ciliumidentities
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumexternalworkloads/status
|
||||
- ciliumnodes
|
||||
- ciliumidentities
|
||||
verbs:
|
||||
- update
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumendpoints
|
||||
- ciliumendpoints/status
|
||||
verbs:
|
||||
- patch
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- ciliumidentities
|
||||
- ciliumexternalworkloads
|
||||
- ciliumendpoints
|
||||
- ciliumnodes
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- endpoints
|
||||
- namespaces
|
||||
- services
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- discovery.k8s.io
|
||||
resources:
|
||||
- endpointslices
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.serviceAccounts.clustermeshApiserver.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: clustermesh-apiserver
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: clustermesh-apiserver
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.clustermeshApiserver.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,443 @@
|
||||
{{- if (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) }}
|
||||
{{- if not (list "legacy" "migration" "cluster" | has .Values.clustermesh.apiserver.tls.authMode) -}}
|
||||
{{- fail ".Values.clustermesh.apiserver.tls.authMode must be one of legacy, migration, cluster" -}}
|
||||
{{- end -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: clustermesh-apiserver
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: clustermesh-apiserver
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: clustermesh-apiserver
|
||||
spec:
|
||||
replicas: {{ .Values.clustermesh.apiserver.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: clustermesh-apiserver
|
||||
{{- with .Values.clustermesh.apiserver.updateStrategy }}
|
||||
strategy:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- with .Values.clustermesh.apiserver.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: clustermesh-apiserver
|
||||
k8s-app: clustermesh-apiserver
|
||||
{{- with .Values.clustermesh.apiserver.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
initContainers:
|
||||
- name: etcd-init
|
||||
image: {{ include "cilium.image" .Values.clustermesh.apiserver.image | quote }}
|
||||
imagePullPolicy: {{ .Values.clustermesh.apiserver.image.pullPolicy }}
|
||||
command:
|
||||
- /usr/bin/clustermesh-apiserver
|
||||
args:
|
||||
- etcdinit
|
||||
{{- if .Values.debug.enabled }}
|
||||
- --debug
|
||||
{{- end }}
|
||||
# These need to match the equivalent arguments to etcd in the main container.
|
||||
- --etcd-cluster-name=clustermesh-apiserver
|
||||
- --etcd-initial-cluster-token=$(INITIAL_CLUSTER_TOKEN)
|
||||
- --etcd-data-dir=/var/run/etcd
|
||||
{{- with .Values.clustermesh.apiserver.etcd.init.extraArgs }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
env:
|
||||
# The Cilium cluster name (specified via the `CILIUM_CLUSTER_NAME` environment variable) and the etcd cluster
|
||||
# name (specified via the `--etcd-cluster-name` argument) are very different concepts. The Cilium cluster name
|
||||
# is the name of the overall Cilium cluster, and is used to set the admin account username. The etcd cluster
|
||||
# name is a concept that's only relevant for etcd itself. The etcd cluster name must be the same for both this
|
||||
# command and the actual invocation of etcd in the main containers of this Pod, but it's otherwise not
|
||||
# relevant to Cilium.
|
||||
- name: CILIUM_CLUSTER_NAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: cilium-config
|
||||
key: cluster-name
|
||||
- name: INITIAL_CLUSTER_TOKEN
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.uid
|
||||
{{- with .Values.clustermesh.apiserver.etcd.init.extraEnv }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.etcd.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: etcd-data-dir
|
||||
mountPath: /var/run/etcd
|
||||
{{- with .Values.clustermesh.apiserver.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- with .Values.clustermesh.apiserver.etcd.init.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: etcd
|
||||
# The clustermesh-apiserver container image includes an etcd binary.
|
||||
image: {{ include "cilium.image" .Values.clustermesh.apiserver.image | quote }}
|
||||
imagePullPolicy: {{ .Values.clustermesh.apiserver.image.pullPolicy }}
|
||||
command:
|
||||
- /usr/bin/etcd
|
||||
args:
|
||||
- --data-dir=/var/run/etcd
|
||||
- --name=clustermesh-apiserver
|
||||
- --client-cert-auth
|
||||
- --trusted-ca-file=/var/lib/etcd-secrets/ca.crt
|
||||
- --cert-file=/var/lib/etcd-secrets/tls.crt
|
||||
- --key-file=/var/lib/etcd-secrets/tls.key
|
||||
# Surrounding the IPv4 address with brackets works in this case, since etcd
|
||||
# uses net.SplitHostPort() internally and it accepts the that format.
|
||||
- --listen-client-urls=https://127.0.0.1:2379,https://[$(HOSTNAME_IP)]:2379
|
||||
- --advertise-client-urls=https://[$(HOSTNAME_IP)]:2379
|
||||
- --initial-cluster-token=$(INITIAL_CLUSTER_TOKEN)
|
||||
- --auto-compaction-retention=1
|
||||
{{- if .Values.clustermesh.apiserver.metrics.etcd.enabled }}
|
||||
- --listen-metrics-urls=http://[$(HOSTNAME_IP)]:{{ .Values.clustermesh.apiserver.metrics.etcd.port }}
|
||||
- --metrics={{ .Values.clustermesh.apiserver.metrics.etcd.mode }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: ETCDCTL_API
|
||||
value: "3"
|
||||
- name: HOSTNAME_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
- name: INITIAL_CLUSTER_TOKEN
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.uid
|
||||
ports:
|
||||
- name: etcd
|
||||
containerPort: 2379
|
||||
protocol: TCP
|
||||
{{- if .Values.clustermesh.apiserver.metrics.etcd.enabled }}
|
||||
- name: etcd-metrics
|
||||
containerPort: {{ .Values.clustermesh.apiserver.metrics.etcd.port }}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: etcd-server-secrets
|
||||
mountPath: /var/lib/etcd-secrets
|
||||
readOnly: true
|
||||
- name: etcd-data-dir
|
||||
mountPath: /var/run/etcd
|
||||
{{- with .Values.clustermesh.apiserver.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- with .Values.clustermesh.apiserver.etcd.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.etcd.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.etcd.lifecycle }}
|
||||
lifecycle:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
- name: apiserver
|
||||
image: {{ include "cilium.image" .Values.clustermesh.apiserver.image | quote }}
|
||||
imagePullPolicy: {{ .Values.clustermesh.apiserver.image.pullPolicy }}
|
||||
command:
|
||||
- /usr/bin/clustermesh-apiserver
|
||||
args:
|
||||
- clustermesh
|
||||
{{- if .Values.debug.enabled }}
|
||||
- --debug
|
||||
{{- end }}
|
||||
- --cluster-name=$(CLUSTER_NAME)
|
||||
- --cluster-id=$(CLUSTER_ID)
|
||||
- --kvstore-opt
|
||||
- etcd.config=/var/lib/cilium/etcd-config.yaml
|
||||
{{- if hasKey .Values.clustermesh "maxConnectedClusters" }}
|
||||
- --max-connected-clusters={{ .Values.clustermesh.maxConnectedClusters }}
|
||||
{{- end }}
|
||||
{{- if ne .Values.clustermesh.apiserver.tls.authMode "legacy" }}
|
||||
- --cluster-users-enabled
|
||||
- --cluster-users-config-path=/var/lib/cilium/etcd-config/users.yaml
|
||||
{{- end }}
|
||||
- --enable-external-workloads={{ .Values.externalWorkloads.enabled }}
|
||||
{{- if .Values.clustermesh.apiserver.metrics.enabled }}
|
||||
- --prometheus-serve-addr=:{{ .Values.clustermesh.apiserver.metrics.port }}
|
||||
- --controller-group-metrics=all
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.extraArgs }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: CLUSTER_NAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: cilium-config
|
||||
key: cluster-name
|
||||
- name: CLUSTER_ID
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: cilium-config
|
||||
key: cluster-id
|
||||
optional: true
|
||||
- name: IDENTITY_ALLOCATION_MODE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: cilium-config
|
||||
key: identity-allocation-mode
|
||||
- name: ENABLE_K8S_ENDPOINT_SLICE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: cilium-config
|
||||
key: enable-k8s-endpoint-slice
|
||||
optional: true
|
||||
{{- with .Values.clustermesh.apiserver.extraEnv }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.clustermesh.apiserver.metrics.enabled }}
|
||||
ports:
|
||||
- name: apiserv-metrics
|
||||
containerPort: {{ .Values.clustermesh.apiserver.metrics.port }}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: etcd-admin-client
|
||||
mountPath: /var/lib/cilium/etcd-secrets
|
||||
readOnly: true
|
||||
{{- if ne .Values.clustermesh.apiserver.tls.authMode "legacy" }}
|
||||
- name: etcd-users-config
|
||||
mountPath: /var/lib/cilium/etcd-config
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- with .Values.clustermesh.apiserver.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.lifecycle }}
|
||||
lifecycle:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.clustermesh.apiserver.kvstoremesh.enabled }}
|
||||
- name: kvstoremesh
|
||||
image: {{ include "cilium.image" .Values.clustermesh.apiserver.image | quote }}
|
||||
imagePullPolicy: {{ .Values.clustermesh.apiserver.image.pullPolicy }}
|
||||
command:
|
||||
- /usr/bin/clustermesh-apiserver
|
||||
args:
|
||||
- kvstoremesh
|
||||
{{- if .Values.debug.enabled }}
|
||||
- --debug
|
||||
{{- end }}
|
||||
- --cluster-name=$(CLUSTER_NAME)
|
||||
- --cluster-id=$(CLUSTER_ID)
|
||||
- --kvstore-opt=etcd.config=/var/lib/cilium/etcd-config.yaml
|
||||
- --kvstore-opt=etcd.qps=100
|
||||
- --kvstore-opt=etcd.maxInflight=10
|
||||
- --clustermesh-config=/var/lib/cilium/clustermesh
|
||||
{{- if hasKey .Values.clustermesh "maxConnectedClusters" }}
|
||||
- --max-connected-clusters={{ .Values.clustermesh.maxConnectedClusters }}
|
||||
{{- end }}
|
||||
{{- if .Values.clustermesh.apiserver.metrics.kvstoremesh.enabled }}
|
||||
- --prometheus-serve-addr=:{{ .Values.clustermesh.apiserver.metrics.kvstoremesh.port }}
|
||||
- --controller-group-metrics=all
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.kvstoremesh.extraArgs }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: CLUSTER_NAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: cilium-config
|
||||
key: cluster-name
|
||||
- name: CLUSTER_ID
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: cilium-config
|
||||
key: cluster-id
|
||||
{{- with .Values.clustermesh.apiserver.kvstoremesh.extraEnv }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.clustermesh.apiserver.metrics.kvstoremesh.enabled }}
|
||||
ports:
|
||||
- name: kvmesh-metrics
|
||||
containerPort: {{ .Values.clustermesh.apiserver.metrics.kvstoremesh.port }}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.kvstoremesh.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: etcd-admin-client
|
||||
mountPath: /var/lib/cilium/etcd-secrets
|
||||
readOnly: true
|
||||
- name: kvstoremesh-secrets
|
||||
mountPath: /var/lib/cilium/clustermesh
|
||||
readOnly: true
|
||||
{{- with .Values.clustermesh.apiserver.kvstoremesh.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- with .Values.clustermesh.apiserver.kvstoremesh.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.kvstoremesh.lifecycle }}
|
||||
lifecycle:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: etcd-server-secrets
|
||||
projected:
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
sources:
|
||||
- secret:
|
||||
name: clustermesh-apiserver-server-cert
|
||||
items:
|
||||
- key: tls.crt
|
||||
path: tls.crt
|
||||
- key: tls.key
|
||||
path: tls.key
|
||||
{{- if not .Values.tls.caBundle.enabled }}
|
||||
- key: ca.crt
|
||||
path: ca.crt
|
||||
{{- else }}
|
||||
- {{ .Values.tls.caBundle.useSecret | ternary "secret" "configMap" }}:
|
||||
name: {{ .Values.tls.caBundle.name }}
|
||||
items:
|
||||
- key: {{ .Values.tls.caBundle.key }}
|
||||
path: ca.crt
|
||||
{{- end }}
|
||||
- name: etcd-admin-client
|
||||
projected:
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
sources:
|
||||
- secret:
|
||||
name: clustermesh-apiserver-admin-cert
|
||||
items:
|
||||
- key: tls.crt
|
||||
path: tls.crt
|
||||
- key: tls.key
|
||||
path: tls.key
|
||||
{{- if not .Values.tls.caBundle.enabled }}
|
||||
- key: ca.crt
|
||||
path: ca.crt
|
||||
{{- else }}
|
||||
- {{ .Values.tls.caBundle.useSecret | ternary "secret" "configMap" }}:
|
||||
name: {{ .Values.tls.caBundle.name }}
|
||||
items:
|
||||
- key: {{ .Values.tls.caBundle.key }}
|
||||
path: ca.crt
|
||||
{{- end }}
|
||||
{{- if ne .Values.clustermesh.apiserver.tls.authMode "legacy" }}
|
||||
- name: etcd-users-config
|
||||
configMap:
|
||||
name: clustermesh-remote-users
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
{{- end }}
|
||||
- name: etcd-data-dir
|
||||
emptyDir: {}
|
||||
{{- if .Values.clustermesh.apiserver.kvstoremesh.enabled }}
|
||||
- name: kvstoremesh-secrets
|
||||
projected:
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
sources:
|
||||
- secret:
|
||||
name: cilium-kvstoremesh
|
||||
optional: true
|
||||
# note: items are not explicitly listed here, since the entries of this secret
|
||||
# depend on the peers configured, and that would cause a restart of this pod
|
||||
# at every addition/removal. Leaving the field empty makes each secret entry
|
||||
# to be automatically projected into the volume as a file whose name is the key.
|
||||
- secret:
|
||||
name: clustermesh-apiserver-remote-cert
|
||||
optional: true
|
||||
items:
|
||||
- key: tls.key
|
||||
path: common-etcd-client.key
|
||||
- key: tls.crt
|
||||
path: common-etcd-client.crt
|
||||
- key: ca.crt
|
||||
path: common-etcd-client-ca.crt
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.extraVolumes }}
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
restartPolicy: Always
|
||||
priorityClassName: {{ include "cilium.priorityClass" (list $ .Values.clustermesh.apiserver.priorityClassName "system-cluster-critical") }}
|
||||
serviceAccount: {{ .Values.serviceAccounts.clustermeshApiserver.name | quote }}
|
||||
serviceAccountName: {{ .Values.serviceAccounts.clustermeshApiserver.name | quote }}
|
||||
terminationGracePeriodSeconds: {{ .Values.clustermesh.apiserver.terminationGracePeriodSeconds }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccounts.clustermeshApiserver.automount }}
|
||||
{{- with .Values.clustermesh.apiserver.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- range $constraint := . }}
|
||||
- {{ toYaml $constraint | nindent 8 | trim }}
|
||||
{{- if not $constraint.labelSelector }}
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
k8s-app: clustermesh-apiserver
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.clustermesh.config.enabled .Values.clustermesh.apiserver.kvstoremesh.enabled }}
|
||||
hostAliases:
|
||||
{{- range $cluster := .Values.clustermesh.config.clusters }}
|
||||
{{- range $ip := $cluster.ips }}
|
||||
- ip: {{ $ip }}
|
||||
hostnames: [ "{{ $cluster.name }}.{{ $.Values.clustermesh.config.domain }}" ]
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,43 @@
|
||||
{{- $kvstoreMetricsEnabled := and .Values.clustermesh.apiserver.kvstoremesh.enabled .Values.clustermesh.apiserver.metrics.kvstoremesh.enabled -}}
|
||||
{{- if and
|
||||
(or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer)
|
||||
(or .Values.clustermesh.apiserver.metrics.enabled $kvstoreMetricsEnabled .Values.clustermesh.apiserver.metrics.etcd.enabled) }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: clustermesh-apiserver-metrics
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: clustermesh-apiserver
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: clustermesh-apiserver
|
||||
app.kubernetes.io/component: metrics
|
||||
spec:
|
||||
clusterIP: None
|
||||
type: ClusterIP
|
||||
ports:
|
||||
{{- if .Values.clustermesh.apiserver.metrics.enabled }}
|
||||
- name: apiserv-metrics
|
||||
port: {{ .Values.clustermesh.apiserver.metrics.port }}
|
||||
protocol: TCP
|
||||
targetPort: apiserv-metrics
|
||||
{{- end }}
|
||||
{{- if $kvstoreMetricsEnabled }}
|
||||
- name: kvmesh-metrics
|
||||
port: {{ .Values.clustermesh.apiserver.metrics.kvstoremesh.port }}
|
||||
protocol: TCP
|
||||
targetPort: kvmesh-metrics
|
||||
{{- end }}
|
||||
{{- if .Values.clustermesh.apiserver.metrics.etcd.enabled }}
|
||||
- name: etcd-metrics
|
||||
port: {{ .Values.clustermesh.apiserver.metrics.etcd.port }}
|
||||
protocol: TCP
|
||||
targetPort: etcd-metrics
|
||||
{{- end }}
|
||||
selector:
|
||||
k8s-app: clustermesh-apiserver
|
||||
{{- end }}
|
||||
@@ -0,0 +1,26 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.clustermesh.apiserver.podDisruptionBudget.enabled }}
|
||||
{{- $component := .Values.clustermesh.apiserver.podDisruptionBudget }}
|
||||
apiVersion: {{ include "podDisruptionBudget.apiVersion" . }}
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: clustermesh-apiserver
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: clustermesh-apiserver
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: clustermesh-apiserver
|
||||
spec:
|
||||
{{- with $component.maxUnavailable }}
|
||||
maxUnavailable: {{ . }}
|
||||
{{- end }}
|
||||
{{- with $component.minAvailable }}
|
||||
minAvailable: {{ . }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: clustermesh-apiserver
|
||||
{{- end }}
|
||||
@@ -0,0 +1,41 @@
|
||||
{{- if (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: clustermesh-apiserver
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
k8s-app: clustermesh-apiserver
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: clustermesh-apiserver
|
||||
{{- if or .Values.clustermesh.apiserver.service.annotations .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.service.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.clustermesh.apiserver.service.type }}
|
||||
selector:
|
||||
k8s-app: clustermesh-apiserver
|
||||
ports:
|
||||
- port: 2379
|
||||
{{- if and (eq "NodePort" .Values.clustermesh.apiserver.service.type) .Values.clustermesh.apiserver.service.nodePort }}
|
||||
nodePort: {{ .Values.clustermesh.apiserver.service.nodePort }}
|
||||
{{- end }}
|
||||
{{- if and (eq "LoadBalancer" .Values.clustermesh.apiserver.service.type) .Values.clustermesh.apiserver.service.loadBalancerClass }}
|
||||
loadBalancerClass: {{ .Values.clustermesh.apiserver.service.loadBalancerClass }}
|
||||
{{- end }}
|
||||
{{- if and (eq "LoadBalancer" .Values.clustermesh.apiserver.service.type) .Values.clustermesh.apiserver.service.loadBalancerIP }}
|
||||
loadBalancerIP: {{ .Values.clustermesh.apiserver.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if .Values.clustermesh.apiserver.service.externalTrafficPolicy }}
|
||||
externalTrafficPolicy: {{ .Values.clustermesh.apiserver.service.externalTrafficPolicy }}
|
||||
{{- end }}
|
||||
{{- if .Values.clustermesh.apiserver.service.internalTrafficPolicy }}
|
||||
internalTrafficPolicy: {{ .Values.clustermesh.apiserver.service.internalTrafficPolicy }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.serviceAccounts.clustermeshApiserver.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ .Values.serviceAccounts.clustermeshApiserver.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or .Values.serviceAccounts.clustermeshApiserver.annotations .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccounts.clustermeshApiserver.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,77 @@
|
||||
{{- $kvstoreMetricsEnabled := and .Values.clustermesh.apiserver.kvstoremesh.enabled .Values.clustermesh.apiserver.metrics.kvstoremesh.enabled -}}
|
||||
{{- if and
|
||||
(or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer)
|
||||
(or .Values.clustermesh.apiserver.metrics.enabled $kvstoreMetricsEnabled .Values.clustermesh.apiserver.metrics.etcd.enabled)
|
||||
.Values.clustermesh.apiserver.metrics.serviceMonitor.enabled }}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: clustermesh-apiserver
|
||||
namespace: {{ .Values.clustermesh.apiserver.metrics.serviceMonitor.namespace | default .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
{{- with .Values.clustermesh.apiserver.metrics.serviceMonitor.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.clustermesh.apiserver.metrics.serviceMonitor.annotations .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.metrics.serviceMonitor.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: clustermesh-apiserver
|
||||
app.kubernetes.io/component: metrics
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
endpoints:
|
||||
{{- if .Values.clustermesh.apiserver.metrics.enabled }}
|
||||
- port: apiserv-metrics
|
||||
interval: {{ .Values.clustermesh.apiserver.metrics.serviceMonitor.interval | quote }}
|
||||
honorLabels: true
|
||||
path: /metrics
|
||||
{{- with .Values.clustermesh.apiserver.metrics.serviceMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.metrics.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $kvstoreMetricsEnabled }}
|
||||
- port: kvmesh-metrics
|
||||
interval: {{ .Values.clustermesh.apiserver.metrics.serviceMonitor.kvstoremesh.interval | quote }}
|
||||
honorLabels: true
|
||||
path: /metrics
|
||||
{{- with .Values.clustermesh.apiserver.metrics.serviceMonitor.kvstoremesh.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.metrics.serviceMonitor.kvstoremesh.metricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.clustermesh.apiserver.metrics.etcd.enabled }}
|
||||
- port: etcd-metrics
|
||||
interval: {{ .Values.clustermesh.apiserver.metrics.serviceMonitor.etcd.interval | quote }}
|
||||
honorLabels: true
|
||||
path: /metrics
|
||||
{{- with .Values.clustermesh.apiserver.metrics.serviceMonitor.etcd.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.apiserver.metrics.serviceMonitor.etcd.metricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "certmanager") }}
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: clustermesh-apiserver-admin-cert
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
issuerRef:
|
||||
{{- toYaml .Values.clustermesh.apiserver.tls.auto.certManagerIssuerRef | nindent 4 }}
|
||||
secretName: clustermesh-apiserver-admin-cert
|
||||
commonName: {{ include "clustermesh-apiserver-generate-certs.admin-common-name" . }}
|
||||
dnsNames:
|
||||
- localhost
|
||||
duration: {{ printf "%dh0m0s" (mul .Values.clustermesh.apiserver.tls.auto.certValidityDuration 24) }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- if and .Values.externalWorkloads.enabled .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "certmanager") }}
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: clustermesh-apiserver-client-cert
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
issuerRef:
|
||||
{{- toYaml .Values.clustermesh.apiserver.tls.auto.certManagerIssuerRef | nindent 4 }}
|
||||
secretName: clustermesh-apiserver-client-cert
|
||||
commonName: externalworkload
|
||||
duration: {{ printf "%dh0m0s" (mul .Values.clustermesh.apiserver.tls.auto.certValidityDuration 24) }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- if and .Values.clustermesh.useAPIServer .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "certmanager") }}
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: clustermesh-apiserver-remote-cert
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
issuerRef:
|
||||
{{- toYaml .Values.clustermesh.apiserver.tls.auto.certManagerIssuerRef | nindent 4 }}
|
||||
secretName: clustermesh-apiserver-remote-cert
|
||||
commonName: {{ include "clustermesh-apiserver-generate-certs.remote-common-name" . }}
|
||||
duration: {{ printf "%dh0m0s" (mul .Values.clustermesh.apiserver.tls.auto.certValidityDuration 24) }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,31 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "certmanager") }}
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: clustermesh-apiserver-server-cert
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
issuerRef:
|
||||
{{- toYaml .Values.clustermesh.apiserver.tls.auto.certManagerIssuerRef | nindent 4 }}
|
||||
secretName: clustermesh-apiserver-server-cert
|
||||
commonName: clustermesh-apiserver.cilium.io
|
||||
dnsNames:
|
||||
- clustermesh-apiserver.cilium.io
|
||||
- "*.mesh.cilium.io"
|
||||
- "clustermesh-apiserver.{{ .Release.Namespace }}.svc"
|
||||
{{- range $dns := .Values.clustermesh.apiserver.tls.server.extraDnsNames }}
|
||||
- {{ $dns | quote }}
|
||||
{{- end }}
|
||||
ipAddresses:
|
||||
- "127.0.0.1"
|
||||
- "::1"
|
||||
{{- range $ip := .Values.clustermesh.apiserver.tls.server.extraIpAddresses }}
|
||||
- {{ $ip | quote }}
|
||||
{{- end }}
|
||||
duration: {{ printf "%dh0m0s" (mul .Values.clustermesh.apiserver.tls.auto.certValidityDuration 24) }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,73 @@
|
||||
{{- define "clustermesh-apiserver-generate-certs.job.spec" }}
|
||||
{{- $certValiditySecondsStr := printf "%ds" (mul .Values.clustermesh.apiserver.tls.auto.certValidityDuration 24 60 60) -}}
|
||||
{{- $clustermeshServerSANs := concat (list "*.mesh.cilium.io" (printf "clustermesh-apiserver.%s.svc" .Release.Namespace))
|
||||
.Values.clustermesh.apiserver.tls.server.extraDnsNames
|
||||
.Values.clustermesh.apiserver.tls.server.extraIpAddresses
|
||||
-}}
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: clustermesh-apiserver-generate-certs
|
||||
{{- with .Values.clustermesh.apiserver.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
containers:
|
||||
- name: certgen
|
||||
image: {{ include "cilium.image" .Values.certgen.image | quote }}
|
||||
imagePullPolicy: {{ .Values.certgen.image.pullPolicy }}
|
||||
command:
|
||||
- "/usr/bin/cilium-certgen"
|
||||
args:
|
||||
- "--cilium-namespace={{ .Release.Namespace }}"
|
||||
{{- if .Values.debug.enabled }}
|
||||
- "--debug"
|
||||
{{- end }}
|
||||
- "--ca-generate"
|
||||
- "--ca-reuse-secret"
|
||||
{{- if and .Values.tls.ca.cert .Values.tls.ca.key }}
|
||||
- "--ca-secret-name=cilium-ca"
|
||||
{{- end }}
|
||||
- "--clustermesh-apiserver-server-cert-generate"
|
||||
- "--clustermesh-apiserver-server-cert-validity-duration={{ $certValiditySecondsStr }}"
|
||||
- "--clustermesh-apiserver-server-cert-sans={{ join "," $clustermeshServerSANs }}"
|
||||
- "--clustermesh-apiserver-admin-cert-generate"
|
||||
- "--clustermesh-apiserver-admin-cert-validity-duration={{ $certValiditySecondsStr }}"
|
||||
- "--clustermesh-apiserver-admin-cert-common-name={{ include "clustermesh-apiserver-generate-certs.admin-common-name" . }}"
|
||||
{{- if .Values.externalWorkloads.enabled }}
|
||||
- "--clustermesh-apiserver-client-cert-generate"
|
||||
- "--clustermesh-apiserver-client-cert-validity-duration={{ $certValiditySecondsStr }}"
|
||||
{{- end }}
|
||||
{{- if .Values.clustermesh.useAPIServer }}
|
||||
- "--clustermesh-apiserver-remote-cert-generate"
|
||||
- "--clustermesh-apiserver-remote-cert-validity-duration={{ $certValiditySecondsStr }}"
|
||||
- "--clustermesh-apiserver-remote-cert-common-name={{ include "clustermesh-apiserver-generate-certs.remote-common-name" . }}"
|
||||
{{- end }}
|
||||
{{- with .Values.certgen.extraVolumeMounts }}
|
||||
volumeMounts:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
hostNetwork: true
|
||||
{{- with .Values.certgen.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccount: {{ .Values.serviceAccounts.clustermeshcertgen.name | quote }}
|
||||
serviceAccountName: {{ .Values.serviceAccounts.clustermeshcertgen.name | quote }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccounts.clustermeshcertgen.automount }}
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
restartPolicy: OnFailure
|
||||
{{- with .Values.certgen.extraVolumes }}
|
||||
volumes:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
affinity:
|
||||
{{- with .Values.certgen.affinity }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
ttlSecondsAfterFinished: {{ .Values.certgen.ttlSecondsAfterFinished }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,19 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "cronJob") .Values.clustermesh.apiserver.tls.auto.schedule }}
|
||||
apiVersion: {{ include "cronjob.apiVersion" . }}
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: clustermesh-apiserver-generate-certs
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: clustermesh-apiserver-generate-certs
|
||||
app.kubernetes.io/part-of: cilium
|
||||
spec:
|
||||
schedule: {{ .Values.clustermesh.apiserver.tls.auto.schedule | quote }}
|
||||
concurrencyPolicy: Forbid
|
||||
jobTemplate:
|
||||
{{- include "clustermesh-apiserver-generate-certs.job.spec" . | nindent 4 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "cronJob") }}
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: clustermesh-apiserver-generate-certs
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
k8s-app: clustermesh-apiserver-generate-certs
|
||||
app.kubernetes.io/part-of: cilium
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,post-upgrade
|
||||
{{- with .Values.certgen.annotations.job }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{ include "clustermesh-apiserver-generate-certs.job.spec" . }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,40 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "cronJob") .Values.serviceAccounts.clustermeshcertgen.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: clustermesh-apiserver-generate-certs
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
resourceNames:
|
||||
- cilium-ca
|
||||
verbs:
|
||||
- get
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
resourceNames:
|
||||
- clustermesh-apiserver-server-cert
|
||||
- clustermesh-apiserver-admin-cert
|
||||
- clustermesh-apiserver-remote-cert
|
||||
- clustermesh-apiserver-client-cert
|
||||
verbs:
|
||||
- update
|
||||
{{- end }}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "cronJob") .Values.serviceAccounts.clustermeshcertgen.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: clustermesh-apiserver-generate-certs
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: clustermesh-apiserver-generate-certs
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.clustermeshcertgen.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "cronJob") .Values.serviceAccounts.clustermeshcertgen.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ .Values.serviceAccounts.clustermeshcertgen.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or .Values.serviceAccounts.clustermeshcertgen.annotations .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.serviceAccounts.clustermeshcertgen.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "helm") }}
|
||||
{{- $_ := include "cilium.ca.setup" . -}}
|
||||
{{- $cn := include "clustermesh-apiserver-generate-certs.admin-common-name" . -}}
|
||||
{{- $dns := list "localhost" }}
|
||||
{{- $cert := genSignedCert $cn nil $dns (.Values.clustermesh.apiserver.tls.auto.certValidityDuration | int) .commonCA -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: clustermesh-apiserver-admin-cert
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
ca.crt: {{ .commonCA.Cert | b64enc }}
|
||||
tls.crt: {{ $cert.Cert | b64enc }}
|
||||
tls.key: {{ $cert.Key | b64enc }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and .Values.externalWorkloads.enabled .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "helm") }}
|
||||
{{- $_ := include "cilium.ca.setup" . -}}
|
||||
{{- $cn := "externalworkload" }}
|
||||
{{- $cert := genSignedCert $cn nil nil (.Values.clustermesh.apiserver.tls.auto.certValidityDuration | int) .commonCA -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: clustermesh-apiserver-client-cert
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
ca.crt: {{ .commonCA.Cert | b64enc }}
|
||||
tls.crt: {{ $cert.Cert | b64enc }}
|
||||
tls.key: {{ $cert.Key | b64enc }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and .Values.clustermesh.useAPIServer .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "helm") }}
|
||||
{{- $_ := include "cilium.ca.setup" . -}}
|
||||
{{- $cn := include "clustermesh-apiserver-generate-certs.remote-common-name" . -}}
|
||||
{{- $cert := genSignedCert $cn nil nil (.Values.clustermesh.apiserver.tls.auto.certValidityDuration | int) .commonCA -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: clustermesh-apiserver-remote-cert
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
ca.crt: {{ .commonCA.Cert | b64enc }}
|
||||
tls.crt: {{ $cert.Cert | b64enc }}
|
||||
tls.key: {{ $cert.Key | b64enc }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,22 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "helm") }}
|
||||
{{- $_ := include "cilium.ca.setup" . -}}
|
||||
{{- $cn := "clustermesh-apiserver.cilium.io" }}
|
||||
{{- $ip := concat (list "127.0.0.1" "::1") .Values.clustermesh.apiserver.tls.server.extraIpAddresses }}
|
||||
{{- $dns := concat (list $cn "*.mesh.cilium.io" (printf "clustermesh-apiserver.%s.svc" .Release.Namespace)) .Values.clustermesh.apiserver.tls.server.extraDnsNames }}
|
||||
{{- $cert := genSignedCert $cn $ip $dns (.Values.clustermesh.apiserver.tls.auto.certValidityDuration | int) .commonCA -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: clustermesh-apiserver-server-cert
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
ca.crt: {{ .commonCA.Cert | b64enc }}
|
||||
tls.crt: {{ $cert.Cert | b64enc }}
|
||||
tls.key: {{ $cert.Key | b64enc }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) (not .Values.clustermesh.apiserver.tls.auto.enabled) }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: clustermesh-apiserver-admin-cert
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
ca.crt: {{ .Values.tls.ca.cert }}
|
||||
tls.crt: {{ .Values.clustermesh.apiserver.tls.admin.cert | required "missing clustermesh.apiserver.tls.admin.cert" }}
|
||||
tls.key: {{ .Values.clustermesh.apiserver.tls.admin.key | required "missing clustermesh.apiserver.tls.admin.key" }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and .Values.externalWorkloads.enabled (not .Values.clustermesh.apiserver.tls.auto.enabled) }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: clustermesh-apiserver-client-cert
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
ca.crt: {{ .Values.tls.ca.cert }}
|
||||
tls.crt: {{ .Values.clustermesh.apiserver.tls.client.cert | required "missing clustermesh.apiserver.tls.client.cert" }}
|
||||
tls.key: {{ .Values.clustermesh.apiserver.tls.client.key | required "missing clustermesh.apiserver.tls.client.key" }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and .Values.clustermesh.useAPIServer (not .Values.clustermesh.apiserver.tls.auto.enabled) }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: clustermesh-apiserver-remote-cert
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
ca.crt: {{ .Values.tls.ca.cert }}
|
||||
tls.crt: {{ .Values.clustermesh.apiserver.tls.remote.cert | required "missing clustermesh.apiserver.tls.remote.cert" }}
|
||||
tls.key: {{ .Values.clustermesh.apiserver.tls.remote.key | required "missing clustermesh.apiserver.tls.remote.key" }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and (or .Values.externalWorkloads.enabled .Values.clustermesh.useAPIServer) (not .Values.clustermesh.apiserver.tls.auto.enabled) }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: clustermesh-apiserver-server-cert
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
ca.crt: {{ .Values.tls.ca.cert }}
|
||||
tls.crt: {{ .Values.clustermesh.apiserver.tls.server.cert | required "missing clustermesh.apiserver.tls.server.cert" }}
|
||||
tls.key: {{ .Values.clustermesh.apiserver.tls.server.key | required "missing clustermesh.apiserver.tls.server.key" }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,25 @@
|
||||
{{- if ne .Values.clustermesh.apiserver.tls.authMode "legacy" }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: clustermesh-remote-users
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
data:
|
||||
users.yaml: |
|
||||
users:
|
||||
{{- if .Values.clustermesh.apiserver.kvstoremesh.enabled }}
|
||||
- name: remote-{{ .Values.cluster.name }}
|
||||
role: remote
|
||||
{{- end }}
|
||||
{{- range .Values.clustermesh.config.clusters }}
|
||||
- name: remote-{{ .name }}
|
||||
role: remote
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- define "clustermesh-config-generate-etcd-cfg" }}
|
||||
{{- $cluster := index . 0 -}}
|
||||
{{- $domain := index . 1 -}}
|
||||
{{- $override := index . 2 -}}
|
||||
{{- /* The parenthesis around $cluster.tls are required, since it can be null: https://stackoverflow.com/a/68807258 */}}
|
||||
{{- $prefix := ternary "common-" (printf "%s." $cluster.name) (or (ne $override "") (empty ($cluster.tls).cert) (empty ($cluster.tls).key)) -}}
|
||||
|
||||
endpoints:
|
||||
{{- if ne $override "" }}
|
||||
- {{ $override }}
|
||||
{{- else if $cluster.ips }}
|
||||
- https://{{ $cluster.name }}.{{ $domain }}:{{ $cluster.port }}
|
||||
{{- else }}
|
||||
- https://{{ $cluster.address | required "missing clustermesh.apiserver.config.clusters.address" }}:{{ $cluster.port }}
|
||||
{{- end }}
|
||||
{{- if not (empty ($cluster.tls).caCert) }}
|
||||
{{- /* The custom CA configuration takes effect only if a custom certificate and key are also set */}}
|
||||
trusted-ca-file: /var/lib/cilium/clustermesh/{{ $prefix }}etcd-client-ca.crt
|
||||
{{- else }}
|
||||
trusted-ca-file: /var/lib/cilium/clustermesh/common-etcd-client-ca.crt
|
||||
{{- end }}
|
||||
key-file: /var/lib/cilium/clustermesh/{{ $prefix }}etcd-client.key
|
||||
cert-file: /var/lib/cilium/clustermesh/{{ $prefix }}etcd-client.crt
|
||||
{{- end }}
|
||||
@@ -0,0 +1,26 @@
|
||||
{{- if .Values.clustermesh.config.enabled }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: cilium-clustermesh
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- $kvstoremesh := and .Values.clustermesh.useAPIServer .Values.clustermesh.apiserver.kvstoremesh.enabled }}
|
||||
{{- $override := ternary (printf "https://clustermesh-apiserver.%s.svc:2379" .Release.Namespace) "" $kvstoremesh }}
|
||||
{{- range .Values.clustermesh.config.clusters }}
|
||||
{{ .name }}: {{ include "clustermesh-config-generate-etcd-cfg" (list . $.Values.clustermesh.config.domain $override) | b64enc }}
|
||||
{{- /* The parenthesis around .tls are required, since it can be null: https://stackoverflow.com/a/68807258 */}}
|
||||
{{- if and (eq $override "") (.tls).cert (.tls).key }}
|
||||
{{- if .tls.caCert }}
|
||||
{{ .name }}.etcd-client-ca.crt: {{ .tls.caCert }}
|
||||
{{- end }}
|
||||
{{ .name }}.etcd-client.key: {{ .tls.key }}
|
||||
{{ .name }}.etcd-client.crt: {{ .tls.cert }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- if and .Values.clustermesh.useAPIServer .Values.clustermesh.config.enabled .Values.clustermesh.apiserver.kvstoremesh.enabled }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: cilium-kvstoremesh
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.clustermesh.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- range .Values.clustermesh.config.clusters }}
|
||||
{{ .name }}: {{ include "clustermesh-config-generate-etcd-cfg" (list . $.Values.clustermesh.config.domain "") | b64enc }}
|
||||
{{- /* The parenthesis around .tls are required, since it can be null: https://stackoverflow.com/a/68807258 */}}
|
||||
{{- if and (.tls).cert (.tls).key }}
|
||||
{{- if .tls.caCert }}
|
||||
{{ .name }}.etcd-client-ca.crt: {{ .tls.caCert }}
|
||||
{{- end }}
|
||||
{{ .name }}.etcd-client.key: {{ .tls.key }}
|
||||
{{ .name }}.etcd-client.crt: {{ .tls.cert }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,79 @@
|
||||
{{- if .Values.etcd.managed }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: cilium-etcd-operator
|
||||
{{- with .Values.etcd.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- etcd.database.coreos.com
|
||||
resources:
|
||||
- etcdclusters
|
||||
verbs:
|
||||
- get
|
||||
- delete
|
||||
- create
|
||||
- update
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- delete
|
||||
- get
|
||||
- create
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- delete
|
||||
- create
|
||||
- get
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- list
|
||||
- get
|
||||
- delete
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- delete
|
||||
- create
|
||||
- get
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- componentstatuses
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- extensions
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- delete
|
||||
- create
|
||||
- get
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
- create
|
||||
- delete
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and .Values.etcd.managed .Values.serviceAccounts.etcd.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: cilium-etcd-operator
|
||||
{{- with .Values.etcd.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cilium-etcd-operator
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.etcd.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,128 @@
|
||||
{{- if .Values.etcd.managed }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
io.cilium/app: etcd-operator
|
||||
name: cilium-etcd-operator
|
||||
app.kubernetes.io/name: cilium-etcd-operator
|
||||
app.kubernetes.io/part-of: cilium
|
||||
name: cilium-etcd-operator
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.etcd.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
io.cilium/app: etcd-operator
|
||||
name: cilium-etcd-operator
|
||||
{{- with .Values.etcd.updateStrategy }}
|
||||
strategy:
|
||||
{{- toYaml . | trim | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.etcd.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
io.cilium/app: etcd-operator
|
||||
app.kubernetes.io/part-of: cilium
|
||||
app.kubernetes.io/name: cilium-etcd-operator
|
||||
name: cilium-etcd-operator
|
||||
{{- with .Values.etcd.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.etcd.affinity }}
|
||||
affinity:
|
||||
{{ toYaml .Values.etcd.affinity | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.etcd.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- range $constraint := . }}
|
||||
- {{ toYaml $constraint | nindent 8 | trim }}
|
||||
{{- if not $constraint.labelSelector }}
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
io.cilium/app: etcd-operator
|
||||
name: cilium-etcd-operator
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{ toYaml .Values.imagePullSecrets | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.etcd.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- args:
|
||||
{{- with .Values.etcd.extraArgs }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
#- --etcd-node-selector=disktype=ssd,cputype=high
|
||||
command:
|
||||
- /usr/bin/cilium-etcd-operator
|
||||
env:
|
||||
- name: CILIUM_ETCD_OPERATOR_CLUSTER_DOMAIN
|
||||
value: "{{ .Values.etcd.clusterDomain }}"
|
||||
- name: CILIUM_ETCD_OPERATOR_ETCD_CLUSTER_SIZE
|
||||
value: "{{ .Values.etcd.clusterSize }}"
|
||||
- name: CILIUM_ETCD_OPERATOR_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.namespace
|
||||
- name: CILIUM_ETCD_OPERATOR_POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.name
|
||||
- name: CILIUM_ETCD_OPERATOR_POD_UID
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.uid
|
||||
- name: CILIUM_ETCD_META_ETCD_AUTO_COMPACTION_MODE
|
||||
value: "revision"
|
||||
- name: CILIUM_ETCD_META_ETCD_AUTO_COMPACTION_RETENTION
|
||||
value: "25000"
|
||||
image: {{ include "cilium.image" .Values.etcd.image | quote }}
|
||||
imagePullPolicy: {{ .Values.etcd.image.pullPolicy }}
|
||||
name: cilium-etcd-operator
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- with .Values.etcd.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.etcd.extraVolumeMounts }}
|
||||
volumeMounts:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
dnsPolicy: ClusterFirst
|
||||
hostNetwork: true
|
||||
priorityClassName: {{ include "cilium.priorityClass" (list $ .Values.clustermesh.apiserver.priorityClassName "system-cluster-critical") }}
|
||||
restartPolicy: Always
|
||||
serviceAccount: {{ .Values.serviceAccounts.etcd.name | quote }}
|
||||
serviceAccountName: {{ .Values.serviceAccounts.etcd.name | quote }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccounts.etcd.automount }}
|
||||
{{- with .Values.etcd.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.etcd.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | trim | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- with .Values.etcd.extraVolumes }}
|
||||
volumes:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and .Values.etcd.managed .Values.serviceAccounts.etcd.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ .Values.serviceAccounts.etcd.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or .Values.serviceAccounts.etcd.annotations .Values.etcd.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.etcd.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccounts.etcd.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,60 @@
|
||||
{{- if .Values.etcd.managed }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: etcd-operator
|
||||
{{- with .Values.etcd.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- etcd.database.coreos.com
|
||||
resources:
|
||||
- etcdclusters
|
||||
- etcdbackups
|
||||
- etcdrestores
|
||||
verbs:
|
||||
- '*'
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- '*'
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
- services
|
||||
- endpoints
|
||||
- persistentvolumeclaims
|
||||
- events
|
||||
- deployments
|
||||
verbs:
|
||||
- '*'
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- '*'
|
||||
- apiGroups:
|
||||
- extensions
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if .Values.etcd.managed }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: etcd-operator
|
||||
{{- with .Values.etcd.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: etcd-operator
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: cilium-etcd-sa
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if .Values.etcd.managed }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: cilium-etcd-sa
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or .Values.serviceAccounts.etcd.annotations .Values.etcd.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.etcd.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccounts.etcd.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,28 @@
|
||||
{{- if and .Values.etcd.managed .Values.etcd.podDisruptionBudget.enabled }}
|
||||
{{- $component := .Values.etcd.podDisruptionBudget }}
|
||||
apiVersion: {{ include "podDisruptionBudget.apiVersion" . }}
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: cilium-etcd-operator
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.etcd.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
io.cilium/app: etcd-operator
|
||||
name: cilium-etcd-operator
|
||||
app.kubernetes.io/name: cilium-etcd-operator
|
||||
app.kubernetes.io/part-of: cilium
|
||||
spec:
|
||||
{{- with $component.maxUnavailable }}
|
||||
maxUnavailable: {{ . }}
|
||||
{{- end }}
|
||||
{{- with $component.minAvailable }}
|
||||
minAvailable: {{ . }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
io.cilium/app: etcd-operator
|
||||
name: cilium-etcd-operator
|
||||
{{- end }}
|
||||
@@ -0,0 +1,51 @@
|
||||
{{- if and .Values.hubble.enabled .Values.hubble.relay.enabled }}
|
||||
{{- $peerSvcPort := .Values.hubble.peerService.servicePort -}}
|
||||
{{- if not .Values.hubble.peerService.servicePort }}
|
||||
{{- $peerSvcPort = (.Values.hubble.tls.enabled | ternary 443 80) -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: hubble-relay-config
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.hubble.relay.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
config.yaml: |
|
||||
cluster-name: {{ .Values.cluster.name }}
|
||||
peer-service: "hubble-peer.{{ .Release.Namespace }}.svc.{{ .Values.hubble.peerService.clusterDomain }}:{{ $peerSvcPort }}"
|
||||
listen-address: {{ .Values.hubble.relay.listenHost }}:{{ .Values.hubble.relay.listenPort }}
|
||||
gops: {{ .Values.hubble.relay.gops.enabled }}
|
||||
gops-port: {{ .Values.hubble.relay.gops.port | quote }}
|
||||
{{- if .Values.hubble.relay.pprof.enabled }}
|
||||
pprof: {{ .Values.hubble.relay.pprof.enabled | quote }}
|
||||
pprof-address: {{ .Values.hubble.relay.pprof.address | quote }}
|
||||
pprof-port: {{ .Values.hubble.relay.pprof.port | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.hubble.relay.prometheus.enabled }}
|
||||
metrics-listen-address: ":{{ .Values.hubble.relay.prometheus.port }}"
|
||||
{{- end }}
|
||||
dial-timeout: {{ .Values.hubble.relay.dialTimeout }}
|
||||
retry-timeout: {{ .Values.hubble.relay.retryTimeout }}
|
||||
sort-buffer-len-max: {{ .Values.hubble.relay.sortBufferLenMax }}
|
||||
sort-buffer-drain-timeout: {{ .Values.hubble.relay.sortBufferDrainTimeout }}
|
||||
{{- if .Values.hubble.tls.enabled }}
|
||||
tls-hubble-client-cert-file: /var/lib/hubble-relay/tls/client.crt
|
||||
tls-hubble-client-key-file: /var/lib/hubble-relay/tls/client.key
|
||||
tls-hubble-server-ca-files: /var/lib/hubble-relay/tls/hubble-server-ca.crt
|
||||
{{- else }}
|
||||
disable-client-tls: true
|
||||
{{- end }}
|
||||
{{- if and .Values.hubble.tls.enabled .Values.hubble.relay.tls.server.enabled }}
|
||||
tls-relay-server-cert-file: /var/lib/hubble-relay/tls/server.crt
|
||||
tls-relay-server-key-file: /var/lib/hubble-relay/tls/server.key
|
||||
{{- if .Values.hubble.relay.tls.server.mtls }}
|
||||
tls-relay-client-ca-files: /var/lib/hubble-relay/tls/hubble-server-ca.crt
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
disable-server-tls: true
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,201 @@
|
||||
{{- if and .Values.hubble.enabled .Values.hubble.relay.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hubble-relay
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.hubble.relay.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: hubble-relay
|
||||
app.kubernetes.io/name: hubble-relay
|
||||
app.kubernetes.io/part-of: cilium
|
||||
spec:
|
||||
replicas: {{ .Values.hubble.relay.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: hubble-relay
|
||||
{{- with .Values.hubble.relay.updateStrategy }}
|
||||
strategy:
|
||||
{{- toYaml . | trim | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- if .Values.hubble.relay.rollOutPods }}
|
||||
# ensure pods roll when configmap updates
|
||||
cilium.io/hubble-relay-configmap-checksum: {{ include (print $.Template.BasePath "/hubble-relay/configmap.yaml") . | sha256sum | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.relay.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: hubble-relay
|
||||
app.kubernetes.io/name: hubble-relay
|
||||
app.kubernetes.io/part-of: cilium
|
||||
{{- with .Values.hubble.relay.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.hubble.relay.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: hubble-relay
|
||||
{{- with .Values.hubble.relay.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
image: {{ include "cilium.image" .Values.hubble.relay.image | quote }}
|
||||
imagePullPolicy: {{ .Values.hubble.relay.image.pullPolicy }}
|
||||
command:
|
||||
- hubble-relay
|
||||
args:
|
||||
- serve
|
||||
{{- if .Values.debug.enabled }}
|
||||
- --debug
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: grpc
|
||||
containerPort: {{ .Values.hubble.relay.listenPort }}
|
||||
{{- if .Values.hubble.relay.prometheus.enabled }}
|
||||
- name: prometheus
|
||||
containerPort: {{ .Values.hubble.relay.prometheus.port }}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
{{- include "hubble-relay.probe" . | nindent 12 }}
|
||||
{{- if semverCompare "<1.20-0" .Capabilities.KubeVersion.Version }}
|
||||
# Starting from Kubernetes 1.20, we are using startupProbe instead
|
||||
# of this field.
|
||||
initialDelaySeconds: 5
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
{{- include "hubble-relay.probe" . | nindent 12 }}
|
||||
{{- if semverCompare "<1.20-0" .Capabilities.KubeVersion.Version }}
|
||||
# Starting from Kubernetes 1.20, we are using startupProbe instead
|
||||
# of this field.
|
||||
initialDelaySeconds: 60
|
||||
{{- end }}
|
||||
{{- if semverCompare ">=1.20-0" .Capabilities.KubeVersion.Version }}
|
||||
startupProbe:
|
||||
# give the relay one minute to start up
|
||||
{{- include "hubble-relay.probe" . | nindent 12 }}
|
||||
failureThreshold: 20
|
||||
periodSeconds: 3
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.relay.extraEnv }}
|
||||
env:
|
||||
{{- toYaml . | trim | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.relay.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/hubble-relay
|
||||
readOnly: true
|
||||
{{- if .Values.hubble.tls.enabled }}
|
||||
- name: tls
|
||||
mountPath: /var/lib/hubble-relay/tls
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.relay.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
restartPolicy: Always
|
||||
priorityClassName: {{ .Values.hubble.relay.priorityClassName }}
|
||||
serviceAccount: {{ .Values.serviceAccounts.relay.name | quote }}
|
||||
serviceAccountName: {{ .Values.serviceAccounts.relay.name | quote }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccounts.relay.automount }}
|
||||
terminationGracePeriodSeconds: {{ .Values.hubble.relay.terminationGracePeriodSeconds }}
|
||||
{{- with .Values.hubble.relay.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.relay.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- range $constraint := . }}
|
||||
- {{ toYaml $constraint | nindent 8 | trim }}
|
||||
{{- if not $constraint.labelSelector }}
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
k8s-app: hubble-relay
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.relay.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.relay.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: hubble-relay-config
|
||||
items:
|
||||
- key: config.yaml
|
||||
path: config.yaml
|
||||
{{- if .Values.hubble.tls.enabled }}
|
||||
- name: tls
|
||||
projected:
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
sources:
|
||||
- secret:
|
||||
name: hubble-relay-client-certs
|
||||
items:
|
||||
- key: tls.crt
|
||||
path: client.crt
|
||||
- key: tls.key
|
||||
path: client.key
|
||||
{{- if not .Values.tls.caBundle.enabled }}
|
||||
- key: ca.crt
|
||||
path: hubble-server-ca.crt
|
||||
{{- else }}
|
||||
- {{ .Values.tls.caBundle.useSecret | ternary "secret" "configMap" }}:
|
||||
name: {{ .Values.tls.caBundle.name }}
|
||||
items:
|
||||
- key: {{ .Values.tls.caBundle.key }}
|
||||
path: hubble-server-ca.crt
|
||||
{{- end }}
|
||||
{{- if .Values.hubble.relay.tls.server.enabled }}
|
||||
- secret:
|
||||
name: hubble-relay-server-certs
|
||||
items:
|
||||
- key: tls.crt
|
||||
path: server.crt
|
||||
- key: tls.key
|
||||
path: server.key
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.relay.extraVolumes }}
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "hubble-relay.probe" }}
|
||||
{{- /* This distinction can be removed once we drop support for k8s 1.23 */}}
|
||||
{{- if semverCompare ">=1.24-0" .Capabilities.KubeVersion.Version -}}
|
||||
grpc:
|
||||
port: 4222
|
||||
{{- else }}
|
||||
exec:
|
||||
command:
|
||||
- grpc_health_probe
|
||||
- -addr=localhost:4222
|
||||
{{- end }}
|
||||
timeoutSeconds: 3
|
||||
{{- end }}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- if and .Values.hubble.enabled .Values.hubble.relay.enabled .Values.hubble.relay.prometheus.enabled }}
|
||||
# We use a separate service from hubble-relay which can be exposed externally
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: hubble-relay-metrics
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.hubble.relay.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: hubble-relay
|
||||
spec:
|
||||
clusterIP: None
|
||||
type: ClusterIP
|
||||
selector:
|
||||
k8s-app: hubble-relay
|
||||
ports:
|
||||
- name: metrics
|
||||
port: {{ .Values.hubble.relay.prometheus.port }}
|
||||
protocol: TCP
|
||||
targetPort: prometheus
|
||||
{{- end }}
|
||||
@@ -0,0 +1,26 @@
|
||||
{{- if and .Values.hubble.enabled .Values.hubble.relay.enabled .Values.hubble.relay.podDisruptionBudget.enabled }}
|
||||
{{- $component := .Values.hubble.relay.podDisruptionBudget }}
|
||||
apiVersion: {{ include "podDisruptionBudget.apiVersion" . }}
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: hubble-relay
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.hubble.relay.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: hubble-relay
|
||||
app.kubernetes.io/name: hubble-relay
|
||||
app.kubernetes.io/part-of: cilium
|
||||
spec:
|
||||
{{- with $component.maxUnavailable }}
|
||||
maxUnavailable: {{ . }}
|
||||
{{- end }}
|
||||
{{- with $component.minAvailable }}
|
||||
minAvailable: {{ . }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: hubble-relay
|
||||
{{- end }}
|
||||
@@ -0,0 +1,30 @@
|
||||
{{- if and .Values.hubble.enabled .Values.hubble.relay.enabled }}
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: hubble-relay
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.hubble.relay.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: hubble-relay
|
||||
app.kubernetes.io/name: hubble-relay
|
||||
app.kubernetes.io/part-of: cilium
|
||||
spec:
|
||||
type: {{ .Values.hubble.relay.service.type | quote }}
|
||||
selector:
|
||||
k8s-app: hubble-relay
|
||||
ports:
|
||||
- protocol: TCP
|
||||
{{- if .Values.hubble.relay.servicePort }}
|
||||
port: {{ .Values.hubble.relay.servicePort }}
|
||||
{{- else }}
|
||||
port: {{ .Values.hubble.relay.tls.server.enabled | ternary 443 80 }}
|
||||
{{- end }}
|
||||
targetPort: {{ .Values.hubble.relay.listenPort }}
|
||||
{{- if and (eq "NodePort" .Values.hubble.relay.service.type) .Values.hubble.relay.service.nodePort }}
|
||||
nodePort: {{ .Values.hubble.relay.service.nodePort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and .Values.hubble.enabled .Values.hubble.relay.enabled .Values.serviceAccounts.relay.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ .Values.serviceAccounts.relay.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or .Values.serviceAccounts.relay.annotations .Values.hubble.relay.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.hubble.relay.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccounts.relay.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,39 @@
|
||||
{{- if and .Values.hubble.enabled .Values.hubble.relay.enabled .Values.hubble.relay.prometheus.enabled .Values.hubble.relay.prometheus.serviceMonitor.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: hubble-relay
|
||||
namespace: {{ .Values.hubble.relay.prometheus.serviceMonitor.namespace | default .Release.Namespace }}
|
||||
labels:
|
||||
{{- with .Values.hubble.relay.prometheus.serviceMonitor.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.hubble.relay.prometheus.serviceMonitor.annotations .Values.hubble.relay.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.hubble.relay.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.relay.prometheus.serviceMonitor.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: hubble-relay
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
endpoints:
|
||||
- port: metrics
|
||||
interval: {{ .Values.hubble.relay.prometheus.serviceMonitor.interval | quote }}
|
||||
path: /metrics
|
||||
{{- with .Values.hubble.relay.prometheus.serviceMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.relay.prometheus.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,61 @@
|
||||
{{- define "hubble-ui.nginx.conf" }}
|
||||
server {
|
||||
listen 8081;
|
||||
{{- if .Values.hubble.ui.frontend.server.ipv6.enabled }}
|
||||
listen [::]:8081;
|
||||
{{- end }}
|
||||
server_name localhost;
|
||||
root /app;
|
||||
index index.html;
|
||||
client_max_body_size 1G;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
# CORS
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, HEAD, DELETE, OPTIONS";
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
add_header Access-Control-Max-Age 1728000;
|
||||
add_header Access-Control-Expose-Headers content-length,grpc-status,grpc-message;
|
||||
add_header Access-Control-Allow-Headers range,keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout;
|
||||
if ($request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
||||
# /CORS
|
||||
|
||||
location {{ .Values.hubble.ui.baseUrl }}api {
|
||||
{{- if not (eq .Values.hubble.ui.baseUrl "/") }}
|
||||
rewrite ^{{ (trimSuffix "/" .Values.hubble.ui.baseUrl) }}(/.*)$ $1 break;
|
||||
{{- end }}
|
||||
proxy_http_version 1.1;
|
||||
proxy_pass_request_headers on;
|
||||
proxy_hide_header Access-Control-Allow-Origin;
|
||||
{{- if eq .Values.hubble.ui.baseUrl "/" }}
|
||||
proxy_pass http://127.0.0.1:8090;
|
||||
{{- else }}
|
||||
proxy_pass http://127.0.0.1:8090/;
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
{{- if not (eq .Values.hubble.ui.baseUrl "/") }}
|
||||
sub_filter_once on;
|
||||
sub_filter '<base href="/"/>' '<base href="{{ .Values.hubble.ui.baseUrl }}"/>';
|
||||
{{- end }}
|
||||
location {{ .Values.hubble.ui.baseUrl }} {
|
||||
{{- if not (eq .Values.hubble.ui.baseUrl "/") }}
|
||||
rewrite ^{{ (trimSuffix "/" .Values.hubble.ui.baseUrl) }}(/.*)$ $1 break;
|
||||
{{- end }}
|
||||
# double `/index.html` is required here
|
||||
try_files $uri $uri/ /index.html /index.html;
|
||||
}
|
||||
|
||||
# Liveness probe
|
||||
location /healthz {
|
||||
access_log off;
|
||||
add_header Content-Type text/plain;
|
||||
return 200 'ok';
|
||||
}
|
||||
}
|
||||
}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,50 @@
|
||||
{{- if and (or .Values.hubble.enabled .Values.hubble.ui.standalone.enabled) .Values.hubble.ui.enabled .Values.serviceAccounts.ui.create }}
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: hubble-ui
|
||||
{{- with .Values.hubble.ui.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
rules:
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- networkpolicies
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- componentstatuses
|
||||
- endpoints
|
||||
- namespaces
|
||||
- nodes
|
||||
- pods
|
||||
- services
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- cilium.io
|
||||
resources:
|
||||
- "*"
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and (or .Values.hubble.enabled .Values.hubble.ui.standalone.enabled) .Values.hubble.ui.enabled .Values.serviceAccounts.ui.create }}
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: hubble-ui
|
||||
{{- with .Values.hubble.ui.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/part-of: cilium
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: hubble-ui
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.serviceAccounts.ui.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{- if and (or .Values.hubble.enabled .Values.hubble.ui.standalone.enabled) .Values.hubble.ui.enabled }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: hubble-ui-nginx
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.hubble.ui.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
nginx.conf: {{ include "hubble-ui.nginx.conf" . | trim | quote }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,214 @@
|
||||
{{- if and (or .Values.hubble.enabled .Values.hubble.ui.standalone.enabled) .Values.hubble.ui.enabled }}
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: hubble-ui
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.hubble.ui.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: hubble-ui
|
||||
app.kubernetes.io/name: hubble-ui
|
||||
app.kubernetes.io/part-of: cilium
|
||||
spec:
|
||||
replicas: {{ .Values.hubble.ui.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: hubble-ui
|
||||
{{- with .Values.hubble.ui.updateStrategy }}
|
||||
strategy:
|
||||
{{- toYaml . | trim | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- if .Values.hubble.ui.rollOutPods }}
|
||||
# ensure pods roll when configmap updates
|
||||
cilium.io/hubble-ui-nginx-configmap-checksum: {{ include (print $.Template.BasePath "/hubble-ui/configmap.yaml") . | sha256sum | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.ui.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: hubble-ui
|
||||
app.kubernetes.io/name: hubble-ui
|
||||
app.kubernetes.io/part-of: cilium
|
||||
{{- with .Values.hubble.ui.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.hubble.ui.securityContext }}
|
||||
securityContext:
|
||||
{{- omit . "enabled" | toYaml | nindent 8 }}
|
||||
{{- end }}
|
||||
priorityClassName: {{ .Values.hubble.ui.priorityClassName }}
|
||||
serviceAccount: {{ .Values.serviceAccounts.ui.name | quote }}
|
||||
serviceAccountName: {{ .Values.serviceAccounts.ui.name | quote }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccounts.ui.automount }}
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: frontend
|
||||
image: {{ include "cilium.image" .Values.hubble.ui.frontend.image | quote }}
|
||||
imagePullPolicy: {{ .Values.hubble.ui.frontend.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8081
|
||||
{{- with .Values.hubble.ui.frontend.extraEnv }}
|
||||
env:
|
||||
{{- toYaml . | trim | nindent 12 }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8081
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 8081
|
||||
{{- with .Values.hubble.ui.frontend.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: hubble-ui-nginx-conf
|
||||
mountPath: /etc/nginx/conf.d/default.conf
|
||||
subPath: nginx.conf
|
||||
- name: tmp-dir
|
||||
mountPath: /tmp
|
||||
{{- with .Values.hubble.ui.frontend.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- with .Values.hubble.ui.frontend.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
- name: backend
|
||||
image: {{ include "cilium.image" .Values.hubble.ui.backend.image | quote }}
|
||||
imagePullPolicy: {{ .Values.hubble.ui.backend.image.pullPolicy }}
|
||||
env:
|
||||
- name: EVENTS_SERVER_PORT
|
||||
value: "8090"
|
||||
{{- if .Values.hubble.relay.tls.server.enabled }}
|
||||
- name: FLOWS_API_ADDR
|
||||
value: "hubble-relay:443"
|
||||
- name: TLS_TO_RELAY_ENABLED
|
||||
value: "true"
|
||||
- name: TLS_RELAY_SERVER_NAME
|
||||
value: {{ .Values.hubble.relay.tls.server.relayName }}
|
||||
- name: TLS_RELAY_CA_CERT_FILES
|
||||
value: /var/lib/hubble-ui/certs/hubble-relay-ca.crt
|
||||
- name: TLS_RELAY_CLIENT_CERT_FILE
|
||||
value: /var/lib/hubble-ui/certs/client.crt
|
||||
- name: TLS_RELAY_CLIENT_KEY_FILE
|
||||
value: /var/lib/hubble-ui/certs/client.key
|
||||
{{- else }}
|
||||
- name: FLOWS_API_ADDR
|
||||
value: "hubble-relay:80"
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.ui.backend.extraEnv }}
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.hubble.ui.backend.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8090
|
||||
{{- end }}
|
||||
{{- if .Values.hubble.ui.backend.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8090
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: grpc
|
||||
containerPort: 8090
|
||||
{{- with .Values.hubble.ui.backend.resources }}
|
||||
resources:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.hubble.relay.tls.server.enabled }}
|
||||
- name: hubble-ui-client-certs
|
||||
mountPath: /var/lib/hubble-ui/certs
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.ui.backend.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- with .Values.hubble.ui.backend.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | trim | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.ui.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.ui.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- range $constraint := . }}
|
||||
- {{ toYaml $constraint | nindent 8 | trim }}
|
||||
{{- if not $constraint.labelSelector }}
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
k8s-app: hubble-ui
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.ui.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.ui.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | trim | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: hubble-ui-nginx
|
||||
name: hubble-ui-nginx-conf
|
||||
- emptyDir: {}
|
||||
name: tmp-dir
|
||||
{{- if .Values.hubble.relay.tls.server.enabled }}
|
||||
- name: hubble-ui-client-certs
|
||||
{{- if .Values.hubble.ui.standalone.enabled }}
|
||||
{{- toYaml .Values.hubble.ui.standalone.tls.certsVolume | nindent 8 }}
|
||||
{{- else }}
|
||||
projected:
|
||||
# note: the leading zero means this number is in octal representation: do not remove it
|
||||
defaultMode: 0400
|
||||
sources:
|
||||
- secret:
|
||||
name: hubble-ui-client-certs
|
||||
items:
|
||||
- key: tls.crt
|
||||
path: client.crt
|
||||
- key: tls.key
|
||||
path: client.key
|
||||
{{- if not .Values.tls.caBundle.enabled }}
|
||||
- key: ca.crt
|
||||
path: hubble-relay-ca.crt
|
||||
{{- else }}
|
||||
- {{ .Values.tls.caBundle.useSecret | ternary "secret" "configMap" }}:
|
||||
name: {{ .Values.tls.caBundle.name }}
|
||||
items:
|
||||
- key: {{ .Values.tls.caBundle.key }}
|
||||
path: hubble-relay-ca.crt
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.ui.frontend.extraVolumes }}
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.ui.backend.extraVolumes }}
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,40 @@
|
||||
{{- if and (or .Values.hubble.enabled .Values.hubble.ui.standalone.enabled) .Values.hubble.ui.enabled .Values.hubble.ui.ingress.enabled }}
|
||||
{{- $baseUrl := .Values.hubble.ui.baseUrl -}}
|
||||
apiVersion: {{ template "ingress.apiVersion" . }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: hubble-ui
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
k8s-app: hubble-ui
|
||||
app.kubernetes.io/name: hubble-ui
|
||||
app.kubernetes.io/part-of: cilium
|
||||
{{- with .Values.hubble.ui.ingress.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.hubble.ui.ingress.annotations .Values.hubble.ui.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.hubble.ui.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.ui.ingress.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.hubble.ui.ingress.className }}
|
||||
ingressClassName: {{ .Values.hubble.ui.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.hubble.ui.ingress.tls }}
|
||||
tls:
|
||||
{{- toYaml .Values.hubble.ui.ingress.tls | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.hubble.ui.ingress.hosts }}
|
||||
- host: {{ . }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $baseUrl | quote }}
|
||||
{{- include "ingress.paths" $ | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,26 @@
|
||||
{{- if and (or .Values.hubble.enabled .Values.hubble.ui.standalone.enabled) .Values.hubble.ui.enabled .Values.hubble.ui.podDisruptionBudget.enabled }}
|
||||
{{- $component := .Values.hubble.ui.podDisruptionBudget }}
|
||||
apiVersion: {{ include "podDisruptionBudget.apiVersion" . }}
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: hubble-ui
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.hubble.ui.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: hubble-ui
|
||||
app.kubernetes.io/name: hubble-ui
|
||||
app.kubernetes.io/part-of: cilium
|
||||
spec:
|
||||
{{- with $component.maxUnavailable }}
|
||||
maxUnavailable: {{ . }}
|
||||
{{- end }}
|
||||
{{- with $component.minAvailable }}
|
||||
minAvailable: {{ . }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: hubble-ui
|
||||
{{- end }}
|
||||
@@ -0,0 +1,31 @@
|
||||
{{- if and (or .Values.hubble.enabled .Values.hubble.ui.standalone.enabled) .Values.hubble.ui.enabled }}
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: hubble-ui
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or .Values.hubble.ui.service.annotations .Values.hubble.ui.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.hubble.ui.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.hubble.ui.service.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
labels:
|
||||
k8s-app: hubble-ui
|
||||
app.kubernetes.io/name: hubble-ui
|
||||
app.kubernetes.io/part-of: cilium
|
||||
spec:
|
||||
type: {{ .Values.hubble.ui.service.type | quote }}
|
||||
selector:
|
||||
k8s-app: hubble-ui
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 8081
|
||||
{{- if and (eq "NodePort" .Values.hubble.ui.service.type) .Values.hubble.ui.service.nodePort }}
|
||||
nodePort: {{ .Values.hubble.ui.service.nodePort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and (or .Values.hubble.enabled .Values.hubble.ui.standalone.enabled) .Values.hubble.ui.enabled .Values.serviceAccounts.ui.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ .Values.serviceAccounts.ui.name | quote }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- if or .Values.serviceAccounts.ui.annotations .Values.hubble.ui.annotations }}
|
||||
annotations:
|
||||
{{- with .Values.hubble.ui.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccounts.ui.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user