-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[kube-prometheus-stack] add network policies (#2580)
Signed-off-by: QuentinBisson <quentin@giantswarm.io> Signed-off-by: QuentinBisson <quentin@giantswarm.io>
- Loading branch information
1 parent
ecb874e
commit 2857c46
Showing
5 changed files
with
85 additions
and
1 deletion.
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
29 changes: 29 additions & 0 deletions
29
...emplates/prometheus-operator/admission-webhooks/job-patch/networkpolicy-createSecret.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,29 @@ | ||
{{- if .Values.prometheusOperator.networkPolicy.enabled }} | ||
{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.admissionWebhooks.enabled .Values.prometheusOperator.admissionWebhooks.patch.enabled (not .Values.prometheusOperator.admissionWebhooks.certManager.enabled) }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ template "kube-prometheus-stack.fullname" . }}-admission-create | ||
namespace: {{ template "kube-prometheus-stack.namespace" . }} | ||
annotations: | ||
"helm.sh/hook": pre-install,pre-upgrade | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
## Ensure this is run before the job | ||
"helm.sh/hook-weight": "-5" | ||
{{- with .Values.prometheusOperator.admissionWebhooks.annotations }} | ||
{{ toYaml . | indent 4 }} | ||
{{- end }} | ||
labels: | ||
app: {{ template "kube-prometheus-stack.name" $ }}-admission-create | ||
{{- include "kube-prometheus-stack.labels" $ | indent 4 }} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: {{ template "kube-prometheus-stack.name" $ }}-admission-create | ||
{{- include "kube-prometheus-stack.labels" $ | indent 6 }} | ||
egress: | ||
- {} | ||
policyTypes: | ||
- Egress | ||
{{- end }} | ||
{{- end }} |
29 changes: 29 additions & 0 deletions
29
...emplates/prometheus-operator/admission-webhooks/job-patch/networkpolicy-patchWebhook.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,29 @@ | ||
{{- if .Values.prometheusOperator.networkPolicy.enabled }} | ||
{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.admissionWebhooks.enabled .Values.prometheusOperator.admissionWebhooks.patch.enabled (not .Values.prometheusOperator.admissionWebhooks.certManager.enabled) }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ template "kube-prometheus-stack.fullname" . }}-admission-patch | ||
namespace: {{ template "kube-prometheus-stack.namespace" . }} | ||
annotations: | ||
"helm.sh/hook": post-install,post-upgrade | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
## Ensure this is run before the job | ||
"helm.sh/hook-weight": "-5" | ||
{{- with .Values.prometheusOperator.admissionWebhooks.patch.annotations }} | ||
{{ toYaml . | indent 4 }} | ||
{{- end }} | ||
labels: | ||
app: {{ template "kube-prometheus-stack.name" $ }}-admission-patch | ||
{{- include "kube-prometheus-stack.labels" $ | indent 4 }} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: {{ template "kube-prometheus-stack.name" $ }}-admission-patch | ||
{{- include "kube-prometheus-stack.labels" $ | indent 6 }} | ||
egress: | ||
- {} | ||
policyTypes: | ||
- Egress | ||
{{- end }} | ||
{{- end }} |
21 changes: 21 additions & 0 deletions
21
charts/kube-prometheus-stack/templates/prometheus-operator/networkpolicy.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,21 @@ | ||
{{- if .Values.prometheusOperator.networkPolicy.enabled }} | ||
apiVersion: {{ template "prometheus.networkPolicy.apiVersion" . }} | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ template "kube-prometheus-stack.fullname" . }}-operator | ||
namespace: {{ template "kube-prometheus-stack.namespace" . }} | ||
labels: | ||
app: {{ template "kube-prometheus-stack.name" . }}-operator | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: {{ template "kube-prometheus-stack.name" . }}-operator | ||
release: {{ $.Release.Name | quote }} | ||
ingress: | ||
- ports: | ||
{{- if .Values.prometheusOperator.tls.enabled }} | ||
- port: {{ .Values.prometheusOperator.tls.internalPort }} | ||
{{- else }} | ||
- port: 8080 | ||
{{- 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