porthole/charts/calicoctl-utility/templates/deployment-calicoctl-utility.yaml
Alexander Vlasov b6392c5069 Add support for k8s datastore, allow access to new calico resources
Also move files related changes to Dockerfiles, change bootstrap
command in order to avoid duplicated pod log entries, updated
k8s resources API versions to be compatible with k8s 1.16, change
rootwrap filters so that 'get' command would allow querying details
about individual resources, switch to python3

Change-Id: I35fe104064b070b510ee2f1b5a4d3c709f1ab94c
2019-11-06 17:30:32 -06:00

217 lines
7.1 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:
securityContext:
runAsUser: {{ $envAll.Values.pod.sec_context.run_as_user }}
allowPrivilegeEscalation: false
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 }}
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 }}