From 5d2827019278a118bf75b3d5ed1c966d6b5560b4 Mon Sep 17 00:00:00 2001 From: Wei-An Yen Date: Fri, 10 Jun 2022 14:56:01 +0800 Subject: [PATCH] feat: bump resource api version (#7) --- Chart.yaml | 2 +- templates/_cronjob.yaml | 4 ++++ templates/_hpa.yaml | 4 ++++ templates/_ingress.yaml | 4 +++- templates/_pdb.yaml | 4 ++++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Chart.yaml b/Chart.yaml index fe562f6..ed47a80 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -14,4 +14,4 @@ type: library # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 0.4.1 +version: 0.5.0 diff --git a/templates/_cronjob.yaml b/templates/_cronjob.yaml index 70c16f7..87e2c76 100644 --- a/templates/_cronjob.yaml +++ b/templates/_cronjob.yaml @@ -10,7 +10,11 @@ spec: {{- $cronJob := index . 1 }} {{- $pod := index . 2 }} {{- $serviceAccount := index . 3 }} +{{- if semverCompare ">=1.21.0" .Capabilities.KubeVersion.Version -}} +apiVersion: batch/v1 +{{- else -}} apiVersion: batch/v1beta1 +{{- end -}} kind: CronJob metadata: {{- include "common.metadata" (list $top) | nindent 2 }} diff --git a/templates/_hpa.yaml b/templates/_hpa.yaml index 0ff4230..e58b9c9 100644 --- a/templates/_hpa.yaml +++ b/templates/_hpa.yaml @@ -3,7 +3,11 @@ {{- define "common.hpa.tpl" -}} {{- $top := first . }} {{- $autoscaling := index . 1 }} +{{- if semverCompare ">=1.23.0" .Capabilities.KubeVersion.Version -}} +apiVersion: autoscaling/v2 +{{- else -}} apiVersion: autoscaling/v2beta2 +{{- end -}} kind: HorizontalPodAutoscaler metadata: {{- include "common.metadata" (list $top) | nindent 2 }} diff --git a/templates/_ingress.yaml b/templates/_ingress.yaml index f55a8df..21bb1ee 100644 --- a/templates/_ingress.yaml +++ b/templates/_ingress.yaml @@ -14,7 +14,9 @@ annotations: {{- $service := index . 2 }} {{- $fullName := include "common.fullname" $top }} {{- $svcPort := $service.port }} -{{- if semverCompare ">=1.14-0" $top.Capabilities.KubeVersion.GitVersion }} +{{- if semverCompare ">=1.19.0" $top.Capabilities.KubeVersion.Version }} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14.0" $top.Capabilities.KubeVersion.Version }} apiVersion: networking.k8s.io/v1beta1 {{- else }} apiVersion: extensions/v1beta1 diff --git a/templates/_pdb.yaml b/templates/_pdb.yaml index f10f26d..d021d24 100644 --- a/templates/_pdb.yaml +++ b/templates/_pdb.yaml @@ -3,7 +3,11 @@ {{- define "common.pdb.tpl" -}} {{- $top := first . }} {{- $pdb := index . 1 }} +{{- if semverCompare ">=1.21.0" .Capabilities.KubeVersion.Version -}} +apiVersion: policy/v1 +{{- else -}} apiVersion: policy/v1beta1 +{{- end -}} kind: PodDisruptionBudget metadata: {{- include "common.metadata" (list $top) | nindent 2 }}