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

[incubator/raw] Resource templates #12422

Merged
merged 1 commit into from
Mar 22, 2019
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
6 changes: 4 additions & 2 deletions incubator/raw/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: raw
home: https://github.com/helm/charts/blob/master/incubator/raw
version: 0.1.0
appVersion: 0.1.0
version: 0.2.0
appVersion: 0.2.0
description: A place for all the Kubernetes resources which don't already have a home.
maintainers:
- name: josdotso
email: josdotso@cisco.com
- name: mumoshu
email: ykuoka@gmail.com
2 changes: 2 additions & 0 deletions incubator/raw/OWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
approvers:
- josdotso
- mumoshu
reviewers:
- josdotso
- mumoshu
45 changes: 42 additions & 3 deletions incubator/raw/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# incubator/raw

The `incubator/raw` chart takes a list of raw Kubernetes resources and
The `incubator/raw` chart takes a list of Kubernetes resources and
merges each resource with a default `metadata.labels` map and installs
the result.

The Kubernetes resources can be "raw" ones defined under the `resources` key, or "templated" ones defined under the `templates` key.

Some use cases for this chart include Helm-based installation and
maintenance of resources of kinds:
- LimitRange
- PriorityClass
- Secret

## Usage

### STEP 1: Create a yaml file containing your raw resources.
### Raw resources

#### STEP 1: Create a yaml file containing your raw resources.

```
# raw-priority-classes.yaml
Expand Down Expand Up @@ -83,8 +88,42 @@ resources:
description: "This priority class should only be used for low priority app pods."
```

### STEP 2: Install your raw resources.
#### STEP 2: Install your raw resources.

```
helm install --name raw-priority-classes incubator/raw -f raw-priority-classes.yaml
```

### Templated resources

#### STEP 1: Create a yaml file containing your templated resources.

```
# values.yaml

templates:
- |
apiVersion: v1
kind: Secret
metadata:
name: common-secret
stringData:
mykey: {{ .Values.mysecret }}
```

The yaml file containing `mysecret` should be encrypted with a tool like [helm-secrets](https://github.com/futuresimple/helm-secrets)

```
# secrets.yaml
mysecret: abc123
```

```
$ helm secrets enc secrets.yaml
```

#### STEP 2: Install your templated resources.

```
helm secrets install --name mysecret incubator/raw -f values.yaml -f secrets.yaml
```
18 changes: 18 additions & 0 deletions incubator/raw/ci/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
resources:
- apiVersion: v1
kind: Secret
metadata:
name: common
stringData:
foo: bar

mysecret: abc134

templates:
- |
apiVersion: v1
kind: Secret
metadata:
name: common-secret
stringData:
mykey: "{{ .Values.mysecret }}"
4 changes: 4 additions & 0 deletions incubator/raw/templates/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
---
{{- toYaml (merge . $template) -}}
{{- end }}
{{- range $i, $t := .Values.templates }}
---
{{- toYaml (merge (tpl $t $ | fromYaml) $template) -}}
{{- end }}
16 changes: 16 additions & 0 deletions incubator/raw/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,19 @@ resources: []
# value: 70000
# globalDefault: false
# description: "This priority class should only be used for low priority app pods."

templates:
# This is here to pass the chart ci
- |
apiVersion: v1
kind: ConfigMap
metadata:
name: raw
#
# - |
# apiVersion: v1
# kind: Secret
# metadata:
# name: common-secret
# stringData:
# mykey: {{ .Values.mysecret }}