{{- $hp := .Values.hocuspocus }} {{- if and (not (include "sebastian.hostedEnvEnabled" .)) (or (not (hasKey $hp "enabled")) $hp.enabled) }} {{- $ns := include "sebastian.namespace" . -}} {{- $existing := (lookup "v1" "Service" $ns "hocuspocus") -}} {{- $annotations := dict -}} {{- if and $existing $existing.metadata $existing.metadata.annotations -}} {{- $annotations = $existing.metadata.annotations -}} {{- end -}} {{- $owned := and $existing (eq (get $annotations "meta.helm.sh/release-name") .Release.Name) -}} {{- if or (not $existing) $owned }} apiVersion: v1 kind: Service metadata: name: hocuspocus namespace: {{ include "sebastian.namespace" . }} labels: app: hocuspocus annotations: "helm.sh/resource-policy": keep spec: type: {{ .Values.hocuspocus.service.type }} ports: - port: {{ .Values.hocuspocus.service.port }} targetPort: http protocol: TCP name: http selector: app: hocuspocus {{- end }} {{- end }}