First commit

This commit is contained in:
Laszlo Fogas
2020-08-18 14:43:47 +02:00
parent d67066e8bc
commit 410c071697
15 changed files with 281 additions and 2 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.idea/
values.yaml

23
.helmignore Normal file
View File

@@ -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/

7
Makefile Normal file
View File

@@ -0,0 +1,7 @@
all: package
package:
helm package onechart
mv onechart*.tgz docs
helm repo index docs --url https://onechart.github.io/onecharts

View File

@@ -1,3 +1,3 @@
# Helm chart for Gimlet
# Onechart
Created based on the https://github.com/technosophos/tscharts chart.# onechart
A generic Helm chart for your application deployments

3
docs/index.html Normal file
View File

@@ -0,0 +1,3 @@
Gimlet Helm chart
<a href="index.yaml">index.yaml</a>

13
docs/index.yaml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: v1
entries:
onechart:
- apiVersion: v2
created: "2020-08-18T14:43:16.767812118+02:00"
description: A generic Helm chart for your application deployments
digest: 69b5b48044729fda2d6a57f184387bfa623f3a480301d206ab813677dd2c8dca
name: onechart
type: application
urls:
- https://onechart.github.io/onecharts/onechart-0.1.0.tgz
version: 0.1.0
generated: "2020-08-18T14:43:16.767421313+02:00"

BIN
docs/onechart-0.1.0.tgz Normal file

Binary file not shown.

18
onechart/Chart.yaml Normal file
View File

@@ -0,0 +1,18 @@
apiVersion: v2
name: onechart
description: A generic Helm chart for your application deployments
# 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

View File

@@ -0,0 +1 @@
TODO intro text

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 }}

View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "helm-chart.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "helm-chart.labels" . | nindent 4 }}
data:
{{- range $key, $val := .Values.vars }}
{{ $key }}: {{ $val }}
{{- end }}

View File

@@ -0,0 +1,75 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "helm-chart.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "helm-chart.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
{{- include "helm-chart.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "helm-chart.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "helm-chart.fullname" . }}
ports:
- name: http
containerPort: {{ .Values.containerPort }}
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: {{ .Values.probe }}
port: {{ .Values.containerPort }}
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
volumeMounts:
{{- range .Values.volumes }}
- name: {{ .name }}
mountPath: {{ .path }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
{{- range .Values.volumes }}
- name: {{ .name }}
persistentVolumeClaim:
claimName: {{ printf "%s-%s" $.Release.Name .name }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,32 @@
{{- $fullName := include "helm-chart.fullname" . -}}
{{- $labels := include "helm-chart.labels" . -}}
{{- with .Values.ingress -}}
{{- if semverCompare ">=1.14-0" $.Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
namespace: {{ $.Release.Namespace }}
labels:
{{- $labels | nindent 4 }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
tls:
- hosts:
- {{ .host | quote }}
secretName: {{ printf "tls-%s" $.Release.Name }}
rules:
- host: {{ .host | quote }}
http:
paths:
- backend:
serviceName: {{ $fullName }}
servicePort: {{ $.Values.containerPort }}
{{- end }}

View File

@@ -0,0 +1,15 @@
{{- range .Values.volumes }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ printf "%s-%s" $.Release.Name .name }}
namespace: {{ $.Release.Namespace }}
spec:
accessModes:
- {{ .accessMode | default "ReadWriteOnce" }}
storageClassName: {{ .storageClass | default "local-path" }}
resources:
requests:
storage: {{ .size | default "1Gi" }}
{{- end }}

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "helm-chart.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "helm-chart.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.containerPort }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "helm-chart.selectorLabels" . | nindent 4 }}