-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
221 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# 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 | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: v2 | ||
name: k8s-resources | ||
description: Helm chart to create any type of k8s resource | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# k8s-resources | ||
|
||
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) | ||
|
||
Helm chart to create any type of k8s resource | ||
|
||
This is a very simple chart to create any type of kubernetes resources with helm.<br> | ||
Since not every chart offers something like extraResources parameter, i use this chart to deploy some stuff along with application - for example, VerticalPodAutoscaler CRs.<br> | ||
Example usage with all supported parameters: | ||
```yaml | ||
resources: | ||
- name: vpa-loki-ingester | ||
# override generated resource name | ||
fullnameOverride: "vpa-loki-ingester" | ||
# add annotations | ||
annotations: | ||
annotation: value | ||
# add annotations | ||
labels: | ||
some-label: value | ||
# apiVersion of resource | ||
apiVersion: autoscaling.k8s.io/v1 | ||
# kind of resource | ||
kind: VerticalPodAutoscaler | ||
# resource spec | ||
spec: | ||
targetRef: | ||
apiVersion: "apps/v1" | ||
kind: Deployment | ||
name: loki-ingester | ||
updatePolicy: | ||
updateMode: "Off" | ||
``` | ||
## Values | ||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| fullnameOverride | string | `""` | Overrides helm-generated chart fullname | | ||
| nameOverride | string | `""` | overrides chart name | | ||
| resources | object | `{}` | dict with user-provided resources | | ||
|
||
## Upgrading | ||
|
||
A major chart version change indicates that there is an incompatible breaking change needing manual actions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{{ template "chart.header" . }} | ||
|
||
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }} | ||
|
||
{{ template "chart.description" . }} | ||
|
||
{{ template "chart.sourcesSection" . }} | ||
|
||
{{ template "chart.requirementsSection" . }} | ||
|
||
This is a very simple chart to create any type of kubernetes resources with helm.<br> | ||
Since not every chart offers something like extraResources parameter, i use this chart to deploy some stuff along with application - for example, VerticalPodAutoscaler CRs.<br> | ||
Example usage with all supported parameters: | ||
```yaml | ||
resources: | ||
- name: vpa-loki-ingester | ||
# override generated resource name | ||
fullnameOverride: "vpa-loki-ingester" | ||
# add annotations | ||
annotations: | ||
annotation: value | ||
# add annotations | ||
labels: | ||
some-label: value | ||
# apiVersion of resource | ||
apiVersion: autoscaling.k8s.io/v1 | ||
# kind of resource | ||
kind: VerticalPodAutoscaler | ||
# resource spec | ||
spec: | ||
targetRef: | ||
apiVersion: "apps/v1" | ||
kind: Deployment | ||
name: loki-ingester | ||
updatePolicy: | ||
updateMode: "Off" | ||
``` | ||
|
||
{{ template "chart.valuesSection" . }} | ||
|
||
## Upgrading | ||
|
||
A major chart version change indicates that there is an incompatible breaking change needing manual actions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "k8s-resources.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 "k8s-resources.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 "k8s-resources.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "k8s-resources.labels" -}} | ||
helm.sh/chart: {{ include "k8s-resources.chart" . }} | ||
{{ include "k8s-resources.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "k8s-resources.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "k8s-resources.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{- if .Values.resources -}} | ||
{{- range .Values.resources }} | ||
apiVersion: {{ .apiVersion }} | ||
kind: {{ .kind }} | ||
metadata: | ||
name: {{ if .fullnameOverride }}{{ .fullnameOverride }}{{ else }}{{ include "k8s-resources.fullname" $ }}-{{ .name }}{{ end }} | ||
labels: | ||
{{- include "k8s-resources.labels" $ | nindent 4 }} | ||
{{- with .labels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- with .annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- toYaml .spec | nindent 2 }} | ||
--- | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -- overrides chart name | ||
nameOverride: "" | ||
# -- Overrides helm-generated chart fullname | ||
fullnameOverride: "" | ||
# -- dict with user-provided resources | ||
resources: {} | ||
# - name: vpa-loki-ingester | ||
# fullnameOverride: "vpa-loki-ingester" | ||
# annotations: | ||
# annotation: value | ||
# labels: | ||
# some-label: value | ||
# apiVersion: autoscaling.k8s.io/v1 | ||
# kind: VerticalPodAutoscaler | ||
# spec: | ||
# targetRef: | ||
# apiVersion: "apps/v1" | ||
# kind: Deployment | ||
# name: loki-ingester | ||
# updatePolicy: | ||
# updateMode: "Off" |