2022-07-27 19:33:21 +00:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ServiceAccount
|
|
|
|
metadata:
|
|
|
|
name: nginx-mesh-api
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
imagePullSecrets:
|
|
|
|
- name: {{ include "registry-key-name" . }}
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: ClusterRole
|
|
|
|
metadata:
|
|
|
|
name: nginx-mesh-api.internal.builtin.nsm.nginx
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
rules:
|
2023-02-16 16:33:45 +00:00
|
|
|
- apiGroups: [""]
|
|
|
|
resources: ["namespaces"]
|
|
|
|
verbs: ["get", "list", "watch"]
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: ["services", "endpoints"]
|
|
|
|
verbs: ["*"]
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: ["secrets", "pods"]
|
|
|
|
verbs: ["create", "get", "list", "watch"]
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: ["configmaps"]
|
|
|
|
verbs: ["get", "list", "watch", "update"]
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: ["events"]
|
|
|
|
verbs: ["create", "patch"]
|
|
|
|
- apiGroups: ["apps"]
|
|
|
|
resources: ["replicasets"]
|
|
|
|
verbs: ["get", "list", "watch"]
|
|
|
|
- apiGroups: ["apps"]
|
|
|
|
resources: ["statefulsets", "deployments", "daemonsets"]
|
|
|
|
verbs: ["list", "watch"]
|
|
|
|
- apiGroups: ["split.smi-spec.io"]
|
|
|
|
resources: ["trafficsplits"]
|
|
|
|
verbs: ["*"]
|
|
|
|
- apiGroups: ["access.smi-spec.io"]
|
|
|
|
resources: ["traffictargets"]
|
|
|
|
verbs: ["*"]
|
|
|
|
- apiGroups: ["specs.smi-spec.io"]
|
|
|
|
resources: ["httproutegroups", "tcproutes"]
|
|
|
|
verbs: ["*"]
|
|
|
|
- apiGroups: ["specs.smi.nginx.com"]
|
|
|
|
resources: ["ratelimits", "circuitbreakers"]
|
|
|
|
verbs: ["*"]
|
|
|
|
- apiGroups: ["admissionregistration.k8s.io"]
|
|
|
|
resources: ["mutatingwebhookconfigurations"]
|
|
|
|
resourceNames: ["sidecar-injector-webhook-cfg.internal.builtin.nsm.nginx"]
|
|
|
|
verbs: ["get", "update"]
|
|
|
|
- apiGroups: ["admissionregistration.k8s.io"]
|
|
|
|
resources: ["validatingwebhookconfigurations"]
|
|
|
|
resourceNames: ["validating-webhook-cfg.internal.builtin.nsm.nginx"]
|
|
|
|
verbs: ["get", "update"]
|
2022-07-27 19:33:21 +00:00
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: ClusterRoleBinding
|
|
|
|
metadata:
|
|
|
|
name: nginx-mesh-api.internal.builtin.nsm.nginx
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: ClusterRole
|
|
|
|
name: nginx-mesh-api.internal.builtin.nsm.nginx
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: nginx-mesh-api
|
|
|
|
namespace: {{ .Release.Namespace }}
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: Role
|
|
|
|
metadata:
|
|
|
|
name: nginx-mesh-api.internal.builtin.nsm.nginx
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
rules:
|
2023-02-16 16:33:45 +00:00
|
|
|
- apiGroups: ["apps"]
|
|
|
|
resources: ["statefulsets", "deployments", "daemonsets"]
|
|
|
|
resourceNames: ["spire-server", "spire-agent"]
|
|
|
|
verbs: ["get", "patch"]
|
2022-07-27 19:33:21 +00:00
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: RoleBinding
|
|
|
|
metadata:
|
|
|
|
name: nginx-mesh-api.internal.builtin.nsm.nginx
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: Role
|
|
|
|
name: nginx-mesh-api.internal.builtin.nsm.nginx
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: nginx-mesh-api
|
|
|
|
namespace: {{ .Release.Namespace }}
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: ClusterRoleBinding
|
|
|
|
metadata:
|
|
|
|
name: nginx-mesh-api-svc.internal.builtin.nsm.nginx
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: ClusterRole
|
|
|
|
name: system:auth-delegator
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: nginx-mesh-api
|
|
|
|
namespace: {{ .Release.Namespace }}
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: RoleBinding
|
|
|
|
metadata:
|
|
|
|
name: nginx-mesh-api-svc.internal.builtin.nsm.nginx
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: Role
|
|
|
|
name: extension-apiserver-authentication-reader
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: nginx-mesh-api
|
|
|
|
namespace: {{ .Release.Namespace }}
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
metadata:
|
|
|
|
name: mesh-config
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
binaryData:
|
|
|
|
mesh-config.json: {{ tpl (.Files.Get "configs/mesh-config.conf") . | b64enc | quote }}
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: nginx-mesh-api
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- name: https
|
|
|
|
port: 443
|
|
|
|
targetPort: 8443
|
|
|
|
protocol: TCP
|
|
|
|
selector:
|
|
|
|
app.kubernetes.io/name: nginx-mesh-api
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: nginx-mesh-webhook
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: nginx-mesh-api
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- name: admission
|
|
|
|
port: 443
|
|
|
|
targetPort: 9443
|
|
|
|
protocol: TCP
|
|
|
|
selector:
|
|
|
|
app.kubernetes.io/name: nginx-mesh-api
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
---
|
|
|
|
apiVersion: admissionregistration.k8s.io/v1
|
|
|
|
kind: MutatingWebhookConfiguration
|
|
|
|
metadata:
|
|
|
|
name: sidecar-injector-webhook-cfg.internal.builtin.nsm.nginx
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
spiffe.io/webhook: "true"
|
|
|
|
webhooks:
|
|
|
|
- name: nginx-mesh-api.sidecar.injector
|
|
|
|
namespaceSelector:
|
|
|
|
matchExpressions:
|
2022-11-02 21:13:54 +00:00
|
|
|
- key: kubernetes.io/metadata.name
|
2022-07-27 19:33:21 +00:00
|
|
|
operator: NotIn
|
|
|
|
values:
|
2023-02-16 16:33:45 +00:00
|
|
|
- kube-system
|
2022-11-02 21:13:54 +00:00
|
|
|
- {{ .Release.Namespace }}
|
2022-07-27 19:33:21 +00:00
|
|
|
clientConfig:
|
|
|
|
service:
|
|
|
|
name: nginx-mesh-webhook
|
|
|
|
namespace: {{ .Release.Namespace }}
|
2023-02-16 16:33:45 +00:00
|
|
|
path: /inject
|
2022-07-27 19:33:21 +00:00
|
|
|
sideEffects: None
|
2023-02-16 16:33:45 +00:00
|
|
|
admissionReviewVersions: ["v1"]
|
2022-07-27 19:33:21 +00:00
|
|
|
rules:
|
2023-02-16 16:33:45 +00:00
|
|
|
- apiGroups: [""]
|
|
|
|
apiVersions: ["v1"]
|
|
|
|
operations: ["CREATE"]
|
|
|
|
resources: ["pods"]
|
2022-07-27 19:33:21 +00:00
|
|
|
---
|
|
|
|
apiVersion: admissionregistration.k8s.io/v1
|
|
|
|
kind: ValidatingWebhookConfiguration
|
|
|
|
metadata:
|
|
|
|
name: validating-webhook-cfg.internal.builtin.nsm.nginx
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
spiffe.io/webhook: "true"
|
|
|
|
webhooks:
|
|
|
|
- name: nginx-mesh-api.policy.validator
|
|
|
|
clientConfig:
|
|
|
|
service:
|
|
|
|
name: nginx-mesh-webhook
|
|
|
|
namespace: {{ .Release.Namespace }}
|
2023-02-16 16:33:45 +00:00
|
|
|
path: /validate
|
2022-07-27 19:33:21 +00:00
|
|
|
sideEffects: None
|
2023-02-16 16:33:45 +00:00
|
|
|
admissionReviewVersions: ["v1"]
|
2022-07-27 19:33:21 +00:00
|
|
|
rules:
|
2023-02-16 16:33:45 +00:00
|
|
|
- apiGroups: ["split.smi-spec.io"]
|
|
|
|
apiVersions: ["*"]
|
|
|
|
operations: ["CREATE", "UPDATE", "DELETE"]
|
|
|
|
resources: ["trafficsplits"]
|
|
|
|
- apiGroups: ["specs.smi-spec.io"]
|
|
|
|
apiVersions: ["*"]
|
|
|
|
operations: ["CREATE", "UPDATE"]
|
|
|
|
resources: ["httproutegroups"]
|
|
|
|
- apiGroups: ["specs.smi.nginx.com"]
|
|
|
|
apiVersions: ["*"]
|
|
|
|
operations: ["CREATE", "UPDATE", "DELETE"]
|
|
|
|
resources: ["circuitbreakers", "ratelimits"]
|
2022-07-27 19:33:21 +00:00
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: nginx-mesh-api
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: nginx-mesh-api
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
spec:
|
|
|
|
replicas: 1
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app.kubernetes.io/name: nginx-mesh-api
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: nginx-mesh-api
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
spiffe.io/spiffeid: "true"
|
|
|
|
spec:
|
|
|
|
serviceAccountName: nginx-mesh-api
|
|
|
|
containers:
|
|
|
|
- name: nginx-mesh-api
|
|
|
|
image: {{ .Values.registry.server }}/nginx-mesh-api:{{ .Values.registry.imageTag }}
|
|
|
|
imagePullPolicy: {{ .Values.registry.imagePullPolicy }}
|
|
|
|
args:
|
2023-02-16 16:33:45 +00:00
|
|
|
- -meshconfig=/etc/config/mesh-config.json
|
|
|
|
- -tlsDir=/tmp/webhooks
|
|
|
|
- -logtostderr
|
|
|
|
- -v=3
|
2022-07-27 19:33:21 +00:00
|
|
|
env:
|
|
|
|
- name: PULL_POLICY
|
|
|
|
value: {{ .Values.registry.imagePullPolicy }}
|
|
|
|
- name: MY_UID
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.uid
|
|
|
|
- name: MY_POD_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.name
|
|
|
|
- name: MY_NAMESPACE
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.namespace
|
|
|
|
securityContext:
|
|
|
|
allowPrivilegeEscalation: false
|
|
|
|
privileged: false
|
|
|
|
runAsUser: 2102
|
|
|
|
capabilities:
|
|
|
|
drop:
|
2023-02-16 16:33:45 +00:00
|
|
|
- all
|
2022-07-27 19:33:21 +00:00
|
|
|
add:
|
2023-02-16 16:33:45 +00:00
|
|
|
- NET_ADMIN
|
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /healthz
|
|
|
|
port: 8081
|
|
|
|
initialDelaySeconds: 5
|
|
|
|
periodSeconds: 10
|
|
|
|
failureThreshold: 30
|
2022-07-27 19:33:21 +00:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
2023-02-16 16:33:45 +00:00
|
|
|
path: /healthz
|
2022-07-27 19:33:21 +00:00
|
|
|
port: 8081
|
|
|
|
initialDelaySeconds: 5
|
|
|
|
periodSeconds: 10
|
|
|
|
failureThreshold: 30
|
|
|
|
volumeMounts:
|
|
|
|
- name: config-volume
|
2023-02-16 16:33:45 +00:00
|
|
|
mountPath: /etc/config
|
2022-07-27 19:33:21 +00:00
|
|
|
- name: spire-agent-socket
|
2023-02-16 16:33:45 +00:00
|
|
|
mountPath: /run/spire/sockets
|
2022-07-27 19:33:21 +00:00
|
|
|
volumes:
|
|
|
|
- name: config-volume
|
|
|
|
configMap:
|
|
|
|
name: mesh-config
|
|
|
|
items:
|
|
|
|
- key: mesh-config.json
|
|
|
|
path: mesh-config.json
|
|
|
|
- name: spire-agent-socket
|
|
|
|
{{ if eq .Values.environment "openshift" -}}
|
|
|
|
csi:
|
2023-02-16 16:33:45 +00:00
|
|
|
driver: csi.spiffe.io
|
2022-07-27 19:33:21 +00:00
|
|
|
readOnly: true
|
|
|
|
{{- else -}}
|
|
|
|
hostPath:
|
2023-02-16 16:33:45 +00:00
|
|
|
path: /run/spire/sockets
|
2022-07-27 19:33:21 +00:00
|
|
|
type: DirectoryOrCreate
|
|
|
|
{{- end }}
|
|
|
|
---
|
|
|
|
apiVersion: apiregistration.k8s.io/v1
|
|
|
|
kind: APIService
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
spiffe.io/apiservice: "true"
|
|
|
|
name: v1alpha1.nsm.nginx.com
|
|
|
|
spec:
|
|
|
|
group: nsm.nginx.com
|
|
|
|
groupPriorityMinimum: 100
|
|
|
|
service:
|
|
|
|
name: nginx-mesh-api
|
|
|
|
namespace: {{ .Release.Namespace}}
|
|
|
|
port: 443
|
|
|
|
version: v1alpha1
|
|
|
|
versionPriority: 100
|
|
|
|
{{- if eq .Values.environment "openshift" }}
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: ClusterRole
|
|
|
|
metadata:
|
|
|
|
name: system:openshift:scc:nginx-mesh-api-permissions
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
rules:
|
2023-02-16 16:33:45 +00:00
|
|
|
- apiGroups: ["security.openshift.io"]
|
|
|
|
resources: ["securitycontextconstraints"]
|
|
|
|
resourceNames: ["nginx-mesh-api-permissions"]
|
|
|
|
verbs: ["use"]
|
2022-07-27 19:33:21 +00:00
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: RoleBinding
|
|
|
|
metadata:
|
|
|
|
name: system:openshift:scc:nginx-mesh-api-permissions
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: ClusterRole
|
|
|
|
name: system:openshift:scc:nginx-mesh-api-permissions
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: nginx-mesh-api
|
|
|
|
namespace: {{ .Release.Namespace }}
|
|
|
|
---
|
|
|
|
apiVersion: security.openshift.io/v1
|
|
|
|
kind: SecurityContextConstraints
|
|
|
|
metadata:
|
|
|
|
name: nginx-mesh-api-permissions
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
allowHostDirVolumePlugin: false
|
|
|
|
allowHostIPC: false
|
|
|
|
allowHostNetwork: false
|
|
|
|
allowHostPID: false
|
|
|
|
allowHostPorts: false
|
|
|
|
allowPrivilegedContainer: false
|
|
|
|
seLinuxContext:
|
|
|
|
type: MustRunAs
|
|
|
|
readOnlyRootFilesystem: false
|
|
|
|
runAsUser:
|
|
|
|
type: MustRunAsNonRoot
|
|
|
|
fsGroup:
|
|
|
|
type: MustRunAs
|
|
|
|
volumes:
|
|
|
|
- configMap
|
|
|
|
- csi
|
|
|
|
- secret
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: ClusterRole
|
|
|
|
metadata:
|
|
|
|
name: system:openshift:scc:nginx-mesh-permissions
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
rules:
|
2023-02-16 16:33:45 +00:00
|
|
|
- apiGroups: ["security.openshift.io"]
|
|
|
|
resources: ["securitycontextconstraints"]
|
|
|
|
resourceNames: ["nginx-mesh-permissions"]
|
|
|
|
verbs: ["use"]
|
2022-07-27 19:33:21 +00:00
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: ClusterRoleBinding
|
|
|
|
metadata:
|
|
|
|
name: system:openshift:scc:nginx-mesh-permissions
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: ClusterRole
|
|
|
|
name: system:openshift:scc:nginx-mesh-permissions
|
|
|
|
subjects:
|
|
|
|
- kind: Group
|
|
|
|
name: system:authenticated
|
|
|
|
---
|
|
|
|
apiVersion: security.openshift.io/v1
|
|
|
|
kind: SecurityContextConstraints
|
|
|
|
metadata:
|
|
|
|
name: nginx-mesh-permissions
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/part-of: nginx-service-mesh
|
|
|
|
allowHostDirVolumePlugin: false
|
|
|
|
allowHostIPC: false
|
|
|
|
allowHostNetwork: false
|
|
|
|
allowHostPID: false
|
|
|
|
allowHostPorts: false
|
|
|
|
allowPrivilegedContainer: false
|
|
|
|
allowedCapabilities:
|
|
|
|
- NET_ADMIN
|
|
|
|
seLinuxContext:
|
|
|
|
type: RunAsAny
|
|
|
|
runAsUser:
|
|
|
|
type: MustRunAsNonRoot
|
|
|
|
fsGroup:
|
|
|
|
type: MustRunAs
|
|
|
|
readOnlyRootFilesystem: false
|
|
|
|
requiredDropCapabilities:
|
|
|
|
- ALL
|
|
|
|
volumes:
|
|
|
|
- configMap
|
|
|
|
- downwardAPI
|
|
|
|
- emptyDir
|
|
|
|
- persistentVolumeClaim
|
|
|
|
- projected
|
|
|
|
- secret
|
|
|
|
- csi
|
|
|
|
{{- end }}
|