-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add admission controller for cilium to disable kube-proxy unless alre…
…ady specified. Cilium can run without kube-proxy. There is no need to enable kube-proxy by default. With the admission controller of this change, new cilium clusters will have kube-proxy disabled by default.
- Loading branch information
Showing
37 changed files
with
1,132 additions
and
2 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
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,22 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,5 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0" | ||
description: A Helm chart for the Gardener Cilium admission controller | ||
name: gardener-extension-admission-cilium | ||
version: 0.1.0 |
5 changes: 5 additions & 0 deletions
5
charts/gardener-extension-admission-cilium/charts/application/Chart.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,5 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0" | ||
description: A Helm chart to deploy the gardener-extension-admission-cilium application related resources | ||
name: application | ||
version: 0.1.0 |
27 changes: 27 additions & 0 deletions
27
charts/gardener-extension-admission-cilium/charts/application/templates/_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,27 @@ | ||
{{- define "name" -}} | ||
gardener-extension-admission-cilium | ||
{{- end -}} | ||
|
||
{{- define "labels.app.key" -}} | ||
app.kubernetes.io/name | ||
{{- end -}} | ||
{{- define "labels.app.value" -}} | ||
{{ include "name" . }} | ||
{{- end -}} | ||
|
||
{{- define "labels" -}} | ||
{{ include "labels.app.key" . }}: {{ include "labels.app.value" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end -}} | ||
|
||
{{- define "image" -}} | ||
{{- if hasPrefix "sha256:" .tag }} | ||
{{- printf "%s@%s" .repository .tag }} | ||
{{- else }} | ||
{{- printf "%s:%s" .repository .tag }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "deploymentversion" -}} | ||
apps/v1 | ||
{{- end -}} |
37 changes: 37 additions & 0 deletions
37
...ener-extension-admission-cilium/charts/application/templates/mutatingwebhook-mutator.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,37 @@ | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: MutatingWebhookConfiguration | ||
metadata: | ||
name: {{ include "name" . }} | ||
webhooks: | ||
- name: mutation.cilium.networking.extensions.gardener.cloud | ||
rules: | ||
- apiGroups: | ||
- "core.gardener.cloud" | ||
apiVersions: | ||
- v1alpha1 | ||
- v1beta1 | ||
operations: | ||
- CREATE | ||
resources: | ||
- shoots | ||
failurePolicy: Fail | ||
objectSelector: | ||
{{- if .Values.global.webhookConfig.useObjectSelector }} | ||
matchLabels: | ||
networking.extensions.gardener.cloud/cilium: "true" | ||
{{- end }} | ||
namespaceSelector: {} | ||
sideEffects: None | ||
admissionReviewVersions: | ||
- v1 | ||
- v1beta1 | ||
clientConfig: | ||
{{- if .Values.global.virtualGarden.enabled }} | ||
url: {{ printf "https://%s.%s/webhooks/mutate" (include "name" .) (.Release.Namespace) }} | ||
{{- else }} | ||
service: | ||
namespace: {{ .Release.Namespace }} | ||
name: {{ include "name" . }} | ||
path: /webhooks/mutate | ||
{{- end }} | ||
caBundle: {{ required ".Values.global.webhookConfig.caBundle is required" .Values.global.webhookConfig.caBundle | b64enc }} |
37 changes: 37 additions & 0 deletions
37
charts/gardener-extension-admission-cilium/charts/application/templates/rbac.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,37 @@ | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "name" . }} | ||
labels: | ||
{{ include "labels" . | indent 4 }} | ||
rules: | ||
- apiGroups: | ||
- core.gardener.cloud | ||
resources: | ||
- shoots | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "name" . }} | ||
labels: | ||
{{ include "labels" . | indent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "name" . }} | ||
subjects: | ||
{{- if and .Values.global.virtualGarden.enabled .Values.global.virtualGarden.user.name }} | ||
- apiGroup: rbac.authorization.k8s.io | ||
kind: User | ||
name: {{ .Values.global.virtualGarden.user.name }} | ||
{{- else }} | ||
- kind: ServiceAccount | ||
name: {{ include "name" . }} | ||
namespace: {{ .Release.Namespace }} | ||
{{- end }} |
9 changes: 9 additions & 0 deletions
9
charts/gardener-extension-admission-cilium/charts/application/templates/serviceaccount.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,9 @@ | ||
{{- if and .Values.global.virtualGarden.enabled ( not .Values.global.virtualGarden.user.name ) }} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "name" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "labels" . | indent 4 }} | ||
{{- end }} |
1 change: 1 addition & 0 deletions
1
charts/gardener-extension-admission-cilium/charts/application/values.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 @@ | ||
../../values.yaml |
5 changes: 5 additions & 0 deletions
5
charts/gardener-extension-admission-cilium/charts/runtime/Chart.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,5 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0" | ||
description: A Helm chart to deploy the gardener-extension-admission-cilium runtime related resources | ||
name: runtime | ||
version: 0.1.0 |
27 changes: 27 additions & 0 deletions
27
charts/gardener-extension-admission-cilium/charts/runtime/templates/_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,27 @@ | ||
{{- define "name" -}} | ||
gardener-extension-admission-cilium | ||
{{- end -}} | ||
|
||
{{- define "labels.app.key" -}} | ||
app.kubernetes.io/name | ||
{{- end -}} | ||
{{- define "labels.app.value" -}} | ||
{{ include "name" . }} | ||
{{- end -}} | ||
|
||
{{- define "labels" -}} | ||
{{ include "labels.app.key" . }}: {{ include "labels.app.value" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end -}} | ||
|
||
{{- define "image" -}} | ||
{{- if hasPrefix "sha256:" .tag }} | ||
{{- printf "%s@%s" .repository .tag }} | ||
{{- else }} | ||
{{- printf "%s:%s" .repository .tag }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "deploymentversion" -}} | ||
apps/v1 | ||
{{- end -}} |
106 changes: 106 additions & 0 deletions
106
charts/gardener-extension-admission-cilium/charts/runtime/templates/deplyoment.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,106 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "name" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "labels" . | indent 4 }} | ||
spec: | ||
revisionHistoryLimit: 5 | ||
replicas: {{ .Values.global.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{ include "labels" . | indent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
checksum/secret-gardener-extension-admission-cilium-cert: {{ include (print $.Template.BasePath "/secret-cert.yaml") . | sha256sum }} | ||
{{- if .Values.global.kubeconfig }} | ||
checksum/gardener-extension-admission-cilium-kubeconfig: {{ include (print $.Template.BasePath "/secret-kubeconfig.yaml") . | sha256sum }} | ||
{{- end }} | ||
labels: | ||
{{ include "labels" . | indent 8 }} | ||
spec: | ||
{{- if not .Values.global.virtualGarden.enabled }} | ||
serviceAccountName: {{ include "name" . }} | ||
{{- else if and .Values.global.virtualGarden.enabled .Values.global.virtualGarden.user.name }} | ||
{{- if .Values.global.serviceAccountTokenVolumeProjection.enabled }} | ||
serviceAccountName: {{ include "name" . }} | ||
{{- else }} | ||
serviceAccountName: default | ||
{{- end }} | ||
{{- else }} | ||
serviceAccountName: default | ||
{{- end }} | ||
{{- if .Values.global.kubeconfig }} | ||
automountServiceAccountToken: false | ||
{{- end }} | ||
containers: | ||
- name: {{ include "name" . }} | ||
image: {{ include "image" .Values.global.image }} | ||
imagePullPolicy: {{ .Values.global.image.pullPolicy }} | ||
command: | ||
- /gardener-extension-admission-cilium | ||
- --webhook-config-server-port={{ .Values.global.webhookConfig.serverPort }} | ||
- --webhook-config-cert-dir=/etc/gardener-extension-admission-cilium/srv | ||
{{- if .Values.global.kubeconfig }} | ||
- --kubeconfig=/etc/gardener-extension-admission-cilium/kubeconfig/kubeconfig | ||
{{- end }} | ||
- --health-bind-address=:{{ .Values.global.healthPort }} | ||
ports: | ||
- name: webhook-server | ||
containerPort: {{ .Values.global.webhookConfig.serverPort }} | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: {{ .Values.global.healthPort }} | ||
scheme: HTTP | ||
initialDelaySeconds: 5 | ||
periodSeconds: 10 | ||
readinessProbe: | ||
httpGet: | ||
path: /readyz | ||
port: {{ .Values.global.healthPort }} | ||
scheme: HTTP | ||
initialDelaySeconds: 5 | ||
{{- if .Values.global.resources }} | ||
resources: | ||
{{ toYaml .Values.global.resources | nindent 10 }} | ||
{{- end }} | ||
volumeMounts: | ||
- name: gardener-extension-admission-cilium-cert | ||
mountPath: /etc/gardener-extension-admission-cilium/srv | ||
readOnly: true | ||
{{- if .Values.global.kubeconfig }} | ||
- name: gardener-extension-admission-cilium-kubeconfig | ||
mountPath: /etc/gardener-extension-admission-cilium/kubeconfig | ||
readOnly: true | ||
{{- end }} | ||
{{- if .Values.global.serviceAccountTokenVolumeProjection.enabled }} | ||
- name: service-account-token | ||
mountPath: /var/run/secrets/projected/serviceaccount | ||
readOnly: true | ||
{{- end }} | ||
volumes: | ||
- name: gardener-extension-admission-cilium-cert | ||
secret: | ||
secretName: gardener-extension-admission-cilium-cert | ||
defaultMode: 420 | ||
{{- if .Values.global.kubeconfig }} | ||
- name: gardener-extension-admission-cilium-kubeconfig | ||
secret: | ||
secretName: gardener-extension-admission-cilium-kubeconfig | ||
defaultMode: 420 | ||
{{- end }} | ||
{{- if .Values.global.serviceAccountTokenVolumeProjection.enabled }} | ||
- name: service-account-token | ||
projected: | ||
sources: | ||
- serviceAccountToken: | ||
path: token | ||
expirationSeconds: {{ .Values.global.serviceAccountTokenVolumeProjection.expirationSeconds }} | ||
{{- if .Values.global.serviceAccountTokenVolumeProjection.audience }} | ||
audience: {{ .Values.global.serviceAccountTokenVolumeProjection.audience }} | ||
{{- end }} | ||
{{- end }} |
14 changes: 14 additions & 0 deletions
14
charts/gardener-extension-admission-cilium/charts/runtime/templates/poddisruptionbudget.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 @@ | ||
{{- if gt (int .Values.global.replicaCount) 1 }} | ||
apiVersion: policy/v1beta1 | ||
kind: PodDisruptionBudget | ||
metadata: | ||
name: {{ include "name" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "labels" . | indent 4 }} | ||
spec: | ||
maxUnavailable: {{ sub (int .Values.global.replicaCount) 1 }} | ||
selector: | ||
matchLabels: | ||
{{ include "labels" . | indent 6 }} | ||
{{- end }} |
15 changes: 15 additions & 0 deletions
15
charts/gardener-extension-admission-cilium/charts/runtime/templates/secret-cert.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,15 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: gardener-extension-admission-cilium-cert | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app: gardener | ||
role: controller-manager | ||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
release: "{{ .Release.Name }}" | ||
heritage: "{{ .Release.Service }}" | ||
type: Opaque | ||
data: | ||
tls.crt: {{ required ".Values.global.webhookConfig.tls.crt is required" (b64enc .Values.global.webhookConfig.tls.crt) }} | ||
tls.key: {{ required ".Values.global.webhookConfig.tls.key is required" (b64enc .Values.global.webhookConfig.tls.key) }} |
Oops, something went wrong.