From 09ff371ed6804010e459c667d76519da8376a044 Mon Sep 17 00:00:00 2001 From: georgekaz Date: Fri, 7 Feb 2020 09:01:42 +0000 Subject: [PATCH] add back support for ingress in k8s < 1.14 (#20591) Signed-off-by: George Kaz --- stable/drone/Chart.yaml | 2 +- stable/drone/templates/_helpers.tpl | 11 +++++++++++ stable/drone/templates/ingress.yaml | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/stable/drone/Chart.yaml b/stable/drone/Chart.yaml index 4181e0800d..44dc5ec843 100644 --- a/stable/drone/Chart.yaml +++ b/stable/drone/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 name: drone home: https://drone.io/ icon: https://drone.io/apple-touch-icon.png -version: 2.6.0 +version: 2.6.1 appVersion: 1.6.1 description: Drone is a Continuous Delivery system built on container technology keywords: diff --git a/stable/drone/templates/_helpers.tpl b/stable/drone/templates/_helpers.tpl index ede20f81f2..e435fcef2d 100644 --- a/stable/drone/templates/_helpers.tpl +++ b/stable/drone/templates/_helpers.tpl @@ -69,3 +69,14 @@ Create the name of the secret for an enterprise license key {{ printf "%s-%s" (include "drone.fullname" .) "license-key" | trunc 63 }} {{- end -}} {{- end -}} + +{{/* +Return the appropriate apiVersion for ingress. +*/}} +{{- define "drone.ingress.apiVersion" -}} +{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "^1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- end -}} +{{- end -}} diff --git a/stable/drone/templates/ingress.yaml b/stable/drone/templates/ingress.yaml index 6d6e6a335e..0f1c23fcf4 100644 --- a/stable/drone/templates/ingress.yaml +++ b/stable/drone/templates/ingress.yaml @@ -1,7 +1,7 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "drone.fullname" . }} {{- $httpPort := .Values.service.httpPort }} -apiVersion: networking.k8s.io/v1beta1 +apiVersion: {{ template "drone.ingress.apiVersion" . }} kind: Ingress metadata: annotations: