Skip to content

Commit

Permalink
Create networkpolicy.yaml
Browse files Browse the repository at this point in the history
Signed-off-by: Quan TRAN <itscaro@users.noreply.github.com>
  • Loading branch information
itscaro committed Aug 31, 2022
1 parent c8eb057 commit 09177fc
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helm/akhq/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "0.22.0"
description: Kafka GUI for Apache Kafka to manage topics, topics data, consumers group, schema registry, connect and more...
name: akhq
version: 0.2.9
version: 0.3.0
keywords:
- kafka
- confluent
Expand Down
22 changes: 22 additions & 0 deletions helm/akhq/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,25 @@ Return the appropriate apiVersion for Ingress
{{- print "networking.k8s.io/v1" -}}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for deployment.
*/}}
{{- define "akhq.deployment.apiVersion" -}}
{{- if semverCompare "<1.9.0-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "apps/v1beta2" -}}
{{- else -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for network policy.
*/}}
{{- define "akhq.networkPolicy.apiVersion" -}}
{{- if semverCompare "<1.8.0-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1" -}}
{{- end -}}
{{- end -}}
25 changes: 25 additions & 0 deletions helm/akhq/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if .Values.networkPolicy.enabled -}}
apiVersion: {{ template "akhq.networkPolicy.apiVersion" . }}
kind: NetworkPolicy
metadata:
name: {{ include "akhq.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "akhq.name" . }}
helm.sh/chart: {{ include "akhq.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
policyTypes:
- Ingress
podSelector:
matchLabels:
app.kubernetes.io/name: {{ include "akhq.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
ingress:
- ports:
- port: http
- port: management
{{- end }}
3 changes: 3 additions & 0 deletions helm/akhq/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,6 @@ nodeSelector: {}
tolerations: []

affinity: {}

networkPolicy:
enabled: true

0 comments on commit 09177fc

Please sign in to comment.