diff --git a/incubator/raw/.helmignore b/incubator/raw/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/incubator/raw/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/incubator/raw/Chart.yaml b/incubator/raw/Chart.yaml new file mode 100644 index 0000000000..c2560cf6e2 --- /dev/null +++ b/incubator/raw/Chart.yaml @@ -0,0 +1,8 @@ +name: raw +home: https://github.com/helm/charts/blob/master/incubator/raw +version: 0.1.0 +appVersion: 0.1.0 +description: A place for all the Kubernetes resources which don't already have a home. +maintainers: +- name: josdotso + email: josdotso@cisco.com diff --git a/incubator/raw/OWNERS b/incubator/raw/OWNERS new file mode 100644 index 0000000000..5f8fd9e5d1 --- /dev/null +++ b/incubator/raw/OWNERS @@ -0,0 +1,4 @@ +approvers: +- josdotso +reviewers: +- josdotso diff --git a/incubator/raw/README.md b/incubator/raw/README.md new file mode 100644 index 0000000000..b191f64d44 --- /dev/null +++ b/incubator/raw/README.md @@ -0,0 +1,90 @@ +# incubator/raw + +The `incubator/raw` chart takes a list of raw Kubernetes resources and +merges each resource with a default `metadata.labels` map and installs +the result. + +Some use cases for this chart include Helm-based installation and +maintenance of resources of kinds: +- LimitRange +- PriorityClass + +## Usage + +### STEP 1: Create a yaml file containing your raw resources. + +``` +# raw-priority-classes.yaml + +resources: + + - apiVersion: scheduling.k8s.io/v1beta1 + kind: PriorityClass + metadata: + name: common-critical + value: 100000000 + globalDefault: false + description: "This priority class should only be used for critical priority common pods." + + - apiVersion: scheduling.k8s.io/v1beta1 + kind: PriorityClass + metadata: + name: common-high + value: 90000000 + globalDefault: false + description: "This priority class should only be used for high priority common pods." + + - apiVersion: scheduling.k8s.io/v1beta1 + kind: PriorityClass + metadata: + name: common-medium + value: 80000000 + globalDefault: false + description: "This priority class should only be used for medium priority common pods." + + - apiVersion: scheduling.k8s.io/v1beta1 + kind: PriorityClass + metadata: + name: common-low + value: 70000000 + globalDefault: false + description: "This priority class should only be used for low priority common pods." + + - apiVersion: scheduling.k8s.io/v1beta1 + kind: PriorityClass + metadata: + name: app-critical + value: 100000 + globalDefault: false + description: "This priority class should only be used for critical priority app pods." + + - apiVersion: scheduling.k8s.io/v1beta1 + kind: PriorityClass + metadata: + name: app-high + value: 90000 + globalDefault: false + description: "This priority class should only be used for high priority app pods." + + - apiVersion: scheduling.k8s.io/v1beta1 + kind: PriorityClass + metadata: + name: app-medium + value: 80000 + globalDefault: true + description: "This priority class should only be used for medium priority app pods." + + - apiVersion: scheduling.k8s.io/v1beta1 + kind: PriorityClass + metadata: + name: app-low + value: 70000 + globalDefault: false + description: "This priority class should only be used for low priority app pods." +``` + +### STEP 2: Install your raw resources. + +``` +helm install --name raw-priority-classes incubator/raw -f raw-priority-classes.yaml +``` diff --git a/incubator/raw/templates/NOTES.txt b/incubator/raw/templates/NOTES.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/incubator/raw/templates/_helpers.tpl b/incubator/raw/templates/_helpers.tpl new file mode 100644 index 0000000000..f916d2752c --- /dev/null +++ b/incubator/raw/templates/_helpers.tpl @@ -0,0 +1,45 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "raw.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "raw.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "raw.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +raw.resource will create a resource template that can be +merged with each item in `.Values.resources`. +*/}} +{{- define "raw.resource" -}} +metadata: + labels: + app: {{ template "raw.name" . }} + chart: {{ template "raw.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- end }} diff --git a/incubator/raw/templates/resources.yaml b/incubator/raw/templates/resources.yaml new file mode 100644 index 0000000000..2799ad8e81 --- /dev/null +++ b/incubator/raw/templates/resources.yaml @@ -0,0 +1,5 @@ +{{- $template := fromYaml (include "raw.resource" .) -}} +{{- range .Values.resources }} +--- +{{- toYaml (merge . $template) -}} +{{- end }} diff --git a/incubator/raw/values.yaml b/incubator/raw/values.yaml new file mode 100644 index 0000000000..71167aa65e --- /dev/null +++ b/incubator/raw/values.yaml @@ -0,0 +1,65 @@ +resources: [] +# +# - apiVersion: scheduling.k8s.io/v1beta1 +# kind: PriorityClass +# metadata: +# name: common-critical +# value: 100000000 +# globalDefault: false +# description: "This priority class should only be used for critical priority common pods." +# +# - apiVersion: scheduling.k8s.io/v1beta1 +# kind: PriorityClass +# metadata: +# name: common-high +# value: 90000000 +# globalDefault: false +# description: "This priority class should only be used for high priority common pods." +# +# - apiVersion: scheduling.k8s.io/v1beta1 +# kind: PriorityClass +# metadata: +# name: common-medium +# value: 80000000 +# globalDefault: false +# description: "This priority class should only be used for medium priority common pods." +# +# - apiVersion: scheduling.k8s.io/v1beta1 +# kind: PriorityClass +# metadata: +# name: common-low +# value: 70000000 +# globalDefault: false +# description: "This priority class should only be used for low priority common pods." +# +# - apiVersion: scheduling.k8s.io/v1beta1 +# kind: PriorityClass +# metadata: +# name: app-critical +# value: 100000 +# globalDefault: false +# description: "This priority class should only be used for critical priority app pods." +# +# - apiVersion: scheduling.k8s.io/v1beta1 +# kind: PriorityClass +# metadata: +# name: app-high +# value: 90000 +# globalDefault: false +# description: "This priority class should only be used for high priority app pods." +# +# - apiVersion: scheduling.k8s.io/v1beta1 +# kind: PriorityClass +# metadata: +# name: app-medium +# value: 80000 +# globalDefault: true +# description: "This priority class should only be used for medium priority app pods." +# +# - apiVersion: scheduling.k8s.io/v1beta1 +# kind: PriorityClass +# metadata: +# name: app-low +# value: 70000 +# globalDefault: false +# description: "This priority class should only be used for low priority app pods."