rancher-partner-charts/charts/linkerd/linkerd-control-plane/2024.7.1/templates/proxy-injector-rbac.yaml

121 lines
4.4 KiB
YAML
Raw Normal View History

2021-09-30 22:13:01 +00:00
---
###
### Proxy Injector RBAC
###
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: linkerd-{{.Release.Namespace}}-proxy-injector
2021-09-30 22:13:01 +00:00
labels:
linkerd.io/control-plane-component: proxy-injector
linkerd.io/control-plane-ns: {{.Release.Namespace}}
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
2021-09-30 22:13:01 +00:00
rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "patch"]
- apiGroups: [""]
resources: ["namespaces", "replicationcontrollers"]
verbs: ["list", "get", "watch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["list", "watch"]
- apiGroups: ["extensions", "apps"]
resources: ["deployments", "replicasets", "daemonsets", "statefulsets"]
verbs: ["list", "get", "watch"]
- apiGroups: ["extensions", "batch"]
resources: ["cronjobs", "jobs"]
verbs: ["list", "get", "watch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: linkerd-{{.Release.Namespace}}-proxy-injector
2021-09-30 22:13:01 +00:00
labels:
linkerd.io/control-plane-component: proxy-injector
linkerd.io/control-plane-ns: {{.Release.Namespace}}
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
2021-09-30 22:13:01 +00:00
subjects:
- kind: ServiceAccount
name: linkerd-proxy-injector
namespace: {{.Release.Namespace}}
2021-09-30 22:13:01 +00:00
apiGroup: ""
roleRef:
kind: ClusterRole
name: linkerd-{{.Release.Namespace}}-proxy-injector
2021-09-30 22:13:01 +00:00
apiGroup: rbac.authorization.k8s.io
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: linkerd-proxy-injector
namespace: {{ .Release.Namespace }}
2021-09-30 22:13:01 +00:00
labels:
linkerd.io/control-plane-component: proxy-injector
linkerd.io/control-plane-ns: {{.Release.Namespace}}
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
2021-09-30 22:13:01 +00:00
{{- include "partials.image-pull-secrets" .Values.imagePullSecrets }}
---
{{- $host := printf "linkerd-proxy-injector.%s.svc" .Release.Namespace }}
2021-09-30 22:13:01 +00:00
{{- $ca := genSelfSignedCert $host (list) (list $host) 365 }}
{{- if (not .Values.proxyInjector.externalSecret) }}
kind: Secret
apiVersion: v1
metadata:
name: linkerd-proxy-injector-k8s-tls
namespace: {{ .Release.Namespace }}
2021-09-30 22:13:01 +00:00
labels:
linkerd.io/control-plane-component: proxy-injector
linkerd.io/control-plane-ns: {{.Release.Namespace}}
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
2021-09-30 22:13:01 +00:00
annotations:
{{ include "partials.annotations.created-by" . }}
type: kubernetes.io/tls
data:
tls.crt: {{ ternary (b64enc (trim $ca.Cert)) (b64enc (trim .Values.proxyInjector.crtPEM)) (empty .Values.proxyInjector.crtPEM) }}
tls.key: {{ ternary (b64enc (trim $ca.Key)) (b64enc (trim .Values.proxyInjector.keyPEM)) (empty .Values.proxyInjector.keyPEM) }}
---
{{- end }}
{{- include "linkerd.webhook.validation" .Values.proxyInjector }}
2021-09-30 22:13:01 +00:00
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: linkerd-proxy-injector-webhook-config
{{- if or (.Values.proxyInjector.injectCaFrom) (.Values.proxyInjector.injectCaFromSecret) }}
annotations:
{{- if .Values.proxyInjector.injectCaFrom }}
cert-manager.io/inject-ca-from: {{ .Values.proxyInjector.injectCaFrom }}
{{- end }}
{{- if .Values.proxyInjector.injectCaFromSecret }}
cert-manager.io/inject-ca-from-secret: {{ .Values.proxyInjector.injectCaFromSecret }}
{{- end }}
{{- end }}
2021-09-30 22:13:01 +00:00
labels:
linkerd.io/control-plane-component: proxy-injector
linkerd.io/control-plane-ns: {{.Release.Namespace}}
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
2021-09-30 22:13:01 +00:00
webhooks:
- name: linkerd-proxy-injector.linkerd.io
namespaceSelector:
{{- toYaml .Values.proxyInjector.namespaceSelector | trim | nindent 4 }}
objectSelector:
{{- toYaml .Values.proxyInjector.objectSelector | trim | nindent 4 }}
2021-09-30 22:13:01 +00:00
clientConfig:
service:
name: linkerd-proxy-injector
namespace: {{ .Release.Namespace }}
2021-09-30 22:13:01 +00:00
path: "/"
{{- if and (empty .Values.proxyInjector.injectCaFrom) (empty .Values.proxyInjector.injectCaFromSecret) }}
2021-09-30 22:13:01 +00:00
caBundle: {{ ternary (b64enc (trim $ca.Cert)) (b64enc (trim .Values.proxyInjector.caBundle)) (empty .Values.proxyInjector.caBundle) }}
{{- end }}
2021-09-30 22:13:01 +00:00
failurePolicy: {{.Values.webhookFailurePolicy}}
admissionReviewVersions: ["v1", "v1beta1"]
rules:
- operations: [ "CREATE" ]
apiGroups: [""]
apiVersions: ["v1"]
resources: ["pods", "services"]
2024-04-03 19:02:06 +00:00
scope: "Namespaced"
2021-09-30 22:13:01 +00:00
sideEffects: None
timeoutSeconds: {{ .Values.proxyInjector.timeoutSeconds | default 10 }}