Skip to content

Commit

Permalink
feat: new dedicated docker-host chart
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Jun 5, 2023
1 parent d35f2af commit b7348b6
Show file tree
Hide file tree
Showing 16 changed files with 484 additions and 0 deletions.
1 change: 1 addition & 0 deletions charts/lagoon-docker-host/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/charts
22 changes: 22 additions & 0 deletions charts/lagoon-docker-host/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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
.vscode/
30 changes: 30 additions & 0 deletions charts/lagoon-docker-host/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: v2
name: lagoon-docker-host
description: A Helm chart to run a lagoon-docker-host
home: https://github.com/uselagoon/lagoon-charts
icon: https://raw.githubusercontent.com/uselagoon/lagoon-charts/main/icon.png
maintainers:
- name: shreddedbacon
email: [email protected]
url: https://amazee.io
kubeVersion: ">= 1.21.0-0"

# Application charts are a collection of templates that can be packaged into
# versioned archives to 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.
version: 0.1.0

appVersion: v3.3.0


# This section is used to collect a changelog for artifacthub.io
# It should be started afresh for each release
# Valid supported kinds are added, changed, deprecated, removed, fixed and security
annotations:
artifacthub.io/changes: |
- kind: changed
description: update lagoon-docker-host to appversion v3.3.0
4 changes: 4 additions & 0 deletions charts/lagoon-docker-host/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Lagoon Docker Host

