From 1c3c14467ef9f6af7c2ae6d747f98509dc1a1b49 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Sat, 24 Mar 2018 01:32:02 +0600 Subject: [PATCH] Rename service port to http (#4442) * Rename service port to http * Remove dependency from common chart * Added keywords for Chart.yaml --- incubator/chartmuseum/Chart.yaml | 6 +- incubator/chartmuseum/requirements.yaml | 4 - incubator/chartmuseum/templates/_helpers.tpl | 84 +++++++++++++++++++ .../chartmuseum/templates/deployment.yaml | 12 +-- incubator/chartmuseum/templates/ingress.yaml | 6 +- incubator/chartmuseum/templates/pvc.yaml | 4 +- incubator/chartmuseum/templates/secret.yaml | 4 +- incubator/chartmuseum/templates/service.yaml | 8 +- 8 files changed, 106 insertions(+), 22 deletions(-) delete mode 100644 incubator/chartmuseum/requirements.yaml create mode 100644 incubator/chartmuseum/templates/_helpers.tpl diff --git a/incubator/chartmuseum/Chart.yaml b/incubator/chartmuseum/Chart.yaml index 8fdc5e9c0956..fb29c4730552 100644 --- a/incubator/chartmuseum/Chart.yaml +++ b/incubator/chartmuseum/Chart.yaml @@ -1,10 +1,14 @@ apiVersion: v1 description: Helm Chart Repository with support for Amazon S3 and Google Cloud Storage name: chartmuseum -version: 0.4.4 +version: 0.4.5 appVersion: 0.4.2 home: https://github.com/chartmuseum/chartmuseum icon: https://raw.githubusercontent.com/chartmuseum/chartmuseum/master/logo.png +keywords: +- chartmuseum +- helm +- charts repo maintainers: - name: ChartMuseum email: chartmuseum@gmail.com diff --git a/incubator/chartmuseum/requirements.yaml b/incubator/chartmuseum/requirements.yaml deleted file mode 100644 index 31bd631df647..000000000000 --- a/incubator/chartmuseum/requirements.yaml +++ /dev/null @@ -1,4 +0,0 @@ -dependencies: -- name: common - version: 0.0.1 - repository: https://kubernetes-charts-incubator.storage.googleapis.com/ diff --git a/incubator/chartmuseum/templates/_helpers.tpl b/incubator/chartmuseum/templates/_helpers.tpl new file mode 100644 index 000000000000..f03294f0b3ec --- /dev/null +++ b/incubator/chartmuseum/templates/_helpers.tpl @@ -0,0 +1,84 @@ +{{- /* +name defines a template for the name of the chartmuseum chart. + +The prevailing wisdom is that names should only contain a-z, 0-9 plus dot (.) and dash (-), and should +not exceed 63 characters. + +Parameters: + +- .Values.nameOverride: Replaces the computed name with this given name +- .Values.namePrefix: Prefix +- .Values.global.namePrefix: Global prefix +- .Values.nameSuffix: Suffix +- .Values.global.nameSuffix: Global suffix + +The applied order is: "global prefix + prefix + name + suffix + global suffix" + +Usage: 'name: "{{- template "chartmuseum.name" . -}}"' +*/ -}} +{{- define "chartmuseum.name"}} +{{- $global := default (dict) .Values.global -}} +{{- $base := default .Chart.Name .Values.nameOverride -}} +{{- $gpre := default "" $global.namePrefix -}} +{{- $pre := default "" .Values.namePrefix -}} +{{- $suf := default "" .Values.nameSuffix -}} +{{- $gsuf := default "" $global.nameSuffix -}} +{{- $name := print $gpre $pre $base $suf $gsuf -}} +{{- $name | lower | trunc 54 | trimSuffix "-" -}} +{{- end -}} + +{{- /* +fullname defines a suitably unique name for a resource by combining +the release name and the chartmuseum chart name. + +The prevailing wisdom is that names should only contain a-z, 0-9 plus dot (.) and dash (-), and should +not exceed 63 characters. + +Parameters: + +- .Values.fullnameOverride: Replaces the computed name with this given name +- .Values.fullnamePrefix: Prefix +- .Values.global.fullnamePrefix: Global prefix +- .Values.fullnameSuffix: Suffix +- .Values.global.fullnameSuffix: Global suffix + +The applied order is: "global prefix + prefix + name + suffix + global suffix" + +Usage: 'name: "{{- template "chartmuseum.fullname" . -}}"' +*/ -}} +{{- define "chartmuseum.fullname"}} +{{- $global := default (dict) .Values.global -}} +{{- $base := default (printf "%s-%s" .Release.Name .Chart.Name) .Values.fullnameOverride -}} +{{- $gpre := default "" $global.fullnamePrefix -}} +{{- $pre := default "" .Values.fullnamePrefix -}} +{{- $suf := default "" .Values.fullnameSuffix -}} +{{- $gsuf := default "" $global.fullnameSuffix -}} +{{- $name := print $gpre $pre $base $suf $gsuf -}} +{{- $name | lower | trunc 54 | trimSuffix "-" -}} +{{- end -}} + + +{{- /* +chartmuseum.labels.standard prints the standard chartmuseum Helm labels. + +The standard labels are frequently used in metadata. +*/ -}} +{{- define "chartmuseum.labels.standard" -}} +app: {{ template "chartmuseum.name" . }} +chart: {{ template "chartmuseum.chartref" . }} +heritage: {{ .Release.Service | quote }} +release: {{ .Release.Name | quote }} +{{- end -}} + +{{- /* +chartmuseum.chartref prints a chart name and version. + +It does minimal escaping for use in Kubernetes labels. + +Example output: + +chartmuseum-0.4.5 +*/ -}} +{{- define "chartmuseum.chartref" -}} +{{- replace "+" "_" .Chart.Version | printf "%s-%s" .Chart.Name -}} +{{- end -}} \ No newline at end of file diff --git a/incubator/chartmuseum/templates/deployment.yaml b/incubator/chartmuseum/templates/deployment.yaml index bd7ab442c24e..07a7630f3b67 100644 --- a/incubator/chartmuseum/templates/deployment.yaml +++ b/incubator/chartmuseum/templates/deployment.yaml @@ -1,11 +1,11 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: {{ include "common.fullname" . }} + name: {{ include "chartmuseum.fullname" . }} annotations: {{ toYaml .Values.deployment.annotations | indent 4 }} labels: -{{ include "common.labels.standard" . | indent 4 }} +{{ include "chartmuseum.labels.standard" . | indent 4 }} spec: replicas: {{ .Values.replicaCount }} strategy: @@ -13,11 +13,11 @@ spec: revisionHistoryLimit: 10 template: metadata: - name: {{ include "common.fullname" . }} + name: {{ include "chartmuseum.fullname" . }} annotations: {{ toYaml .Values.replica.annotations | indent 8 }} labels: - app: {{ template "common.name" . }} + app: {{ template "chartmuseum.name" . }} release: {{ .Release.Name | quote }} spec: containers: @@ -31,7 +31,7 @@ spec: value: {{ $value | quote }} {{- end }} {{- end }} -{{- $secret_name := include "common.fullname" . }} +{{- $secret_name := include "chartmuseum.fullname" . }} {{- range $name, $value := .Values.env.secret }} {{- if not ( empty $value) }} - name: {{ $name | quote }} @@ -86,7 +86,7 @@ spec: - name: storage-volume {{- if .Values.persistence.Enabled }} persistentVolumeClaim: - claimName: {{ .Values.persistence.ExistingClaim | default (include "common.fullname" .) }} + claimName: {{ .Values.persistence.ExistingClaim | default (include "chartmuseum.fullname" .) }} {{- else }} emptyDir: {} {{- end -}} diff --git a/incubator/chartmuseum/templates/ingress.yaml b/incubator/chartmuseum/templates/ingress.yaml index 3fd1707053da..0ae70e22cd2c 100644 --- a/incubator/chartmuseum/templates/ingress.yaml +++ b/incubator/chartmuseum/templates/ingress.yaml @@ -1,18 +1,18 @@ {{- $servicePort := .Values.service.externalPort -}} -{{- $serviceName := include "common.fullname" . -}} +{{- $serviceName := include "chartmuseum.fullname" . -}} {{- if .Values.ingress.enabled }} --- apiVersion: extensions/v1beta1 kind: Ingress metadata: - name: {{ include "common.fullname" . }} + name: {{ include "chartmuseum.fullname" . }} annotations: {{ toYaml .Values.ingress.annotations | indent 4 }} labels: {{- if .Values.ingress.labels }} {{ toYaml .Values.ingress.labels | indent 4 }} {{- end }} -{{ include "common.labels.standard" . | indent 4 }} +{{ include "chartmuseum.labels.standard" . | indent 4 }} spec: rules: {{- range $host, $paths := .Values.ingress.hosts }} diff --git a/incubator/chartmuseum/templates/pvc.yaml b/incubator/chartmuseum/templates/pvc.yaml index 28a1570186c7..da379cddb89a 100644 --- a/incubator/chartmuseum/templates/pvc.yaml +++ b/incubator/chartmuseum/templates/pvc.yaml @@ -2,9 +2,9 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: {{ include "common.fullname" . }} + name: {{ include "chartmuseum.fullname" . }} labels: - app: {{ include "common.fullname" . }} + app: {{ include "chartmuseum.fullname" . }} release: {{ .Release.Name | quote }} spec: accessModes: diff --git a/incubator/chartmuseum/templates/secret.yaml b/incubator/chartmuseum/templates/secret.yaml index e405a2da2d4c..2d65e3c010dc 100644 --- a/incubator/chartmuseum/templates/secret.yaml +++ b/incubator/chartmuseum/templates/secret.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Secret metadata: - name: {{ include "common.fullname" . }} + name: {{ include "chartmuseum.fullname" . }} labels: -{{ include "common.labels.standard" . | indent 4 }} +{{ include "chartmuseum.labels.standard" . | indent 4 }} type: Opaque data: {{- range $name, $value := .Values.env.secret }} diff --git a/incubator/chartmuseum/templates/service.yaml b/incubator/chartmuseum/templates/service.yaml index f3580a153a24..7ba5a0c1565b 100644 --- a/incubator/chartmuseum/templates/service.yaml +++ b/incubator/chartmuseum/templates/service.yaml @@ -1,11 +1,11 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "common.fullname" . }} + name: {{ include "chartmuseum.fullname" . }} annotations: {{ toYaml .Values.service.annotations | indent 4 }} labels: -{{ include "common.labels.standard" . | indent 4 }} +{{ include "chartmuseum.labels.standard" . | indent 4 }} {{- if .Values.service.annotations }} annotations: {{ toYaml .Values.service.annotations | indent 4 }} @@ -20,7 +20,7 @@ spec: targetPort: {{ .Values.service.internalPort }} {{- end }} protocol: TCP - name: {{ .Release.Name }} + name: http selector: - app: {{ template "common.name" . }} + app: {{ template "chartmuseum.name" . }} release: {{ .Release.Name | quote }}