diff --git a/helm/akhq/Chart.yaml b/helm/akhq/Chart.yaml index 9b2587b91..6fb133466 100644 --- a/helm/akhq/Chart.yaml +++ b/helm/akhq/Chart.yaml @@ -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 diff --git a/helm/akhq/templates/_helpers.tpl b/helm/akhq/templates/_helpers.tpl index f7bce891e..958ab9973 100644 --- a/helm/akhq/templates/_helpers.tpl +++ b/helm/akhq/templates/_helpers.tpl @@ -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 -}} diff --git a/helm/akhq/templates/networkpolicy.yaml b/helm/akhq/templates/networkpolicy.yaml new file mode 100644 index 000000000..cc2833866 --- /dev/null +++ b/helm/akhq/templates/networkpolicy.yaml @@ -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 }} diff --git a/helm/akhq/values.yaml b/helm/akhq/values.yaml index 302cfab46..66578d550 100644 --- a/helm/akhq/values.yaml +++ b/helm/akhq/values.yaml @@ -143,3 +143,6 @@ nodeSelector: {} tolerations: [] affinity: {} + +networkPolicy: + enabled: true