This chart installs a docker hpst service for [Lagoon](https://github.com/amazeeio/lagoon/).
Install this chart into the cluster you want to deploy workloads to.
2 changes: 2 additions & 0 deletions charts/lagoon-docker-host/ci/linter-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
storage:
size: 50Gi
27 changes: 27 additions & 0 deletions charts/lagoon-docker-host/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

            .;.
        .':ooo' .l;.
     .:odddooo' .lllc:'.
 .;oxxxxdddddo' .lllcc:::,.
.kkkkxxxxxdddd' .lllcc::::::
.kkkkkkxxxxxdd, .lllcccccc::
.OOOkkkkkxxxxx, .llllllccccc
.OOOOOkkkkkxxx;  ':llllllccc
.0OOOOOOkkkkxxxo;.  .,cllllc.
.0000OOOOOkkkkxxxddc,. .':ll.
.K0000000OOOOkkkxxxxddo;.  .
.kKKKKKK0000OOOkkkkxxxdddoc.
  .;d0KKKKK000OOOOkkkxxdc'
      .ckKKKK000OOOOd;.
         .,o0KKKOl,
             .;. 
_ _ _ _ _
| | | | | | | | | |
| | __ _ __ _ ___ ___ _ __ __| | ___ ___| | _____ _ __ | |__ ___ ___| |_
| |/ _` |/ _` |/ _ \ / _ \| '_ \ / _` |/ _ \ / __| |/ / _ \ '__| | '_ \ / _ \/ __| __|
| | (_| | (_| | (_) | (_) | | | | | (_| | (_) | (__| < __/ | | | | | (_) \__ \ |_
|_|\__,_|\__, |\___/ \___/|_| |_| \__,_|\___/ \___|_|\_\___|_| |_| |_|\___/|___/\__|
__/ |
|___/

Lagoon Docker Host configured.
81 changes: 81 additions & 0 deletions charts/lagoon-docker-host/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "lagoon-docker-host.name" -}}
{{- .Chart.Name | 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 "lagoon-docker-host.fullname" -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "lagoon-docker-host.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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



{{/*
Create the name of the service account to use for dockerHost.
*/}}
{{- define "lagoon-docker-host.dockerHost.serviceAccountName" -}}
{{- default (include "lagoon-docker-host.dockerHost.fullname" .) .Values.serviceAccount.name }}
{{- end }}

{{/*
Create a default fully qualified app name for dockerHost.
*/}}
{{- define "lagoon-docker-host.dockerHost.fullname" -}}
{{- include "lagoon-docker-host.fullname" . }}-docker-host
{{- end }}

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

{{/*
Selector labels dockerHost.
*/}}
{{- define "lagoon-docker-host.dockerHost.selectorLabels" -}}
app.kubernetes.io/name: {{ include "lagoon-docker-host.name" . }}
app.kubernetes.io/component: {{ include "lagoon-docker-host.dockerHost.fullname" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

17 changes: 17 additions & 0 deletions charts/lagoon-docker-host/templates/docker-host.clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if and .Values.serviceAccount.create .Values.global.openshift -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "lagoon-docker-host.dockerHost.fullname" . }}
labels:
{{- include "lagoon-docker-host.dockerHost.labels" . | nindent 4 }}
rules:
- apiGroups:
- security.openshift.io
resourceNames:
- privileged
resources:
- securitycontextconstraints
verbs:
- use
{{- end }}
113 changes: 113 additions & 0 deletions charts/lagoon-docker-host/templates/docker-host.deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "lagoon-docker-host.dockerHost.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "lagoon-docker-host.dockerHost.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "lagoon-docker-host.dockerHost.selectorLabels" . | nindent 6 }}
strategy:
type: Recreate
template:
metadata:
labels:
{{- include "lagoon-docker-host.dockerHost.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ include "lagoon-docker-host.dockerHost.serviceAccountName" . }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: docker-host
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- range $name, $value := .Values.extraEnvs }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
{{- with .Values.httpProxy }}
- name: HTTP_PROXY
value: {{ . | quote }}
- name: http_proxy
value: {{ . | quote }}
{{- end }}
{{- with .Values.httpsProxy }}
- name: HTTPS_PROXY
value: {{ . | quote }}
- name: https_proxy
value: {{ . | quote }}
{{- end }}
{{- with .Values.noProxy }}
- name: NO_PROXY
value: {{ . | quote }}
- name: no_proxy
value: {{ . | quote }}
{{- end }}
- name: DOCKER_HOST
value: localhost
- name: REGISTRY
value: {{ .Values.registry | quote }}
- name: REPOSITORY_TO_UPDATE
value: {{ .Values.repositoryToUpdate | quote }}
- name: PRUNE_IMAGES_UNTIL
value: {{ .Values.pruneImagesUntil | quote }}
- name: CRONJOBS
value: |
22 1 * * * /lagoon/cronjob.sh "/prune-images.sh"
22 */4 * * * /lagoon/cronjob.sh "/remove-exited.sh"
*/15 * * * * /lagoon/cronjob.sh "/update-images.sh"
ports:
- containerPort: 2375
protocol: TCP
name: docker-daemon
livenessProbe:
failureThreshold: 3
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 2375
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 2375
timeoutSeconds: 1
resources:
{{- toYaml .Values.resources | nindent 10 }}
volumeMounts:
- mountPath: /var/lib/docker
name: docker-lib
volumes:
- name: docker-lib
{{- if .Values.storage.create }}
persistentVolumeClaim:
claimName: {{ include "lagoon-docker-host.dockerHost.fullname" . }}
{{- else }}
emptyDir: {}
{{- end -}}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 6 }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/lagoon-docker-host/templates/docker-host.networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.networkPolicy.enabled -}}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "lagoon-docker-host.dockerHost.fullname" . }}
labels:
{{- include "lagoon-docker-host.dockerHost.labels" . | nindent 4 }}
spec:
ingress:
- from:
{{- toYaml .Values.networkPolicy.policy | nindent 4 }}
podSelector:
matchLabels:
{{- include "lagoon-docker-host.dockerHost.selectorLabels" . | nindent 6 }}
policyTypes:
- Ingress
{{- end }}
17 changes: 17 additions & 0 deletions charts/lagoon-docker-host/templates/docker-host.pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.storage.create -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "lagoon-docker-host.dockerHost.fullname" . }}
labels:
{{- include "lagoon-docker-host.dockerHost.labels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.storage.size | quote }}
{{- with .Values.storage.className }}
storageClassName: {{ . | quote }}
{{- end }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/lagoon-docker-host/templates/docker-host.rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if and .Values.serviceAccount.create .Values.global.openshift -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "lagoon-docker-host.dockerHost.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "lagoon-docker-host.dockerHost.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "lagoon-docker-host.dockerHost.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "lagoon-docker-host.dockerHost.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
Loading

0 comments on commit b7348b6

Please sign in to comment.