2 Commits

Author SHA1 Message Date
Josh Sizer
3e91e96ea1 fix: use .Values.service.name 2024-03-15 17:38:46 -04:00
perangel
66d4da1f9a Support for setting the service name 2024-03-15 17:38:46 -04:00
12 changed files with 44 additions and 163 deletions

15
.circleci/config.yml Normal file
View File

@@ -0,0 +1,15 @@
version: 2.1
jobs:
lint:
docker:
- image: twuni/helm:3.4.1
steps:
- checkout
- run:
command: helm lint --strict
name: lint
workflows:
version: 2
default:
jobs:
- lint

View File

@@ -1,8 +0,0 @@
---
# Dependabot Config Ref: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

View File

@@ -1,41 +0,0 @@
---
# GitHub Actions Workflows Ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: CI
"on":
push:
branches:
- main
pull_request:
branches:
- "**"
workflow_dispatch:
concurrency:
group: ${{ github.event_name }}-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
permissions: read-all
jobs:
helm-lint:
name: Helm Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4.1.4
- run: |
helm lint --strict
integration-test:
name: Integration Test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4.1.4
- uses: AbsaOSS/k3d-action@v2.4.0
name: Create K3D Cluster with Container Registry
with:
cluster-name: local-ci-k3d-cluster
args: >-
--agents 1
--registry-create local-ci-k3d-registry
- name: Test
run: |
helm install docker-registry . --wait --wait-for-jobs
kubectl get all,pvc

View File

@@ -1,35 +0,0 @@
name: Release Charts
on:
workflow_dispatch:
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install chart-releaser
uses: helm/chart-releaser-action@v1.7.0
with:
install_only: true
- name: Run chart-releaser
env:
CR_TOKEN: "${{ secrets.CR_TOKEN }}"
run: |
owner=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY")
repo=$(cut -d '/' -f 2 <<< "$GITHUB_REPOSITORY")
cr package
cr upload --owner="$owner" --git-repo "$repo" --token="$CR_TOKEN" --release-name-template="v{{ .Version }}" --packages-with-index --push --skip-existing --generate-release-notes --commit main
cr index --owner="$owner" --git-repo "$repo" --token="$CR_TOKEN" --release-name-template="v{{ .Version }}" --packages-with-index --push --index-path="."

View File

@@ -44,7 +44,7 @@ jobs:
echo 'HELM_DIFF<<EOF' >> $GITHUB_ENV
echo "$(diff -ur before after)" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db
- uses: marocchino/sticky-pull-request-comment@39c5b5dc7717447d0cba270cd115037d32d28443
with:
message: |
Running a `helm template` smoketest on commit ${{ github.ref }} results in the following diff against `${{ github.base_ref }}`:

1
.gitignore vendored
View File

@@ -1 +0,0 @@
.cr-release-packages

View File

@@ -1,7 +1,7 @@
apiVersion: v1
description: A Helm chart for Docker Registry
name: docker-registry
version: 2.3.0
version: 2.2.2
appVersion: 2.8.1
home: https://hub.docker.com/_/registry/
icon: https://helm.twun.io/docker-registry.png

View File

@@ -17,13 +17,13 @@ This chart will do the following:
First, add the repo:
```console
helm repo add twuni https://helm.twun.io
$ helm repo add twuni https://helm.twun.io
```
To install the chart, use the following:
```console
helm install twuni/docker-registry
$ helm install twuni/docker-registry
```
## Configuration
@@ -57,8 +57,8 @@ their default values.
| `service.sessionAffinityConfig` | service session affinity config | `nil` |
| `replicaCount` | k8s replicas | `1` |
| `updateStrategy` | update strategy for deployment | `{}` |
| `podAnnotations` | Annotations for deployment pod, and `garbageCollect` pod unless set explicitly there. See `garbageCollect` | `{}` |
| `podLabels` | Labels for deployment pod, and `garbageCollect` pod unless set explicitly there. See `garbageCollect` | `{}` |
| `podAnnotations` | Annotations for pod | `{}` |
| `podLabels` | Labels for pod | `{}` |
| `podDisruptionBudget` | Pod disruption budget | `{}` |
| `resources.limits.cpu` | Container requested CPU | `nil` |
| `resources.limits.memory` | Container requested memory | `nil` |
@@ -74,7 +74,7 @@ their default values.
| `secrets.htpasswd` | Htpasswd authentication | `nil` |
| `secrets.s3.accessKey` | Access Key for S3 configuration | `nil` |
| `secrets.s3.secretKey` | Secret Key for S3 configuration | `nil` |
| `secrets.s3.secretRef` | The ref for an external secret containing the s3AccessKey and s3SecretKey keys | `""` |
| `secrets.s3.secretRef` | The ref for an external secret containing the accessKey and secretKey keys | `""` |
| `secrets.swift.username` | Username for Swift configuration | `nil` |
| `secrets.swift.password` | Password for Swift configuration | `nil` |
| `secrets.haSharedSecret` | Shared secret for Registry | `nil` |
@@ -117,14 +117,11 @@ their default values.
| `extraEnvVars` | Additional environment variables to the pod | `[]` |
| `initContainers` | Init containers to be created in the pod | `[]` |
| `garbageCollect.enabled` | If true, will deploy garbage-collector cronjob | `false` |
| `garbageCollect.deleteUntagged` | If true, garbage-collector will delete manifests that are not currently referenced via tag | `true` |
| `garbageCollect.schedule` | CronTab schedule, please use standard crontab format | `0 1 * * *` |
| `garbageCollect.podAnnotations` | CronJob pod Annotations. If left empty and chart `podAnnotations` are set, will use those. If both are set, these take precedence for the `garbageCollect` pods. | `{}` |
| `garbageCollect.podLabels` | CronJob pod Annotations. If left empty and chart `podLabels` are set, will use those. If both are set, these take precedence for the `garbageCollect` pods. | `{}` |
| `garbageCollect.resources` | garbage-collector requested resources | `{}` |
| `garbageCollect.deleteUntagged` | If true, garbage-collector will delete manifests that are not currently referenced via tag | `true` | |
| `garbageCollect.schedule` | CronTab schedule, please use standard crontab format | `0 1 * * *` | |
Specify each parameter using the `--set key=value[,key=value]` argument to
`helm install`.
To generate htpasswd file, run this docker command:
`docker run --entrypoint htpasswd httpd:2 -Bbn user password > ./htpasswd`.
`docker run --entrypoint htpasswd registry:2 -Bbn user password > ./htpasswd`.

