-
Notifications
You must be signed in to change notification settings - Fork 5k
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: Markus Lippert <markuslippert@outlook.com>
- Loading branch information
1 parent
3408202
commit d09268d
Showing
17 changed files
with
120 additions
and
17 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
32 changes: 32 additions & 0 deletions
32
charts/kube-prometheus-stack/templates/prometheus/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,32 @@ | ||
{{- if .Values.prometheus.networkPolicy.enabled }} | ||
apiVersion: {{ template "kube-prometheus-stack.prometheus.networkPolicy.apiVersion" . }} | ||
kind: NetworkPolicy | ||
metadata: | ||
labels: | ||
app: {{ template "kube-prometheus-stack.name" . }}-prometheus | ||
{{- include "kube-prometheus-stack.labels" . | nindent 4 }} | ||
name: {{ template "kube-prometheus-stack.fullname" . }}-prometheus | ||
namespace: {{ template "kube-prometheus-stack.namespace" . }} | ||
spec: | ||
{{- if .Values.prometheus.networkPolicy.egress }} | ||
## Deny all egress by default | ||
egress: | ||
{{- toYaml .Values.prometheus.networkPolicy.egress | nindent 4 }} | ||
{{- end }} | ||
{{- if .Values.prometheus.networkPolicy.ingress }} | ||
# Deny all ingress by default (prometheus scrapes itself using localhost) | ||
ingress: | ||
{{- toYaml .Values.prometheus.networkPolicy.ingress | nindent 4 }} | ||
{{- end }} | ||
policyTypes: | ||
- Egress | ||
- Ingress | ||
podSelector: | ||
{{- if .Values.prometheus.networkPolicy.podSelector }} | ||
{{- toYaml .Values.prometheus.networkPolicy.podSelector | nindent 4 }} | ||
{{- else }} | ||
matchExpressions: | ||
- {key: app.kubernetes.io/name, operator: In, values: [prometheus]} | ||
- {key: prometheus, operator: In, values: [{{ template "kube-prometheus-stack.prometheus.crname" . }}]} | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{{- if .Values.networkPolicy.enabled }} | ||
kind: NetworkPolicy | ||
apiVersion: networking.k8s.io/v1 | ||
metadata: | ||
labels: | ||
{{- include "kube-state-metrics.labels" . | indent 4 }} | ||
name: {{ template "kube-state-metrics.fullname" . }} | ||
namespace: {{ template "kube-state-metrics.namespace" . }} | ||
{{- if .Values.annotations }} | ||
annotations: | ||
{{ toYaml .Values.annotations | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if .Values.networkPolicy.egress }} | ||
## Deny all egress by default | ||
egress: | ||
{{- toYaml .Values.networkPolicy.egress | nindent 4 }} | ||
{{- end }} | ||
ingress: | ||
{{- if .Values.networkPolicy.ingress }} | ||
{{- toYaml .Values.networkPolicy.ingress | nindent 4 }} | ||
{{- else }} | ||
## Allow ingress on default ports by default | ||
- ports: | ||
- port: {{ .Values.service.port | default 8080 }} | ||
protocol: TCP | ||
{{- if .Values.selfMonitor.enabled }} | ||
{{- $telemetryPort := ternary 9091 (.Values.selfMonitor.telemetryPort | default 8081) .Values.kubeRBACProxy.enabled}} | ||
- port: {{ $telemetryPort }} | ||
protocol: TCP | ||
{{- end }} | ||
{{- end }} | ||
podSelector: | ||
{{- if .Values.networkPolicy.podSelector }} | ||
{{- toYaml .Values.networkPolicy.podSelector | nindent 4 }} | ||
{{- else }} | ||
matchLabels: | ||
{{- include "kube-state-metrics.selectorLabels" . | indent 6 }} | ||
{{- end }} | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
{{- 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ image: | |
# pullSecrets: | ||
# - myRegistrKeySecretName | ||
|
||
command: [] | ||
|
||
service: | ||
type: ClusterIP | ||
port: 80 | ||
|