From 60ea6ea51dce04e9aa9154be8a21020376cdcf59 Mon Sep 17 00:00:00 2001 From: George Tsigourakos Date: Tue, 27 Feb 2024 16:59:02 +0200 Subject: [PATCH] Add extra optional service definitions --- charts/falcon-crowdstrike/templates/NOTES.txt | 5 ++++- charts/falcon-crowdstrike/templates/service.yaml | 4 +++- charts/falcon-crowdstrike/values.yaml | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/charts/falcon-crowdstrike/templates/NOTES.txt b/charts/falcon-crowdstrike/templates/NOTES.txt index 0597980..95e403a 100644 --- a/charts/falcon-crowdstrike/templates/NOTES.txt +++ b/charts/falcon-crowdstrike/templates/NOTES.txt @@ -5,7 +5,9 @@ http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} {{- end }} {{- end }} -{{- else if contains "NodePort" .Values.service.type }} +{{- end }} +{{- if .Values.service.create }} +{{- if contains "NodePort" .Values.service.type }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "falcon-crowdstrike.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT @@ -20,3 +22,4 @@ echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT {{- end }} +{{- end }} diff --git a/charts/falcon-crowdstrike/templates/service.yaml b/charts/falcon-crowdstrike/templates/service.yaml index d796f09..d1eae84 100644 --- a/charts/falcon-crowdstrike/templates/service.yaml +++ b/charts/falcon-crowdstrike/templates/service.yaml @@ -1,7 +1,8 @@ +{{- if .Values.service.create -}} apiVersion: v1 kind: Service metadata: - name: {{ include "falcon-crowdstrike.fullname" . }} + name: {{ include "falcon-crowdstrike.fullname" . | default "ClusterIP" }} labels: {{- include "falcon-crowdstrike.labels" . | nindent 4 }} spec: @@ -13,3 +14,4 @@ spec: name: http selector: {{- include "falcon-crowdstrike.selectorLabels" . | nindent 4 }} +{{- end }} diff --git a/charts/falcon-crowdstrike/values.yaml b/charts/falcon-crowdstrike/values.yaml index 0c6f6ab..ccdab10 100644 --- a/charts/falcon-crowdstrike/values.yaml +++ b/charts/falcon-crowdstrike/values.yaml @@ -26,6 +26,10 @@ serviceAccount: # If not set and create is true, a name is generated using the fullname template name: "falcon-crowdstrike-sa" +service: + create: false + type: ClusterIP + podAnnotations: {} podLabels: {}