Skip to content

Commit 21a8e52

Browse files
author
dabo
committed
[Graphite]: fix kiwigrid#443
- template ingress in all api versions and add ingress class
1 parent 68b6ed2 commit 21a8e52

File tree

4 files changed

+44
-10
lines changed

4 files changed

+44
-10
lines changed

charts/graphite/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v1
2-
version: 0.7.2
2+
version: 0.7.3
33
appVersion: "1.1.7-6"
44
description: Graphite metrics server
55
name: graphite

charts/graphite/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The following table lists the configurable parameters of the Graphite chart and
5151
| `resources` | Resource limits for Graphite pod | `{}` |
5252
| `ingress.enabled` | Ingress enabled | `false` |
5353
| `ingress.annotations` | Ingress annotations | `{}` |
54-
| `ingress.path` | Ingress path | `/` |
54+
| `ingress.className` | Ingress class | `nil` |
5555
| `ingress.hosts` | Ingress hosts | `[]` |
5656
| `ingress.tls` | Ingress TLS | `[]` |
5757
| `resources` | Resources | `{}` |

charts/graphite/templates/ingress.yaml

+32-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
{{- if .Values.ingress.enabled -}}
22
{{- $fullName := include "graphite.fullname" . -}}
33
{{- $ingressPath := .Values.ingress.path -}}
4+
{{- $svcPort := .Values.service.port -}}
5+
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
6+
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
7+
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
8+
{{- end }}
9+
{{- end }}
10+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
11+
apiVersion: networking.k8s.io/v1
12+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
413
apiVersion: networking.k8s.io/v1beta1
14+
{{- else -}}
15+
apiVersion: extensions/v1beta1
16+
{{- end }}
517
kind: Ingress
618
metadata:
719
name: {{ $fullName }}
@@ -15,6 +27,9 @@ metadata:
1527
{{ toYaml . | indent 4 }}
1628
{{- end }}
1729
spec:
30+
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
31+
ingressClassName: {{ .Values.ingress.className }}
32+
{{- end }}
1833
{{- if .Values.ingress.tls }}
1934
tls:
2035
{{- range .Values.ingress.tls }}
@@ -26,13 +41,25 @@ spec:
2641
{{- end }}
2742
{{- end }}
2843
rules:
29-
{{- range .Values.ingress.hosts }}
30-
- host: {{ . }}
44+
{{- range .Values.ingress.hosts }}
45+
- host: {{ .host | quote }}
3146
http:
3247
paths:
33-
- path: {{ $ingressPath }}
48+
{{- range .paths }}
49+
- path: {{ .path }}
50+
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
51+
pathType: {{ .pathType }}
52+
{{- end }}
3453
backend:
54+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
55+
service:
56+
name: {{ $fullName }}
57+
port:
58+
number: {{ $svcPort }}
59+
{{- else }}
3560
serviceName: {{ $fullName }}
36-
servicePort: {{ $.Values.service.port }}
37-
{{- end }}
61+
servicePort: {{ $svcPort }}
62+
{{- end }}
63+
{{- end }}
64+
{{- end }}
3865
{{- end }}

charts/graphite/values.yaml

+10-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@ ingress:
1616
annotations: {}
1717
# kubernetes.io/ingress.class: nginx
1818
# kubernetes.io/tls-acme: "true"
19-
path: /
20-
hosts:
21-
- chart-example.local
19+
## IngressClassName is the name of the IngressClass cluster resource. The
20+
## associated IngressClass defines which controller will implement the
21+
## resource. This replaces the deprecated `kubernetes.io/ingress.class`
22+
## annotation.
23+
className: ""
24+
hosts: []
25+
# - host: chart-example.local
26+
# paths:
27+
# - path: /
28+
# pathType: ImplementationSpecific
2229
tls: []
2330
# - secretName: chart-example-tls
2431
# hosts:

0 commit comments

Comments
 (0)