From bde3115c9c66860c4de0e6137eb75132c8e1f872 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Mon, 11 Nov 2024 17:13:49 +0100 Subject: [PATCH] added skeleton and new-chart script --- README.md | 5 +++++ scripts/new-chart | 22 +++++++++++++++++++++- skeleton/Chart.yaml | 18 ++++++++++++++++++ skeleton/Makefile | 2 ++ skeleton/templates/base.tpl | 1 + skeleton/values.yaml | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 skeleton/Chart.yaml create mode 100644 skeleton/Makefile create mode 100644 skeleton/templates/base.tpl create mode 100644 skeleton/values.yaml diff --git a/README.md b/README.md index ce1c233..0d772f7 100644 --- a/README.md +++ b/README.md @@ -1 +1,6 @@ # My helm-charts + +Create a new chart with script: +``` +scripts/new-chart +``` diff --git a/scripts/new-chart b/scripts/new-chart index b5f4196..9ecdf9a 100755 --- a/scripts/new-chart +++ b/scripts/new-chart @@ -3,5 +3,25 @@ if [[ "$(git rev-parse --abbrev-ref HEAD)" == "main" ]]; then echo "Create a new branch first!" exit 1; fi +CHART_NAME="$1" +REPO_PATH=$(git rev-parse --show-toplevel) -echo "running" +type yq >/dev/null 2>&1 || { echo "yq not found, quitting!"; exit 1; } + +if [[ -z "$CHART_NAME" ]]; then + echo "no chartname given" + exit 1; +fi + +if [[ -d "${REPO_PATH}/charts/${CHART_NAME}" ]]; then + echo "chart-name already exists" + exit 1; +fi + +cp -r "${REPO_PATH}/skeleton" "${REPO_PATH}/charts/${CHART_NAME}" + +yq -i ".name=\"${CHART_NAME}\"" "${REPO_PATH}/charts/${CHART_NAME}/Chart.yaml" +yq -i ".maintainers[0].name=\"$(git config user.name)\"" "${REPO_PATH}/charts/${CHART_NAME}/Chart.yaml" +yq -i ".maintainers[0].email=\"$(git config user.email)\"" "${REPO_PATH}/charts/${CHART_NAME}/Chart.yaml" + +echo "Start editing your chart at: "${REPO_PATH}/charts/${CHART_NAME}/" diff --git a/skeleton/Chart.yaml b/skeleton/Chart.yaml new file mode 100644 index 0000000..5e6196d --- /dev/null +++ b/skeleton/Chart.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: v2 +name: +description: +type: application +version: 1.0.0 +appVersion: +kubeVersion: ">=1.27.0" +home: +sources: + - https://git.rre.nu/jonas/helm-charts +maintainers: + - name: + email: +dependencies: + - name: lib + repository: https://git.rre.nu/api/packages/jonas/helm + version: 1.0.3 diff --git a/skeleton/Makefile b/skeleton/Makefile new file mode 100644 index 0000000..6cd25d8 --- /dev/null +++ b/skeleton/Makefile @@ -0,0 +1,2 @@ +doc: + frigate gen --output-format markdown --no-deps --no-credits ./ > README.md diff --git a/skeleton/templates/base.tpl b/skeleton/templates/base.tpl new file mode 100644 index 0000000..30c9b59 --- /dev/null +++ b/skeleton/templates/base.tpl @@ -0,0 +1 @@ +{{ include "lib.all" . }} diff --git a/skeleton/values.yaml b/skeleton/values.yaml new file mode 100644 index 0000000..7144aa4 --- /dev/null +++ b/skeleton/values.yaml @@ -0,0 +1,32 @@ +image: + repository: + tag: + +controller: # main workload + enabled: true # should the main workload be included or not + type: deployment # valid options are deployment, statefulset, job + +service: + http: + enabled: false + ports: + http: + port: 80 + targetPort: 8123 + +ingress: + enabled: false + service: http # what service should the ingress target + servicePort: 80 + className: "nginx" + hosts: + - host: example.local + paths: + - path: / + pathType: Prefix + annotations: + {} + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local