rancher-charts/charts/rancher-provisioning-capi/104.0.0+up0.2.0/templates/hardened.yaml

82 lines
2.2 KiB
YAML
Raw Normal View History

apiVersion: batch/v1
kind: Job
metadata:
name: rancher-provisioning-capi-patch-sa
namespace: {{ .Release.Namespace }}
labels:
app: rancher-provisioning-capi-patch-sa
annotations:
"helm.sh/hook": post-install, post-upgrade
"helm.sh/hook-delete-policy": hook-succeeded, before-hook-creation
spec:
template:
metadata:
name: rancher-provisioning-capi-patch-sa
labels:
app: rancher-provisioning-capi-patch-sa
spec:
serviceAccountName: rancher-provisioning-capi-patch-sa
securityContext:
runAsNonRoot: true
runAsUser: 1000
restartPolicy: Never
nodeSelector: {{ include "linux-node-selector" . | nindent 8 }}
tolerations: {{ include "linux-node-tolerations" . | nindent 8 }}
containers:
- name: patch-sa-{{ .Release.Namespace }}
image: {{ template "system_default_registry" $ }}{{ $.Values.global.kubectl.repository }}:{{ $.Values.global.kubectl.tag }}
imagePullPolicy: {{ $.Values.global.kubectl.pullPolicy }}
command: ["kubectl", "patch", "serviceaccount", "default", "-p", "{\"automountServiceAccountToken\": false}"]
args: ["-n", "{{ .Release.Namespace }}"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: rancher-provisioning-capi-patch-sa
labels:
app: rancher-provisioning-capi-patch-sa
rules:
- apiGroups:
- ""
resources:
- serviceaccounts
verbs: ['get', 'patch']
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: rancher-provisioning-capi-patch-sa
labels:
app: rancher-provisioning-capi-patch-sa
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: rancher-provisioning-capi-patch-sa
subjects:
- kind: ServiceAccount
name: rancher-provisioning-capi-patch-sa
namespace: {{ .Release.Namespace }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: rancher-provisioning-capi-patch-sa
namespace: {{ .Release.Namespace }}
labels:
app: rancher-provisioning-capi-patch-sa
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-allow-all
namespace: {{ .Release.Namespace }}
spec:
podSelector: {}
ingress:
- {}
egress:
- {}
policyTypes:
- Ingress
- Egress