View File

@@ -17,26 +17,16 @@ spec:
app: {{ template "docker-registry.name" . }}
release: {{ .Release.Name }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{ toYaml . | nindent 8 }}
{{- end }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- if .Values.podAnnotations }}
{{- toYaml .Values.podAnnotations | nindent 8 }}
{{ toYaml .Values.podAnnotations | nindent 8 }}
{{- end }}
spec:
template:
metadata:
labels:
release: {{ .Release.Name }}
{{- if or .Values.podLabels .Values.garbageCollect.podLabels }}
{{- toYaml (merge (.Values.garbageCollect.podLabels | default (dict)) (.Values.podLabels | default (dict))) | nindent 12 }}
{{- end }}
{{- if or .Values.podAnnotations .Values.garbageCollect.podAnnotations }}
annotations:
{{- toYaml (merge (.Values.garbageCollect.podAnnotations | default (dict)) (.Values.podAnnotations | default (dict))) | nindent 12 }}
{{- end}}
spec:
{{- if or (eq .Values.serviceAccount.create true) (ne .Values.serviceAccount.name "") }}
serviceAccountName: {{ .Values.serviceAccount.name | default (include "docker-registry.fullname" .) }}
@@ -59,10 +49,6 @@ spec:
- garbage-collect
- --delete-untagged={{ .Values.garbageCollect.deleteUntagged }}
- /etc/docker/registry/config.yml
{{- if .Values.garbageCollect.resources }}
resources:
{{- toYaml .Values.garbageCollect.resources | nindent 16 }}
{{- end }}
env: {{ include "docker-registry.envs" . | nindent 16 }}
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{ omit .Values.containerSecurityContext "enabled" | toYaml | nindent 16 }}

View File

@@ -1,6 +1,6 @@
{{- if .Values.ingress.enabled -}}
{{- $apiVersions := .Capabilities.APIVersions -}}
{{- $serviceName := include "docker-registry.fullname" . -}}
{{- $serviceName := .Values.service.name | default (include "docker-registry.fullname" .) -}}
{{- $servicePort := .Values.service.port -}}
{{- $path := .Values.ingress.path -}}
apiVersion: {{- if $apiVersions.Has "networking.k8s.io/v1" }} networking.k8s.io/v1 {{- else }} networking.k8s.io/v1beta1 {{- end }}

View File

@@ -1,16 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "docker-registry.fullname" . }}
name: {{ .Values.service.name | default (include "docker-registry.fullname" .) }}
namespace: {{ .Values.namespace | default .Release.Namespace }}
labels:
app: {{ template "docker-registry.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.service.labels }}
{{ toYaml .Values.service.labels | indent 4 }}
{{- end }}
{{- if .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}

View File

@@ -26,7 +26,7 @@ image:
deployment: {}
# annotations:
service:
name: registry
name: ""
type: ClusterIP
# sessionAffinity: None
# sessionAffinityConfig: {}
@@ -37,8 +37,6 @@ service:
# loadBalancerSourceRanges:
annotations: {}
# foo.io/bar: "true"
labels: {}
# foo.io/baz: "false"
ingress:
enabled: false
className: nginx
@@ -61,11 +59,11 @@ resources: {}
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# cpu: 100m
# memory: 128Mi
persistence:
accessMode: 'ReadWriteOnce'
enabled: false
@@ -98,17 +96,17 @@ secrets:
# Options for s3 storage type:
# s3:
# region: us-east-1
# regionEndpoint: https://s3.us-east-1.amazonaws.com
# bucket: my-bucket
# rootdirectory: /object/prefix
# encrypt: false
# secure: true
# region: us-east-1
# regionEndpoint: s3.us-east-1.amazonaws.com
# bucket: my-bucket
# rootdirectory: /object/prefix
# encrypt: false
# secure: true
# Options for swift storage type:
# swift:
# authurl: http://swift.example.com/
# container: my-container
# authurl: http://swift.example.com/
# container: my-container
# https://docs.docker.com/registry/recipes/mirror/
proxy:
@@ -157,25 +155,11 @@ configData:
threshold: 3
containerSecurityContext:
enabled: true
seLinuxOptions: {}
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
privileged: false
readOnlyRootFilesystem: true
runAsUser: 1000
runAsGroup: 1000
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
enabled: false
securityContext:
enabled: true
fsGroupChangePolicy: Always
sysctls: []
supplementalGroups: []
runAsUser: 1000
fsGroup: 1000
priorityClassName: ""
@@ -245,16 +229,3 @@ garbageCollect:
enabled: false
deleteUntagged: true
schedule: "0 1 * * *"
podAnnotations: {}
podLabels: {}
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi