Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

[stable/mcrouter] create a template for api version #22638

Merged
merged 1 commit into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stable/mcrouter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: mcrouter
home: https://github.com/facebook/mcrouter
version: 1.0.2
version: 1.0.3
appVersion: 0.36.0
description: Mcrouter is a memcached protocol router for scaling memcached deployments.
sources:
Expand Down
22 changes: 22 additions & 0 deletions stable/mcrouter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,25 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for daemonset.
*/}}
{{- define "daemonset.apiVersion" -}}
{{- if semverCompare "<1.9-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare "^1.9-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for statefulset.
*/}}
{{- define "statefulset.apiVersion" -}}
{{- if semverCompare "<1.9-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare "^1.9-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}
5 changes: 4 additions & 1 deletion stable/mcrouter/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if eq .Values.controller "daemonset" }}
apiVersion: extensions/v1beta1
apiVersion: {{ template "daemonset.apiVersion" . }}
kind: DaemonSet
metadata:
name: {{ template "fullname" . }}
Expand All @@ -10,6 +10,9 @@ metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
spec:
selector:
matchLabels:
app: {{ template "fullname" . }}
template:
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion stable/mcrouter/templates/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if eq .Values.controller "statefulset" }}
apiVersion: apps/v1beta1
apiVersion: {{ template "statefulset.apiVersion" . }}
kind: StatefulSet
metadata:
name: {{ template "fullname" . }}
Expand Down