-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor admission controller chart (#12)
* refactor resource-templates fix invalid cluter-rolebinding fix rolebinding Signed-off-by: David J. M. Karlsen <[email protected]> * add labels Signed-off-by: David J. M. Karlsen <[email protected]> * refactor labels into a helper function Signed-off-by: David J. M. Karlsen <[email protected]> * fix labels and selector Signed-off-by: David J. M. Karlsen <[email protected]> * bump chart-version Signed-off-by: David J. M. Karlsen <[email protected]> * bump version Signed-off-by: David J. M. Karlsen <[email protected]> * fix indenting Signed-off-by: David J. M. Karlsen <[email protected]> * handle secrets Signed-off-by: David J. M. Karlsen <[email protected]> * base64 encode Signed-off-by: David J. M. Karlsen <[email protected]>
- Loading branch information
1 parent
7cf242b
commit 70ba473
Showing
15 changed files
with
224 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
credentials: | ||
users: | ||
- username: user1 | ||
password: password1 | ||
- username: user2 | ||
password: password2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 0 additions & 117 deletions
117
stable/anchore-admission-controller/templates/anchore-admission-controller.yaml
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
stable/anchore-admission-controller/templates/clusterrole.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# to let the admission server read the namespace reservations | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
labels: {{- include "anchore-admission-controller.labels" . | nindent 4 }} | ||
name: {{ template "anchore-admission-controller.fullname" . }} | ||
rules: | ||
- apiGroups: | ||
- {{ .Values.apiService.group }} | ||
resources: | ||
- {{ template "anchore-admission-controller.fullname" . }} | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- create |
43 changes: 43 additions & 0 deletions
43
stable/anchore-admission-controller/templates/clusterrolebinding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Allow delegate authentication and authorization to the service account | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: auth-delegator-{{ template "anchore-admission-controller.fullname" . }}-default | ||
labels: {{- include "anchore-admission-controller.labels" . | nindent 4 }} | ||
roleRef: | ||
kind: ClusterRole | ||
apiGroup: rbac.authorization.k8s.io | ||
name: system:auth-delegator | ||
subjects: | ||
- kind: ServiceAccount | ||
namespace: {{ .Release.Namespace }} | ||
name: {{ template "anchore-admission-controller.fullname" . }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: auth-delegator-{{ template "anchore-admission-controller.fullname" . }}-admin | ||
labels: {{- include "anchore-admission-controller.labels" . | nindent 4 }} | ||
roleRef: | ||
kind: ClusterRole | ||
apiGroup: rbac.authorization.k8s.io | ||
name: cluster-admin | ||
subjects: | ||
- kind: ServiceAccount | ||
namespace: {{ .Release.Namespace }} | ||
name: {{ template "anchore-admission-controller.fullname" . }} | ||
--- | ||
# to let the admission server read the namespace reservations | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ template "anchore-admission-controller.fullname" . }}-default | ||
labels: {{- include "anchore-admission-controller.labels" . | nindent 4 }} | ||
roleRef: | ||
kind: ClusterRole | ||
apiGroup: rbac.authorization.k8s.io | ||
name: {{ template "anchore-admission-controller.fullname" . }} | ||
subjects: | ||
- kind: ServiceAccount | ||
namespace: {{ .Release.Namespace }} | ||
name: {{ template "anchore-admission-controller.fullname" . }} |
14 changes: 14 additions & 0 deletions
14
stable/anchore-admission-controller/templates/configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Release.Name }}-controller-config | ||
labels: {{- include "anchore-admission-controller.labels" . | nindent 4 }} | ||
data: | ||
config.json: |- | ||
{ | ||
"validator": { | ||
"requestanalysis": {{ .Values.requestAnalysis }} | ||
}, | ||
"AnchoreEndpoint": "{{ .Values.anchoreEndpoint }}", | ||
"PolicySelectors": {{ toJson .Values.policySelectors }} | ||
} |
68 changes: 68 additions & 0 deletions
68
stable/anchore-admission-controller/templates/deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ template "anchore-admission-controller.fullname" . }} | ||
labels: {{- include "anchore-admission-controller.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "anchore-admission-controller.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: {{- include "anchore-admission-controller.labels" . | nindent 8 }} | ||
spec: | ||
serviceAccountName: {{ template "anchore-admission-controller.fullname" . }} | ||
volumes: | ||
- name: serving-cert | ||
secret: | ||
defaultMode: 420 | ||
secretName: {{ template "anchore-admission-controller.name" . }}-certs | ||
- name: controller-config | ||
configMap: | ||
name: {{.Release.Name}}-controller-config | ||
- name: anchore-auth | ||
secret: | ||
secretName: {{ if .Values.existingCredentialsSecret }}{{ .Values.existingCredentialsSecret }}{{ else }}{{ template "anchore-admission-controller.fullname" . }}{{ end }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image }}" | ||
imagePullPolicy: {{ .Values.imagePullPolicy }} | ||
command: | ||
- "/anchore-kubernetes-admission-controller" | ||
- "--audit-log-path=-" | ||
- "--tls-cert-file=/var/serving-cert/tls.crt" | ||
- "--tls-private-key-file=/var/serving-cert/tls.key" | ||
- "--v={{ .Values.logVerbosity }}" | ||
- "--secure-port={{ .Values.service.internalPort }}" | ||
ports: | ||
- containerPort: {{ .Values.service.internalPort }} | ||
readinessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: {{ .Values.service.internalPort }} | ||
scheme: HTTPS | ||
volumeMounts: | ||
- mountPath: /var/serving-cert | ||
name: serving-cert | ||
readOnly: true | ||
- mountPath: /config | ||
name: controller-config | ||
- mountPath: /credentials | ||
name: anchore-auth | ||
env: | ||
- name: CONFIG_FILE_PATH | ||
value: /config/config.json | ||
- name: CREDENTIALS_FILE_PATH | ||
value: /credentials/credentials.json | ||
resources: {{- toYaml .Values.resources | nindent 12 }} | ||
{{- if .Values.nodeSelector }} | ||
nodeSelector: {{- toYaml .Values.nodeSelector | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.tolerations }} | ||
tolerations: {{- toYaml .Values.tolerations | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.affinity }} | ||
affinity: {{- toYaml .Values.affinity | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.