4f0a22345e
The calicoctl-utility container is leaving behind zombie processes and setting 'shareProcessNamespace: true' eliminates that problem. When you enable process namespace sharing for a Pod, Kubernetes uses a single process namespace for all the containers in that Pod. The Kubernetes Pod infrastructure container becomes PID 1 and automatically reaps orphaned processes. [0] [0]https://cloud.google.com/solutions/best-practices-for-building-containers#solution_2_enable_process_namespace_sharing_in_kubernetes Change-Id: I8efc08942ac281f5da0f0819fc5f181eca15d25b
216 lines
7.4 KiB
YAML
216 lines
7.4 KiB
YAML
{{/*
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/}}
|
|
|
|
{{- if .Values.manifests.deployment_calicoctl_utility }}
|
|
{{- $envAll := . }}
|
|
|
|
{{- $serviceAccountName := printf "%s" $envAll.Release.Name }}
|
|
{{ tuple $envAll "utility" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: {{ $serviceAccountName }}
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: ClusterRole
|
|
name: {{ $serviceAccountName }}
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: {{ $serviceAccountName }}
|
|
namespace: {{ .Release.Namespace }}
|
|
---
|
|
kind: ClusterRole
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
metadata:
|
|
name: {{ $serviceAccountName }}
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources:
|
|
- namespaces
|
|
- nodes
|
|
- pods
|
|
- pods/status
|
|
- serviceaccounts
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
- apiGroups: ["extensions"]
|
|
resources:
|
|
- networkpolicies
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
- apiGroups: ["networking.k8s.io"]
|
|
resources:
|
|
- networkpolicies
|
|
verbs:
|
|
- watch
|
|
- list
|
|
- get
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
resources:
|
|
- globalfelixconfigs
|
|
- bgppeers
|
|
- globalbgpconfigs
|
|
- bgpconfigurations
|
|
- clusterinformations
|
|
- licensekeys
|
|
- felixconfigurations
|
|
- globalthreatfeeds
|
|
- globalnetworkpolicies
|
|
- globalnetworksets
|
|
- networksets
|
|
- remoteclusterconfigurations
|
|
- ippools
|
|
- networkpolicies
|
|
- tiers
|
|
- profiles
|
|
- clusterinformations
|
|
- hostendpoints
|
|
- ipamblocks
|
|
- blockaffinities
|
|
- ipamhandles
|
|
verbs:
|
|
- get
|
|
- list
|
|
---
|
|
kind: Deployment
|
|
apiVersion: apps/v1
|
|
metadata:
|
|
name: {{ printf "%s" $envAll.Release.Name }}
|
|
labels:
|
|
{{ tuple $envAll "calico" "utility" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
|
spec:
|
|
replicas: {{ .Values.pod.replicas.utility }}
|
|
selector:
|
|
matchLabels:
|
|
{{ tuple $envAll "calico" "utility" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
|
|
template:
|
|
metadata:
|
|
name: {{ printf "%s" $envAll.Release.Name }}
|
|
labels:
|
|
{{ tuple $envAll "calico" "utility" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
|
annotations:
|
|
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
|
|
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
|
|
{{ dict "envAll" $envAll "podName" "calicoctl-utility" "containerNames" (list "calicoctl-utility") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
|
|
{{ tuple . | include "helm-toolkit.snippets.release_uuid" | indent 8}}
|
|
spec:
|
|
{{ dict "envAll" $envAll "application" "calico" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
|
|
serviceAccountName: {{ $serviceAccountName }}
|
|
nodeSelector:
|
|
{{ .Values.labels.utility.node_selector_key }}: {{ .Values.labels.utility.node_selector_value }}
|
|
shareProcessNamespace: true
|
|
containers:
|
|
- name: calicoctl-utility
|
|
{{ tuple $envAll "calicoctl_utility" | include "helm-toolkit.snippets.image" | indent 10 }}
|
|
{{ tuple $envAll $envAll.Values.pod.resources.calicoctl_utility | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
|
{{ dict "envAll" $envAll "application" "calico" "container" "calicoctl_utility" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
|
|
command:
|
|
- "bootstrap.sh"
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
{{- if .Values.conf.utility.match_versions }}
|
|
- /usr/local/bin/version_check.sh
|
|
{{- else }}
|
|
- utilscli
|
|
- calicoctl
|
|
- version
|
|
{{- end }}
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 15
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- utilscli
|
|
- calicoctl
|
|
- version
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 15
|
|
volumeMounts:
|
|
{{- if and .Values.manifests.secret_certificates (include "calico.etcd.tls" .) }}
|
|
- name: calico-etcd-secrets
|
|
mountPath: {{ .Values.endpoints.etcd.auth.client.path.ca }}
|
|
subPath: tls.ca
|
|
readOnly: true
|
|
- name: calico-etcd-secrets
|
|
mountPath: {{ .Values.endpoints.etcd.auth.client.path.crt }}
|
|
subPath: tls.crt
|
|
readOnly: true
|
|
- name: calico-etcd-secrets
|
|
mountPath: {{ .Values.endpoints.etcd.auth.client.path.key }}
|
|
subPath: tls.key
|
|
readOnly: true
|
|
{{- end }}
|
|
- name: calicoctl-utility-bin-utilscli
|
|
mountPath: /usr/local/bin/version_check.sh
|
|
subPath: version_check.sh
|
|
readOnly: true
|
|
- name: calicoctl-utility-bin-utilscli
|
|
mountPath: /usr/local/bin/bootstrap.sh
|
|
subPath: bootstrap.sh
|
|
readOnly: true
|
|
- name: calicoctl-utility-bin-utilscli
|
|
mountPath: /usr/local/bin/utilscli
|
|
subPath: utilscli
|
|
readOnly: true
|
|
- name: calicoctl-utility-bin
|
|
mountPath: /usr/local/bin/calicoctl-utility-rootwrap
|
|
subPath: calicoctl-utility-rootwrap
|
|
readOnly: true
|
|
- name: calicoctl-utility-sudoers
|
|
mountPath: /etc/sudoers.d/nobody
|
|
subPath: utilscli-sudo
|
|
readOnly: true
|
|
- name: calicoctl-utility-etc
|
|
mountPath: /etc/calicoctl/rootwrap.d/calicoctl.filter
|
|
subPath: calicoctl.filter
|
|
readOnly: true
|
|
- name: calicoctl-utility-etc
|
|
mountPath: /etc/calicoctl/rootwrap.conf
|
|
subPath: rootwrap.conf
|
|
readOnly: true
|
|
- name: calicoctl-utility-etc
|
|
mountPath: /etc/calico/calicoctl.cfg
|
|
subPath: calicoctl.cfg
|
|
readOnly: true
|
|
volumes:
|
|
- name: calicoctl-utility-sudoers
|
|
configMap:
|
|
name: {{ printf "%s-%s" $envAll.Release.Name "sudoers" }}
|
|
defaultMode: 0644
|
|
- name: calicoctl-utility-bin
|
|
configMap:
|
|
name: {{ printf "%s-%s" $envAll.Release.Name "bin" }}
|
|
defaultMode: 0500
|
|
- name: calicoctl-utility-bin-utilscli
|
|
configMap:
|
|
name: {{ printf "%s-%s" $envAll.Release.Name "bin-utilscli" }}
|
|
defaultMode: 0555
|
|
- name: calicoctl-utility-etc
|
|
configMap:
|
|
name: {{ printf "%s-%s" $envAll.Release.Name "etc" }}
|
|
defaultMode: 0400
|
|
{{- if .Values.manifests.secret_certificates }}
|
|
- name: calico-etcd-secrets
|
|
secret:
|
|
secretName: calico-etcd-secrets
|
|
defaultMode: 0400
|
|
{{- end }}
|
|
{{- end }}
|