Skip to content

Commit

Permalink
add runtime chart
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino committed Feb 7, 2024
1 parent bbc6115 commit 0c6dc71
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/runtime/.helmignore
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/
6 changes: 6 additions & 0 deletions charts/runtime/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: runtime
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.16.0"
62 changes: 62 additions & 0 deletions charts/runtime/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "runtime.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 "runtime.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 "runtime.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "runtime.labels" -}}
helm.sh/chart: {{ include "runtime.chart" . }}
{{ include "runtime.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "runtime.selectorLabels" -}}
app.kubernetes.io/name: {{ include "runtime.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "runtime.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "runtime.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
11 changes: 11 additions & 0 deletions charts/runtime/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ if .Values.pullCredentials }}
apiVersion: v1
kind: Secret
metadata:
name: mottmac-pull-creds
labels:
{{- include "runtime.labels" . | nindent 4 }}
type: kubernetes.io/dockerconfigjson
stringData:
.dockerconfigjson: {{ .Values.pullCredentials | quote }}
{{ end }}
14 changes: 14 additions & 0 deletions charts/runtime/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: mottmac
labels:
{{- include "runtime.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{ if .Values.pullCredentials }}
imagePullSecrets:
- name: mottmac-pull-creds
{{ end }}
3 changes: 3 additions & 0 deletions charts/runtime/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
replicaCount: 1

pullCredentials: ~
3 changes: 3 additions & 0 deletions charts/runtime/values.yaml.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% if configuration[".dockerconfigjson"] %}
pullCredentials: {{ configuration[".dockerconfigjson"] }}
{% endif %}

0 comments on commit 0c6dc71

Please sign in to comment.