apiVersion shouldn't be hardcoded (#5060)

* apiVersion shouldn't be hardcoded

* updated chart version

* fixed semver comparison
This commit is contained in:
Deirdre Storck
2018-04-17 01:59:58 -07:00
committed by k8s-ci-robot
parent 2fa12d2be6
commit 4a70cab3a1
4 changed files with 17 additions and 3 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "5.4.1"
description: A Helm chart for Elasticseach Curator
name: elasticsearch-curator
version: 0.1.0
version: 0.1.1
home: https://github.com/elastic/curator
keywords:
- curator
@@ -6,6 +6,9 @@ This directory contains a Kubernetes chart to deploy the [Elasticsearch Curator]
* Elasticsearch
* The `elasticsearch-curator` cron job requires [K8s CronJob](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/) support:
> You need a working Kubernetes cluster at version >= 1.8 (for CronJob). For previous versions of cluster (< 1.8) you need to explicitly enable `batch/v2alpha1` API by passing `--runtime-config=batch/v2alpha1=true` to the API server ([see Turn on or off an API version for your cluster for more](https://kubernetes.io/docs/admin/cluster-management/#turn-on-or-off-an-api-version-for-your-cluster)).
## Chart Details
This chart will do the following:
@@ -1,5 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Return the appropriate apiVersion for cronjob APIs.
*/}}
{{- define "cronjob.apiVersion" -}}
{{- if semverCompare "< 1.8-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "batch/v2alpha1" }}
{{- else if semverCompare ">=1.8-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "batch/v1beta1" }}
{{- end -}}
{{- end -}}
{{/*
Expand the name of the chart.
*/}}
@@ -1,4 +1,4 @@
apiVersion: batch/v1beta1
apiVersion: {{ template "cronjob.apiVersion" . }}
kind: CronJob
metadata:
name: {{ template "elasticsearch-curator.fullname" . }}
@@ -19,7 +19,7 @@ spec:
spec:
volumes:
- name: config-volume
configMap:
configMap:
name: curator-config
restartPolicy: Never
containers: