Skip to content

Commit

Permalink
Add WIP chart: docker_auth
Browse files Browse the repository at this point in the history
  • Loading branch information
auguwu committed May 27, 2024
1 parent 6104d82 commit a0098ae
Show file tree
Hide file tree
Showing 21 changed files with 1,105 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .charted.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ repository "hazel" {
source = "${cwd}/charts/noelware/hazel"
path = "noelware/hazel"
}

repository "docker_auth" {
registry = registry.default
source = "${cwd}/charts/docker_auth"
path = "noelware/docker-auth"
}
Empty file added charts/docker_auth/.helmignore
Empty file.
6 changes: 6 additions & 0 deletions charts/docker_auth/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.19.2
digest: sha256:259c2016a8bd1aca53bb5d9d18ab142a139924dbd7946457a29465ed7e8d37b0
generated: "2024-05-25T02:43:30.962658517-07:00"
48 changes: 48 additions & 0 deletions charts/docker_auth/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 🐻‍❄️🔮 Noelware's Helm Charts: Curated catalog of Noelware's Helm charts.
# Copyright (c) 2022-2024 Noelware, LLC. <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

kubeVersion: ">=1.26"
description: Unofficial Helm chart for the `cesanta/docker_auth` Docker image.
apiVersion: v2

# renovate: image=cesanta/docker_auth
appVersion: "1.12.0"
version: 0.1.0
type: application
home: https://github.com/cesanta/docker_auth
name: docker_auth
keywords:
- docker-auth
- docker-registry
maintainers:
- name: Noelware, LLC.
email: [email protected]
url: https://noelware.org
- name: Noel Towa
email: [email protected]
url: https://floofy.dev
annotations:
charts.noelware.org/licenses: Apache-2.0
charts.noelware.org/categories: Authentication
dependencies:
- name: common
version: 2.19.2
repository: oci://registry-1.docker.io/bitnamicharts
120 changes: 120 additions & 0 deletions charts/docker_auth/README.md

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions charts/docker_auth/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
To access your `docker_auth` instance, use the following commands (if any appear):

{{- if (eq .Values.service.type "NodePort") }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "hazel.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo "http://$NODE_IP:$NODE_PORT"
{{- else if (eq .Values.service.type "ClusterIP") }}
export POD=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "k8s.noel.pink/name={{ include "hazel.name" . }}" -o jsonpath="{.items[0].metadata.name}")
export PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "http://127.0.0.1:8080"

kubectl --namespace {{ .Release.Namespace }} port-forward $POD 8080:$PORT
{{- end }}
176 changes: 176 additions & 0 deletions charts/docker_auth/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
{{/*
~ 🐻‍❄️🔮 Noelware's Helm Charts: Curated catalog of Noelware's Helm charts.
~ Copyright (c) 2022-2024 Noelware, LLC. <[email protected]>
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all
~ copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
~ SOFTWARE.
*/}}

{{/*
Expand the name of the chart.
Example:
{{ include "registry.auth.name" . }}
*/}}
{{- define "registry.auth.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.
Example:
{{ include "registry.auth.fullname" }}
*/}}
{{- define "registry.auth.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.
Example:
{{ include "registry.auth.chart" . }}
*/}}
{{- define "registry.auth.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels that are attached to each Kubernetes object spawned by the Helm chart.
Example:
labels:
{{- include "registry.auth.labels" . | nindent 8 }}
*/}}
{{- define "registry.auth.labels" -}}
{{ include "registry.auth.selectorLabels" . }}
k8s.noelware.cloud/managed-by: Helm
{{- end }}

{{- define "registry.auth.selectorLabels" -}}
k8s.noelware.cloud/name: {{ include "registry.auth.name" . }}
k8s.noelware.cloud/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
Example:
serviceAccountName: {{ include "registry.auth.serviceAccountName" . | quote }}
*/}}
{{- define "registry.auth.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "registry.auth.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Default annotations that are included in each Kubernetes object spawned by the Helm chart.
Example:
annotations:
# with no external annotations
{{- include "registry.auth.annotations" (dict "context" .) }}

# with external annotations
{{- $annotations := dict "hello.world/uwu" "world" }}
{{- include "registry.auth.annotations" (dict "external" $annotations "context" .) }}
*/}}
{{- define "registry.auth.annotations" -}}
k8s.noelware.cloud/component: http-proxy
k8s.noelware.cloud/product: Hazel
{{- if .context.Chart.AppVersion }}
k8s.noelware.cloud/version: {{ .context.Chart.AppVersion | quote }}
{{- end }}

{{- $externalAnnotations := .external | default dict }}
{{/* "common.tplvalues.merge" conjoins as a YAML string, so we need to `fromYaml` for this to probably work (idk!) */}}
{{- $all := include "common.tplvalues.merge" (dict "values" (list $externalAnnotations .context.Values.global.annotations) "context" .context) | fromYaml }}

