Skip to content

Commit f5bd56f

Browse files
committed
chore(pmm): pmm network support
1 parent 9e65f72 commit f5bd56f

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{{- /*
2+
Copyright Drycc Community.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{- if .Values.networkPolicy.enabled }}
7+
kind: NetworkPolicy
8+
apiVersion: {{ template "common.capabilities.networkPolicy.apiVersion" . }}
9+
metadata:
10+
name: {{ template "common.names.fullname" . }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
12+
labels: {{- include "common.labels.standard" . | nindent 4 }}
13+
{{- if .Values.commonLabels }}
14+
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
15+
{{- end }}
16+
{{- if .Values.commonAnnotations }}
17+
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
18+
{{- end }}
19+
spec:
20+
podSelector:
21+
matchLabels:
22+
{{- include "common.labels.matchLabels" . | nindent 6 }}
23+
{{- if eq .Values.service.type "ClusterIP" }}
24+
ingress:
25+
# Allow inbound connections
26+
{{- with .Values.service.ports }}
27+
- ports:
28+
{{- toYaml . | nindent 8 }}
29+
{{- end }}
30+
{{- if or .Values.networkPolicy.allowCurrentNamespace .Values.networkPolicy.allowNamespaces }}
31+
from:
32+
{{- if .Values.networkPolicy.allowCurrentNamespace }}
33+
- namespaceSelector:
34+
matchLabels:
35+
kubernetes.io/metadata.name: {{ .Release.Namespace }}
36+
{{- end }}
37+
{{- range $namespace := .Values.networkPolicy.allowNamespaces }}
38+
{{- if $namespace }}
39+
- namespaceSelector:
40+
matchLabels:
41+
kubernetes.io/metadata.name: {{ $namespace }}
42+
{{- end }}
43+
{{- end }}
44+
{{- end }}
45+
{{- end }}
46+
{{- if eq .Values.service.type "LoadBalancer" }}
47+
ingress:
48+
- {}
49+
{{- end}}
50+
{{- end }}

addons/pmm/2.41/chart/pmm/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,18 @@ extraVolumeMounts: []
226226
## @param extraVolumes Optionally specify extra list of additional volumes
227227
##
228228
extraVolumes: []
229+
230+
## Nework Policy configuration
231+
##
232+
networkPolicy:
233+
## @param networkPolicy.enabled Enable creation of NetworkPolicy resources
234+
##
235+
enabled: true
236+
## @param networkPolicy.allowExternal The Policy model to apply.
237+
## When set to false, only pods with the correct
238+
## client label will have network access to the port MySQL is listening
239+
## on. When true, MySQL will accept connections from any source
240+
## (with the correct destination port).
241+
##
242+
allowCurrentNamespace: true
243+
allowNamespaces: []

0 commit comments

Comments
 (0)