8afa84729f
This updates the calicoctl-utility chart to include the pod security context on the pod template. This also adds the container security context to set readOnlyRootFilesystem flag to false Change-Id: I5fa54165f0409ca56dd8aafeda028a7398122c4b
216 lines
7.3 KiB
YAML
216 lines
7.3 KiB
YAML
{{/*
|
|
Copyright 2019 The Openstack-Helm Authors.
|
|
|
|
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 "utility" "calicoctl-util" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
|
spec:
|
|
replicas: {{ .Values.pod.replicas.utility }}
|
|
selector:
|
|
matchLabels:
|
|
{{ tuple $envAll "utility" "calicoctl-util" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
|
|
template:
|
|
metadata:
|
|
name: {{ printf "%s" $envAll.Release.Name }}
|
|
labels:
|
|
{{ tuple $envAll "utility" "calicoctl-util" | 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" }}
|
|
{{ tuple . | include "helm-toolkit.snippets.release_uuid" | indent 8}}
|
|
spec:
|
|
{{ dict "envAll" $envAll "application" "calicoctl_util" | 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 }}
|
|
containers:
|
|
- name: {{ printf "%s" $envAll.Release.Name }}
|
|
{{ 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" "calicoctl_util" "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 }}
|