-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from colearendt/add-ghcr-chart
Add regcred chart
- Loading branch information
Showing
13 changed files
with
265 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
docs: | ||
#!/bin/bash | ||
helm-docs --chart-search-root=charts --template-files=README.md.gotmpl --template-files=./_templates.gotmpl | ||
|
||
lint: | ||
#!/bin/bash | ||
ct lint ./charts --target-branch main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{- define "colearendt.install" }} | ||
{{- $repoName := "colearendt" }} | ||
{{- $repoUrl := "https://colearendt.github.io/helm" }} | ||
|
||
## Installing the Chart | ||
|
||
To install the chart with the release name `my-release` at version {{ template "chart.version" . }}: | ||
|
||
```bash | ||
helm repo add {{ $repoName }} {{ $repoUrl }} | ||
helm install {{- if (regexMatch "[0-9]+\\.[0-9]+\\.[0-9]+-[a-zA-Z\\.0-9]+" .Version) }} --devel{{ end }} my-release {{ $repoName }}/{{ template "chart.name" . }} --version={{ template "chart.version" . }} | ||
``` | ||
|
||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v2 | ||
name: regcred | ||
description: A Helm chart that deploys registry credential secrets | ||
|
||
type: application | ||
version: 0.1.0 | ||
appVersion: "0.1.0" | ||
|
||
maintainers: | ||
- name: colearendt | ||
email: [email protected] | ||
url: https://github.com/colearendt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# regcred | ||
|
||
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square) | ||
|
||
## Installing the Chart | ||
|
||
To install the chart with the release name `my-release` at version 0.1.0: | ||
|
||
```bash | ||
helm repo add colearendt https://colearendt.github.io/helm | ||
helm install my-release colearendt/regcred --version=0.1.0 | ||
``` | ||
|
||
#### Description | ||
|
||
This chart simplifies the creation | ||
of ["Registry Credentials"](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) for | ||
use authenticating a Kubernetes cluster to a Container Registry for pulling images. | ||
|
||
This is very important for (1) private images and (2) DockerHub, because of their unfortunate rate limit. | ||
|
||
Each helm deployment only creates a single secret, but that secret can have multiple credentials within it. | ||
|
||
Use this chart to automate away the annoying parts of registry credentials. | ||
|
||
#### Examples | ||
|
||
`ghcr.io` | ||
```yaml | ||
registryCredentials: | ||
- url: ghcr.io | ||
username: 'colearendt' | ||
password: 'my-github-pat' | ||
``` | ||
`docker.io` (DockerHub) | ||
```yaml | ||
registryCredentials: | ||
- url: docker.io | ||
username: 'colearendt' | ||
password: 'my-password-or-token' | ||
``` | ||
|
||
## Values | ||
|
||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| extraLabels | object | `{}` | | | ||
| fullnameOverride | string | `""` | | | ||
| nameOverride | string | `""` | | | ||
| registryCredentials | list | `[]` | | | ||
|
||
---------------------------------------------- | ||
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{{ template "chart.header" . }} | ||
|
||
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }} | ||
|
||
{{ template "colearendt.install" . }} | ||
|
||
#### Description | ||
|
||
This chart simplifies the creation | ||
of ["Registry Credentials"](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) for | ||
use authenticating a Kubernetes cluster to a Container Registry for pulling images. | ||
|
||
This is very important for (1) private images and (2) DockerHub, because of their unfortunate rate limit. | ||
|
||
Each helm deployment only creates a single secret, but that secret can have multiple credentials within it. | ||
|
||
Use this chart to automate away the annoying parts of registry credentials. | ||
|
||
#### Examples | ||
|
||
`ghcr.io` | ||
```yaml | ||
registryCredentials: | ||
- url: ghcr.io | ||
username: 'colearendt' | ||
password: 'my-github-pat' | ||
``` | ||
|
||
`docker.io` (DockerHub) | ||
```yaml | ||
registryCredentials: | ||
- url: docker.io | ||
username: 'colearendt' | ||
password: 'my-password-or-token' | ||
``` | ||
|
||
{{ template "chart.valuesSection" . }} | ||
|
||
{{ template "helm-docs.versionFooter" . }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
extraLabels: | ||
mylabel: fun | ||
|
||
registryCredentials: | ||
- url: ghcr.io | ||
username: 'username' | ||
password: 'password' | ||
- url: docker.io | ||
username: 'other_username' | ||
password: 'other_password' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
registryCredentials: | ||
- url: ghcr.io | ||
username: 'username' | ||
password: 'password' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "regcred.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 "regcred.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 "regcred.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "regcred.labels" -}} | ||
helm.sh/chart: {{ include "regcred.chart" . }} | ||
{{ include "regcred.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "regcred.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "regcred.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{{- /* | ||
Base64 Encode the essential "username:password" key | ||
Required keys: | ||
username | ||
password | ||
*/ -}} | ||
{{- define "regcred.b64Creds" -}} | ||
{{- printf "%s:%s" .username .password | b64enc }} | ||
{{- end }} | ||
|
||
{{- define "regcred.regCred" -}} | ||
{{- $secret := include "regcred.b64Creds" . }} | ||
{{- printf "\"%s\":{\"auth\": \"%s\"}" .url ($secret) }} | ||
{{- end }} | ||
|
||
{{- define "regcred.registryCredentials" -}} | ||
{{- $total := "" }} | ||
{{- range $rc := . }} | ||
{{- $rcTmp := include "regcred.regCred" . }} | ||
{{- $total = join "," (list $total $rcTmp) }} | ||
{{- $total = trimPrefix "," $total }} | ||
{{- end }} | ||
{{- printf "{\"auths\":{%s}}" $total | b64enc }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{- if .Values.registryCredentials -}} | ||
kind: Secret | ||
type: kubernetes.io/dockerconfigjson | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ include "regcred.fullname" . }} | ||
labels: | ||
{{- include "regcred.labels" . | nindent 4}} | ||
{{- with .Values.extraLabels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
data: | ||
.dockerconfigjson: {{- include "regcred.registryCredentials" .Values.registryCredentials | nindent 4 }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Declare variables to be passed into your templates. | ||
|
||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
extraLabels: {} | ||
|
||
registryCredentials: [] | ||
# - url: ghcr.io | ||
# username: 'username' | ||
# password: 'password' | ||
# |