Namespaces chart for namespace creation and defaults

This commit is contained in:
Laszlo Fogas
2020-11-02 16:00:12 +01:00
parent 38168aa75e
commit 19f7c216cc
12 changed files with 145 additions and 20 deletions
+11
View File
@@ -4,6 +4,7 @@ all: lint kubeval test package
lint: lint:
helm lint charts/onechart/ helm lint charts/onechart/
helm lint charts/cron-job/ helm lint charts/cron-job/
helm lint charts/namespaces/
kubeval: kubeval:
rm -rf manifests && true rm -rf manifests && true
@@ -18,9 +19,16 @@ kubeval:
find manifests/ -name '*.yaml' | xargs kubeval --ignore-missing-schemas -v 1.13.0 find manifests/ -name '*.yaml' | xargs kubeval --ignore-missing-schemas -v 1.13.0
find manifests/ -name '*.yaml' | xargs kubeval --ignore-missing-schemas -v 1.18.0 find manifests/ -name '*.yaml' | xargs kubeval --ignore-missing-schemas -v 1.18.0
rm -rf manifests && true
mkdir manifests
helm template charts/namespaces --output-dir manifests
find manifests/ -name '*.yaml' | xargs kubeval --ignore-missing-schemas -v 1.13.0
find manifests/ -name '*.yaml' | xargs kubeval --ignore-missing-schemas -v 1.18.0
test: test:
helm unittest charts/onechart helm unittest charts/onechart
helm unittest charts/cron-job helm unittest charts/cron-job
helm unittest charts/namespaces
package: package:
helm package charts/onechart helm package charts/onechart
@@ -29,4 +37,7 @@ package:
helm package charts/cron-job helm package charts/cron-job
mv cron-job*.tgz docs mv cron-job*.tgz docs
helm package charts/namespaces
mv namespaces*.tgz docs
helm repo index docs --url https://chart.onechart.dev helm repo index docs --url https://chart.onechart.dev
+1
View File
@@ -0,0 +1 @@
tests
+18
View File
@@ -0,0 +1,18 @@
apiVersion: v2
name: namespaces
description: Chart to create namespaces and their defaults
# 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
+1
View File
@@ -0,0 +1 @@
TODO intro text
+63
View File
@@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "helm-chart.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 "helm-chart.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 "helm-chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "helm-chart.labels" -}}
helm.sh/chart: {{ include "helm-chart.chart" . }}
{{ include "helm-chart.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "helm-chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "helm-chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "helm-chart.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "helm-chart.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
@@ -0,0 +1,7 @@
{{- range .Values.namespaces }}
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ .name }}
{{- end }}
+12
View File
@@ -0,0 +1,12 @@
suite: test deployment
templates:
- namespace.yaml
tests:
- it: Should create namespace
set:
namespaces:
- name: staging
asserts:
- equal:
path: metadata.name
value: staging
+2
View File
@@ -0,0 +1,2 @@
namespaces:
- name: staging
Binary file not shown.
+30 -20
View File
@@ -2,17 +2,17 @@ apiVersion: v1
entries: entries:
cron-job: cron-job:
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.618019841+01:00" created: "2020-11-02T15:58:33.790295161+01:00"
description: One chart to rule them all. A generic Helm chart for your application description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax. deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 4aeccff17fc263b8ebb79faf6fb89131860a42d02a9407d312fbb8f16d74d4e7 digest: 28735c68d458a840610d1550c703bb3044cae8dcc70c0cb7bf09c3a9cd33d44d
name: cron-job name: cron-job
type: application type: application
urls: urls:
- https://chart.onechart.dev/cron-job-0.1.2.tgz - https://chart.onechart.dev/cron-job-0.1.2.tgz
version: 0.1.2 version: 0.1.2
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.617744579+01:00" created: "2020-11-02T15:58:33.789951721+01:00"
description: One chart to rule them all. A generic Helm chart for your application description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax. deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: afab9ba533a4686827b54b0dad64f5bbf76f7fbc075e35fb1034689db9ab9dda digest: afab9ba533a4686827b54b0dad64f5bbf76f7fbc075e35fb1034689db9ab9dda
@@ -22,7 +22,7 @@ entries:
- https://chart.onechart.dev/cron-job-0.1.1.tgz - https://chart.onechart.dev/cron-job-0.1.1.tgz
version: 0.1.1 version: 0.1.1
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.617364562+01:00" created: "2020-11-02T15:58:33.78967665+01:00"
description: One chart to rule them all. A generic Helm chart for your application description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax. deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 01f9fa40c1c4085d7688474ab00c9e9d21bd1d0793db6b75f2edda0e18456282 digest: 01f9fa40c1c4085d7688474ab00c9e9d21bd1d0793db6b75f2edda0e18456282
@@ -31,19 +31,29 @@ entries:
urls: urls:
- https://chart.onechart.dev/cron-job-0.1.0.tgz - https://chart.onechart.dev/cron-job-0.1.0.tgz
version: 0.1.0 version: 0.1.0
namespaces:
- apiVersion: v2
created: "2020-11-02T15:58:33.790485508+01:00"
description: Chart to create namespaces and their defaults
digest: 4fde09fb3fb0d5d7575c25c3e33b0b7c12e6836166a9b421f7f096789f6938de
name: namespaces
type: application
urls:
- https://chart.onechart.dev/namespaces-0.1.0.tgz
version: 0.1.0
onechart: onechart:
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.623812883+01:00" created: "2020-11-02T15:58:33.795821549+01:00"
description: One chart to rule them all. A generic Helm chart for your application description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax. deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 62139f65b01aed60c0caebaf476e5686e0323a9f9b55579df98946f4d80064a6 digest: db8354b30748f8785ba45afcac15b4e69d2adda69168e2b37d33f221a8636b09
name: onechart name: onechart
type: application type: application
urls: urls:
- https://chart.onechart.dev/onechart-0.7.1.tgz - https://chart.onechart.dev/onechart-0.7.1.tgz
version: 0.7.1 version: 0.7.1
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.623483264+01:00" created: "2020-11-02T15:58:33.795248796+01:00"
description: One chart to rule them all. A generic Helm chart for your application description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax. deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 4bf90835f287917671ec40b5b395da9332cf18e70f248d250f8d5a72360dcb4e digest: 4bf90835f287917671ec40b5b395da9332cf18e70f248d250f8d5a72360dcb4e
@@ -53,7 +63,7 @@ entries:
- https://chart.onechart.dev/onechart-0.7.0.tgz - https://chart.onechart.dev/onechart-0.7.0.tgz
version: 0.7.0 version: 0.7.0
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.623061264+01:00" created: "2020-11-02T15:58:33.794775255+01:00"
description: One chart to rule them all. A generic Helm chart for your application description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax. deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 0cade489fc74a040f5e7f71d01c6fa00d3f68b4752a4d8234ccf2c1504b4c0a1 digest: 0cade489fc74a040f5e7f71d01c6fa00d3f68b4752a4d8234ccf2c1504b4c0a1
@@ -63,7 +73,7 @@ entries:
- https://chart.onechart.dev/onechart-0.6.1.tgz - https://chart.onechart.dev/onechart-0.6.1.tgz
version: 0.6.1 version: 0.6.1
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.622696086+01:00" created: "2020-11-02T15:58:33.79439208+01:00"
description: One chart to rule them all. A generic Helm chart for your application description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax. deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: d607820a7e104eaaa88c153c1f2f7f409ef4c612ad747caeb3a671cf3fce03d4 digest: d607820a7e104eaaa88c153c1f2f7f409ef4c612ad747caeb3a671cf3fce03d4
@@ -73,7 +83,7 @@ entries:
- https://chart.onechart.dev/onechart-0.6.0.tgz - https://chart.onechart.dev/onechart-0.6.0.tgz
version: 0.6.0 version: 0.6.0
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.622315353+01:00" created: "2020-11-02T15:58:33.794113702+01:00"
description: One chart to rule them all. A generic Helm chart for your application description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax. deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: ddf7cf87402095d62855898744b805115fdf86c4b295e0a4def0c50408fd9138 digest: ddf7cf87402095d62855898744b805115fdf86c4b295e0a4def0c50408fd9138
@@ -83,7 +93,7 @@ entries:
- https://chart.onechart.dev/onechart-0.5.1.tgz - https://chart.onechart.dev/onechart-0.5.1.tgz
version: 0.5.1 version: 0.5.1
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.621970279+01:00" created: "2020-11-02T15:58:33.793836394+01:00"
description: One chart to rule them all. A generic Helm chart for your application description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax. deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: adf3c2cf3a27e58ec75620599e0e1c2031a7410a061a590317beeff6d8a9ad69 digest: adf3c2cf3a27e58ec75620599e0e1c2031a7410a061a590317beeff6d8a9ad69
@@ -93,7 +103,7 @@ entries:
- https://chart.onechart.dev/onechart-0.5.0.tgz - https://chart.onechart.dev/onechart-0.5.0.tgz
version: 0.5.0 version: 0.5.0
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.621583482+01:00" created: "2020-11-02T15:58:33.793578335+01:00"
description: One chart to rule them all. A generic Helm chart for your application description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax. deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 8dab33263c4e632aeb4656c666871440b589497b70e76a1d6c3a5e3db1a30bba digest: 8dab33263c4e632aeb4656c666871440b589497b70e76a1d6c3a5e3db1a30bba
@@ -103,7 +113,7 @@ entries:
- https://chart.onechart.dev/onechart-0.4.0.tgz - https://chart.onechart.dev/onechart-0.4.0.tgz
version: 0.4.0 version: 0.4.0
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.621201831+01:00" created: "2020-11-02T15:58:33.793253157+01:00"
description: A generic Helm chart for your application deployments description: A generic Helm chart for your application deployments
digest: fbaf6139e0ef8ad9a87cc1e41a97c7d25fdcf7ea17fa6364952f1a851a87480a digest: fbaf6139e0ef8ad9a87cc1e41a97c7d25fdcf7ea17fa6364952f1a851a87480a
name: onechart name: onechart
@@ -112,7 +122,7 @@ entries:
- https://chart.onechart.dev/onechart-0.3.2.tgz - https://chart.onechart.dev/onechart-0.3.2.tgz
version: 0.3.2 version: 0.3.2
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.620758303+01:00" created: "2020-11-02T15:58:33.792896988+01:00"
description: A generic Helm chart for your application deployments description: A generic Helm chart for your application deployments
digest: bd6f5b1865ab9b05fc6925c163ab8045235bd2723dba31f09d5083d24322d1f8 digest: bd6f5b1865ab9b05fc6925c163ab8045235bd2723dba31f09d5083d24322d1f8
name: onechart name: onechart
@@ -121,7 +131,7 @@ entries:
- https://chart.onechart.dev/onechart-0.3.1.tgz - https://chart.onechart.dev/onechart-0.3.1.tgz
version: 0.3.1 version: 0.3.1
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.6203096+01:00" created: "2020-11-02T15:58:33.792305454+01:00"
description: A generic Helm chart for your application deployments description: A generic Helm chart for your application deployments
digest: c79cef21eceab948144a289298cdf1e20e77a0782a883d7d65f9e709ccbbc271 digest: c79cef21eceab948144a289298cdf1e20e77a0782a883d7d65f9e709ccbbc271
name: onechart name: onechart
@@ -130,7 +140,7 @@ entries:
- https://chart.onechart.dev/onechart-0.3.0.tgz - https://chart.onechart.dev/onechart-0.3.0.tgz
version: 0.3.0 version: 0.3.0
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.619707993+01:00" created: "2020-11-02T15:58:33.791566888+01:00"
description: A generic Helm chart for your application deployments description: A generic Helm chart for your application deployments
digest: dd814ac5d08d5e6163a1b769df6803f5cb0f09d906045086dfcc5be522bb1ec3 digest: dd814ac5d08d5e6163a1b769df6803f5cb0f09d906045086dfcc5be522bb1ec3
name: onechart name: onechart
@@ -139,7 +149,7 @@ entries:
- https://chart.onechart.dev/onechart-0.2.0.tgz - https://chart.onechart.dev/onechart-0.2.0.tgz
version: 0.2.0 version: 0.2.0
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.619093238+01:00" created: "2020-11-02T15:58:33.791295368+01:00"
description: A generic Helm chart for your application deployments description: A generic Helm chart for your application deployments
digest: e46062df8053840cbfbba26c0a66a843a79f15a0b43a145ed019327513bd5098 digest: e46062df8053840cbfbba26c0a66a843a79f15a0b43a145ed019327513bd5098
name: onechart name: onechart
@@ -148,7 +158,7 @@ entries:
- https://chart.onechart.dev/onechart-0.1.2.tgz - https://chart.onechart.dev/onechart-0.1.2.tgz
version: 0.1.2 version: 0.1.2
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.618772737+01:00" created: "2020-11-02T15:58:33.791047332+01:00"
description: A generic Helm chart for your application deployments description: A generic Helm chart for your application deployments
digest: a7bbc8b7dcc008e89156cd1830282b7d39c0592e82ccdcefb77a25a42eca2a3d digest: a7bbc8b7dcc008e89156cd1830282b7d39c0592e82ccdcefb77a25a42eca2a3d
name: onechart name: onechart
@@ -157,7 +167,7 @@ entries:
- https://chart.onechart.dev/onechart-0.1.1.tgz - https://chart.onechart.dev/onechart-0.1.1.tgz
version: 0.1.1 version: 0.1.1
- apiVersion: v2 - apiVersion: v2
created: "2020-11-02T11:00:14.618406551+01:00" created: "2020-11-02T15:58:33.790768469+01:00"
description: A generic Helm chart for your application deployments description: A generic Helm chart for your application deployments
digest: 1ed8c0645abdae6c950526e9c5410dc056847a11700dc7def5f1c55eb7de0cd4 digest: 1ed8c0645abdae6c950526e9c5410dc056847a11700dc7def5f1c55eb7de0cd4
name: onechart name: onechart
@@ -165,4 +175,4 @@ entries:
urls: urls:
- https://chart.onechart.dev/onechart-0.1.0.tgz - https://chart.onechart.dev/onechart-0.1.0.tgz
version: 0.1.0 version: 0.1.0
generated: "2020-11-02T11:00:14.616879883+01:00" generated: "2020-11-02T15:58:33.789308321+01:00"
Binary file not shown.
Binary file not shown.