Skip to content

Commit 9200005

Browse files
ArminashexpertVersion2
authored andcommitted
Add priorityClassName, networkPolicy, and imagePullSecrets option to chart
Signed-off-by: ashexpertVersion2 <[email protected]>
1 parent 1d246ea commit 9200005

File tree

5 files changed

+53
-0
lines changed

5 files changed

+53
-0
lines changed

charts/prom-aggregation-gateway/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,14 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
2626
app.kubernetes.io/name: {{ include "prom-aggregation-gateway.name" . }}
2727
app.kubernetes.io/instance: {{ .Release.Name }}
2828
{{- end }}
29+
30+
{{/*
31+
Return the appropriate apiVersion for networkpolicy.
32+
*/}}
33+
{{- define "prom-aggregation-gateway.networkPolicy.apiVersion" -}}
34+
{{- if semverCompare ">=1.4-0, <1.7-0" .Capabilities.KubeVersion.GitVersion }}
35+
{{- print "extensions/v1beta1" }}
36+
{{- else if semverCompare "^1.7-0" .Capabilities.KubeVersion.GitVersion }}
37+
{{- print "networking.k8s.io/v1" }}
38+
{{- end }}
39+
{{- end }}

charts/prom-aggregation-gateway/templates/controller.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ spec:
6060
{{- with .Values.controller.resources }}
6161
resources: {{ . | toYaml | nindent 12 }}
6262
{{- end }}
63+
{{- with .Values.controller.priorityClassName }}
64+
priorityClassName: {{ . | quote }}
65+
{{- end }}
66+
{{- with .Values.controller.imagePullSecrets }}
67+
imagePullSecrets:
68+
{{- toYaml . | nindent 8 }}
69+
{{- end }}
6370
{{- with .Values.controller.nodeSelector }}
6471
nodeSelector:
6572
{{- toYaml . | nindent 8 }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{- if .Values.networkPolicy }}
2+
apiVersion: {{ include "prom-aggregation-gateway.networkPolicy.apiVersion" . }}
3+
kind: NetworkPolicy
4+
metadata:
5+
labels:
6+
{{- include "prom-aggregation-gateway.labels" . | nindent 4 }}
7+
{{- if .Values.networkPolicy.customSelectors }}
8+
name: ingress-allow-customselector-{{ template "prom-aggregation-gateway.name" . }}
9+
{{- else if .Values.networkPolicy.allowAll }}
10+
name: ingress-allow-all-{{ template "prom-aggregation-gateway.name" . }}
11+
{{- else -}}
12+
{{- fail "One of `allowAll` or `customSelectors` must be specified." }}
13+
{{- end }}
14+
spec:
15+
podSelector:
16+
matchLabels:
17+
{{- include "prom-aggregation-gateway.selectorLabels" . | nindent 6 }}
18+
ingress:
19+
- ports:
20+
- port: {{ .Values.controller.apiPort }}
21+
- port: {{ .Values.controller.lifecyclePort }}
22+
{{- with .Values.networkPolicy.customSelectors }}
23+
from:
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
26+
{{- end }}

charts/prom-aggregation-gateway/values.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
},
5555
"tolerations": {
5656
"type": "array"
57+
},
58+
"priorityClassName": {
59+
"type": "string"
60+
},
61+
"imagePullSecrets": {
62+
"type": "array"
5763
}
5864
},
5965
"required": [

charts/prom-aggregation-gateway/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ controller:
1717

1818
nodeSelector: {}
1919

20+
# Optional pod imagePullSecrets
21+
imagePullSecrets: []
22+
2023
podMonitor:
2124
create: true
2225
additionalLabels: {}

0 commit comments

Comments
 (0)