Skip to content

Commit

Permalink
Merge pull request #9237 from TomHellier/cherrypick-pr-9176
Browse files Browse the repository at this point in the history
helm: allow further configurability of ingress version (manual backport)
  • Loading branch information
leseb committed Nov 29, 2021
2 parents f38dcb9 + 80b63bd commit 3a7dfdd
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
1 change: 1 addition & 0 deletions Documentation/helm-ceph-cluster.md
Expand Up @@ -57,6 +57,7 @@ The following tables lists the configurable parameters of the rook-operator char
| Parameter | Description | Default |
| ---------------------- | -------------------------------------------------------------------- | ----------- |
| `operatorNamespace` | Namespace of the Rook Operator | `rook-ceph` |
| `kubeVersion` | Optional override of the target kubernetes version | `` |
| `configOverride` | Cluster ceph.conf override | <empty> |
| `toolbox.enabled` | Enable Ceph debugging pod deployment. See [toolbox](ceph-toolbox.md) | `false` |
| `toolbox.tolerations` | Toolbox tolerations | `[]` |
Expand Down
20 changes: 20 additions & 0 deletions cluster/charts/rook-ceph-cluster/templates/_helpers.tpl
Expand Up @@ -31,3 +31,23 @@ Define the clusterName as defaulting to the release namespace
{{- define "clusterName" -}}
{{ .Values.clusterName | default .Release.Namespace }}
{{- end -}}

{{/*
Return the target Kubernetes version.
*/}}
{{- define "capabilities.kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for ingress.
*/}}
{{- define "capabilities.ingress.apiVersion" -}}
{{- if semverCompare "<1.14-0" (include "capabilities.kubeVersion" .) -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare "<1.19-0" (include "capabilities.kubeVersion" .) -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1" -}}
{{- end -}}
{{- end -}}
24 changes: 9 additions & 15 deletions cluster/charts/rook-ceph-cluster/templates/ingress.yaml
@@ -1,12 +1,6 @@
{{- if .Values.ingress.dashboard.host }}
---
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
apiVersion: networking.k8s.io/v1
{{ else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{ else }}
apiVersion: extensions/v1beta1
{{ end -}}
apiVersion: {{ include "capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ template "clusterName" . }}-dashboard
Expand All @@ -20,7 +14,14 @@ spec:
paths:
- path: {{ .Values.ingress.dashboard.host.path | default "/" }}
backend:
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
{{- if (semverCompare "<1.18-0" (include "capabilities.kubeVersion" .)) }}
serviceName: rook-ceph-mgr-dashboard
{{- if .Values.cephClusterSpec.dashboard.ssl }}
servicePort: https-dashboard
{{- else }}
servicePort: http-dashboard
{{- end }}
{{- else }}
service:
name: rook-ceph-mgr-dashboard
port:
Expand All @@ -30,13 +31,6 @@ spec:
name: http-dashboard
{{- end }}
pathType: Prefix
{{- else }}
serviceName: rook-ceph-mgr-dashboard
{{- if .Values.cephClusterSpec.dashboard.ssl }}
servicePort: https-dashboard
{{- else }}
servicePort: http-dashboard
{{- end }}
{{- end }}
{{- if .Values.ingress.dashboard.tls }}
tls: {{- toYaml .Values.ingress.dashboard.tls | nindent 4 }}
Expand Down
3 changes: 3 additions & 0 deletions cluster/charts/rook-ceph-cluster/values.yaml
Expand Up @@ -8,6 +8,9 @@ operatorNamespace: rook-ceph
# The metadata.name of the CephCluster CR. The default name is the same as the namespace.
# clusterName: rook-ceph

# Ability to override the kubernetes version used in rendering the helm chart
# kubeVersion: 1.21

# Ability to override ceph.conf
# configOverride: |
# [global]
Expand Down

0 comments on commit 3a7dfdd

Please sign in to comment.