diff --git a/charts/cloudinfo/Chart.yaml b/charts/cloudinfo/Chart.yaml index c20280955..88eff050a 100644 --- a/charts/cloudinfo/Chart.yaml +++ b/charts/cloudinfo/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Cloud instance type and price information as a service name: cloudinfo -version: 0.9.0 +version: 0.10.0 appVersion: "0.18.0" diff --git a/charts/cloudinfo/templates/ingress.yaml b/charts/cloudinfo/templates/ingress.yaml index dc590206f..3bcef48a3 100644 --- a/charts/cloudinfo/templates/ingress.yaml +++ b/charts/cloudinfo/templates/ingress.yaml @@ -1,6 +1,18 @@ {{- if .Values.frontend.ingress.enabled -}} {{- $fullName := include "cloudinfo.frontend.fullname" . -}} +{{- $svcPort := .Values.frontend.service.port -}} +{{- if and .Values.frontend.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.frontend.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.frontend.ingress.annotations "kubernetes.io/ingress.class" .Values.frontend.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} kind: Ingress metadata: name: {{ $fullName }} @@ -15,29 +27,40 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - ingressClassName: {{ .Values.frontend.ingress.ingressClassName }} -{{- if .Values.frontend.ingress.tls }} + {{- if and .Values.frontend.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.frontend.ingress.className }} + {{- end }} + {{- if .Values.frontend.ingress.tls }} tls: - {{- range .Values.frontend.ingress.tls }} + {{- range .Values.frontend.ingress.tls }} - hosts: - {{- range .hosts }} + {{- range .hosts }} - {{ . | quote }} - {{- end }} + {{- end }} secretName: {{ .secretName }} + {{- end }} {{- end }} -{{- end }} rules: - {{- range .Values.frontend.ingress.hosts }} - {{- $url := splitList "/" . }} - - host: {{ first $url }} + {{- range .Values.frontend.ingress.hosts }} + - host: {{ .host | quote }} http: paths: - - path: /{{ rest $url | join "/" }} - pathType: {{ .Values.frontend.ingress.pathType }} + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: name: {{ $fullName }} port: - number: {{ .Values.frontend.service.port }} - {{- end }} + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} {{- end }} + diff --git a/charts/cloudinfo/values.yaml b/charts/cloudinfo/values.yaml index 0d6e9eb7f..6dcfa987e 100644 --- a/charts/cloudinfo/values.yaml +++ b/charts/cloudinfo/values.yaml @@ -25,19 +25,31 @@ frontend: port: 80 ingress: + # -- Enable [ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/). enabled: false - ingressClassName: traefik + + # -- Ingress [class name](https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-class). + className: "" + + # -- Annotations to be added to the ingress. annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" + + # -- Ingress host configuration. + # @default -- See [values.yaml](values.yaml). hosts: - - "/" + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + # -- Ingress TLS configuration. + # @default -- See [values.yaml](values.yaml). tls: [] # - secretName: chart-example-tls # hosts: # - chart-example.local - pathType: Prefix resources: {} # We usually recommend not to specify default resources and to leave this as a conscious