Skip to content

Commit 19bea6d

Browse files
host raw chart
1 parent 17131fe commit 19bea6d

5 files changed

Lines changed: 146 additions & 0 deletions

File tree

itscontained/raw/Chart.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v2
2+
description: A place for all the Kubernetes resources which don't already have a home
3+
name: raw
4+
version: v0.2.5
5+
kubeVersion: ">=1.16.0-0"
6+
home: https://github.com/itscontained/charts/blob/master/itscontained/raw
7+
keywords:
8+
- raw
9+
- incubator
10+
- incubator-raw
11+
sources:
12+
- https://github.com/helm/charts/blob/master/incubator/raw
13+
maintainers:
14+
- name: DirtyCajunRice
15+
email: nick@cajun.pro

itscontained/raw/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# itscontained/raw
2+
3+
The `itscontained/raw` chart takes a list of Kubernetes resources and
4+
merges each resource with a default `metadata.labels` map and installs
5+
the result.
6+
7+
The Kubernetes resources can be "raw" ones defined under the `resources` key, or "templated" ones defined under the `templates` key.
8+
9+
Some use cases for this chart include Helm-based installation and
10+
maintenance of resources of kinds:
11+
- LimitRange
12+
- PriorityClass
13+
- Secret
14+
15+
## Usage
16+
17+
### Raw resources
18+
19+
#### STEP 1: Create a yaml file containing your raw resources.
20+
21+
```
22+
# raw-priority-classes.yaml
23+
resources:
24+
- apiVersion: scheduling.k8s.io/v1beta1
25+
kind: PriorityClass
26+
metadata:
27+
name: common-critical
28+
value: 100000000
29+
globalDefault: false
30+
description: "This priority class should only be used for critical priority common pods."
31+
```
32+
33+
#### STEP 2: Install your raw resources.
34+
35+
```
36+
helm install raw-priority-classes itscontained/raw -f raw-priority-classes.yaml
37+
```
38+
39+
### Templated resources
40+
41+
#### STEP 1: Create a yaml file containing your templated resources.
42+
43+
```
44+
# values.yaml
45+
46+
templates:
47+
- |
48+
apiVersion: v1
49+
kind: Secret
50+
metadata:
51+
name: common-secret
52+
stringData:
53+
mykey: {{ .Values.mysecret }}
54+
```
55+
56+
#### STEP 2: Install your templated resources.
57+
58+
```
59+
helm install mysecret itscontained/raw -f values.yaml
60+
```
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "raw.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "raw.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "raw.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{/*
35+
raw.resource will create a resource template that can be
36+
merged with each item in `.Values.resources`.
37+
*/}}
38+
{{- define "raw.resource" -}}
39+
metadata:
40+
labels:
41+
app: {{ template "raw.name" . }}
42+
chart: {{ template "raw.chart" . }}
43+
release: {{ .Release.Name }}
44+
heritage: {{ .Release.Service }}
45+
{{- end }}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{- $template := fromYaml (include "raw.resource" .) -}}
2+
{{- range .Values.resources }}
3+
---
4+
{{ toYaml (merge . $template) -}}
5+
{{- end }}
6+
{{- range $i, $t := .Values.templates }}
7+
---
8+
{{ toYaml (merge (tpl $t $ | fromYaml) $template) -}}
9+
{{- end }}

itscontained/raw/values.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
resources: []
2+
# - apiVersion: scheduling.k8s.io/v1beta1
3+
# kind: PriorityClass
4+
# metadata:
5+
# name: app-low
6+
# value: 70000
7+
# globalDefault: false
8+
# description: "This priority class should only be used for low priority app pods."
9+
10+
templates: []
11+
# - |
12+
# apiVersion: v1
13+
# kind: Secret
14+
# metadata:
15+
# name: common-secret
16+
# stringData:
17+
# mykey: {{ .Values.mysecret }}

0 commit comments

Comments
 (0)