Skip to content

Commit c8d2e3f

Browse files
Feat: Initial implementation of chart with argo workflows init hook (#1)
1 parent 123d3e1 commit c8d2e3f

19 files changed

+551
-18
lines changed

.github/configs/cr.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Reference: https://github.com/helm/chart-releaser
2+
index-path: "./index.yaml"
3+
4+
# PGP signing
5+
sign: true
6+
key: garage-cf
7+
# keyring: # Set via env variable CR_KEYRING
8+
# passphrase-file: # Set via env variable CR_PASSPHRASE_FILE
9+
10+
# Enable automatic generation of release notes using GitHubs release notes generator.
11+
# see: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
12+
generate-release-notes: true

.github/configs/ct-install.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Reference: https://github.com/helm/chart-testing/blob/master/doc/ct_lint-and-install.md
2+
# Don't add the 'debug' attribute, otherwise the workflow won't work anymore
3+
# Only Used for the CT Install Stage
4+
remote: origin
5+
charts:
6+
- script/helm/garage
7+
helm-extra-args: "--timeout 600s"
8+
validate-chart-schema: false
9+
validate-maintainers: true
10+
validate-yaml: true
11+
exclude-deprecated: true
12+
excluded-charts: []

.github/configs/ct-lint.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Reference: https://github.com/helm/chart-testing/blob/master/doc/ct_lint-and-install.md
2+
# Don't add the 'debug' attribute, otherwise the workflow won't work anymore
3+
# Only Used for the CT Lint Stage
4+
remote: origin
5+
charts:
6+
- script/helm/garage
7+
validate-chart-schema: false
8+
validate-maintainers: false
9+
validate-yaml: true
10+
exclude-deprecated: true
11+
excluded-charts: []

.github/configs/kind-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
kind: Cluster
2+
apiVersion: kind.x-k8s.io/v1alpha4
3+
nodes:
4+
- role: control-plane
5+
- role: worker
6+
- role: worker
7+
- role: worker

.github/configs/lintconf.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
rules:
3+
braces:
4+
min-spaces-inside: 0
5+
max-spaces-inside: 0
6+
min-spaces-inside-empty: -1
7+
max-spaces-inside-empty: -1
8+
brackets:
9+
min-spaces-inside: 0
10+
max-spaces-inside: 0
11+
min-spaces-inside-empty: -1
12+
max-spaces-inside-empty: -1
13+
colons:
14+
max-spaces-before: 0
15+
max-spaces-after: 1
16+
commas:
17+
max-spaces-before: 0
18+
min-spaces-after: 1
19+
max-spaces-after: 1
20+
comments:
21+
require-starting-space: true
22+
min-spaces-from-content: 1
23+
document-end: disable
24+
document-start: disable # No --- to start a file
25+
empty-lines:
26+
max: 2
27+
max-start: 0
28+
max-end: 0
29+
hyphens:
30+
max-spaces-after: 1
31+
indentation:
32+
spaces: consistent
33+
indent-sequences: whatever # - list indentation will handle both indentation and without
34+
check-multi-line-strings: false
35+
key-duplicates: enable
36+
line-length: disable # Lines can be any length
37+
new-line-at-end-of-file: enable
38+
new-lines:
39+
type: unix
40+
trailing-spaces: enable
41+
truthy:
42+
level: warning

.github/workflows/lint-and-test.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
## Reference: https://github.com/helm/chart-testing-action
2+
name: Linting and Testing
3+
on:
4+
pull_request:
5+
branches:
6+
- 'codefresh-main'
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
chart-test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Helm
21+
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
22+
with:
23+
version: v3.10.1 # Also update in publish.yaml
24+
25+
- name: Set up python
26+
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
27+
with:
28+
python-version: 3.9
29+
30+
- name: Setup Chart Linting
31+
id: lint
32+
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
33+
with:
34+
# Note: Also update in scripts/lint.sh
35+
version: v3.10.0
36+
37+
- name: Run chart-testing (lint)
38+
run: ct lint --debug --config ./.github/configs/ct-lint.yaml --target-branch ${{ github.base_ref }} --lint-conf ./.github/configs/lintconf.yaml
39+
40+
- name: Run docs-testing (helm-docs)
41+
id: helm-docs
42+
run: |
43+
./script/helm-docs.sh
44+
if [[ $(git diff --stat) != '' ]]; then
45+
echo -e '\033[0;31mDocumentation outdated!\033[0m ❌'
46+
git diff --color
47+
exit 1
48+
else
49+
echo -e '\033[0;32mDocumentation up to date\033[0m ✔'
50+
fi
51+
52+
- name: Create kind cluster
53+
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
54+
with:
55+
config: .github/configs/kind-config.yaml
56+
57+
- name: Run chart-testing (install)
58+
run: ct install --config ./.github/configs/ct-install.yaml --target-branch ${{ github.base_ref }}

.github/workflows/publish.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
## Reference: https://github.com/helm/chart-releaser-action
2+
name: Chart Publish
3+
on:
4+
push:
5+
branches:
6+
- codefresh-main
7+
paths:
8+
- "script/helm/garage/**"
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
publish:
15+
permissions:
16+
contents: write # for helm/chart-releaser-action to push chart release and create a release
17+
packages: write # to push OCI chart package to GitHub Registry
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Install Helm
26+
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
27+
with:
28+
version: v3.10.1 # Also update in lint-and-test.yaml
29+
30+
- name: Configure Git
31+
run: |
32+
git config user.name "$GITHUB_ACTOR"
33+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
34+
35+
- name: Package chart
36+
run: |
37+
rm -rf .cr-release-packages
38+
mkdir .cr-release-packages
39+
helm package script/helm/garage -u -d .cr-release-packages/
40+
41+
# The GitHub repository secret `PGP_PRIVATE_KEY` contains the private key
42+
# in ASCII-armored format. To export a (new) key, run this command:
43+
# `gpg --armor --export-secret-key <my key>`
44+
- name: Prepare PGP key
45+
run: |
46+
IFS=""
47+
echo "$PGP_PRIVATE_KEY" | gpg --dearmor > $HOME/secring.gpg
48+
echo "$PGP_PASSPHRASE" > $HOME/passphrase.txt
49+
50+
# Tell chart-releaser-action where to find the key and its passphrase
51+
echo "CR_KEYRING=$HOME/secring.gpg" >> "$GITHUB_ENV"
52+
echo "CR_PASSPHRASE_FILE=$HOME/passphrase.txt" >> "$GITHUB_ENV"
53+
env:
54+
PGP_PRIVATE_KEY: "${{ secrets.PGP_PRIVATE_KEY }}"
55+
PGP_PASSPHRASE: "${{ secrets.PGP_PASSPHRASE }}"
56+
57+
- name: Run chart-releaser
58+
uses: helm/chart-releaser-action@be16258da8010256c6e82849661221415f031968 # v1.5.0 - currently there is a bug on 1.6.0 version, can upgrade back when it'll be solved - https://github.com/helm/chart-releaser-action/issues/171
59+
with:
60+
config: "./.github/configs/cr.yaml"
61+
skip_packaging: true
62+
charts_dir: script/helm
63+
env:
64+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
65+
66+
- name: Login to GHCR
67+
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
68+
with:
69+
registry: ghcr.io
70+
username: ${{ github.actor }}
71+
password: ${{ secrets.GITHUB_TOKEN }}
72+
73+
- name: Push chart to GHCR
74+
run: |
75+
shopt -s nullglob
76+
for pkg in .cr-release-packages/*.tgz; do
77+
if [ -z "${pkg:-}" ]; then
78+
break
79+
fi
80+
helm push "${pkg}" oci://ghcr.io/${{ github.repository }}
81+
done

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
/pki
44
**/*.rs.bk
55
*.swp
6-
/.direnv
6+
/.direnv
7+
values-dev.yaml

script/helm-docs.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
## Reference: https://github.com/norwoodj/helm-docs
3+
set -eux
4+
CHART_DIR="$(cd "$(dirname "$0")/helm/garage" && pwd)"
5+
echo "$CHART_DIR"
6+
7+
echo "Running Helm-Docs"
8+
docker run \
9+
-v "$CHART_DIR:/helm-docs" \
10+
-u $(id -u) \
11+
--rm \
12+
jnorwood/helm-docs:v1.9.1

script/helm-lint.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
# This script runs the chart-testing tool locally. It simulates the linting that is also done by the github action. Run this without any errors before pushing.
3+
# Reference: https://github.com/helm/chart-testing
4+
set -eux
5+
6+
SRCROOT="$(cd "$(dirname "$0")/.." && pwd)"
7+
echo $SRCROOT
8+
echo -e "\n-- Linting all Helm Charts --\n"
9+
docker run \
10+
-v "$SRCROOT:/workdir" \
11+
--entrypoint /bin/sh \
12+
quay.io/helmpack/chart-testing:v3.10.0 \
13+
-c cd /workdir \
14+
ct lint \
15+
--config .github/configs/ct-lint.yaml \
16+
--lint-conf .github/configs/lintconf.yaml \
17+
--debug

script/helm/garage/Chart.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
apiVersion: v2
22
name: garage
33
description: S3-compatible object store for small self-hosted geo-distributed deployments
4-
4+
maintainers:
5+
- name: garagehq.deuxfleurs.fr
6+
- name: codefresh.io
57
# A chart can be either an 'application' or a 'library' chart.
68
#
79
# Application charts are a collection of templates that can be packaged into versioned archives
@@ -15,10 +17,10 @@ type: application
1517
# This is the chart version. This version number should be incremented each time you make changes
1618
# to the chart and its templates, including the app version.
1719
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.5.0
20+
version: 0.5.0-cf.1
1921

2022
# This is the version number of the application being deployed. This version number should be
2123
# incremented each time you make changes to the application. Versions are not expected to
2224
# follow Semantic Versioning. They should reflect the version the application is using.
2325
# It is recommended to use it with quotes.
24-
appVersion: "v1.0.0"
26+
appVersion: "v0.9.4"

script/helm/garage/README.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# garage
2+
3+
![Version: 0.5.0-cf.1](https://img.shields.io/badge/Version-0.5.0--cf.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.9.4](https://img.shields.io/badge/AppVersion-v0.9.4-informational?style=flat-square)
4+
5+
S3-compatible object store for small self-hosted geo-distributed deployments
6+
7+
## Maintainers
8+
9+
| Name | Email | Url |
10+
| ---- | ------ | --- |
11+
| garagehq.deuxfleurs.fr | | |
12+
| codefresh.io | | |
13+
14+
## Values
15+
16+
| Key | Type | Default | Description |
17+
|-----|------|---------|-------------|
18+
| affinity | object | `{}` | |
19+
| argoWorkflowsConfigHook | object | `{"image":{"pullPolicy":"IfNotPresent","repository":"quay.io/codefresh/garage-argo-workflows-config-hook","tag":"2024.05.18-5def96f"}}` | Config hook for argo workflows |
20+
| deployment.kind | string | `"StatefulSet"` | |
21+
| deployment.replicaCount | int | `3` | |
22+
| fullnameOverride | string | `""` | |
23+
| garage."garage.toml" | string | `"metadata_dir = \"/mnt/meta\"\ndata_dir = \"/mnt/data\"\n\ndb_engine = \"{{ .Values.garage.dbEngine }}\"\n\nblock_size = {{ .Values.garage.blockSize }}\n\nreplication_mode = \"{{ .Values.garage.replicationMode }}\"\n\ncompression_level = {{ .Values.garage.compressionLevel }}\n\nrpc_bind_addr = \"{{ .Values.garage.rpcBindAddr }}\"\n# rpc_secret will be populated by the init container from a k8s secret object\nrpc_secret = \"__RPC_SECRET_REPLACE__\"\n\nbootstrap_peers = {{ .Values.garage.bootstrapPeers }}\n\n[kubernetes_discovery]\nnamespace = \"{{ .Release.Namespace }}\"\nservice_name = \"{{ include \"garage.fullname\" . }}\"\nskip_crd = {{ .Values.garage.kubernetesSkipCrd }}\n\n[s3_api]\ns3_region = \"{{ .Values.garage.s3.api.region }}\"\napi_bind_addr = \"[::]:3900\"\nroot_domain = \"{{ .Values.garage.s3.api.rootDomain }}\"\n\n[s3_web]\nbind_addr = \"[::]:3902\"\nroot_domain = \"{{ .Values.garage.s3.web.rootDomain }}\"\nindex = \"{{ .Values.garage.s3.web.index }}\"\n\n[admin]\napi_bind_addr = \"[::]:3903\"\n{{- if .Values.monitoring.tracing.sink }}\ntrace_sink = \"{{ .Values.monitoring.tracing.sink }}\"\n{{- end }}"` | |
24+
| garage.blockSize | string | `"1048576"` | |
25+
| garage.bootstrapPeers | list | `[]` | |
26+
| garage.compressionLevel | string | `"1"` | |
27+
| garage.dbEngine | string | `"lmdb"` | |
28+
| garage.kubernetesSkipCrd | bool | `false` | |
29+
| garage.replicationMode | string | `"3"` | |
30+
| garage.rpcBindAddr | string | `"[::]:3901"` | |
31+
| garage.rpcSecret | string | `""` | |
32+
| garage.s3.api.region | string | `"garage"` | |
33+
| garage.s3.api.rootDomain | string | `".s3.garage.tld"` | |
34+
| garage.s3.web.index | string | `"index.html"` | |
35+
| garage.s3.web.rootDomain | string | `".web.garage.tld"` | |
36+
| image.pullPolicy | string | `"IfNotPresent"` | |
37+
| image.repository | string | `"dxflrs/garage"` | |
38+
| image.tag | string | `""` | |
39+
| imagePullSecrets | list | `[]` | |
40+
| ingress.s3.api.annotations | object | `{}` | |
41+
| ingress.s3.api.enabled | bool | `false` | |
42+
| ingress.s3.api.hosts[0].host | string | `"s3.garage.tld"` | |
43+
| ingress.s3.api.hosts[0].paths[0].path | string | `"/"` | |
44+
| ingress.s3.api.hosts[0].paths[0].pathType | string | `"Prefix"` | |
45+
| ingress.s3.api.hosts[1].host | string | `"*.s3.garage.tld"` | |
46+
| ingress.s3.api.hosts[1].paths[0].path | string | `"/"` | |
47+
| ingress.s3.api.hosts[1].paths[0].pathType | string | `"Prefix"` | |
48+
| ingress.s3.api.labels | object | `{}` | |
49+
| ingress.s3.api.tls | list | `[]` | |
50+
| ingress.s3.web.annotations | object | `{}` | |
51+
| ingress.s3.web.enabled | bool | `false` | |
52+
| ingress.s3.web.hosts[0].host | string | `"*.web.garage.tld"` | |
53+
| ingress.s3.web.hosts[0].paths[0].path | string | `"/"` | |
54+
| ingress.s3.web.hosts[0].paths[0].pathType | string | `"Prefix"` | |
55+
| ingress.s3.web.hosts[1].host | string | `"mywebpage.example.com"` | |
56+
| ingress.s3.web.hosts[1].paths[0].path | string | `"/"` | |
57+
| ingress.s3.web.hosts[1].paths[0].pathType | string | `"Prefix"` | |
58+
| ingress.s3.web.labels | object | `{}` | |
59+
| ingress.s3.web.tls | list | `[]` | |
60+
| initImage.pullPolicy | string | `"IfNotPresent"` | |
61+
| initImage.repository | string | `"busybox"` | |
62+
| initImage.tag | string | `"stable"` | |
63+
| monitoring.metrics.enabled | bool | `false` | |
64+
| monitoring.metrics.serviceMonitor.enabled | bool | `false` | |
65+
| monitoring.metrics.serviceMonitor.interval | string | `"15s"` | |
66+
| monitoring.metrics.serviceMonitor.labels | object | `{}` | |
67+
| monitoring.metrics.serviceMonitor.path | string | `"/metrics"` | |
68+
| monitoring.metrics.serviceMonitor.relabelings | list | `[]` | |
69+
| monitoring.metrics.serviceMonitor.scheme | string | `"http"` | |
70+
| monitoring.metrics.serviceMonitor.scrapeTimeout | string | `"10s"` | |
71+
| monitoring.metrics.serviceMonitor.tlsConfig | object | `{}` | |
72+
| monitoring.tracing.sink | string | `""` | |
73+
| nameOverride | string | `""` | |
74+
| nodeSelector | object | `{}` | |
75+
| persistence.data.hostPath | string | `"/var/lib/garage/data"` | |
76+
| persistence.data.size | string | `"100Mi"` | |
77+
| persistence.data.storageClass | string | `""` | |
78+
| persistence.enabled | bool | `true` | |
79+
| persistence.meta.hostPath | string | `"/var/lib/garage/meta"` | |
80+
| persistence.meta.size | string | `"100Mi"` | |
81+
| persistence.meta.storageClass | string | `""` | |
82+
| podAnnotations | object | `{}` | |
83+
| podSecurityContext.fsGroup | int | `1000` | |
84+
| podSecurityContext.runAsGroup | int | `1000` | |
85+
| podSecurityContext.runAsNonRoot | bool | `true` | |
86+
| podSecurityContext.runAsUser | int | `1000` | |
87+
| resources | object | `{}` | |
88+
| securityContext.capabilities.drop[0] | string | `"ALL"` | |
89+
| securityContext.readOnlyRootFilesystem | bool | `true` | |
90+
| service.s3.admin.port | int | `3903` | |
91+
| service.s3.api.port | int | `3900` | |
92+
| service.s3.web.port | int | `3902` | |
93+
| service.type | string | `"ClusterIP"` | |
94+
| serviceAccount.annotations | object | `{}` | |
95+
| serviceAccount.create | bool | `true` | |
96+
| serviceAccount.name | string | `""` | |
97+
| tests.awsCliImage | string | `"amazon/aws-cli:2.13.2"` | |
98+
| tolerations | list | `[]` | |
99+
100+
----------------------------------------------
101+
Autogenerated from chart metadata using [helm-docs v1.9.1](https://github.com/norwoodj/helm-docs/releases/v1.9.1)

0 commit comments

Comments
 (0)