Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[monochart] Fix bugs, remove dependency on obsolescent Kubernetes repo #256

Merged
merged 1 commit into from
Aug 12, 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
4 changes: 2 additions & 2 deletions incubator/monochart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
description: A declarative helm chart for deploying common types of services on Kubernetes
name: monochart
version: 0.22.0
appVersion: 0.22.0
version: 0.23.0
appVersion: 0.23.0
home: https://github.com/cloudposse/charts/tree/master/incubator/monochart
icon: https://raw.githubusercontent.com/cloudposse/charts/master/incubator/monochart/logo.png
maintainers:
Expand Down
3 changes: 0 additions & 3 deletions incubator/monochart/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
dependencies:
- name: common
version: 0.0.4
repository: https://kubernetes-charts-incubator.storage.googleapis.com/
- name: dockercfg
version: 0.1.0
repository: https://charts.cloudposse.com/incubator/
Expand Down
42 changes: 42 additions & 0 deletions incubator/monochart/templates/_common_fullname.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- /*
From obsolete Kubernetes Incubator Common chart
https://github.com/helm/charts/blob/master/incubator/common/

fullname defines a suitably unique name for a resource by combining
the release name and the 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 "common.fullname" . -}}"'
*/ -}}
{{- define "common.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 -}}

{{- /*
common.fullname.unique adds a random suffix to the unique name.

This takes the same parameters as common.fullname

*/ -}}
{{- define "common.fullname.unique" -}}
{{ template "common.fullname" . }}-{{ randAlphaNum 7 | lower }}
{{- end }}
46 changes: 46 additions & 0 deletions incubator/monochart/templates/_common_metadata_labels.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{{- /*
From obsolete Kubernetes Incubator Common chart
https://github.com/helm/charts/blob/master/incubator/common/

common.labelize takes a dict or map and generates labels.

Values will be quoted. Keys will not.

Example output:

first: "Matt"
last: "Butcher"

*/ -}}
{{- define "common.labelize" -}}
{{- range $k, $v := . }}
{{ $k }}: {{ $v | quote }}
{{- end -}}
{{- end -}}

{{- /*
common.chartref prints a chart name and version.

It does minimal escaping for use in Kubernetes labels.

Example output:

zookeeper-1.2.3
wordpress-3.2.1_20170219

*/ -}}
{{- define "common.chartref" -}}
{{- replace "+" "_" .Chart.Version | printf "%s-%s" .Chart.Name -}}
{{- end -}}

{{- /*
common.labels.standard prints the standard Helm labels.

The standard labels are frequently used in metadata.
*/ -}}
{{- define "common.labels.standard" -}}
app: {{ template "common.name" . }}
chart: {{ template "common.chartref" . }}
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
{{- end -}}
32 changes: 32 additions & 0 deletions incubator/monochart/templates/_common_name.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- /*
From obsolete Kubernetes Incubator Common chart
https://github.com/helm/charts/blob/master/incubator/common/

name defines a template for the name of the chart. It should be used for the `app` label.
This is common practice in many Kubernetes manifests, and is not Helm-specific.

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 "common.name" . -}}"'
*/ -}}
{{- define "common.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 -}}
4 changes: 2 additions & 2 deletions incubator/monochart/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ spec:
{{ toYaml .| indent 8 }}
{{- end }}
spec:
{{- if index .Values "serviceAccountName" }}
serviceAccountName: {{ .Values.serviceAccountName }}
{{- if index $root.Values "serviceAccountName" }}
serviceAccountName: {{ $root.Values.serviceAccountName }}
{{- end }}
restartPolicy: '{{ default "Never" $job.restartPolicy }}'
containers:
Expand Down
16 changes: 8 additions & 8 deletions incubator/monochart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ image:
# - "docker-secret-1"
# - "docker-secret-2"

configMaps:
configMaps: {}
# default:
# enabled: false
# mountPath: /config-default
Expand All @@ -36,7 +36,7 @@ configMaps:
# group:
# key: value

secrets:
secrets: {}
# default:
# enabled: false
# mountPath: /secret-default
Expand All @@ -54,7 +54,7 @@ secrets:
# key: value

# Inline ENV variables
env:
env: {}
# ENV_NAME: ENV_VALUE

# ENV variables from existing Kubernetes secrets and ConfigMaps
Expand Down Expand Up @@ -218,7 +218,7 @@ service:
## Ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/service-monitor.md
## Ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#servicemonitorspec
##
serviceMonitors:
serviceMonitors: {}
# ## Name of the ServiceMonitor to create
# ##
# name:
Expand Down Expand Up @@ -302,7 +302,7 @@ serviceMonitors:
# # serverName: ""

## https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusrulespec
prometheusRules:
prometheusRules: {}
# name:
# labels:
# prometheus: kube-prometheus
Expand All @@ -318,7 +318,7 @@ prometheusRules:
# description: Reloading Prometheus' configuration has failed for {{$labels.namespace}}/{{$labels.pod}}
# summary: Reloading Promehteus' configuration failed

probes:
probes: {}
# livenessProbe:
# httpGet:
# path: /
Expand All @@ -328,7 +328,7 @@ probes:
# path: /
# port: http

resources:
resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
Expand Down Expand Up @@ -405,7 +405,7 @@ virtualServices:
# subset: v1


crd:
crd: {}
# "networking.istio.io/v1alpha3":
# ServiceEntry:
# default:
Expand Down