{{- range $key, $val := $all }}
{{ $key }}: {{ $val | quote }}
{{- end -}}
{{- end -}}

{{/*
Default Pod security context object
*/}}
{{- define "registry.auth.defaultPodSecurityContext" -}}
fsGroup: 1001
seccompProfile:
type: "RuntimeDefault"
{{- end -}}

{{/*
Default container security context object
*/}}
{{- define "registry.auth.defaultContainerSecurityContext" -}}
runAsUser: 1001
runAsNonRoot: true
readOnlyRootFilesystem: false
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
{{- end -}}

{{/*
Default resource limits
*/}}
{{- define "registry.auth.defaultResourceLimits" -}}
limits:
memory: 4Gi
cpu: 1500m
requests:
memory: 1Gi
cpu: 500m
{{- end -}}

{{/*
Image definition for Hazel
*/}}
{{- define "registry.auth.image" -}}
{{/* define our variables */}}
{{- $registry := default "docker.io" .Values.image.registry -}}
{{- $repo := .Values.image.image -}}
{{- $tag := default .Chart.AppVersion .Values.image.tag -}}
{{- $sep := ":" -}}

{{- if .Values.image.digest }}
{{- $tag := .Values.image.digest | toString -}}
{{- $sep := "@" -}}
{{- end -}}

{{/* bring it all together */}}
{{- printf "%s/%s%s%s" $registry $repo $sep $tag -}}
{{- end -}}
107 changes: 107 additions & 0 deletions charts/docker_auth/templates/_pod.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{{/*
~ 🐻‍❄️🔮 Noelware's Helm Charts: Curated catalog of Noelware's Helm charts.
~ Copyright (c) 2022-2024 Noelware, LLC. <[email protected]>
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all
~ copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
~ SOFTWARE.
*/}}

{{- define "registry.auth.pod" -}}
serviceAccountName: {{ include "registry.auth.serviceAccountName" . }}
{{- if .Values.global.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.global.affinity "context" $) }}
{{- end }}
{{- if .Values.global.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.global.nodeSelector "context" $) }}
{{- end }}
{{- if .Values.global.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.global.tolerations "context" $) }}
{{- end }}
{{- if .Values.global.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.global.affinity "context" $) }}
{{- end }}
{{- if .Values.global.dnsPolicy }}
dnsPolicy: {{ .Values.global.dnsPolicy }}
{{- end }}
{{- with .Values.global.dnsConfig }}
dnsConfig:
{{ toYaml . | nindent 2 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ default (printf "%s-config" (include "registry.auth.fullname" .)) .Values.config.existingMap }}
{{- with .Values.global.initContainers }}
initContainers:
{{- . | toYaml }}
{{- end }}
containers:
- name: {{ include "registry.auth.fullname" . }}
image: {{ include "registry.auth.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources: {{ default (include "registry.auth.defaultResourceLimits" .) .Values.global.resources | nindent 8 }}
securityContext: {{ default (include "registry.auth.defaultContainerSecurityContext" .) .Values.global.containerSecurityContext | nindent 8 }}
args:
- "--v={{ .Values.deployment.logLevel }}"
- -logtostderr
- /data/config.yaml
volumeMounts:
- name: config
mountPath: /data/config.yaml
subPath: config.yaml
ports:
- name: http
containerPort: {{ .Values.service.port }}
{{- if .Values.global.extraEnvVars }}
env:
{{ include "common.tplvalues.render" (dict "value" .Values.global.extraEnvVars "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.deployment.startupProbe.enabled }}
startupProbe:
httpGet:
path: /
port: {{ .Values.service.port }}
initialDelaySeconds: {{ .Values.deployment.startupProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.deployment.startupProbe.timeoutSeconds }}
periodSeconds: {{ .Values.deployment.startupProbe.periodSeconds }}
successThreshold: {{ .Values.deployment.startupProbe.successThreshold }}
failureThreshold: {{ .Values.deployment.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.deployment.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /
port: {{ .Values.service.port }}
initialDelaySeconds: {{ .Values.deployment.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.deployment.readinessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.deployment.readinessProbe.periodSeconds }}
successThreshold: {{ .Values.deployment.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.deployment.readinessProbe.failureThreshold }}
{{- end }}
{{- if .Values.deployment.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /
port: {{ .Values.service.port }}
initialDelaySeconds: {{ .Values.deployment.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.deployment.livenessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.deployment.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.deployment.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.deployment.livenessProbe.failureThreshold }}
{{- end }}
{{- end -}}
Loading

0 comments on commit a0098ae

Please sign in to comment.