-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Frank Jogeleit <[email protected]>
- Loading branch information
Frank Jogeleit
committed
Mar 10, 2024
1 parent
a25e54f
commit b568a16
Showing
44 changed files
with
1,881 additions
and
552 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
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
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,23 @@ | ||
leaderElection: | ||
enabled: {{ or .Values.plugin.kyverno.leaderElection.enabled (gt (int .Values.plugin.kyverno.replicaCount) 1) }} | ||
releaseOnCancel: {{ .Values.plugin.kyverno.leaderElection.releaseOnCancel }} | ||
leaseDuration: {{ .Values.plugin.kyverno.leaderElection.leaseDuration }} | ||
renewDeadline: {{ .Values.plugin.kyverno.leaderElection.renewDeadline }} | ||
retryPeriod: {{ .Values.plugin.kyverno.leaderElection.retryPeriod }} | ||
lockName: {{ .Values.plugin.kyverno.leaderElection.lockName }} | ||
|
||
logging: | ||
encoding: {{ .Values.plugin.kyverno.logging.encoding }} | ||
logLevel: {{ .Values.plugin.kyverno.logging.logLevel }} | ||
|
||
server: | ||
logging: {{ .Values.plugin.kyverno.server.logging }} | ||
basicAuth: | ||
username: {{ .Values.plugin.kyverno.server.basicAuth.username }} | ||
password: {{ .Values.plugin.kyverno.server.basicAuth.password }} | ||
secretRef: {{ .Values.plugin.kyverno.server.basicAuth.secretRef }} | ||
|
||
{{- with .Values.plugin.kyverno.blockReports }} | ||
blockReports: | ||
{{- toYaml . | nindent 4 }} | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
logging: | ||
encoding: {{ .Values.plugin.trivy.logging.encoding }} | ||
logLevel: {{ .Values.plugin.trivy.logging.logLevel }} | ||
|
||
server: | ||
logging: {{ .Values.plugin.trivy.server.logging }} | ||
basicAuth: | ||
username: {{ .Values.plugin.trivy.server.basicAuth.username }} | ||
password: {{ .Values.plugin.trivy.server.basicAuth.password }} | ||
secretRef: {{ .Values.plugin.trivy.server.basicAuth.secretRef }} | ||
|
||
core: | ||
host: {{ printf "http://%s:%d" (include "policyreporter.fullname" .) (.Values.service.port | int) }} | ||
skipTLS: {{ .Values.plugin.trivy.policyReporter.skipTLS }} | ||
certificate: {{ .Values.plugin.trivy.policyReporter.certificate }} | ||
secretRef: {{ .Values.plugin.trivy.policyReporter.secretRef }} | ||
basicAuth: | ||
username: {{ .Values.global.basicAuth.username }} | ||
password: {{ .Values.global.basicAuth.password }} |
File renamed without changes.
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
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
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
65 changes: 65 additions & 0 deletions
65
charts/policy-reporter/templates/plugins/kyverno/_helpers.tpl
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,65 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "kyverno-plugin.name" -}} | ||
{{ template "policyreporter.name" . }}-kyverno-plugin | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "kyverno-plugin.fullname" -}} | ||
{{ template "policyreporter.fullname" . }}-kyverno-plugin | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "kyverno-plugin.chart" -}} | ||
{{ template "policyreporter.chart" . }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "kyverno-plugin.labels" -}} | ||
helm.sh/chart: {{ include "kyverno-plugin.chart" . }} | ||
{{ include "kyverno-plugin.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "kyverno-plugin.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "kyverno-plugin.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "kyverno-plugin.serviceAccountName" -}} | ||
{{- if .Values.plugin.kyverno.serviceAccount.create }} | ||
{{- default (include "kyverno-plugin.fullname" .) .Values.plugin.kyverno.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.plugin.kyverno.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "kyverno-plugin.podDisruptionBudget" -}} | ||
{{- if and .Values.plugin.kyverno.podDisruptionBudget.minAvailable .Values.plugin.kyverno.podDisruptionBudget.maxUnavailable }} | ||
{{- fail "Cannot set both" -}} | ||
{{- end }} | ||
{{- if not .Values.plugin.kyverno.podDisruptionBudget.maxUnavailable }} | ||
minAvailable: {{ default 1 .Values.plugin.kyverno.podDisruptionBudget.minAvailable }} | ||
{{- end }} | ||
{{- if .Values.plugin.kyverno.podDisruptionBudget.maxUnavailable }} | ||
maxUnavailable: {{ .Values.plugin.kyverno.podDisruptionBudget.maxUnavailable }} | ||
{{- end }} | ||
{{- end }} |
45 changes: 45 additions & 0 deletions
45
charts/policy-reporter/templates/plugins/kyverno/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,45 @@ | ||
{{- if .Values.plugin.kyverno.enabled -}} | ||
{{- if .Values.plugin.kyverno.rbac.enabled -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
labels: | ||
rbac.authorization.k8s.io/aggregate-to-admin: "true" | ||
{{- include "kyverno-plugin.labels" . | nindent 4 }} | ||
name: {{ include "kyverno-plugin.fullname" . }} | ||
rules: | ||
- apiGroups: | ||
- '*' | ||
resources: | ||
- policies | ||
- policies/status | ||
- clusterpolicies | ||
- clusterpolicies/status | ||
verbs: | ||
- get | ||
- list | ||
{{- if .Values.plugin.kyverno.blockReports.enabled }} | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- events | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- '*' | ||
resources: | ||
- policyreports | ||
- policyreports/status | ||
- clusterpolicyreports | ||
- clusterpolicyreports/status | ||
verbs: | ||
- get | ||
- list | ||
- create | ||
- update | ||
- delete | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
18 changes: 18 additions & 0 deletions
18
charts/policy-reporter/templates/plugins/kyverno/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,18 @@ | ||
{{- if .Values.plugin.kyverno.enabled -}} | ||
{{- if and .Values.plugin.kyverno.serviceAccount.create .Values.plugin.kyverno.rbac.enabled -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "kyverno-plugin.fullname" . }} | ||
labels: | ||
{{- include "kyverno-plugin.labels" . | nindent 4 }} | ||
roleRef: | ||
kind: ClusterRole | ||
name: {{ include "kyverno-plugin.fullname" . }} | ||
apiGroup: rbac.authorization.k8s.io | ||
subjects: | ||
- kind: "ServiceAccount" | ||
name: {{ include "kyverno-plugin.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
{{- end }} | ||
{{- end }} |
12 changes: 12 additions & 0 deletions
12
charts/policy-reporter/templates/plugins/kyverno/config-secret.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,12 @@ | ||
{{- if .Values.plugin.kyverno.enabled -}} | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ include "kyverno-plugin.fullname" . }}-config | ||
namespace: {{ include "policyreporter.namespace" . }} | ||
labels: | ||
{{- include "kyverno-plugin.labels" . | nindent 4 }} | ||
type: Opaque | ||
data: | ||
config.yaml: {{ tpl (.Files.Get "kyverno-plugin.tmpl") . | b64enc }} | ||
{{- end }} |
103 changes: 103 additions & 0 deletions
103
charts/policy-reporter/templates/plugins/kyverno/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,103 @@ | ||
{{- if .Values.plugin.kyverno.enabled -}} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "kyverno-plugin.fullname" . }} | ||
namespace: {{ include "policyreporter.namespace" . }} | ||
labels: | ||
{{- include "kyverno-plugin.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.plugin.kyverno.replicaCount }} | ||
revisionHistoryLimit: {{ .Values.plugin.kyverno.revisionHistoryLimit }} | ||
{{- with .Values.plugin.kyverno.updateStrategy }} | ||
strategy: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
selector: | ||
matchLabels: | ||
{{- include "kyverno-plugin.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
checksum/secret: {{ include (print .Template.BasePath "/config-secret.yaml") . | sha256sum | quote }} | ||
{{- with .Values.plugin.kyverno.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "kyverno-plugin.labels" . | nindent 8 }} | ||
{{- with .Values.plugin.kyverno.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
{{- with .Values.plugin.kyverno.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "kyverno-plugin.serviceAccountName" . }} | ||
{{- if .Values.plugin.kyverno.podSecurityContext }} | ||
securityContext: | ||
{{- toYaml .Values.plugin.kyverno.podSecurityContext | nindent 8 }} | ||
{{- end }} | ||
containers: | ||
- name: policy-reporter-kyverno-plugin | ||
{{- if .Values.plugin.kyverno.securityContext }} | ||
securityContext: | ||
{{- toYaml .Values.plugin.kyverno.securityContext | nindent 12 }} | ||
{{- end }} | ||
image: "{{ .Values.plugin.kyverno.image.registry }}/{{ .Values.plugin.kyverno.image.repository }}:{{ .Values.plugin.kyverno.image.tag }}" | ||
imagePullPolicy: {{ .Values.plugin.kyverno.image.pullPolicy }} | ||
args: | ||
- run | ||
- --config=/app/config.yaml | ||
- --port={{ .Values.plugin.kyverno.server.port }} | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.plugin.kyverno.server.port }} | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /api/v1/policies | ||
port: http | ||
readinessProbe: | ||
httpGet: | ||
path: /api/v1/policies | ||
port: http | ||
resources: | ||
{{- toYaml .Values.plugin.kyverno.resources | nindent 12 }} | ||
volumeMounts: | ||
- name: config-file | ||
mountPath: /app/config.yaml | ||
subPath: config.yaml | ||
readOnly: true | ||
env: | ||
- name: POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
{{- if or .Values.plugin.kyverno.leaderElection.enabled (gt (int .Values.plugin.kyverno.replicaCount) 1) }} | ||
- name: POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
{{- end }} | ||
{{- with .Values.plugin.kyverno.envVars }} | ||
{{- . | toYaml | trim | nindent 10 }} | ||
{{- end }} | ||
volumes: | ||
- name: config-file | ||
secret: | ||
secretName: {{ include "kyverno-plugin.fullname" . }}-config | ||
optional: true | ||
{{- with .Values.plugin.kyverno.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.plugin.kyverno.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.plugin.kyverno.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.