-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #458 from kubescape/feature/admission
Adding helm chart for admission controller
- Loading branch information
Showing
11 changed files
with
297 additions
and
71 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
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
20 changes: 20 additions & 0 deletions
20
charts/kubescape-operator/templates/operator/admission-service.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,20 @@ | ||
{{- $components := fromYaml (include "components" .) }} | ||
{{- if $components.operator.enabled }} | ||
{{- if eq .Values.capabilities.admissionController "enable" }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: "kubescape-admission-webhook" | ||
namespace: {{ .Values.ksNamespace }} | ||
labels: | ||
app: {{ .Values.operator.name }} | ||
kubescape.io/ignore: "true" | ||
spec: | ||
ports: | ||
- port: 443 | ||
targetPort: 8443 | ||
selector: | ||
app: {{ .Values.operator.name }} | ||
type: ClusterIP # Or use LoadBalancer or NodePort if needed | ||
{{- end }} | ||
{{- end }} |
42 changes: 42 additions & 0 deletions
42
charts/kubescape-operator/templates/operator/admission-webhook.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,42 @@ | ||
{{- $components := fromYaml (include "components" .) }} | ||
{{- if $components.operator.enabled }} | ||
{{- if eq .Values.capabilities.admissionController "enable" }} | ||
{{- $svcName := (printf "kubescape-admission-webhook.%s.svc" .Release.Namespace) -}} | ||
{{- $certData := fromYaml (include "admission-certificates" .) -}} | ||
{{- $ca := $certData.ca -}} | ||
{{- $cert := $certData.cert -}} | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ $svcName }}-kubescape-tls-pair | ||
namespace: {{ .Values.ksNamespace }} | ||
type: kubernetes.io/tls | ||
data: | ||
tls.key: {{ $cert.Key | b64enc }} | ||
tls.crt: {{ $cert.Cert | b64enc }} | ||
--- | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingWebhookConfiguration | ||
metadata: | ||
name: validation | ||
webhooks: | ||
- name: validation.kubescape.admission | ||
clientConfig: | ||
service: | ||
name: kubescape-admission-webhook | ||
namespace: {{ .Values.ksNamespace }} | ||
path: /validate | ||
port: 443 | ||
caBundle: {{ $ca.Cert | b64enc }} | ||
admissionReviewVersions: ["v1"] | ||
sideEffects: None | ||
rules: | ||
- operations: ["CREATE", "UPDATE", "DELETE", "CONNECT"] | ||
apiGroups: ["*"] | ||
apiVersions: ["v1"] | ||
resources: ["pods", "pods/exec", "pods/portforward", "pods/attach", "clusterrolebindings", "rolebindings"] | ||
scope: "*" | ||
failurePolicy: Ignore | ||
{{- end }} | ||
{{- 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 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
Oops, something went wrong.