RIC-919 Upgrade influxdb helm chart v1.8 > v2.2
[ric-plt/ric-dep.git] / helm / 3rdparty / influxdb / templates / ingress.yaml
index 49c4fa2..c5bbcd4 100644 (file)
@@ -1,25 +1,14 @@
-################################################################################
-#   Copyright (c) 2021 HCL Technolgies Limited.                                #
-#                                                                              #
-#   Licensed under the Apache License, Version 2.0 (the "License");            #
-#   you may not use this file except in compliance with the License.           #
-#   You may obtain a copy of the License at                                    #
-#                                                                              #
-#       http://www.apache.org/licenses/LICENSE-2.0                             #
-#                                                                              #
-#   Unless required by applicable law or agreed to in writing, software        #
-#   distributed under the License is distributed on an "AS IS" BASIS,          #
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-#   See the License for the specific language governing permissions and        #
-#   limitations under the License.                                             #
-################################################################################
 {{- if .Values.ingress.enabled -}}
+{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
+apiVersion: networking.k8s.io/v1
+{{- else }}
 apiVersion: networking.k8s.io/v1beta1
+{{- end }}
 kind: Ingress
 metadata:
-  name: {{ include "common.fullname.influxdb" . }}
+  name: {{ include "influxdb.fullname" . }}
   labels:
-    {{- include "common.influxdb.labels" . | nindent 4 }}
+    {{- include "influxdb.labels" . | nindent 4 }}
   annotations:
 {{ toYaml .Values.ingress.annotations | indent 4 }}
 spec:
@@ -27,7 +16,9 @@ spec:
   tls:
     - hosts:
       - {{ .Values.ingress.hostname | quote }}
+      {{- if .Values.ingress.secretName }}
       secretName: {{ .Values.ingress.secretName }}
+      {{- end -}}
 {{- end }}
 {{- if .Values.ingress.className }}
   ingressClassName: {{ .Values.ingress.className }}
@@ -37,7 +28,17 @@ spec:
     http:
       paths:
       - path: {{ .Values.ingress.path }}
+{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
+        pathType: Prefix
+{{- end }}
         backend:
-          serviceName: {{ include "common.fullname.influxdb" . }}
-          servicePort: {{ include "common.serviceport.influxdb.http" .}}
+{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
+          service:
+            name: {{ include "influxdb.fullname" . }}
+            port:
+              name: {{ .Values.service.portName }}
+{{- else }}
+          serviceName: {{ include "influxdb.fullname" . }}
+          servicePort: {{ .Values.service.portName }}
+{{- end }}
 {{- end -}}