From 3cd58c33b663f3f4737ec97c5bf89e1f1dfcfc2a Mon Sep 17 00:00:00 2001 From: ada mancini Date: Tue, 6 May 2025 09:27:40 -0400 Subject: [PATCH 01/14] set VERSION var by default --- applications/wg-easy/Taskfile.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/applications/wg-easy/Taskfile.yaml b/applications/wg-easy/Taskfile.yaml index adf7f65b..abb6b429 100644 --- a/applications/wg-easy/Taskfile.yaml +++ b/applications/wg-easy/Taskfile.yaml @@ -133,7 +133,7 @@ tasks: # Find all charts and update their dependencies for chart_dir in $(find . -maxdepth 2 -name "Chart.yaml" | xargs dirname); do echo "Updating dependency $chart_dir" - helm dependency update "$chart_dir" + helm dependency update --skip-refresh "$chart_dir" done - echo "All dependencies updated!" @@ -283,8 +283,10 @@ tasks: release-create: desc: Create and promote a release using the Replicated CLI silent: false + run: once vars: CHANNEL: '{{.CHANNEL | default "Unstable"}}' + VERSION: '{{.VERSION | default "0.0.1"}}' RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}' requires: vars: [APP_SLUG, VERSION] From b9b5a91cae9a42d3a6d87b7882e71c58016daabf Mon Sep 17 00:00:00 2001 From: ada mancini Date: Tue, 6 May 2025 11:47:37 -0400 Subject: [PATCH 02/14] release create and customer create tasks --- applications/wg-easy/Taskfile.yaml | 108 +++++++++++++++++++++-- applications/wg-easy/taskfiles/utils.yml | 34 +++++++ 2 files changed, 133 insertions(+), 9 deletions(-) diff --git a/applications/wg-easy/Taskfile.yaml b/applications/wg-easy/Taskfile.yaml index abb6b429..fd59723a 100644 --- a/applications/wg-easy/Taskfile.yaml +++ b/applications/wg-easy/Taskfile.yaml @@ -6,7 +6,13 @@ includes: vars: # Application configuration - APP_SLUG: '{{.REPLICATED_APP | default "wg-easy"}}' + APP_NAME: '{{.REPLICATED_APP | default "wg-easy"}}' + APP_SLUG: '{{.REPLICATED_APP_SLUG | default "wg-easy-cre"}}' + + # Release configuration + RELEASE_CHANNELd: '{{.RELEASE_CHANNEL | default "Unstable"}}' + RELEASE_VERSION: '{{.RELEASE_VERSION | default "0.0.1"}}' + RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}' # Cluster configuration CLUSTER_NAME: '{{.CLUSTER_NAME | default "test-cluster"}}' @@ -137,8 +143,8 @@ tasks: done - echo "All dependencies updated!" - ports-expose: - desc: Expose configured ports and capture exposed URLs + cluster-ports-expose: + desc: Expose configured ports for a cluster and capture exposed URLs silent: false run: once status: @@ -166,8 +172,8 @@ tasks: deps: - cluster-create - helm-deploy: - desc: Deploy all charts using helmfile + helm-install: + desc: Install all charts using helmfile silent: false cmds: - echo "Installing all charts via helmfile" @@ -185,10 +191,10 @@ tasks: # Deploy with helmfile echo "Using $ENV_VARS" eval "KUBECONFIG={{.KUBECONFIG_FILE}} $ENV_VARS helmfile sync --wait" - - echo "All charts deployed!" + - echo "All charts installed!" deps: - setup-kubeconfig - - ports-expose + - cluster-ports-expose cluster-delete: desc: Delete all test clusters with matching name and clean up kubeconfig @@ -300,6 +306,53 @@ tasks: deps: - release-prepare + customer-create: + desc: Create a new customer or get existing customer with matching name and return their ID + silent: false + run: once + vars: + CUSTOMER_NAME: '{{.CUSTOMER_NAME | default "test-customer"}}' + CUSTOMER_EMAIL: '{{.CUSTOMER_EMAIL | default "test@example.com"}}' + CHANNEL: '{{.CHANNEL | default "Unstable"}}' + LICENSE_TYPE: '{{.LICENSE_TYPE | default "dev"}}' + EXPIRES_IN: '{{.EXPIRES_IN | default ""}}' + requires: + vars: [APP_SLUG] + cmds: + - | + # First check if customer already exists + echo "Looking for existing customer {{.CUSTOMER_NAME}} for app {{.APP_SLUG}}..." + EXISTING_CUSTOMER=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.name=="{{.CUSTOMER_NAME}}") | .id' | head -1) + + if [ -n "$EXISTING_CUSTOMER" ]; then + echo "Found existing customer {{.CUSTOMER_NAME}} with ID: $EXISTING_CUSTOMER" + echo "$EXISTING_CUSTOMER" + exit 0 + fi + + # No existing customer found, create a new one + echo "Creating new customer {{.CUSTOMER_NAME}} for app {{.APP_SLUG}}..." + + # Build the command with optional expiration + CMD="replicated customer create \ + --app {{.APP_SLUG}} \ + --name {{.CUSTOMER_NAME}} \ + --email {{.CUSTOMER_EMAIL}} \ + --channel {{.CHANNEL}} \ + --type {{.LICENSE_TYPE}} \ + --output json" + + # Add expiration if specified + if [ -n "{{.EXPIRES_IN}}" ]; then + CMD="$CMD --expires-in {{.EXPIRES_IN}}" + fi + + # Create the customer and capture the output + CUSTOMER_JSON=$($CMD) + + # Extract and output just the customer ID + echo "$CUSTOMER_JSON" | jq -r '.id' + gcp-vm-create: desc: Create a simple GCP VM instance silent: false @@ -357,14 +410,51 @@ tasks: GCP_ZONE: '{{.GCP_ZONE}}' VM_NAME: '{{.VM_NAME}}' + customer-ls: + desc: List customers for the application + silent: false + vars: + OUTPUT_FORMAT: '{{.OUTPUT_FORMAT | default "table"}}' + requires: + vars: [APP_SLUG] + cmds: + - echo "Listing customers for app {{.APP_SLUG}}..." + - replicated customer ls --app {{.APP_SLUG}} --output {{.OUTPUT_FORMAT}} + + customer-delete: + desc: Archive a customer by ID + silent: false + vars: + CUSTOMER_ID: '{{.CUSTOMER_ID}}' + requires: + vars: [APP_SLUG, CUSTOMER_ID] + cmds: + - echo "Archiving customer with ID {{.CUSTOMER_ID}} from app {{.APP_SLUG}}..." + - | + # Verify customer exists before attempting to archive + CUSTOMER_EXISTS=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.id=="{{.CUSTOMER_ID}}") | .id') + if [ -z "$CUSTOMER_EXISTS" ]; then + echo "Error: Customer with ID {{.CUSTOMER_ID}} not found for app {{.APP_SLUG}}" + exit 1 + fi + + # Get customer name for confirmation message + CUSTOMER_NAME=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.id=="{{.CUSTOMER_ID}}") | .name') + + # Archive the customer + replicated customer archive {{.CUSTOMER_ID}} --app {{.APP_SLUG}} + + # Confirm archiving + echo "Customer '$CUSTOMER_NAME' (ID: {{.CUSTOMER_ID}}) successfully archived" + full-test-cycle: desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete silent: false cmds: - task: cluster-create - task: setup-kubeconfig - - task: ports-expose + - task: cluster-ports-expose - task: dependencies-update - - task: helm-deploy + - task: helm-install - task: test - task: cluster-delete diff --git a/applications/wg-easy/taskfiles/utils.yml b/applications/wg-easy/taskfiles/utils.yml index 7b3a14de..67e26e6f 100644 --- a/applications/wg-easy/taskfiles/utils.yml +++ b/applications/wg-easy/taskfiles/utils.yml @@ -132,6 +132,40 @@ tasks: echo "TF_EXPOSED_URL=$TF_EXPOSED_URL TF_EXPOSED_HTTP_URL=$TF_EXPOSED_HTTP_URL" fi + vendor-api-auth: + desc: Verify authorization against Replicated Vendor API + silent: false + vars: + API_TOKEN: '{{.REPLICATED_API_TOKEN | default (env "REPLICATED_API_TOKEN")}}' + cmds: + - | + echo "Verifying Replicated Vendor API authorization..." + + # Check if API token is provided + if [ -z "{{.API_TOKEN}}" ]; then + echo "ERROR: No API token provided." + echo "Please set the REPLICATED_API_TOKEN environment variable or provide it as a task variable." + echo "You can generate an API token in the Replicated Vendor Portal under 'API Tokens'." + echo "Documentation: https://docs.replicated.com/reference/vendor-api-using" + exit 1 + fi + + # Make API request to check authentication + AUTH_RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \ + -H "Authorization: {{.API_TOKEN}}" \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + "https://api.replicated.com/vendor/v3/auth") + + if [ "$AUTH_RESPONSE" = "200" ]; then + echo "Authentication successful! Token is valid." + exit 0 + else + echo "ERROR: Authentication failed with status code $AUTH_RESPONSE." + echo "Please check your API token and try again." + exit 1 + fi + gcp-operations: desc: GCP VM operations internal: true From 87391534a9812ec7b1a207603c9d05bcfa455d0c Mon Sep 17 00:00:00 2001 From: Scott Rigby Date: Tue, 6 May 2025 14:56:19 -0400 Subject: [PATCH 03/14] Move all charts to charts/ dir Signed-off-by: Scott Rigby --- applications/wg-easy/README.md | 13 +++++++------ .../{ => charts}/cert-manager-issuers/Chart.yaml | 0 .../replicated/helmChart-cert-manager-issuers.yaml | 0 .../cert-manager-issuers/templates/issuers.yaml | 0 .../{ => charts}/cert-manager-issuers/values.yaml | 0 .../wg-easy/{ => charts}/cert-manager/Chart.yaml | 0 .../replicated/helmChart-cert-manager.yaml | 0 .../cert-manager/templates/issuers.yaml | 0 .../wg-easy/{ => charts}/cert-manager/values.yaml | 0 .../wg-easy/{ => charts}/replicated-sdk/Chart.yaml | 0 .../replicated/helmChart-replicated-sdk.yaml | 0 .../wg-easy/{ => charts}/replicated-sdk/values.yaml | 0 .../wg-easy/{ => charts}/traefik/Chart.yaml | 0 .../traefik/replicated/helmChart-traefik.yaml | 0 .../{ => charts}/traefik/templates/certificate.yaml | 0 .../{ => charts}/traefik/templates/tls-options.yaml | 0 .../wg-easy/{ => charts}/traefik/values.yaml | 0 .../wg-easy/{ => charts}/wg-easy/Chart.yaml | 0 .../{ => charts}/wg-easy/replicated/config.yaml | 0 .../wg-easy/replicated/helmChart-wg-easy.yaml | 0 .../wg-easy/{ => charts}/wg-easy/values.yaml | 0 applications/wg-easy/docs/chart-structure.md | 2 +- applications/wg-easy/docs/development-workflow.md | 2 +- applications/wg-easy/docs/task-reference.md | 4 ++-- applications/wg-easy/helmfile.yaml.gotmpl | 10 +++++----- 25 files changed, 16 insertions(+), 15 deletions(-) rename applications/wg-easy/{ => charts}/cert-manager-issuers/Chart.yaml (100%) rename applications/wg-easy/{ => charts}/cert-manager-issuers/replicated/helmChart-cert-manager-issuers.yaml (100%) rename applications/wg-easy/{ => charts}/cert-manager-issuers/templates/issuers.yaml (100%) rename applications/wg-easy/{ => charts}/cert-manager-issuers/values.yaml (100%) rename applications/wg-easy/{ => charts}/cert-manager/Chart.yaml (100%) rename applications/wg-easy/{ => charts}/cert-manager/replicated/helmChart-cert-manager.yaml (100%) rename applications/wg-easy/{ => charts}/cert-manager/templates/issuers.yaml (100%) rename applications/wg-easy/{ => charts}/cert-manager/values.yaml (100%) rename applications/wg-easy/{ => charts}/replicated-sdk/Chart.yaml (100%) rename applications/wg-easy/{ => charts}/replicated-sdk/replicated/helmChart-replicated-sdk.yaml (100%) rename applications/wg-easy/{ => charts}/replicated-sdk/values.yaml (100%) rename applications/wg-easy/{ => charts}/traefik/Chart.yaml (100%) rename applications/wg-easy/{ => charts}/traefik/replicated/helmChart-traefik.yaml (100%) rename applications/wg-easy/{ => charts}/traefik/templates/certificate.yaml (100%) rename applications/wg-easy/{ => charts}/traefik/templates/tls-options.yaml (100%) rename applications/wg-easy/{ => charts}/traefik/values.yaml (100%) rename applications/wg-easy/{ => charts}/wg-easy/Chart.yaml (100%) rename applications/wg-easy/{ => charts}/wg-easy/replicated/config.yaml (100%) rename applications/wg-easy/{ => charts}/wg-easy/replicated/helmChart-wg-easy.yaml (100%) rename applications/wg-easy/{ => charts}/wg-easy/values.yaml (100%) diff --git a/applications/wg-easy/README.md b/applications/wg-easy/README.md index d8b92464..291ab2b2 100644 --- a/applications/wg-easy/README.md +++ b/applications/wg-easy/README.md @@ -55,14 +55,15 @@ Use tools to automate repetitive tasks, reducing human error and increasing deve ``` applications/wg-easy/ -├── charts/templates/ # Common templates shared across charts -├── cert-manager/ # Wrapped cert-manager chart -├── cert-manager-issuers/ # Chart for cert-manager issuers +├── charts +│   ├── cert-manager # Wrapped cert-manager chart +│   ├── cert-manager-issuers # Chart for cert-manager issuers +│   ├── replicated-sdk # Replicated SDK chart +│   ├── templates # Common templates shared across charts +│   ├── traefik # Wrapped Traefik chart +│   └── wg-easy # Main application chart ├── replicated/ # Root Replicated configuration -├── replicated-sdk/ # Replicated SDK chart ├── taskfiles/ # Task utility functions -├── traefik/ # Wrapped Traefik chart -├── wg-easy/ # Main application chart ├── helmfile.yaml # Defines chart installation order └── Taskfile.yaml # Main task definitions ``` diff --git a/applications/wg-easy/cert-manager-issuers/Chart.yaml b/applications/wg-easy/charts/cert-manager-issuers/Chart.yaml similarity index 100% rename from applications/wg-easy/cert-manager-issuers/Chart.yaml rename to applications/wg-easy/charts/cert-manager-issuers/Chart.yaml diff --git a/applications/wg-easy/cert-manager-issuers/replicated/helmChart-cert-manager-issuers.yaml b/applications/wg-easy/charts/cert-manager-issuers/replicated/helmChart-cert-manager-issuers.yaml similarity index 100% rename from applications/wg-easy/cert-manager-issuers/replicated/helmChart-cert-manager-issuers.yaml rename to applications/wg-easy/charts/cert-manager-issuers/replicated/helmChart-cert-manager-issuers.yaml diff --git a/applications/wg-easy/cert-manager-issuers/templates/issuers.yaml b/applications/wg-easy/charts/cert-manager-issuers/templates/issuers.yaml similarity index 100% rename from applications/wg-easy/cert-manager-issuers/templates/issuers.yaml rename to applications/wg-easy/charts/cert-manager-issuers/templates/issuers.yaml diff --git a/applications/wg-easy/cert-manager-issuers/values.yaml b/applications/wg-easy/charts/cert-manager-issuers/values.yaml similarity index 100% rename from applications/wg-easy/cert-manager-issuers/values.yaml rename to applications/wg-easy/charts/cert-manager-issuers/values.yaml diff --git a/applications/wg-easy/cert-manager/Chart.yaml b/applications/wg-easy/charts/cert-manager/Chart.yaml similarity index 100% rename from applications/wg-easy/cert-manager/Chart.yaml rename to applications/wg-easy/charts/cert-manager/Chart.yaml diff --git a/applications/wg-easy/cert-manager/replicated/helmChart-cert-manager.yaml b/applications/wg-easy/charts/cert-manager/replicated/helmChart-cert-manager.yaml similarity index 100% rename from applications/wg-easy/cert-manager/replicated/helmChart-cert-manager.yaml rename to applications/wg-easy/charts/cert-manager/replicated/helmChart-cert-manager.yaml diff --git a/applications/wg-easy/cert-manager/templates/issuers.yaml b/applications/wg-easy/charts/cert-manager/templates/issuers.yaml similarity index 100% rename from applications/wg-easy/cert-manager/templates/issuers.yaml rename to applications/wg-easy/charts/cert-manager/templates/issuers.yaml diff --git a/applications/wg-easy/cert-manager/values.yaml b/applications/wg-easy/charts/cert-manager/values.yaml similarity index 100% rename from applications/wg-easy/cert-manager/values.yaml rename to applications/wg-easy/charts/cert-manager/values.yaml diff --git a/applications/wg-easy/replicated-sdk/Chart.yaml b/applications/wg-easy/charts/replicated-sdk/Chart.yaml similarity index 100% rename from applications/wg-easy/replicated-sdk/Chart.yaml rename to applications/wg-easy/charts/replicated-sdk/Chart.yaml diff --git a/applications/wg-easy/replicated-sdk/replicated/helmChart-replicated-sdk.yaml b/applications/wg-easy/charts/replicated-sdk/replicated/helmChart-replicated-sdk.yaml similarity index 100% rename from applications/wg-easy/replicated-sdk/replicated/helmChart-replicated-sdk.yaml rename to applications/wg-easy/charts/replicated-sdk/replicated/helmChart-replicated-sdk.yaml diff --git a/applications/wg-easy/replicated-sdk/values.yaml b/applications/wg-easy/charts/replicated-sdk/values.yaml similarity index 100% rename from applications/wg-easy/replicated-sdk/values.yaml rename to applications/wg-easy/charts/replicated-sdk/values.yaml diff --git a/applications/wg-easy/traefik/Chart.yaml b/applications/wg-easy/charts/traefik/Chart.yaml similarity index 100% rename from applications/wg-easy/traefik/Chart.yaml rename to applications/wg-easy/charts/traefik/Chart.yaml diff --git a/applications/wg-easy/traefik/replicated/helmChart-traefik.yaml b/applications/wg-easy/charts/traefik/replicated/helmChart-traefik.yaml similarity index 100% rename from applications/wg-easy/traefik/replicated/helmChart-traefik.yaml rename to applications/wg-easy/charts/traefik/replicated/helmChart-traefik.yaml diff --git a/applications/wg-easy/traefik/templates/certificate.yaml b/applications/wg-easy/charts/traefik/templates/certificate.yaml similarity index 100% rename from applications/wg-easy/traefik/templates/certificate.yaml rename to applications/wg-easy/charts/traefik/templates/certificate.yaml diff --git a/applications/wg-easy/traefik/templates/tls-options.yaml b/applications/wg-easy/charts/traefik/templates/tls-options.yaml similarity index 100% rename from applications/wg-easy/traefik/templates/tls-options.yaml rename to applications/wg-easy/charts/traefik/templates/tls-options.yaml diff --git a/applications/wg-easy/traefik/values.yaml b/applications/wg-easy/charts/traefik/values.yaml similarity index 100% rename from applications/wg-easy/traefik/values.yaml rename to applications/wg-easy/charts/traefik/values.yaml diff --git a/applications/wg-easy/wg-easy/Chart.yaml b/applications/wg-easy/charts/wg-easy/Chart.yaml similarity index 100% rename from applications/wg-easy/wg-easy/Chart.yaml rename to applications/wg-easy/charts/wg-easy/Chart.yaml diff --git a/applications/wg-easy/wg-easy/replicated/config.yaml b/applications/wg-easy/charts/wg-easy/replicated/config.yaml similarity index 100% rename from applications/wg-easy/wg-easy/replicated/config.yaml rename to applications/wg-easy/charts/wg-easy/replicated/config.yaml diff --git a/applications/wg-easy/wg-easy/replicated/helmChart-wg-easy.yaml b/applications/wg-easy/charts/wg-easy/replicated/helmChart-wg-easy.yaml similarity index 100% rename from applications/wg-easy/wg-easy/replicated/helmChart-wg-easy.yaml rename to applications/wg-easy/charts/wg-easy/replicated/helmChart-wg-easy.yaml diff --git a/applications/wg-easy/wg-easy/values.yaml b/applications/wg-easy/charts/wg-easy/values.yaml similarity index 100% rename from applications/wg-easy/wg-easy/values.yaml rename to applications/wg-easy/charts/wg-easy/values.yaml diff --git a/applications/wg-easy/docs/chart-structure.md b/applications/wg-easy/docs/chart-structure.md index f68aa483..a5463fca 100644 --- a/applications/wg-easy/docs/chart-structure.md +++ b/applications/wg-easy/docs/chart-structure.md @@ -95,7 +95,7 @@ releases: - name: cert-manager-issuers namespace: cert-manager - chart: ./cert-manager-issuers + chart: .charts/cert-manager-issuers createNamespace: true wait: true needs: diff --git a/applications/wg-easy/docs/development-workflow.md b/applications/wg-easy/docs/development-workflow.md index 3c7e36d9..dd0d149d 100644 --- a/applications/wg-easy/docs/development-workflow.md +++ b/applications/wg-easy/docs/development-workflow.md @@ -163,7 +163,7 @@ Test multiple charts working together using Helmfile orchestration. # ... - name: cert-manager-issuers namespace: cert-manager - chart: ./cert-manager-issuers + chart: ./charts/cert-manager-issuers # ... needs: - cert-manager/cert-manager diff --git a/applications/wg-easy/docs/task-reference.md b/applications/wg-easy/docs/task-reference.md index f28267b6..2723c29f 100644 --- a/applications/wg-easy/docs/task-reference.md +++ b/applications/wg-easy/docs/task-reference.md @@ -22,8 +22,8 @@ task update-dependencies && task deploy-helm **Single Chart Testing:** ```bash -helm dependency update ./traefik -helm install traefik ./traefik -n traefik --create-namespace +helm dependency update ./charts/traefik +helm install traefik ./charts/traefik -n traefik --create-namespace ``` ## Environment Tasks diff --git a/applications/wg-easy/helmfile.yaml.gotmpl b/applications/wg-easy/helmfile.yaml.gotmpl index 4adc18e3..26cd34b3 100644 --- a/applications/wg-easy/helmfile.yaml.gotmpl +++ b/applications/wg-easy/helmfile.yaml.gotmpl @@ -10,11 +10,11 @@ environments: default: values: - chartSources: - certManager: ./cert-manager - certManagerIssuers: ./cert-manager-issuers - traefik: ./traefik - wgEasy: ./wg-easy - replicatedSDK: ./replicated-sdk + certManager: ./charts/cert-manager + certManagerIssuers: ./charts/cert-manager-issuers + traefik: ./charts/traefik + wgEasy: ./charts/wg-easy + replicatedSDK: ./charts/replicated-sdk - extras: enableReplicatedSDK: false replicated: From ae4a2a1764143ca42d064c7a5af584c01a4ab878 Mon Sep 17 00:00:00 2001 From: Scott Rigby Date: Tue, 6 May 2025 15:14:05 -0400 Subject: [PATCH 04/14] Copy Chris' upstream wg-easy chart to filesystem Signed-off-by: Scott Rigby --- .../charts/wg-easy-upstream/.helmignore | 25 + .../charts/wg-easy-upstream/Chart.lock | 6 + .../charts/wg-easy-upstream/Chart.yaml | 13 + .../wg-easy/charts/wg-easy-upstream/README.md | 17 + .../replicated-library/ADVANCED_TEMPLATING.md | 165 ++++++ .../charts/replicated-library/Chart.yaml | 14 + .../charts/replicated-library/FEATURES.md | 203 +++++++ .../charts/replicated-library/README.md | 273 +++++++++ .../replicated-library/README.md.gotmpl | 83 +++ .../README_CHANGELOG.md.gotmpl | 216 +++++++ .../README_CONFIG.md.gotmpl | 46 ++ .../replicated-library/templates/_all.tpl | 32 + .../templates/lib/_analyzer.tpl | 17 + .../templates/lib/_analyzer_templates.tpl | 8 + .../templates/lib/_analyzers.tpl | 16 + .../templates/lib/_annotations.tpl | 10 + .../templates/lib/_apps.tpl | 26 + .../templates/lib/_capabilities.tpl | 19 + .../templates/lib/_collector.tpl | 31 + .../templates/lib/_collectors.tpl | 16 + .../templates/lib/_configmap.tpl | 28 + .../templates/lib/_configmaps.tpl | 16 + .../templates/lib/_container.tpl | 105 ++++ .../templates/lib/_daemonset.tpl | 58 ++ .../templates/lib/_deployment.tpl | 63 ++ .../templates/lib/_env_vars.tpl | 44 ++ .../templates/lib/_ingress.tpl | 90 +++ .../templates/lib/_ingresses.tpl | 34 ++ .../templates/lib/_init_container.tpl | 69 +++ .../templates/lib/_labels.tpl | 70 +++ .../templates/lib/_names.tpl | 95 +++ .../templates/lib/_notes.tpl | 3 + .../replicated-library/templates/lib/_pod.tpl | 116 ++++ .../templates/lib/_pod_annotations.tpl | 93 +++ .../templates/lib/_preflights.tpl | 171 ++++++ .../replicated-library/templates/lib/_pvc.tpl | 30 + .../templates/lib/_pvcs.tpl | 19 + .../templates/lib/_role.tpl | 44 ++ .../templates/lib/_rolebinding.tpl | 48 ++ .../templates/lib/_rolebindings.tpl | 12 + .../templates/lib/_roles.tpl | 13 + .../templates/lib/_secret.tpl | 29 + .../templates/lib/_secrets.tpl | 17 + .../templates/lib/_service.tpl | 92 +++ .../templates/lib/_serviceaccount.tpl | 23 + .../templates/lib/_serviceaccounts.tpl | 13 + .../templates/lib/_services.tpl | 17 + .../templates/lib/_statefulset.tpl | 93 +++ .../templates/lib/_support_bundle.tpl | 36 ++ .../templates/lib/_troubleshoot.tpl | 30 + .../templates/lib/_values.tpl | 9 + .../lib/troubleshoot/_collector_collectd.tpl | 46 ++ .../lib/troubleshoot/_collector_configMap.tpl | 43 ++ .../troubleshoot/_collector_copyFromHost.tpl | 44 ++ .../lib/troubleshoot/_collector_data.tpl | 19 + .../lib/troubleshoot/_collector_exec.tpl | 69 +++ .../lib/troubleshoot/_collector_general.tpl | 8 + .../lib/troubleshoot/_collector_logs.tpl | 58 ++ .../lib/troubleshoot/_collector_secrets.tpl | 35 ++ .../replicated-library/values-example.yaml | 557 ++++++++++++++++++ .../charts/replicated-library/values.yaml | 91 +++ .../templates/replicated-library.yaml | 69 +++ .../charts/wg-easy-upstream/values.yaml | 98 +++ .../wg-easy/charts/wg-easy/Chart.lock | 9 + .../wg-easy/charts/wg-easy/Chart.yaml | 4 +- 65 files changed, 3964 insertions(+), 2 deletions(-) create mode 100644 applications/wg-easy/charts/wg-easy-upstream/.helmignore create mode 100644 applications/wg-easy/charts/wg-easy-upstream/Chart.lock create mode 100644 applications/wg-easy/charts/wg-easy-upstream/Chart.yaml create mode 100644 applications/wg-easy/charts/wg-easy-upstream/README.md create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/ADVANCED_TEMPLATING.md create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/Chart.yaml create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/FEATURES.md create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README.md create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README.md.gotmpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README_CHANGELOG.md.gotmpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README_CONFIG.md.gotmpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/_all.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzer.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzer_templates.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzers.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_annotations.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_apps.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_capabilities.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_collector.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_collectors.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_configmap.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_configmaps.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_container.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_daemonset.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_deployment.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_env_vars.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_ingress.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_ingresses.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_init_container.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_labels.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_names.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_notes.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pod.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pod_annotations.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_preflights.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pvc.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pvcs.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_role.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_rolebinding.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_rolebindings.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_roles.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_secret.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_secrets.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_service.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_serviceaccount.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_serviceaccounts.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_services.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_statefulset.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_support_bundle.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_troubleshoot.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_values.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_collectd.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_configMap.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_copyFromHost.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_data.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_exec.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_general.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_logs.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_secrets.tpl create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/values-example.yaml create mode 100644 applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/values.yaml create mode 100644 applications/wg-easy/charts/wg-easy-upstream/templates/replicated-library.yaml create mode 100644 applications/wg-easy/charts/wg-easy-upstream/values.yaml create mode 100644 applications/wg-easy/charts/wg-easy/Chart.lock diff --git a/applications/wg-easy/charts/wg-easy-upstream/.helmignore b/applications/wg-easy/charts/wg-easy-upstream/.helmignore new file mode 100644 index 00000000..889621cf --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/.helmignore @@ -0,0 +1,25 @@ +# 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/ +manifests/ +doc/ diff --git a/applications/wg-easy/charts/wg-easy-upstream/Chart.lock b/applications/wg-easy/charts/wg-easy-upstream/Chart.lock new file mode 100644 index 00000000..08dd4d52 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: replicated-library + repository: https://replicatedhq.github.io/helm-charts + version: 0.13.10 +digest: sha256:cb41956b9ecae9581fa42eeb58487c8251a6e6d4ead534c28b577931e566e37e +generated: "2023-12-27T16:31:00.156396361-06:00" diff --git a/applications/wg-easy/charts/wg-easy-upstream/Chart.yaml b/applications/wg-easy/charts/wg-easy-upstream/Chart.yaml new file mode 100644 index 00000000..216664a9 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/Chart.yaml @@ -0,0 +1,13 @@ +apiVersion: v2 +dependencies: +- name: replicated-library + repository: https://replicatedhq.github.io/helm-charts + version: ^0.13.2 +description: Simple wireguard with web configuration management +home: https://github.com/chris-sanders/helm-charts/charts/wg-easy +maintainers: +- email: sanders.chris@gmail.com + name: Chris Sanders + url: https://github.com/chris-sanders/helm-charts +name: wg-easy +version: 1.0.0 diff --git a/applications/wg-easy/charts/wg-easy-upstream/README.md b/applications/wg-easy/charts/wg-easy-upstream/README.md new file mode 100644 index 00000000..76d3d1e1 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/README.md @@ -0,0 +1,17 @@ +# wg-easy + +## Helm chart + +This is a helm chart for deploying [wg-easy](https://github.com/wg-easy/wg-easy) which describes itself as "You have found the easiest way to install & manage WireGuard on any Linux host!". This chart is not affiliated with the upstream project and bugs for this chart should not be filed against the upstream project. + +## Installing the Chart + +This chart exposes all of the wg-easy environment variables for configuration under the key `wireguard`. You can see the value available in the values.yaml file with this chart. Detailed instructions have not been written although the upstream project documents each of the environment variables. + +## Releasing the chart + +To release a new version of this chart simply set the version number in `Chart.yaml` as part of a pull request and once merged the new version will be released. Note that since this chart uses a `chart.lock` file the version in the lock file should match the version of the dependency listed in `Chart.yaml`, which should also be the version you tested your development changes against. Anytime you adjust the dependency version in `Chart.yaml` you should use `helm dependencies update` to fetch the new version and update the lock file to match. If your lock file and dependency version in the `Chart.yaml` file do not match you should update your dependencies and re-test to ensure your changes work with the version in the lock file. + +## Contributing + +This chart is functional and in use but lacks practices like more user friendly install instructions, explanation of how to configure values like `loadBalancerIP` on the vpn service, and a changelog to document changes in the versions. Contributions to add any of these items, to operate in a similar fashion to what's available in the library-chart that is used as a dependency would be greatly appreciated. diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/ADVANCED_TEMPLATING.md b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/ADVANCED_TEMPLATING.md new file mode 100644 index 00000000..b3a8b0dd --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/ADVANCED_TEMPLATING.md @@ -0,0 +1,165 @@ +## Advanced Templating + +The library chart can cover a lot of ground, but you may have the need to bring your own templates, hardcode values that you don't want end-users to change, +or write a conditional that's toggled with the contents of a variable in your values.yaml. Here we'll provide a few examples of how +to implement this on top of the library chart. + + +### Bringing your own templates and manifests + +Because the library chart is still helm, it doesn't prevent you from doing this in anyway. For example, let's say you need to create +the below TLS secret for use in an ingress: + +templates/tls.yaml +```yaml +{{$cert := genSelfSignedCert "yourapp.example.com" nil nil 730 }} +apiVersion: v1 +data: + tls.crt: {{ $cert.Cert | b64enc }} + tls.key: {{ $cert.Key | b64enc }} +kind: Secret +metadata: + name: yourapp-tls-secret +type: kubernetes.io/tls +``` + +And then you could use this secret in `ingresses` section of your values.yaml + +values.yaml +``` +ingresses: + yourapp: + enabled: true + serviceName: yourapp + hosts: + - host: yourapp.example.com + paths: + - path: / + pathType: Prefix + service: + port: 8080 + tls: + - hosts: + - yourapp.example.com + secretName: yourapp-tls-secret +``` + +### Hardcoding values +You may have a need to hardcode certain config in your values.yaml that you don't want users to overwrite. You can use the `mergeOverwrite` function to do this: + +values.yaml +```yaml +apps: + yourapp: + enabled: true + type: deployment + replicas: 1 + containers: + yourapp: + image: + repository: yourapp/server + tag: 1.27.0-alpine + volumeMounts: + - mountPath: /work-dir + name: work-dir + volumes: + - name: work-dir + emptyDir: {} +``` + +templates/all.yaml +```tpl +{{- define "youapp.hardcodedValues" -}} +apps: + yourapp: + enabled: true + type: deployment + containers: + yourapp: + volumeMounts: + - mountPath: /data + name: yourapp + volumes: + - name: yourapp + persistentVolumeClaim: + claimName: yourapp +{{- end -}} + +{{- $_ := mergeOverwrite .Values (include "yourapp.hardcodedValues" . | fromYaml) -}} + +{{- include "replicated-library.all" . }} +``` + +The computed values in this case would be: + +```yaml +apps: + yourapp: + enabled: true + type: deployment + replicas: 1 + containers: + yourapp: + image: + repository: yourapp/server + tag: 1.27.0-alpine + volumeMounts: + - mountPath: /data + name: yourapp + - mountPath: /work-dir + name: work-dir + volumes: + - name: work-dir + emptyDir: {} + - name: yourapp + persistentVolumeClaim: + claimName: yourapp +``` + +Regardless what the end user configures in the values.yaml for `yourapp`, the values you've hardcoded in your template will always be merged in and potentially overwrite. + +### Adding a conditional +You can also use the hardcode values pattern to implement a conditional or other logic on top of the library chart: + +values.yaml +```yaml +apps: + yourapp: + enabled: true + type: deployment + replicas: 1 + containers: + yourapp: + image: + repository: yourapp/server + tag: 1.27.0-alpine +yourAppConfig: + enableSomeFeature: true +``` + +templates/all.yaml +```yaml +{{- define "youapp.hardcodedValues" -}} +apps: + yourapp: + enabled: true + type: deployment + replicas: 1 + containers: + yourapp: + image: + repository: yourapp/server + tag: 1.27.0-alpine + {{- if .Values.yourAppConfig.enableSomeFeature -}} + env: + SOME_FEATURE: enabled + {{- end -}} +{{- end -}} + +{{- $_ := mergeOverwrite .Values (include "yourapp.hardcodedValues" . | fromYaml) -}} + +{{- include "replicated-library.all" . }} +``` + +You've now created a new value specific to your helm chart which optionally enables an environment variable. And as we know from the first hardcoded values example, +the template including the conditional will merge and overwrite over the values in the `values.yaml` diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/Chart.yaml b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/Chart.yaml new file mode 100644 index 00000000..616fb4ee --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v2 +description: Replicated library chart +home: https://github.com/replicatedhq/helm-charts/tree/main/charts/replicated-library +keywords: +- replicated-library +kubeVersion: '>=1.16.0-0' +maintainers: +- email: diamon@replicated.com + name: diamonwiggins +- email: chriss@replicated.com + name: chris-sanders +name: replicated-library +type: library +version: 0.13.10 diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/FEATURES.md b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/FEATURES.md new file mode 100644 index 00000000..75334ee5 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/FEATURES.md @@ -0,0 +1,203 @@ +## Features + +### Dynamic App Reload on Configuration Changes + +By default, when configmaps and secrets are used in the `envFrom` or `volumes` section of an App, +any changes to those objects will force a restart of the App's pods so that they receive the latest configuration. + +```yaml +global: + fullNameOverride: "-" + +apps: + vaultwarden: + enabled: true + type: deployment + replicas: 1 + containers: + vaultwarden: + image: + repository: vaultwarden/server + tag: 1.27.0-alpine + ports: + - name: http + containerPort: 80 + envFrom: + - secretRef: + name: vaultwarden + volumeMounts: + - mountPath: /randomPath/file.yaml + subPath: file.yaml + name: sample-configmap + volumes: + - name: sample-configmap + configMap: + name: sample-configmap +secrets: + vaultwarden: + enabled: true + data: + TEST_VAR: "some-value" +configmaps: + sample-configmap: + enabled: true + data: + file.yaml: "file contents go here" +``` + +With the above configuration, annotations containing a hash of the configmap and secret will be added to the pod template. When the configmap or secret changes, the pod will be restarted. + +``` +Annotations: checksum/config-vaultwarden: some-hash + checksum/secret-sample-configmap: some-hash +``` + +**NOTE**: This feature is not yet supported when a configmap or secret is referenced in `env`. + +#### Disabling App Reloads + +You can disable App reloads when a ConfigMap or Secret changes with the `appReload` key globally or at the Secret/ConfigMap level. `appReload` when set on a ConfigMap or Secret takes precedence over `.Values.global.appReload`. + +```yaml +global: + labels: {} + annotations: {} + fullNameOverride: "-" + appReload: true + +secrets: + vaultwarden: + enabled: true + appReload: false + data: + TEST_VAR: "some-value" + +configmaps: + sample-configmap: + enabled: true + appReload: true + data: + file.yaml: "file contents go here" +``` + +With the above configuration, App reloads would only take place for anything using the `sample-configmap` ConfigMap. + +### App, Service, and Ingress Association + +The Replicated library allows you to easily associate a Service object to an App or a Ingress object to a Service. + +#### Associating a Service to an App + +When you use `appName` to associate a service to an App, the library will automatically configure the `labelSelector` for both the service and the app to match the App name. This allows you to easily associate a service to an App without having to manually configure the labelSelector. + +```yaml +global: + labels: {} + annotations: {} + fullNameOverride: "-" +apps: + vaultwarden: + enabled: true + type: deployment + replicas: 1 + containers: + vaultwarden: + image: + repository: vaultwarden/server + tag: 1.27.0-alpine + ports: + - name: http + containerPort: 80 +services: + vaultwarden: + enabled: true + appName: ["vaultwarden"] #appName supports one or more app names + type: ClusterIP + ports: + http: + enabled: true + port: 8080 + protocol: HTTP + targetPort: 80 +``` + +The result is a Service object that automatically sets `spec.selector` to one or more labels matching the apps in `appName`. + +```yaml +apiVersion: v1 +kind: Service +metadata: + annotations: + ... + labels: + ... + name: vaultwarden +spec: + ports: + - name: http + port: 8080 + protocol: TCP + targetPort: 80 + selector: + app.kubernetes.io/instance: vaultwarden + app.kubernetes.io/name: vaultwarden + type: ClusterIP +``` + +#### Associating a Service to an Ingress + +Similiar to `appName` for services, you can use `serviceName` to associate an ingress to a service. + +```yaml +services: + vaultwarden: + enabled: true + appName: ["vaultwarden"] + type: ClusterIP + ports: + http: + enabled: true + port: 8080 + protocol: HTTP + targetPort: 80 +ingresses: + vaultwarden: + enabled: true + serviceName: vaultwarden + hosts: + - host: vaultwarden.example.com + paths: + - path: / + pathType: Prefix + service: + port: 8080 +``` + +The result is an Ingress object that automatically configures `backend.service.name` to what was specified in `serviceName`. + +```yaml +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + ... + labels: + ... + name: vaultwarden +spec: + rules: + - host: vaultwarden.example.com + http: + paths: + - backend: + service: + name: vaultwarden + port: + number: 8080 + path: / + pathType: Prefix + tls: + - hosts: + - vaultwarden.example.com + secretName: vaultwarden-tls-secret +``` diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README.md b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README.md new file mode 100644 index 00000000..3ba63968 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README.md @@ -0,0 +1,273 @@ +# replicated-library + +![Version: 0.13.10](https://img.shields.io/badge/Version-0.13.10-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) + +Replicated library chart + +This is a library chart maintained by Replicated in order to keep the creation of helm charts dry when deploying third party commercial software + +## Requirements + +Kubernetes: `>=1.16.0-0` + +## Releasing + +Ensure the version number is set in `Chart.yaml` for the version you want to release. + +Add your changes to the file `README_CHANGELOG.md.gotmpl`. The format for using this file is documented in the file itself. + +You need to have [Helm Docs](https://github.com/norwoodj/helm-docs) installed. Then run the following command to update the README and README_CHANGELOG files. + +``` +helm-docs -t README.md.gotmpl -t README_CHANGELOG.md.gotmpl -t README_CONFIG.md.gotmpl +``` + +Check in the updated files as part of your PR. + +## Installing the Chart + +This is a [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm). + +**WARNING: THIS CHART IS NOT MEANT TO BE INSTALLED DIRECTLY** + +## Using this library + +Include the chart as a dependency in your `Chart.yaml` + +```yaml +# Chart.yaml +dependencies: +- name: replicated-library + repository: https://replicatedhq.github.io/helm-charts + version: 0.13.10 +``` + +You can see a full example of this library chart in use [here](https://github.com/replicatedhq/replicated-starter-helm) +To see an example of the available values see [values-example.yaml](values-example.yaml) + +## Features + +Below highlights some of the useful features available in this library + +* [Dynamic App Reload on Configuration Changes](FEATURES.md#dynamic-app-reload-on-configuration-changes) +* [App, Service, and Ingress Association](FEATURES.md#app-service-and-ingress-association) + +## Advanced Templating + +[Examples of how you can advanced templating and build on top of this library chart](ADVANCED_TEMPLATING.md) + +## Changelog + +All notable changes to this library Helm chart will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +### [Unreleased] + +### [0.13.10] + +#### Fixed + +- 121 - Fixed issue causing Readiness and Liveness probes from being rendering correctly for apps with multiple containers + +### [0.13.9] + +#### Fixed + +- 110 - Fix examples for existingClaim and implement it in containers +- 109 - Trim "-" from serviceName +- 91 - cleaned up white spaces in Statefulset spec +- fixes serviceName not being set on Statefulsets + +#### Added + +Adds prefixes to configmaps in volumes like persistentVolumes +Use existingClaim in pods when set on persistence + +### [0.13.8] + +#### Fixed + +- Fixed the README +- Clean up some whitespace formatting on deployments +- Updated the labels used for Troubleshoot secrets to match the new naming convention from v0.66.0 + +### [0.13.7] + +#### Added + +- Remove unused app.serviceAccount +- Setup app.serviceAccountName to configure which serviceAccount an app uses + +### [0.13.5] + +#### Added + +- Adding support for native Kubernetes syntax for container environment variables. Supported formats are now: + - string in values.yaml example: + foo: bar + - map in values.yaml with value example: + - name: foo + value: bar + - map in values.yaml with valueFrom example: + - name: MYSQL_ROOT_PASSWORD # Renders & installs statefulset with said environment variable. + valueFrom: + secretKeyRef: + name: mysql-auth + key: MYSQL_ROOT_PASSWORD + +### [0.13.4] + +#### Added + +- Make RBAC for preflights optional + +### [0.13.3] + +#### Fixed + +- Fixed issue where whitespace was being chomped and causing formatting issue with imagePullSecrets + +### [0.13.2] + +#### Added + +- Add support for preflights specs + +### [0.13.1] + +#### Changed + +- Rename `troubleshoot.support-bundle` to `troubleshoot.support-bundles` + +### [0.13.0] + +#### Added + +- Add support for support bundle specs +- Added capability to override service name for ingress hosts (shortcut story - 71019) + +### [0.12.2] + +- Tidied up extra whitespace for pod and conatiner templates + +### [0.12.1] + +#### Fixed + +- Fixed an issue when specifying multiple containers in a single app caused the chart to fail to render + +### [0.12.0] + +#### Added + +- Added support for RBAC objects + +### [0.11.1] + +#### Fixed + +- Fixed an issue in YAML formatting that was causing `imagePullSecrets` not to render properly in Pod spec +- Fixed an issue with the logic to automatically set Readiness and Liveness probes if ports.containerPort is defined + +### [0.11.0] + +#### Changed + +- Apps using ConfigMaps and Secrets as volumes or env vars will now have their pods automatically re-deployed whenever the data in the configmap or secret changes +- **NOTE**: This only applies to `volumes` and `envFrom`. This feature has not yet been implementd for `env` + +### [0.10.0] + +#### Changed + +- The `replicated-library.names.fullname` template will now trim a leading or trailing hyphen to prevent invalid names when the prefix is empty + +#### Fixed + +- Init containers now work as expected and follow the same format as containers + +### [0.9.0] + +#### Changed + +- Adding Global "Context" dictionaries for values and names with unique subkeys per object type to prevent collisions +- Removing class directory and collapsing all templates into a single directory +- Altered helm-docs to generate documentation from values-example.yaml file. + +### [0.8.0] + +#### Changed + +- Fixed volumeClaimTemplate loop in lib/_statefulset.tpl so metadata.name is rendered correctly. +- Added daemonset templates + +### [0.7.1] +#### Changed + +- Fix fullNameOverride to work with a null input rather than just an empty string. +- Remove configmap name override, fixes label errors when configmaps are included. + +### [0.7.0] +#### Changed + +- BREAKING: The `appName` key for services is now an optional list instead of a string. Charts using the previous implementation will need to convert the string into a single entry list which will work as before. +- Services `selector` now overrides selectors set by `appName`. +- If no `appName` or `selector` is defined, we try and match on the service name itself + +### [0.6.1] +#### Changed + +- Fixed automatic prefix on volumes + +### [0.6.0] +#### Added + +- Added Statefulsets template +- Added a prefix function + +### [0.5.3] +#### Added + +- Automatically add prefix to Statefulset volumes if it's a volume defined and enabled in the chart + +### [0.5.2] +#### Added + +- added capability to set type of secret. + +### [0.5.1] +#### Changed + +- fix spelling error in pod annotations +- fix label selector using chart name instead of app name + +### [0.5.0] +#### Changed + +- Add a unique prefix with global overrides to prevent multiple installs from conflicting. +- Update readme for Advanced Templating clarification + +### [0.4.0] +#### Changed + +- Livesness and Readiness probes are automatically generated if a container has ports defined +- All probe definitions moved to conatiner rather than "probes" sub-key. + +### [0.3.0] +#### Changed + +- Setting best practice defaults for imagePullPolicy, updateStrategy, and probes. +- Updated README to use .Chart.Version instead of hardcoding the chart version + +#### Fixed +- Container image tags which were not strings failing to be templated correctly + +[0.2.0]: #15 +[0.1.1]: #9 + +## Support + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0) diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README.md.gotmpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README.md.gotmpl new file mode 100644 index 00000000..624e8073 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README.md.gotmpl @@ -0,0 +1,83 @@ +{{- define "custom.repository.organization" -}} +replicated-library +{{- end -}} + +{{- define "custom.repository.url" -}} +https://github.com/replicatedhq/replicated-library-chart +{{- end -}} + +{{- define "custom.helm.url" -}} +https://github.com/replicatedhq/replicated-library-chart +{{- end -}} + +{{- define "custom.helm.path" -}} +{{ template "custom.repository.organization" . }}/{{ template "chart.name" . }} +{{- end -}} + +{{- define "custom.notes" -}} +{{- end -}} + +{{- define "custom.requirements" -}} +## Requirements + +{{ template "chart.kubeVersionLine" . }} +{{- end -}} + +{{- define "custom.releasing" -}} +## Releasing + +Ensure the version number is set in `Chart.yaml` for the version you want to release. + +Add your changes to the file `README_CHANGELOG.md.gotmpl`. The format for using this file is documented in the file itself. + +You need to have [Helm Docs](https://github.com/norwoodj/helm-docs) installed. Then run the following command to update the README and README_CHANGELOG files. + +``` +helm-docs -t README.md.gotmpl -t README_CHANGELOG.md.gotmpl -t README_CONFIG.md.gotmpl +``` + +Check in the updated files as part of your PR. + +{{- end -}} + +{{- define "custom.install" -}} +## Installing the Chart + +This is a [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm). + +**WARNING: THIS CHART IS NOT MEANT TO BE INSTALLED DIRECTLY** +{{- end -}} + +{{- define "custom.support" -}} +## Support + +{{- end -}} + +{{ template "chart.header" . }} + +{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }} + +{{ template "chart.description" . }} + +{{ template "custom.notes" . }} + +{{ template "chart.sourcesSection" . }} + +{{ template "custom.requirements" . }} + +{{ template "custom.releasing" . }} + +{{ template "custom.install" . }} + +{{ template "custom.usage" . }} + +{{ template "custom.features" . }} + +{{ template "custom.advancedTemplating" . }} + +{{ template "custom.changelog" . }} + +{{ template "custom.support" . }} + +{{ template "helm-docs.versionFooter" . }} +{{ "" }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README_CHANGELOG.md.gotmpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README_CHANGELOG.md.gotmpl new file mode 100644 index 00000000..df4182c2 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README_CHANGELOG.md.gotmpl @@ -0,0 +1,216 @@ +{{- define "custom.changelog.header" -}} +## Changelog +{{- end -}} + +{{- define "custom.changelog" -}} +{{ template "custom.changelog.header" . }} + +All notable changes to this library Helm chart will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +### [Unreleased] + +### [0.13.10] + +#### Fixed + +- 121 - Fixed issue causing Readiness and Liveness probes from being rendering correctly for apps with multiple containers + +### [0.13.9] + +#### Fixed + +- 110 - Fix examples for existingClaim and implement it in containers +- 109 - Trim "-" from serviceName +- 91 - cleaned up white spaces in Statefulset spec +- fixes serviceName not being set on Statefulsets + +#### Added + +Adds prefixes to configmaps in volumes like persistentVolumes +Use existingClaim in pods when set on persistence + +### [0.13.8] + +#### Fixed + +- Fixed the README +- Clean up some whitespace formatting on deployments +- Updated the labels used for Troubleshoot secrets to match the new naming convention from v0.66.0 + +### [0.13.7] + +#### Added + +- Remove unused app.serviceAccount +- Setup app.serviceAccountName to configure which serviceAccount an app uses + +### [0.13.5] + +#### Added + +- Adding support for native Kubernetes syntax for container environment variables. Supported formats are now: + - string in values.yaml example: + foo: bar + - map in values.yaml with value example: + - name: foo + value: bar + - map in values.yaml with valueFrom example: + - name: MYSQL_ROOT_PASSWORD # Renders & installs statefulset with said environment variable. + valueFrom: + secretKeyRef: + name: mysql-auth + key: MYSQL_ROOT_PASSWORD + +### [0.13.4] + +#### Added + +- Make RBAC for preflights optional + +### [0.13.3] + +#### Fixed + +- Fixed issue where whitespace was being chomped and causing formatting issue with imagePullSecrets + +### [0.13.2] + +#### Added + +- Add support for preflights specs + +### [0.13.1] + +#### Changed + +- Rename `troubleshoot.support-bundle` to `troubleshoot.support-bundles` + +### [0.13.0] + +#### Added + +- Add support for support bundle specs +- Added capability to override service name for ingress hosts (shortcut story - 71019) + +### [0.12.2] + +- Tidied up extra whitespace for pod and conatiner templates + +### [0.12.1] + +#### Fixed + +- Fixed an issue when specifying multiple containers in a single app caused the chart to fail to render + +### [0.12.0] + +#### Added + +- Added support for RBAC objects + +### [0.11.1] + +#### Fixed + +- Fixed an issue in YAML formatting that was causing `imagePullSecrets` not to render properly in Pod spec +- Fixed an issue with the logic to automatically set Readiness and Liveness probes if ports.containerPort is defined + +### [0.11.0] + +#### Changed + +- Apps using ConfigMaps and Secrets as volumes or env vars will now have their pods automatically re-deployed whenever the data in the configmap or secret changes +- **NOTE**: This only applies to `volumes` and `envFrom`. This feature has not yet been implementd for `env` + +### [0.10.0] + +#### Changed + +- The `replicated-library.names.fullname` template will now trim a leading or trailing hyphen to prevent invalid names when the prefix is empty + +#### Fixed + +- Init containers now work as expected and follow the same format as containers + +### [0.9.0] + +#### Changed + +- Adding Global "Context" dictionaries for values and names with unique subkeys per object type to prevent collisions +- Removing class directory and collapsing all templates into a single directory +- Altered helm-docs to generate documentation from values-example.yaml file. + +### [0.8.0] + +#### Changed + +- Fixed volumeClaimTemplate loop in lib/_statefulset.tpl so metadata.name is rendered correctly. +- Added daemonset templates + +### [0.7.1] +#### Changed + +- Fix fullNameOverride to work with a null input rather than just an empty string. +- Remove configmap name override, fixes label errors when configmaps are included. + +### [0.7.0] +#### Changed + +- BREAKING: The `appName` key for services is now an optional list instead of a string. Charts using the previous implementation will need to convert the string into a single entry list which will work as before. +- Services `selector` now overrides selectors set by `appName`. +- If no `appName` or `selector` is defined, we try and match on the service name itself + +### [0.6.1] +#### Changed + +- Fixed automatic prefix on volumes + +### [0.6.0] +#### Added + +- Added Statefulsets template +- Added a prefix function + +### [0.5.3] +#### Added + +- Automatically add prefix to Statefulset volumes if it's a volume defined and enabled in the chart + +### [0.5.2] +#### Added + +- added capability to set type of secret. + +### [0.5.1] +#### Changed + +- fix spelling error in pod annotations +- fix label selector using chart name instead of app name + +### [0.5.0] +#### Changed + +- Add a unique prefix with global overrides to prevent multiple installs from conflicting. +- Update readme for Advanced Templating clarification + +### [0.4.0] +#### Changed + +- Livesness and Readiness probes are automatically generated if a container has ports defined +- All probe definitions moved to conatiner rather than "probes" sub-key. + +### [0.3.0] +#### Changed + +- Setting best practice defaults for imagePullPolicy, updateStrategy, and probes. +- Updated README to use .Chart.Version instead of hardcoding the chart version + +#### Fixed +- Container image tags which were not strings failing to be templated correctly + +[0.2.0]: #15 +[0.1.1]: #9 +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README_CONFIG.md.gotmpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README_CONFIG.md.gotmpl new file mode 100644 index 00000000..0be3e11c --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README_CONFIG.md.gotmpl @@ -0,0 +1,46 @@ +{{- define "custom.notes" -}} +This is a library chart maintained by Replicated in order to keep the creation of helm charts dry when deploying third party commercial software +{{- end -}} + +{{- define "custom.custom.configuration.header" -}} +## Custom configuration +{{- end -}} + +{{- define "custom.custom.configuration" -}} +{{ template "custom.custom.configuration.header" . }} + +N/A +{{- end -}} + +{{- define "custom.usage" }} +## Using this library + +Include the chart as a dependency in your `Chart.yaml` + +```yaml +# Chart.yaml +dependencies: +- name: replicated-library + repository: https://replicatedhq.github.io/helm-charts + version: {{ template "chart.version" . }} +``` + +You can see a full example of this library chart in use [here](https://github.com/replicatedhq/replicated-starter-helm) +To see an example of the available values see [values-example.yaml](values-example.yaml) + +{{- end -}} + +{{- define "custom.features" -}} +## Features + +Below highlights some of the useful features available in this library + +* [Dynamic App Reload on Configuration Changes](FEATURES.md#dynamic-app-reload-on-configuration-changes) +* [App, Service, and Ingress Association](FEATURES.md#app-service-and-ingress-association) +{{- end -}} + +{{- define "custom.advancedTemplating" -}} +## Advanced Templating + +[Examples of how you can advanced templating and build on top of this library chart](ADVANCED_TEMPLATING.md) +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/_all.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/_all.tpl new file mode 100644 index 00000000..8c000d05 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/_all.tpl @@ -0,0 +1,32 @@ +{{/* +Main entrypoint for the replicated-library chart. It will render all underlying templates based on the provided values. +*/}} +{{- define "replicated-library.all" -}} + {{- /* Merge the local chart values and the replicated-library chart defaults */ -}} + {{ include "replicated-library.values.setup" . }} + + {{- /* Create global context dicts */ -}} + {{- $_ := set $ "ContextNames" dict -}} + {{- $_ := set $ "ContextValues" dict -}} + + {{- /* Build the templates */ -}} + {{ include "replicated-library.apps" . | nindent 0 }} + {{ include "replicated-library.services" . | nindent 0 }} + {{ include "replicated-library.ingresses" . | nindent 0 }} + {{ include "replicated-library.configmaps" . | nindent 0 }} + {{ include "replicated-library.secrets" . | nindent 0 }} + {{ include "replicated-library.pvc" . | nindent 0 }} + {{ include "replicated-library.serviceAccounts" . | nindent 0 }} + {{ include "replicated-library.roles" . | nindent 0 }} + {{ include "replicated-library.roleBindings" . | nindent 0 }} + {{ include "replicated-library.troubleshoot" . | nindent 0 }} + + {{/* Uncomment when all fails are removed + {{- if len $.ContextNames -}} + {{- fail "$.ContextNames is not empty" -}} + {{- end -}} + {{- if len $.ContextValues -}} + {{- fail "$.ContextValues is not empty" -}} + {{- end -}} + */}} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzer.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzer.tpl new file mode 100644 index 00000000..982f74f3 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzer.tpl @@ -0,0 +1,17 @@ +{{/* +Renders the Support Bundle Analyzers objects required by the chart. +*/}} +{{- define "replicated-library.troubleshoot.analyzer" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "analyzer") -}} + {{- $values = .ContextValues.analyzer -}} + {{- else -}} + {{- fail "_analyzer.tpl requires the 'analyzer' ContextValues to be set" -}} + {{- end -}} + {{- $_ := set $.ContextValues "names" (dict "context" "analyzer") -}} + + + {{ include "replicated-library.troubleshoot.analyzer.general" $ }} + + +{{- end }} \ No newline at end of file diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzer_templates.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzer_templates.tpl new file mode 100644 index 00000000..a2c5c5cc --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzer_templates.tpl @@ -0,0 +1,8 @@ +{{- define "replicated-library.troubleshoot.analyzer.general" -}} +- {{ .ContextNames.analyzer }}: + {{- if .ContextValues.analyzer }} + {{- .ContextValues.analyzer | toYaml | nindent 4}} + {{- else -}} + {{ "{}" | indent 1 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzers.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzers.tpl new file mode 100644 index 00000000..501a6559 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzers.tpl @@ -0,0 +1,16 @@ +{{/* +Renders the Support Bundle Analyzers objects required by the chart. +*/}} +{{- define "replicated-library.troubleshoot.analyzers" -}} + {{- range $analyzer := .ContextValues.troubleshoot.analyzers -}} + {{- range $name, $analyzerValues := $analyzer -}} + {{- $_ := set $.ContextNames "analyzer" $name -}} + {{- $_ := set $.ContextValues "analyzer" $analyzerValues -}} + + {{- include "replicated-library.troubleshoot.analyzer" $ | nindent 2 }} + + {{- $_ := unset $.ContextNames "analyzer" -}} + {{- $_ := unset $.ContextValues "analyzer" -}} + {{- end -}} + {{- end -}} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_annotations.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_annotations.tpl new file mode 100644 index 00000000..068055d6 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_annotations.tpl @@ -0,0 +1,10 @@ +{{/* replicated-library annotations shared across objects */}} +{{- define "replicated-library.annotations" -}} + {{- with .Values.global.annotations }} + {{- range $k, $v := . }} + {{- $name := $k }} + {{- $value := tpl $v $ }} +{{ $name }}: {{ quote $value }} + {{- end }} + {{- end }} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_apps.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_apps.tpl new file mode 100644 index 00000000..4476db83 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_apps.tpl @@ -0,0 +1,26 @@ +{{/* +Renders the app objects into Deployments, DaemonSets, and StatefulSets as required by the chart. +*/}} +{{- define "replicated-library.apps" -}} + {{- range $name, $appValues := .Values.apps }} + {{- if $appValues.enabled -}} + {{- $_ := set $.ContextNames "app" $name -}} + {{- $_ := set $.ContextValues "app" $appValues -}} + {{- $_ := set $.ContextValues "names" (dict "context" "app") -}} + + {{- if eq $appValues.type "deployment" }} + {{- include "replicated-library.deployment" $ | nindent 0 }} + {{ else if eq $appValues.type "daemonset" }} + {{- include "replicated-library.daemonset" $ | nindent 0 }} + {{ else if eq $appValues.type "statefulset" }} + {{- include "replicated-library.statefulset" $ | nindent 0 }} + {{ else }} + {{- fail (printf "Type of (%s) for app - (%s) is not valid" $appValues.type $name) }} + {{ end -}} + + {{- $_ := unset $.ContextNames "app" -}} + {{- $_ := unset $.ContextValues "app" -}} + {{- $_ := unset $.ContextValues "names" -}} + {{- end }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_capabilities.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_capabilities.tpl new file mode 100644 index 00000000..6d98986a --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_capabilities.tpl @@ -0,0 +1,19 @@ +{{/* Allow KubeVersion to be overridden. */}} +{{- define "replicated-library.capabilities.ingress.kubeVersion" -}} + {{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Ingress objects */}} +{{- define "replicated-library.capabilities.ingress.apiVersion" -}} + {{- print "networking.k8s.io/v1" -}} + {{- if semverCompare "<1.19" (include "replicated-library.capabilities.ingress.kubeVersion" .) -}} + {{- print "beta1" -}} + {{- end -}} +{{- end -}} + +{{/* Check Ingress stability */}} +{{- define "replicated-library.capabilities.ingress.isStable" -}} + {{- if eq (include "replicated-library.capabilities.ingress.apiVersion" .) "networking.k8s.io/v1" -}} + {{- true -}} + {{- end -}} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_collector.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_collector.tpl new file mode 100644 index 00000000..48444d45 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_collector.tpl @@ -0,0 +1,31 @@ +{{/* +Renders the Support Bundle Collectors objects required by the chart. +*/}} +{{- define "replicated-library.troubleshoot.collector" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "collector") -}} + {{- $values = .ContextValues.collector -}} + {{- else -}} + {{- fail "_collector.tpl requires the 'collector' ContextValues to be set" -}} + {{- end -}} + {{- $_ := set $.ContextValues "names" (dict "context" "collector") -}} + + {{- if eq .ContextNames.collector "logs" -}} + {{ include "replicated-library.troubleshoot.collector.logs" $ }} + {{- else if eq .ContextNames.collector "exec" -}} + {{ include "replicated-library.troubleshoot.collector.exec" $ }} + {{- else if eq .ContextNames.collector "secret" -}} + {{ include "replicated-library.troubleshoot.collector.secret" $ }} + {{- else if eq .ContextNames.collector "data" -}} + {{ include "replicated-library.troubleshoot.collector.data" $ }} + {{- else if eq .ContextNames.collector "imagePullSecret" -}} + {{ include "replicated-library.troubleshoot.collector.imagePullSecret" $ }} + {{- else if eq .ContextNames.collector "configMap" -}} + {{ include "replicated-library.troubleshoot.collector.configMap" $ }} + {{- else if eq .ContextNames.collector "collectd" -}} + {{ include "replicated-library.troubleshoot.collector.collectd" $ }} + {{- else -}} + {{ include "replicated-library.troubleshoot.collector.general" $ }} + {{- end }} + +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_collectors.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_collectors.tpl new file mode 100644 index 00000000..1af6efa3 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_collectors.tpl @@ -0,0 +1,16 @@ +{{/* +Renders the Support Bundle Collectors objects required by the chart. +*/}} +{{- define "replicated-library.troubleshoot.collectors" -}} + {{- range $collector := .ContextValues.troubleshoot.collectors -}} + {{- range $name, $collectorValues := $collector -}} + {{- $_ := set $.ContextNames "collector" $name -}} + {{- $_ := set $.ContextValues "collector" $collectorValues -}} + + {{- include "replicated-library.troubleshoot.collector" $ | nindent 2 }} + + {{- $_ := unset $.ContextNames "collector" -}} + {{- $_ := unset $.ContextValues "collector" -}} + {{- end -}} + {{- end -}} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_configmap.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_configmap.tpl new file mode 100644 index 00000000..14f0bac0 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_configmap.tpl @@ -0,0 +1,28 @@ +{{/* +This template serves as a blueprint for all configMap objects that are created +within the replicated-library library. +*/}} +{{- define "replicated-library.configmap" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "configmap") -}} + {{- $values = .ContextValues.configmap -}} + {{- else -}} + {{- fail "_configmap.tpl requires the 'configmap' ContextValues to be set" -}} + {{- end -}} + {{- $_ := set $.ContextValues "names" (dict "context" "configmap") -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "replicated-library.names.fullname" . }} + {{- with (merge ($values.labels | default dict) (include "replicated-library.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} + {{- end }} + {{- with (merge ($values.annotations | default dict) (include "replicated-library.annotations" $ | fromYaml)) }} + annotations: {{- toYaml . | nindent 4 }} + {{- end }} +data: +{{- with $values.data }} + {{- tpl (toYaml .) $ | nindent 2 }} +{{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_configmaps.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_configmaps.tpl new file mode 100644 index 00000000..0a538453 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_configmaps.tpl @@ -0,0 +1,16 @@ +{{/* +Renders the configmap objects required by the chart. +*/}} +{{- define "replicated-library.configmaps" -}} + {{- /* Generate named configmaps as required */ -}} + {{- range $name, $configmapValues := .Values.configmaps }} + {{- if $configmapValues.enabled -}} + {{- $_ := set $.ContextNames "configmap" $name -}} + {{- $_ := set $.ContextValues "configmap" $configmapValues -}} + + {{- include "replicated-library.configmap" $ | nindent 0 }} + {{- $_ := unset $.ContextNames "configmap" -}} + {{- $_ := unset $.ContextValues "configmap" -}} + {{- end }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_container.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_container.tpl new file mode 100644 index 00000000..0954d7b9 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_container.tpl @@ -0,0 +1,105 @@ +{{- /* The main container included in the main */ -}} +{{- define "replicated-library.container" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "app") -}} + {{- $values = .ContextValues.app -}} + {{- else -}} + {{- fail "_container.tpl requires the 'app' ContextValues to be set" -}} + {{- end -}} + {{- $_ := set $.ContextValues "names" (dict "context" "app") }} +{{- range $containerName, $containerValues := $values.containers }} +- name: {{ printf "%s" $containerName | trunc 63 | trimAll "-" }} + image: {{ printf "%s:%s" $containerValues.image.repository (default $.Chart.AppVersion ($containerValues.image.tag | toString)) | quote }} + imagePullPolicy: {{ default $.Values.defaults.image.pullPolicy $containerValues.image.pullPolicy }} + {{- with $containerValues.command }} + command: + {{- if kindIs "string" . }} + - {{ . }} + {{- else }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} + {{- with $containerValues.args }} + args: + {{- if kindIs "string" . }} + - {{ . }} + {{- else }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} + {{- with $containerValues.securityContext }} + securityContext: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with $containerValues.lifecycle }} + lifecycle: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- if $containerValues.termination }} + {{- with $containerValues.termination.messagePath }} + terminationMessagePath: {{ . }} + {{- end }} + {{- with $containerValues.termination.messagePolicy }} + terminationMessagePolicy: {{ . }} + {{- end }} +{{- end }} + {{- with $containerValues.env }} + env: + {{- get (fromYaml (include "replicated-library.env_vars" .)) "env" | toYaml | nindent 4 }} + {{- end }} + {{- if or $containerValues.envFrom $containerValues.secret }} + envFrom: + {{- with $containerValues.envFrom }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} + {{- with $containerValues.ports }} + ports: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with $containerValues.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with $containerValues.resources }} + resources: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- if $containerValues.livenessProbe }} + {{- with (mergeOverwrite (mustDeepCopy $.Values.defaults.probes.livenessProbe) $containerValues.livenessProbe) }} + livenessProbe: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- else if and (hasKey $containerValues "ports") $containerValues.ports }} + {{- $firstPort := first $containerValues.ports }} + {{- if and (hasKey $firstPort "containerPort") $firstPort.containerPort }} + {{- $_ := set $.Values.defaults.probes.livenessProbe "tcpSocket" (dict "port" (first $containerValues.ports).containerPort) }} + {{- with $.Values.defaults.probes.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} + {{- end }} + {{- if $containerValues.readinessProbe }} + {{- with (mergeOverwrite (mustDeepCopy $.Values.defaults.probes.readinessProbe) $containerValues.readinessProbe) }} + readinessProbe: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- else if and (hasKey $containerValues "ports") $containerValues.ports }} + {{- $firstPort := first $containerValues.ports }} + {{- if and (hasKey $firstPort "containerPort") $firstPort.containerPort }} + {{- $_ := set $.Values.defaults.probes.readinessProbe "tcpSocket" (dict "port" (first $containerValues.ports).containerPort) }} + {{- with $.Values.defaults.probes.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} + {{- end }} + {{- if $containerValues.startupProbe }} + {{- with (mergeOverwrite (mustDeepCopy $.Values.defaults.probes.startupProbe) $containerValues.startupProbe) }} + startupProbe: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} +{{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_daemonset.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_daemonset.tpl new file mode 100644 index 00000000..6fde5ad2 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_daemonset.tpl @@ -0,0 +1,58 @@ +{{/* +This template serves as the blueprint for the DaemonSet objects that are created +within the replicated-library library. +*/}} +{{- define "replicated-library.daemonset" }} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "app") -}} + {{- $values = .ContextValues.app -}} + {{- else -}} + {{- fail "_daemonset.tpl requires the 'app' ContextValues to be set" -}} + {{- end -}} +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ include "replicated-library.names.fullname" . }} + {{- with (merge ($values.labels | default dict) (include "replicated-library.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} + {{- end }} + {{- with (merge ($values.annotations | default dict) (include "replicated-library.annotations" $ | fromYaml)) }} + annotations: {{- toYaml . | nindent 4 }} + {{- end }} +spec: + revisionHistoryLimit: {{ $values.revisionHistoryLimit }} + {{- $strategy := default $.Values.defaults.strategy $values.strategy }} + {{- if and (ne $strategy "OnDelete") (ne $strategy "RollingUpdate") }} + {{- fail (printf "Not a valid strategy type for DaemonSet (%s)" $strategy) }} + {{- end }} + updateStrategy: + type: {{ $strategy }} + {{- with $values.rollingUpdate }} + {{- if and (eq $strategy "RollingUpdate") (or .surge .unavailable) }} + rollingUpdate: + {{- with .unavailable }} + maxUnavailable: {{ . }} + {{- end }} + {{- with .surge }} + maxSurge: {{ . }} + {{- end }} + {{- end }} + {{- end }} + selector: + matchLabels: + {{- include "replicated-library.labels.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with include ("replicated-library.podAnnotations") . }} + annotations: + {{- . | nindent 8 }} + {{- end }} + labels: + {{- include "replicated-library.labels.selectorLabels" . | nindent 8 }} + {{- with $values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- include "replicated-library.pod" . | nindent 6 }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_deployment.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_deployment.tpl new file mode 100644 index 00000000..42b8ab1b --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_deployment.tpl @@ -0,0 +1,63 @@ +{{/* +This template serves as the blueprint for the Deployment objects that are created +within the replicated-library library. +*/}} +{{- define "replicated-library.deployment" }} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "app") -}} + {{- $values = .ContextValues.app -}} + {{- else -}} + {{- fail "_deployment.tpl requires the 'app' ContextValues to be set" -}} + {{- end -}} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "replicated-library.names.fullname" . }} + {{- with (merge ($values.labels | default dict) (include "replicated-library.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} + {{- end }} + {{- with (merge ($values.annotations | default dict) (include "replicated-library.annotations" $ | fromYaml)) }} + annotations: {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if $values.revisionHistoryLimit }} + revisionHistoryLimit: {{ $values.revisionHistoryLimit }} + {{- end }} + {{- if $values.replicas }} + replicas: {{ $values.replicas }} + {{- end }} + {{- $strategy := default $.Values.defaults.strategy $values.strategy }} + {{- if and (ne $strategy "Recreate") (ne $strategy "RollingUpdate") }} + {{- fail (printf "Not a valid strategy type for Deployment (%s)" $strategy) }} + {{- end }} + strategy: + type: {{ $strategy }} + {{- with $values.rollingUpdate }} + {{- if and (eq $strategy "RollingUpdate") (or .surge .unavailable) }} + rollingUpdate: + {{- with .unavailable }} + maxUnavailable: {{ . }} + {{- end }} + {{- with .surge }} + maxSurge: {{ . }} + {{- end }} + {{- end }} + {{- end }} + selector: + matchLabels: + {{- include "replicated-library.labels.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with include ("replicated-library.podAnnotations") . }} + annotations: + {{- . | nindent 8 }} + {{- end }} + labels: + {{- include "replicated-library.labels.selectorLabels" . | nindent 8 }} + {{- with $values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- include "replicated-library.pod" . | trim | nindent 6 }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_env_vars.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_env_vars.tpl new file mode 100644 index 00000000..633dfbb2 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_env_vars.tpl @@ -0,0 +1,44 @@ +{{/* +Environment variables used by containers. +*/}} +{{- define "replicated-library.env_vars" -}} + {{- $values := . -}} + + {{- with $values -}} + {{- $result := list -}} + {{- range $k, $v := . -}} + {{- $name := $k -}} + {{- $value := $v -}} + {{- if kindIs "int" $name -}} + {{- $name = required "environment variables as a list of maps require a name field" $value.name -}} + {{- end -}} + {{- if kindIs "string" $value -}} + # string in values.yaml example: foo: bar + {{- $result = append $result (dict "name" $name "value" $value) -}} + {{- else if or (kindIs "float64" $value) (kindIs "bool" $value) -}} + {{- $result = append $result (dict "name" $name "value" ($value | toString)) -}} + {{- else if kindIs "map" $value -}} + # map in values.yaml with value example: + # - name: foo + # value: bar + {{- if hasKey $value "value" -}} + {{- $envValue := $value.value | toString -}} + {{- $result = append $result (dict "name" $name "value" $envValue) -}} + {{- else if hasKey $value "valueFrom" -}} + # map in values.yaml with valueFrom example: + # - name: MYSQL_ROOT_PASSWORD # Renders & installs statefulset with said environment variable. + # valueFrom: + # secretKeyRef: + # name: mysql-auth + # key: MYSQL_ROOT_PASSWORD + {{- $result = append $result (dict "name" $name "valueFrom" $value.valueFrom) -}} + {{- else -}} + {{- $result = append $result (dict "name" $name "valueFrom" $value) -}} + {{- end -}} + {{- else -}} + {{- $result = append $result (dict "name" $name "value" $value) -}} + {{- end -}} + {{- end -}} + {{- toYaml (dict "env" $result) | nindent 0 -}} + {{- end -}} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_ingress.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_ingress.tpl new file mode 100644 index 00000000..cbb40ed3 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_ingress.tpl @@ -0,0 +1,90 @@ +{{/* +This template serves as a blueprint for all Ingress objects that are created +within the replicated-library library. +*/}} +{{- define "replicated-library.classes.ingress" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "ingress") -}} + {{- $values = .ContextValues.ingress -}} + {{- else -}} + {{- fail "_ingress.tpl requires the 'ingress' ContextValues to be set" -}} + {{- end -}} + {{- $_ := set $.ContextValues "names" (dict "context" "ingress") -}} + + {{- $isStable := include "replicated-library.capabilities.ingress.isStable" . }} + + {{- $serviceName := $values.serviceName }} +--- +apiVersion: {{ include "replicated-library.capabilities.ingress.apiVersion" . }} +kind: Ingress +metadata: + name: {{ include "replicated-library.names.fullname" . }} + {{- with (merge ($values.labels | default dict) (include "replicated-library.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} + {{- end }} + {{- with (merge ($values.annotations | default dict) (include "replicated-library.annotations" $ | fromYaml)) }} + annotations: {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and $isStable $values.ingressClassName }} + ingressClassName: {{ $values.ingressClassName }} + {{- end }} + {{- if $values.tls }} + tls: + {{- range $values.tls }} + - hosts: + {{- range .hosts }} + - {{ tpl . $ | quote }} + {{- end }} + {{- if .secretName }} + secretName: {{ tpl .secretName $ | quote}} + {{- end }} + {{- end }} + {{- end }} + rules: + {{- range $values.hosts }} + - host: {{ tpl .host $ | quote }} + http: + paths: + {{- range .paths }} + {{- $service := "" -}} + {{- $port := 80 -}} + {{- if .service -}} + {{- if .service.name }} + {{- $service = .service.name }} + {{- else if $values.serviceName }} + {{- $service = $values.serviceName }} + {{- else }} + {{- range $key, $val := $.Values.services }} + {{- if and $val.enabled (eq $key $.ContextNames.ingress) }} + {{- $service = $.ContextNames.ingress }} + {{- end }} + {{- end }} + {{- end }} + {{- range $key, $val := $.Values.services }} + {{- if and $val.enabled (eq $key $service) -}} + {{- $service = printf "%s-%s" (include "replicated-library.names.prefix" $) $service | trunc 63 | trimAll "-" -}} + {{- end }} + {{- end }} + {{- if not $service -}} + {{- fail "a service name is required for the ingress host" }} + {{- end }} + {{- $port = default $port .service.port -}} + {{- end }} + - path: {{ tpl .path $ | quote }} + {{- if $isStable }} + pathType: {{ default "Prefix" .pathType }} + {{- end }} + backend: + {{- if $isStable }} + service: + name: {{ $service }} + port: + number: {{ $port }} + {{- else }} + serviceName: {{ $service }} + servicePort: {{ $port }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_ingresses.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_ingresses.tpl new file mode 100644 index 00000000..5b2d188a --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_ingresses.tpl @@ -0,0 +1,34 @@ +{{/* +Renders the Service objects required by the chart. +*/}} +{{- define "replicated-library.ingresses" -}} + {{- /* Generate named ingresses as required */ -}} + {{- range $name, $ingressValues := .Values.ingresses }} + {{- if $ingressValues.enabled -}} + {{- $_ := set $.ContextNames "ingress" $name -}} + {{- $_ := set $.ContextValues "ingress" $ingressValues -}} + + {{- if $ingressValues.serviceName }} + {{- $matchingAppFound := false -}} + + {{- range $serviceName, $serviceValues := $.Values.services }} + {{- if and $serviceValues.enabled (eq $serviceName $ingressValues.serviceName) (ne $matchingAppFound true) -}} + {{- $matchingAppFound = true -}} + {{- include "replicated-library.classes.ingress" $ | nindent 0 }} + {{- end }} + {{- end }} + + {{- if (ne $matchingAppFound true) -}} + {{- fail (printf "Matching service for ServiceName (%s) was not found" $ingressValues.serviceName) }} + {{- end }} + + {{- else }} + {{- include "replicated-library.classes.ingress" $ | nindent 0 }} + {{- end }} + + {{- $_ := unset $.ContextNames "ingress" -}} + {{- $_ := unset $.ContextValues "ingress" -}} + + {{- end }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_init_container.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_init_container.tpl new file mode 100644 index 00000000..e0be592b --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_init_container.tpl @@ -0,0 +1,69 @@ +{{- /* The main container included in the main */ -}} +{{- define "replicated-library.initContainer" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "app") -}} + {{- $values = .ContextValues.app -}} + {{- else -}} + {{- fail "_init_container.tpl requires the 'app' ContextValues to be set" -}} + {{- end -}} + {{- $_ := set $.ContextValues "names" (dict "context" "app") -}} +{{- range $containerName, $containerValues := $values.initContainers }} +- name: {{ printf "%s" $containerName | trunc 63 | trimAll "-" }} + image: {{ printf "%s:%s" $containerValues.image.repository (default $.Chart.AppVersion ($containerValues.image.tag | toString)) | quote }} + imagePullPolicy: {{ default $.Values.defaults.image.pullPolicy $containerValues.image.pullPolicy }} + {{- with $containerValues.command }} + command: + {{- if kindIs "string" . }} + - {{ . }} + {{- else }} + {{ toYaml . | nindent 4 }} + {{- end }} + {{- end }} + {{- with $containerValues.args }} + args: + {{- if kindIs "string" . }} + - {{ . }} + {{- else }} + {{ toYaml . | nindent 4 }} + {{- end }} + {{- end }} + {{- with $containerValues.securityContext }} + securityContext: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with $containerValues.lifecycle }} + lifecycle: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- if $containerValues.termination }} + {{- with $containerValues.termination.messagePath }} + terminationMessagePath: {{ . }} + {{- end }} + {{- with $containerValues.termination.messagePolicy }} + terminationMessagePolicy: {{ . }} + {{- end }} +{{- end }} + {{- with $containerValues.env }} + env: + {{- get (fromYaml (include "replicated-library.env_vars" .)) "env" | toYaml | nindent 4 -}} + {{- end }} + {{- if or $containerValues.envFrom $containerValues.secret }} + envFrom: + {{- with $containerValues.envFrom }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} + {{- with $containerValues.ports }} + ports: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with $containerValues.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with $containerValues.resources }} + resources: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_labels.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_labels.tpl new file mode 100644 index 00000000..a513183e --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_labels.tpl @@ -0,0 +1,70 @@ +{{/* replicated-library labels shared across objects */}} +{{- define "replicated-library.labels" -}} +helm.sh/chart: {{ include "replicated-library.names.chart" . }} +app.kubernetes.io/name: {{ include "replicated-library.names.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} + {{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + {{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- with .Values.global.labels }} + {{- range $k, $v := . }} + {{- $name := $k }} + {{- $value := tpl $v $ }} +{{ $name }}: {{ quote $value }} + {{- end }} + {{- end }} +{{- end -}} +{{/* Selector labels shared across objects */}} +{{- define "replicated-library.labels.selectorLabels" -}} +{{- $_ := set $.ContextValues "names" (dict "context" "app") -}} +app.kubernetes.io/name: {{ include "replicated-library.names.appname" . }} +{{- $_ := unset $.ContextValues "names" }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} +{{- define "replicated-library.labels.serviceSelectorLabels" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "service") -}} + {{- $values = .ContextValues.service -}} + {{- else -}} + {{- fail "_labels.tpl requires the 'service' ContextValues to be set" -}} + {{- end -}} + {{- if $values.selector -}} +{{ toYaml $values.selector }} + {{- else -}} + {{- if $values.appName }} + {{- range $values.appName }} + {{- $name := . -}} + {{- $matchingAppFound := false -}} + {{- range $appName, $appValues := $.Values.apps }} + {{- if and $appValues.enabled (eq $appName $name) (ne $matchingAppFound true) -}} + {{- $matchingAppFound = true -}} +{{ printf "app.kubernetes.io/name: %s\n" $appName }} + {{- end -}} + {{- end -}} + {{- if (ne $matchingAppFound true) -}} + {{- fail (printf "Matching app for AppName (%s) was not found" $values.appName) }} + {{- end -}} + {{- end -}} +app.kubernetes.io/instance: {{ $.Release.Name }} + {{- else -}} + {{/* if no appName or selector is set on the service, check if there's an app that matches the service name to use instead */}} + {{- $objectName := "" -}} + {{- if and (hasKey .ContextValues "names") (hasKey .ContextValues.names "context") -}} + {{- $contextKey := .ContextValues.names.context -}} + {{- $objectName = get .ContextNames .ContextValues.names.context -}} + {{- end -}} + {{- $matchingAppFound := false -}} + {{- range $appName, $appValues := $.Values.apps -}} + {{- if and $appValues.enabled (eq $appName $objectName) (ne $matchingAppFound true) -}} + {{- $matchingAppFound = true -}} +app.kubernetes.io/name: {{ $objectName }} +app.kubernetes.io/instance: {{ $.Release.Name }} + {{- end -}} + {{- end -}} + {{- if (ne $matchingAppFound true) -}} + {{- fail (printf "Service (%s) has no selectors or matching apps" $objectName ) }} + {{- end -}} + {{- end }} + {{- end -}} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_names.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_names.tpl new file mode 100644 index 00000000..631fa605 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_names.tpl @@ -0,0 +1,95 @@ +{{/* Expand the name of the chart */}} +{{- define "replicated-library.names.name" -}} + {{- $globalNameOverride := "" -}} + {{- if hasKey .Values "global" -}} + {{- $globalNameOverride = (default $globalNameOverride .Values.global.nameOverride) -}} + {{- end -}} + {{- default .Chart.Name (default "" $globalNameOverride) | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Return the object prefix including user provided overrides. +Prefix will be of the form: ReleaseName-ChartName. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +The global nameOverride will replace the ChartName if provided. +The global fullNameOverride will replace the entire prefix if provided. +The ChartName will not be included if it is contained in the ReleaseName, leaving only the ReleaseName. +*/}} +{{- define "replicated-library.names.prefix" -}} + {{- if and (hasKey .Values "global") ( and (hasKey .Values.global "fullNameOverride") .Values.global.fullNameOverride) -}} + {{- trunc 63 .Values.global.fullNameOverride | trimSuffix "-" -}} + {{- else -}} + {{- $chartName := include "replicated-library.names.name" . -}} + {{- if contains $chartName .Release.Name -}} + {{- trunc 63 .Release.Name | trimSuffix "-" -}} + {{- else -}} + {{- printf "%s-%s" .Release.Name $chartName | trunc 63 | trimSuffix "-" -}} + {{- end -}} + {{- end -}} +{{- end }} + +{{/* +Create a default fully qualified object name. +This function will fail if called outside the scope of an object. +If only the prefix is needed use "replicated-library.names.prefix" instead. +If fullNameOverride is provided on the object it will take precedence over the normal prefix calculation. +*/}} +{{- define "replicated-library.names.fullname" -}} + {{- $objectName := "" -}} + {{- $values := . -}} + {{- if and (hasKey .ContextValues "names") (hasKey .ContextValues.names "context") -}} + {{- $contextKey := .ContextValues.names.context -}} + {{- $objectName = get .ContextNames $contextKey -}} + {{- $values = get .ContextValues $contextKey -}} + {{- end -}} + + {{- if $values.fullNameOverride -}} + {{- trunc 63 $values.fullNameOverride | trimSuffix "-" -}} + {{- else -}} + {{- $prefix := include "replicated-library.names.prefix" . -}} + {{- printf "%s-%s" $prefix $objectName | trunc 63 | trimAll "-" -}} + {{- end -}} +{{- end -}} + +{{/* Create chart name and version as used by the chart label */}} +{{- define "replicated-library.names.chart" -}} + {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* Create the name of the ServiceAccount to use */}} +{{- define "replicated-library.names.serviceAccountName" -}} + {{- $values := . -}} + {{- if and (hasKey .ContextValues "names") (hasKey .ContextValues.names "context") -}} + {{- $values = get .ContextValues .ContextValues.names.context -}} + {{- end -}} + + {{- if $values.serviceAccount -}} + {{- if $values.serviceAccount.create -}} + {{- default (include "replicated-library.names.fullname" .) $values.serviceAccount.name -}} + {{- else -}} + {{- default "default" $values.serviceAccount.name -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{/* Get name of current app */}} +{{- define "replicated-library.names.appname" -}} + {{- $objectName := "" -}} + {{- if and (hasKey .ContextValues "names") (hasKey .ContextValues.names "context") -}} + {{- $contextKey := .ContextValues.names.context -}} + {{- $objectName = get .ContextNames .ContextValues.names.context -}} + {{- end -}} + {{- trunc 63 $objectName | trimSuffix "-" -}} +{{- end -}} + +{{/* Get name of current service */}} +{{- define "replicated-library.names.servicename" -}} + {{- $objectName := "" -}} + {{- if and (hasKey .ContextValues "names") (hasKey .ContextValues.names "context") -}} + {{- $contextKey := .ContextValues.names.context -}} + {{- $objectName = get .ContextNames .ContextValues.names.context -}} + {{- else -}} + {{- fail (print "not found .ContextValues.names.context") }} + {{ end -}} + {{- trunc 63 $objectName | trimSuffix "-" -}} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_notes.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_notes.tpl new file mode 100644 index 00000000..cd675dd0 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_notes.tpl @@ -0,0 +1,3 @@ +{{/* +Default NOTES.txt content. +*/}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pod.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pod.tpl new file mode 100644 index 00000000..51c30462 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pod.tpl @@ -0,0 +1,116 @@ +{{- /* +The pod definition included in the main. +*/ -}} +{{- define "replicated-library.pod" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "app") -}} + {{- $values = .ContextValues.app -}} + {{- else -}} + {{- fail "_pod.tpl requires the 'app' ContextValues to be set" -}} + {{- end -}} + {{- with $values.imagePullSecrets }} +imagePullSecrets: + {{- toYaml . | nindent 2 }} + {{- end }} + {{- if $values.serviceAccountName }} + {{- /* Add the prefix to the serviceAccountName if it is in the serviceAccounts dict and is enabled */}} + {{- if $.Values.serviceAccounts }} + {{- if and (hasKey $.Values.serviceAccounts $values.serviceAccountName) (get (get $.Values.serviceAccounts $values.serviceAccountName) "enabled") -}} + {{- $_ := set $values "serviceAccountName" (printf "%s-%s" (include "replicated-library.names.prefix" $) $values.serviceAccountName | trimAll "-") }} + {{- end }} + {{- end }} +serviceAccountName: {{ $values.serviceAccountName }} + {{- end }} +automountServiceAccountToken: {{ $values.automountServiceAccountToken }} + {{- with $values.podSecurityContext }} +securityContext: + {{- toYaml . | nindent 2 }} + {{- end }} + {{- with $values.priorityClassName }} +priorityClassName: {{ . }} + {{- end }} + {{- with $values.runtimeClassName }} +runtimeClassName: {{ . }} + {{- end }} + {{- with $values.schedulerName }} +schedulerName: {{ . }} + {{- end }} + {{- with $values.hostNetwork }} +hostNetwork: {{ . }} + {{- end }} + {{- with $values.hostname }} +hostname: {{ . }} + {{- end }} + {{- if $values.dnsPolicy }} +dnsPolicy: {{ $values.dnsPolicy }} + {{- else if $values.hostNetwork }} +dnsPolicy: ClusterFirstWithHostNet + {{- else }} +dnsPolicy: ClusterFirst + {{- end }} + {{- with $values.dnsConfig }} +dnsConfig: + {{- toYaml . | nindent 2 }} + {{- end }} +enableServiceLinks: {{ $values.enableServiceLinks }} +{{- if $values.termination }} + {{- with $values.termination.gracePeriodSeconds }} +terminationGracePeriodSeconds: {{ . }} + {{- end }} +{{- end }} +{{- if $values.initContainers }} +initContainers: + {{- include "replicated-library.initContainer" . | nindent 2 }} +{{- end }} +containers: + {{- include "replicated-library.container" . | trim | nindent 2 }} + {{- with $values.volumes }} +volumes: + {{- range . }} + {{- /* Add the prefix to the persistentVolumes if from this chart */}} + {{- if (hasKey . "persistentVolumeClaim") -}} + {{- if (hasKey .persistentVolumeClaim "claimName") -}} + {{- if (hasKey $.Values.persistence .persistentVolumeClaim.claimName) }} + {{- $globalVolume := get (get $.Values.persistence .persistentVolumeClaim.claimName) "persistentVolumeClaim" }} + {{- if and (hasKey $globalVolume "existingClaim") $globalVolume.existingClaim -}} + {{- /* Volume is an existing claim use that name */}} + {{- $_ := set .persistentVolumeClaim "claimName" $globalVolume.existingClaim }} + {{- else }} + {{- /* Append the prefix */}} + {{- $_ := set .persistentVolumeClaim "claimName" (printf "%s-%s" (include "replicated-library.names.prefix" $) .persistentVolumeClaim.claimName | trimAll "-") }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- /* Add the prefix to configMaps if from this chart */}} + {{- if (hasKey . "configMap") -}} + {{- if (hasKey .configMap "name") -}} + {{- if and (hasKey $.Values.configmaps .configMap.name) (get (get $.Values.configmaps .configMap.name) "enabled") -}} + {{- $_ := set .configMap "name" (printf "%s-%s" (include "replicated-library.names.prefix" $) .configMap.name | trimAll "-") }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- toYaml . | nindent 2}} + {{- end }} + {{- with $values.hostAliases }} +hostAliases: + {{- toYaml . | nindent 2 }} + {{- end }} + {{- with $values.nodeSelector }} +nodeSelector: + {{- toYaml . | nindent 2 }} + {{- end }} + {{- with $values.affinity }} +affinity: + {{- toYaml . | nindent 2 }} + {{- end }} + {{- with $values.topologySpreadConstraints }} +topologySpreadConstraints: + {{- toYaml . | nindent 2 }} + {{- end }} + {{- with $values.tolerations }} +tolerations: + {{- toYaml . | nindent 2 }} + {{- end }} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pod_annotations.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pod_annotations.tpl new file mode 100644 index 00000000..7a76e3de --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pod_annotations.tpl @@ -0,0 +1,93 @@ +{{/* Determine the Pod annotations used in the main */}} +{{- define "replicated-library.podAnnotations" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "app") -}} + {{- $values = .ContextValues.app -}} + {{- else -}} + {{- fail "_pod_annotations.tpl requires the 'app' ContextValues to be set" -}} + {{- end -}} + + {{- if $values.podAnnotations }} + {{- tpl (toYaml $values.podAnnotations) . | nindent 0 }} + {{- end }} + + {{- $configMapsFound := false -}} + {{- range $name, $configmap := .Values.configmaps -}} + {{- if $configmap.enabled -}} + {{- $configMapsFound = true -}} + {{- end -}} + {{- end -}} + {{- if $configMapsFound -}} + {{- include ("replicated-library.podAnnotations.shaAnnotations") . -}} + {{- end -}} +{{- end -}} + +{{- define "replicated-library.podAnnotations.shaAnnotations" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "app") -}} + {{- $values = .ContextValues.app -}} + {{- else -}} + {{- fail "_pod_annotations.tpl requires the 'app' ContextValues to be set" -}} + {{- end -}} + + {{- $prefix := include "replicated-library.names.prefix" . -}} + {{- $configMapsFound := dict -}} + {{- $secretsFound := dict -}} + + {{- if hasKey $values "volumes" -}} + {{- range $i, $v := $values.volumes -}} + {{- if hasKey $v "configMap" -}} + {{- $fullName := (printf "%s-%s" $prefix $v.configMap.name | trunc 63 | trimAll "-") -}} + {{- $_ := set $configMapsFound $fullName true -}} + {{- end -}} + {{- if hasKey $v "secret" -}} + {{- $fullName := (printf "%s-%s" $prefix $v.secret.secretName | trunc 63 | trimAll "-") -}} + {{- $_ := set $secretsFound $fullName true -}} + {{- end -}} + {{- end -}} + {{- end -}} + + {{- range $container, $containerValues := $values.containers -}} + {{- if hasKey $containerValues "envFrom" -}} + {{- range $i, $v := $containerValues.envFrom -}} + {{- if hasKey $v "configMapRef" -}} + {{- $fullName := (printf "%s-%s" $prefix $v.configMapRef.name | trunc 63 | trimAll "-") -}} + {{- $_ := set $configMapsFound $fullName true -}} + {{- end -}} + {{- if hasKey $v "secretRef" -}} + {{- $fullName := (printf "%s-%s" $prefix $v.secretRef.name | trunc 63 | trimAll "-") -}} + {{- $_ := set $secretsFound $fullName true -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} + + {{- $appReload := .Values.global.appReload -}} + {{- range $configMapFound, $v := $configMapsFound -}} + {{- range $configMapName, $configMapValues := $.Values.configmaps -}} + {{- if (hasKey $configMapValues "appReload") -}} + {{- $appReload = $configMapValues.appReload -}} + {{- end -}} + {{- if and $configMapValues.enabled $appReload -}} + {{- $configMapFullName := (printf "%s-%s" $prefix $configMapName | trunc 63 | trimAll "-") -}} + {{- if eq $configMapFound $configMapFullName -}} + {{- printf "checksum/config-%v: %v" $configMapFullName (printf "%v" ($configMapValues.data) | sha256sum) | nindent 0 -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} + + {{- range $secretFound, $v := $secretsFound -}} + {{- range $secretName, $secretValues := $.Values.secrets -}} + {{- if (hasKey $secretValues "appReload") -}} + {{- $appReload = $secretValues.appReload -}} + {{- end -}} + {{- if and $secretValues.enabled $appReload -}} + {{- $secretFullName := (printf "%s-%s" $prefix $secretName | trunc 63 | trimAll "-") -}} + {{- if eq $secretFound $secretFullName -}} + {{- printf "checksum/secret-%v: %v" $secretFullName (printf "%v" ($secretValues.data) | sha256sum) | nindent 0 -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_preflights.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_preflights.tpl new file mode 100644 index 00000000..c8ec9bac --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_preflights.tpl @@ -0,0 +1,171 @@ +{{/* +Renders the Support Bundle objects required by the chart. +*/}} +{{- define "replicated-library.preflights" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "troubleshoot") -}} + {{- $values = .ContextValues.troubleshoot -}} + {{- else -}} + {{- fail "_preflights.tpl requires the 'troubleshoot' ContextValues to be set" -}} + {{- end -}} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "replicated-library.names.prefix" . }}-preflight-{{ .ContextNames.troubleshoot }} + labels: + {{- include "replicated-library.labels" $ | nindent 4 }} + troubleshoot.sh/kind: preflight + annotations: + "helm.sh/hook": pre-install, pre-upgrade + "helm.sh/hook-weight": "-6" + "helm.sh/hook-delete-policy": before-hook-creation, hook-succeeded, hook-failed +stringData: + preflight.yaml: |- + apiVersion: troubleshoot.sh/v1beta2 + kind: Preflight + metadata: + name: {{ include "replicated-library.names.prefix" . }}-preflight-{{ .ContextNames.troubleshoot }} + spec: + {{- if $values.collectors }} + collectors: + {{- include "replicated-library.troubleshoot.collectors" . | indent 6 }} + {{- end }} + {{- if $values.analyzers }} + analyzers: + {{- include "replicated-library.troubleshoot.analyzers" . | indent 6 }} + {{- else -}} + {{- fail (printf "Preflight %s requires the analyzers to be set" .ContextNames.troubleshoot) }} + {{- end }} + +{{ if $values.enableRBAC -}} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ $.Release.Name }}-preflight-{{ .ContextNames.troubleshoot }} + labels: + {{- include "replicated-library.labels" $ | nindent 4 }} + annotations: + "helm.sh/hook": pre-install, pre-upgrade + "helm.sh/hook-weight": "-6" + "helm.sh/hook-delete-policy": before-hook-creation, hook-succeeded, hook-failed +secrets: + - name: {{ include "replicated-library.names.prefix" . }}-preflight-{{ .ContextNames.troubleshoot }} + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ $.Release.Name }}-preflight-{{ .ContextNames.troubleshoot }} + labels: + {{- include "replicated-library.labels" $ | nindent 4 }} + annotations: + "helm.sh/hook": pre-install, pre-upgrade + "helm.sh/hook-weight": "-6" + "helm.sh/hook-delete-policy": before-hook-creation, hook-succeeded, hook-failed +rules: + - apiGroups: + - "" + resources: + - "namespaces" + verbs: + - "get" + - "watch" + - "list" + - apiGroups: + - "" + resources: + - "nodes" + verbs: + - "get" + - "watch" + - "list" + - apiGroups: + - "" + resources: + - "pods" + verbs: + - "get" + - "watch" + - "list" + - "create" + - apiGroups: + - "apiextensions.k8s.io" + resources: + - "customresourcedefinitions" + verbs: + - "get" + - "watch" + - "list" + - apiGroups: + - "storage.k8s.io" + resources: + - "storageclasses" + verbs: + - "get" + - "watch" + - "list" + - apiGroups: + - "" + resources: + - "pods/log" + verbs: + - "get" + - "list" + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ $.Release.Name }}-preflight-{{ .ContextNames.troubleshoot }} + labels: + {{- include "replicated-library.labels" $ | nindent 4 }} + annotations: + "helm.sh/hook": pre-install, pre-upgrade + "helm.sh/hook-weight": "-6" + "helm.sh/hook-delete-policy": before-hook-creation, hook-succeeded, hook-failed +subjects: +- kind: ServiceAccount + name: {{ $.Release.Name }}-preflight-{{ .ContextNames.troubleshoot }} + namespace: {{ $.Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ $.Release.Name }}-preflight-{{ .ContextNames.troubleshoot }} + apiGroup: rbac.authorization.k8s.io + +{{- end -}} +--- +apiVersion: v1 +kind: Pod +metadata: + name: {{ $.Release.Name }}-preflight-check + labels: + {{- include "replicated-library.labels" $ | nindent 4 }} + annotations: + "helm.sh/hook": pre-install, pre-upgrade + "helm.sh/show-output": "true" + "helm.sh/hook-weight": "-5" + "helm.sh/hook-delete-policy": before-hook-creation, hook-succeeded, hook-failed + "helm.sh/hook-output-log-policy": hook-failed, hook-succeeded +spec: +{{- if $values.enableRBAC }} + serviceAccountName: {{ $.Release.Name }}-preflight-{{ .ContextNames.troubleshoot }} +{{- end }} + restartPolicy: Never + volumes: + - name: preflights + secret: + secretName: {{ include "replicated-library.names.prefix" . }}-preflight-{{ .ContextNames.troubleshoot }} + containers: + - name: pre-install-job + image: {{ default "replicated/preflight:latest" $values.image }} + command: + - "preflight" + - "--interactive=false" + - "/preflights/preflight.yaml" + volumeMounts: + - name: preflights + mountPath: /preflights + +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pvc.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pvc.tpl new file mode 100644 index 00000000..547cd389 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pvc.tpl @@ -0,0 +1,30 @@ +{{/* +This template serves as a blueprint for all PersistentVolumeClaim objects that are created +within the replicated-library library. +*/}} +{{- define "replicated-library.classes.pvc" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "persistence") -}} + {{- $values = .ContextValues.persistence -}} + {{- else -}} + {{- fail "_persistence.tpl requires the 'persistence' ContextValues to be set" -}} + {{- end -}} +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + {{- $_ := set $.ContextValues "names" (dict "context" "persistence") }} + name: {{ include "replicated-library.names.fullname" . }} + {{- $_ := unset $.ContextValues "names" }} + {{- with (merge ($values.labels | default dict) (include "replicated-library.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} + {{- end }} + annotations: + {{- with (merge ($values.annotations | default dict) (include "replicated-library.annotations" $ | fromYaml)) }} + {{- toYaml . | nindent 4 }} + {{- end }} +{{- with $values.persistentVolumeClaim.spec }} +spec: + {{- toYaml . | nindent 4 }} +{{- end }} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pvcs.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pvcs.tpl new file mode 100644 index 00000000..de5c539c --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pvcs.tpl @@ -0,0 +1,19 @@ +{{/* +Renders the Persistent Volume Claim objects required by the chart. +*/}} +{{- define "replicated-library.pvc" -}} + {{- /* Generate pvc as required */ -}} + {{- range $name, $values := .Values.persistence -}} + {{- if $values.enabled -}} + {{- if and (eq (default "persistentVolumeClaim" $values.type) "persistentVolumeClaim") (not $values.persistentVolumeClaim.existingClaim) -}} + {{- $_ := set $.ContextNames "persistence" $name -}} + {{- $_ := set $.ContextValues "persistence" $values -}} + + {{- include "replicated-library.classes.pvc" $ | nindent 0 -}} + + {{- $_ := unset $.ContextNames "persistence" -}} + {{- $_ := unset $.ContextValues "persistence" -}} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_role.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_role.tpl new file mode 100644 index 00000000..438c3c92 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_role.tpl @@ -0,0 +1,44 @@ +{{/* +This template serves as the blueprint for a Role object created +within the replicated-library library. +*/}} +{{- define "replicated-library.role" }} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "role") -}} + {{- $values = .ContextValues.role -}} + {{- else -}} + {{- fail "_role.tpl requires the 'role' ContextValues to be set" -}} + {{- end -}} + {{- $_ := set $.ContextValues "names" (dict "context" "role") -}} +--- +apiVersion: rbac.authorization.k8s.io/v1 + {{- $kind := default "Role" $values.kind -}} + {{- if and (ne $kind "Role") (ne $kind "ClusterRole") -}} + {{- fail (printf "Not a valid kind of Role (%s); must be Role or ClusterRole" $kind) -}} + {{- end }} +kind: {{ $kind }} +metadata: + name: {{ include "replicated-library.names.fullname" . }} + {{- with (merge ($values.labels | default dict) (include "replicated-library.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} + {{- end }} + {{- with (merge ($values.annotations | default dict) (include "replicated-library.annotations" $ | fromYaml)) }} + annotations: {{- toYaml . | nindent 4 }} + {{- end }} + {{- if $values.aggregationRule }} + {{- if ne $kind "ClusterRole" }} + {{- fail (printf "If aggregation rules are set, role must be a ClusterRole") -}} + {{- end }} + aggregationRule: + clusterRoleSelectors: + {{- with $values.aggregationRule.clusterRoleSelectors }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} + {{- if $values.rules }} +rules: + {{- with $values.rules -}} + {{- toYaml . | nindent 2 }} + {{- end }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_rolebinding.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_rolebinding.tpl new file mode 100644 index 00000000..a1ed7143 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_rolebinding.tpl @@ -0,0 +1,48 @@ +{{/* +This template serves as the blueprint for a RoleBinding object created within the replicated-library library. + +TODO: implement support for subjects other than ServiceAccounts +*/}} +{{- define "replicated-library.roleBinding" }} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "roleBinding") -}} + {{- $values = .ContextValues.roleBinding -}} + {{- else -}} + {{- fail "_rolebinding.tpl requires the 'roleBinding' ContextValues to be set" -}} + {{- end -}} + {{- $_ := set $.ContextValues "names" (dict "context" "roleBinding") -}} +--- +apiVersion: rbac.authorization.k8s.io/v1 +{{- $kind := default "RoleBinding" $values.kind -}} +{{- $roleKind := default "Role" $values.roleRef.kind -}} +{{- if and (eq $kind "ClusterRoleBinding") (ne $roleKind "ClusterRole") -}} + {{- fail (printf "Not a valid Role in roleRef (%s); if a ClusterRoleBinding is created, roleRef must be a ClusterRole" $kind) -}} +{{- end }} +kind: {{ $kind }} +metadata: + name: {{ include "replicated-library.names.fullname" . }} + {{- with (merge ($values.labels | default dict) (include "replicated-library.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} + {{- end }} + {{- with (merge ($values.annotations | default dict) (include "replicated-library.annotations" $ | fromYaml)) }} + annotations: {{- toYaml . | nindent 4 }} + {{- end }} +subjects: + {{- range $s := $values.subjects }} + - apiGroup: "" + {{- $subjectKind := default "ServiceAcount" $s.kind }} + {{- if ne $subjectKind "ServiceAccount" }} + {{- fail (printf "Currently, only ServiceAccounts are supported as subjects in RoleBindings. Found: %s" $subjectKind) }} + {{- end }} + {{- if and (and (ne $subjectKind "ServiceAccount" ) (ne $subjectKind "User")) (ne $subjectKind "Group") }} + {{- fail (printf "Not a valid Kind in subject: (%s); must be one of ServiceAccount, User, or Group")}} + {{- end }} + kind: {{ $subjectKind }} + name: {{ $s.name }} + namespace: {{ default $.Release.Namespace $s.namespace }} + {{- end }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: {{ $roleKind }} + name: {{ $values.roleRef.name }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_rolebindings.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_rolebindings.tpl new file mode 100644 index 00000000..4aa123da --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_rolebindings.tpl @@ -0,0 +1,12 @@ +{{/* Renders RoleBinding objects required by the chart */}} +{{- define "replicated-library.roleBindings" -}} + {{- range $name, $roleBindingValues := .Values.roleBindings -}} + {{- if $roleBindingValues.enabled -}} + {{- $_ := set $.ContextNames "roleBinding" $name -}} + {{- $_ := set $.ContextValues "roleBinding" $roleBindingValues -}} + {{- include "replicated-library.roleBinding" $ | nindent 0 }} + {{- $_ := unset $.ContextNames "roleBinding" -}} + {{- $_ := unset $.ContextValues "roleBinding" -}} + {{- end -}} + {{- end -}} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_roles.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_roles.tpl new file mode 100644 index 00000000..c7f61854 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_roles.tpl @@ -0,0 +1,13 @@ +{{/* Renders the Role objects required by the chart */}} +{{- define "replicated-library.roles" -}} + {{- range $name, $roleValues := .Values.roles -}} + {{- if $roleValues.enabled -}} + {{- $_ := set $.ContextNames "role" $name -}} + {{- $_ := set $.ContextValues "role" $roleValues -}} + + {{- include "replicated-library.role" $ | nindent 0 }} + {{- $_ := unset $.ContextNames "role" -}} + {{- $_ := unset $.ContextValues "role" -}} + {{- end -}} + {{- end -}} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_secret.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_secret.tpl new file mode 100644 index 00000000..401fb1b7 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_secret.tpl @@ -0,0 +1,29 @@ +{{/* +This template serves as a blueprint for all secret objects that are created +within the replicated-library library. +*/}} +{{- define "replicated-library.classes.secret" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "secret") -}} + {{- $values = .ContextValues.secret -}} + {{- else -}} + {{- fail "_secret.tpl requires the 'secret' ContextValues to be set" -}} + {{- end -}} + {{- $_ := set $.ContextValues "names" (dict "context" "secret") -}} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "replicated-library.names.fullname" . }} + {{- with (merge ($values.labels | default dict) (include "replicated-library.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} + {{- end }} + {{- with (merge ($values.annotations | default dict) (include "replicated-library.annotations" $ | fromYaml)) }} + annotations: {{- toYaml . | nindent 4 }} + {{- end }} +stringData: +{{- with $values.data }} + {{- tpl (toYaml .) $ | nindent 2 }} +{{- end }} +type: {{ $values.type }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_secrets.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_secrets.tpl new file mode 100644 index 00000000..009a1970 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_secrets.tpl @@ -0,0 +1,17 @@ +{{/* +Renders the Secret objects required by the chart. +*/}} +{{- define "replicated-library.secrets" -}} + {{- /* Generate named secrets as required */ -}} + {{- range $name, $secretValues := .Values.secrets }} + {{- if $secretValues.enabled -}} + {{- $_ := set $.ContextNames "secret" $name -}} + {{- $_ := set $.ContextValues "secret" $secretValues -}} + + {{- include "replicated-library.classes.secret" $ | nindent 0 }} + + {{- $_ := unset $.ContextNames "secret" -}} + {{- $_ := unset $.ContextValues "secret" -}} + {{- end }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_service.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_service.tpl new file mode 100644 index 00000000..7e7f6f56 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_service.tpl @@ -0,0 +1,92 @@ +{{/* +This template serves as a blueprint for all Service objects that are created +within the replicated-library library. +*/}} +{{- define "replicated-library.classes.service" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "service") -}} + {{- $values = .ContextValues.service -}} + {{- else -}} + {{- fail "_service.tpl requires the 'service' ContextValues to be set" -}} + {{- end -}} + + {{- $svcType := $values.type | default "" -}} +--- +apiVersion: v1 +kind: Service +metadata: + {{- $_ := set $.ContextValues "names" (dict "context" "service") }} + name: {{ include "replicated-library.names.fullname" . }} + {{- $_ := unset $.ContextValues "names" }} + {{- with (merge ($values.labels | default dict) (include "replicated-library.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} + {{- end }} + annotations: + {{- with (merge ($values.annotations | default dict) (include "replicated-library.annotations" $ | fromYaml)) }} + {{ toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if (or (eq $svcType "ClusterIP") (empty $svcType)) }} + type: ClusterIP + {{- if $values.clusterIP }} + clusterIP: {{ $values.clusterIP }} + {{end}} + {{- else if eq $svcType "LoadBalancer" }} + type: {{ $svcType }} + {{- if $values.loadBalancerIP }} + loadBalancerIP: {{ $values.loadBalancerIP }} + {{- end }} + {{- if $values.loadBalancerSourceRanges }} + loadBalancerSourceRanges: + {{ toYaml $values.loadBalancerSourceRanges | nindent 4 }} + {{- end -}} + {{- else }} + type: {{ $svcType }} + {{- end }} + {{- if $values.externalTrafficPolicy }} + externalTrafficPolicy: {{ $values.externalTrafficPolicy }} + {{- end }} + {{- if $values.sessionAffinity }} + sessionAffinity: {{ $values.sessionAffinity }} + {{- if $values.sessionAffinityConfig }} + sessionAffinityConfig: + {{ toYaml $values.sessionAffinityConfig | nindent 4 }} + {{- end -}} + {{- end }} + {{- with $values.externalIPs }} + externalIPs: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- if $values.publishNotReadyAddresses }} + publishNotReadyAddresses: {{ $values.publishNotReadyAddresses }} + {{- end }} + {{- if $values.ipFamilyPolicy }} + ipFamilyPolicy: {{ $values.ipFamilyPolicy }} + {{- end }} + {{- with $values.ipFamilies }} + ipFamilies: + {{ toYaml . | nindent 4 }} + {{- end }} + ports: + {{- range $name, $port := $values.ports }} + {{- if $port.enabled }} + - port: {{ $port.port }} + targetPort: {{ $port.targetPort | default $name }} + {{- if $port.protocol }} + {{- if or ( eq $port.protocol "HTTP" ) ( eq $port.protocol "HTTPS" ) ( eq $port.protocol "TCP" ) }} + protocol: TCP + {{- else }} + protocol: {{ $port.protocol }} + {{- end }} + {{- else }} + protocol: TCP + {{- end }} + name: {{ $name }} + {{- if (and (eq $svcType "NodePort") (not (empty $port.nodePort))) }} + nodePort: {{ $port.nodePort }} + {{ end }} + {{- end }} + {{- end }} + selector: + {{- include "replicated-library.labels.serviceSelectorLabels" . | nindent 4 }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_serviceaccount.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_serviceaccount.tpl new file mode 100644 index 00000000..15156bb1 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_serviceaccount.tpl @@ -0,0 +1,23 @@ +{{/* +The ServiceAccount object to be created. +*/}} +{{- define "replicated-library.serviceAccount" }} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "serviceAccount") -}} + {{- $values = .ContextValues.serviceAccount -}} + {{- else -}} + {{- fail "_serviceaccount.tpl requires the 'serviceAccount' ContextValues to be set" -}} + {{- end -}} + {{- $_ := set $.ContextValues "names" (dict "context" "serviceAccount") -}} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "replicated-library.names.fullname" . }} + {{- with (merge ($values.labels | default dict) (include "replicated-library.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} + {{- end }} + {{- with (merge ($values.annotations | default dict) (include "replicated-library.annotations" $ | fromYaml)) }} + annotations: {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_serviceaccounts.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_serviceaccounts.tpl new file mode 100644 index 00000000..b5fc3fdd --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_serviceaccounts.tpl @@ -0,0 +1,13 @@ +{{/* Renders the ServiceAccount objects required by the chart */}} +{{- define "replicated-library.serviceAccounts" -}} +{{- range $name, $serviceAccountValues := .Values.serviceAccounts -}} + {{- if $serviceAccountValues.enabled -}} + {{- $_ := set $.ContextNames "serviceAccount" $name -}} + {{- $_ := set $.ContextValues "serviceAccount" $serviceAccountValues -}} + + {{- include "replicated-library.serviceAccount" $ | nindent 0 }} + {{- $_ := unset $.ContextNames "serviceAccount" -}} + {{- $_ := unset $.ContextValues "serviceAccount" -}} + {{- end -}} + {{- end -}} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_services.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_services.tpl new file mode 100644 index 00000000..636947c5 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_services.tpl @@ -0,0 +1,17 @@ +{{/* +Renders the Service objects required by the chart. +*/}} +{{- define "replicated-library.services" -}} + {{- /* Generate named services as required */ -}} + {{- range $name, $serviceValues := .Values.services }} + {{- if $serviceValues.enabled -}} + {{- $_ := set $.ContextNames "service" $name -}} + {{- $_ := set $.ContextValues "service" $serviceValues -}} + + {{- include "replicated-library.classes.service" $ | nindent 0 }} + + {{- $_ := unset $.ContextNames "service" -}} + {{- $_ := unset $.ContextValues "service" -}} + {{- end }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_statefulset.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_statefulset.tpl new file mode 100644 index 00000000..bfd1aac2 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_statefulset.tpl @@ -0,0 +1,93 @@ +{{/* +This template serves as the blueprint for the StatefulSet objects that are created +within the replicated library. +*/}} +{{- define "replicated-library.firstservice" -}} + {{- $_ := set $.ContextValues "names" (dict "context" "app") }} + {{- $appName := include "replicated-library.names.appname" . }} + {{- $_ := unset $.ContextValues "names" }} + {{- $matchingServices := list }} + + {{- range $name, $values := .Values.services }} + {{- range $values.appName -}} + {{- if eq . $appName }} + {{- $serviceName := "" }} + {{- if $values.fullNameOverride }} + {{- $serviceName = $values.fullNameOverride }} + {{- else }} + {{- $serviceName = printf "%s-%s" (include "replicated-library.names.prefix" $) $name | trimAll "-" -}} + {{- end }} + {{- $matchingServices = append $matchingServices $serviceName }} + {{- end }} + {{- end }} + {{- end }} + + {{- if len $matchingServices }} + {{- first $matchingServices }} + {{- end }} +{{- end }} +{{- define "replicated-library.statefulset" }} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "app") -}} + {{- $values = .ContextValues.app -}} + {{- else -}} + {{- fail "_statefulset.tpl requires the 'app' ContextValues to be set" -}} + {{- end -}} +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "replicated-library.names.fullname" . }} + {{- with (merge ($values.labels | default dict) (include "replicated-library.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} + {{- end }} + {{- with (merge ($values.annotations | default dict) (include "replicated-library.annotations" $ | fromYaml)) }} + annotations: {{- toYaml . | nindent 4 }} + {{- end }} +spec: + revisionHistoryLimit: {{ $values.revisionHistoryLimit }} + replicas: {{ $values.replicas }} + podManagementPolicy: {{ default "OrderedReady" $values.podManagementPolicy }} + {{- $strategy := default "RollingUpdate" $values.strategy }} + {{- if and (ne $strategy "OnDelete") (ne $strategy "RollingUpdate") }} + {{- fail (printf "Not a valid strategy type for StatefulSet (%s)" $strategy) }} + {{- end }} + updateStrategy: + type: {{ $strategy }} + {{- if and (eq $strategy "RollingUpdate") (and $values.rollingUpdate $values.rollingUpdate.partition) }} + rollingUpdate: + partition: {{ $values.rollingUpdate.partition }} + {{- end }} + selector: + matchLabels: + {{- include "replicated-library.labels.selectorLabels" . | nindent 6 }} + {{- $serviceName := default (include "replicated-library.firstservice" .) ($values.serviceName) }} + {{- if and $values.serviceName (get (get $.Values "services") $values.serviceName) }} + {{- if (get (get (get $.Values "services") $values.serviceName) "enabled") }} + {{- $serviceName = printf "%s-%s" (include "replicated-library.names.prefix" .) $serviceName }} + {{- end }} + {{- end }} + serviceName: {{ required "Statefulsets must have a service mapped to it or provided via serviceName" $serviceName }} + template: + metadata: + {{- with include ("replicated-library.podAnnotations") . }} + annotations: + {{- . | nindent 8 }} + {{- end }} + labels: + {{- include "replicated-library.labels.selectorLabels" . | nindent 8 }} + {{- with $values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- include "replicated-library.pod" . | trim | nindent 6 }} + {{- if $values.volumeClaimTemplates }} + volumeClaimTemplates: + {{- range $index, $vct := $values.volumeClaimTemplates }} + - metadata: + name: {{ $vct.name }} + spec: + {{- toYaml $vct.spec | nindent 6 }} + {{- end }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_support_bundle.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_support_bundle.tpl new file mode 100644 index 00000000..910b0577 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_support_bundle.tpl @@ -0,0 +1,36 @@ +{{/* +Renders the Support Bundle objects required by the chart. +*/}} +{{- define "replicated-library.supportBundle" -}} + {{- $values := "" -}} + {{- if and (hasKey . "ContextValues") (hasKey .ContextValues "troubleshoot") -}} + {{- $values = .ContextValues.troubleshoot -}} + {{- else -}} + {{- fail "_support_bundle.tpl requires the 'troubleshoot' ContextValues to be set" -}} + {{- end -}} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "replicated-library.names.prefix" . }}-support-bundle-{{ .ContextNames.troubleshoot }} + labels: + troubleshoot.sh/kind: support-bundle +stringData: + support-bundle-spec: |- + apiVersion: troubleshoot.sh/v1beta2 + kind: SupportBundle + metadata: + name: {{ include "replicated-library.names.prefix" . }}-support-bundle-{{ .ContextNames.troubleshoot }} + spec: + {{- if $values.uri }} + uri: {{ $values.uri }} + {{- end }} + {{- if $values.collectors }} + collectors: + {{- include "replicated-library.troubleshoot.collectors" . | indent 6 }} + {{- end }} + {{- if $values.analyzers }} + analyzers: + {{- include "replicated-library.troubleshoot.analyzers" . | indent 6 }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_troubleshoot.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_troubleshoot.tpl new file mode 100644 index 00000000..affa7f63 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_troubleshoot.tpl @@ -0,0 +1,30 @@ +{{/* +Renders the Troubleshoot objects required by the chart. +*/}} +{{- define "replicated-library.troubleshoot" -}} + {{- range $name, $troubleshootValues := .Values.troubleshoot }} + {{- if eq $name "support-bundles" -}} + {{- range $supportBundleName, $supportBundleValues := $troubleshootValues }} + {{- if $supportBundleValues.enabled -}} + {{- $_ := set $.ContextNames "troubleshoot" $supportBundleName -}} + {{- $_ := set $.ContextValues "troubleshoot" $supportBundleValues -}} + {{- include "replicated-library.supportBundle" $ | nindent 0 -}} + {{- $_ := unset $.ContextNames "troubleshoot" -}} + {{- $_ := unset $.ContextValues "troubleshoot" -}} + {{- end }} + {{- end }} + {{- end }} + + {{- if eq $name "preflights" -}} + {{- range $preflightsName, $preflightsValues := $troubleshootValues }} + {{- if $preflightsValues.enabled -}} + {{- $_ := set $.ContextNames "troubleshoot" $preflightsName -}} + {{- $_ := set $.ContextValues "troubleshoot" $preflightsValues -}} + {{- include "replicated-library.preflights" $ | nindent 0 -}} + {{- $_ := unset $.ContextNames "troubleshoot" -}} + {{- $_ := unset $.ContextValues "troubleshoot" -}} + {{- end }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_values.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_values.tpl new file mode 100644 index 00000000..173f02da --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_values.tpl @@ -0,0 +1,9 @@ +{{/* Merge the local chart values and the replicated-library chart defaults */}} +{{- define "replicated-library.values.setup" -}} + {{- if (index .Values "replicated-library") -}} + {{- $defaultValues := deepCopy (index .Values "replicated-library") -}} + {{- $userValues := deepCopy (omit .Values "replicated-library") -}} + {{- $mergedValues := mustMergeOverwrite $defaultValues $userValues -}} + {{- $_ := set . "Values" (deepCopy $mergedValues) -}} + {{- end -}} +{{- end -}} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_collectd.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_collectd.tpl new file mode 100644 index 00000000..a365096e --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_collectd.tpl @@ -0,0 +1,46 @@ +{{- define "replicated-library.troubleshoot.collector.collectd" -}} +- {{ .ContextNames.collector }}: + {{- with .ContextValues.collector }} + {{- if .hostPath }} + hostPath: {{ .hostPath }} + {{- else }} + {{- fail (printf "The 'hostPath' for the 'collectd' collector was not found." ) }} + {{- end }} + + {{- if .image }} + image: {{ .image }} + {{- else }} + {{- fail (printf "The 'image' for the 'collectd' collector was not found." ) }} + {{- end }} + + {{- if .collectorName }} + collectorName: {{ .collectorName }} + {{- end }} + + {{- if .timeout }} + timeout: {{ .timeout }} + {{- end }} + + {{- if .name }} + name: {{ .name }} + {{- end }} + + {{- if .namespace }} + namespace: {{ .namespace }} + {{- end }} + + {{- if .extractArchive }} + extractArchive: {{ .extractArchive }} + {{- end }} + + {{- if .imagePullPolicy }} + imagePullPolicy: {{ .imagePullPolicy }} + {{- end }} + + {{- if .imagePullSecret }} + imagePullSecret: {{ .imagePullSecret }} + {{- end }} + + {{- end }} + +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_configMap.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_configMap.tpl new file mode 100644 index 00000000..2a9e3a68 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_configMap.tpl @@ -0,0 +1,43 @@ +{{- define "replicated-library.troubleshoot.collector.configMap" -}} +- {{ .ContextNames.collector }}: + {{- with .ContextValues.collector }} + {{- if eq .configMapName "*" }} + selector: + - app.kubernetes.io/name={{ include "replicated-library.names.name" $ }} + - app.kubernetes.io/instance={{ $.Release.Name }} + {{- else if .configMapName }} + name: {{ .configMapName }} + {{- else if .selector }} + selector: + {{- .selector | toYaml | nindent 6}} + {{- else if .name }} + name: {{ .name }} + {{- else }} + {{- fail (printf "Neither 'selector', 'name', nor 'configMapName' were found for the 'configMap' collector." .) }} + {{- end }} + + {{- if .collectorName }} + collectorName: {{ .collectorName }} + {{- end }} + + {{- if .namespace }} + namespace: {{ .namespace }} + {{- else }} + namespace: {{ $.Release.Namespace }} + {{- end }} + + {{- if .includeValue }} + includeValue: {{ .includeValue }} + {{- end }} + + {{- if .key }} + key: {{ .key }} + {{- end }} + + {{- if .includeAllData }} + includeAllData: {{ .includeAllData }} + {{- end }} + + {{- end }} + +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_copyFromHost.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_copyFromHost.tpl new file mode 100644 index 00000000..6756883b --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_copyFromHost.tpl @@ -0,0 +1,44 @@ +{{- define "replicated-library.troubleshoot.collector.copyFromHost" -}} +- {{ .ContextNames.collector }}: + {{- with .ContextValues.collector }} + {{- if .hostPath }} + hostPath: {{ .hostPath }} + {{- else }} + {{- fail (printf "The 'hostPath' for the 'copyFromHost' collector was not found." ) }} + {{- end }} + + {{- if .image }} + image: {{ .image }} + {{- else }} + {{- fail (printf "The 'image' for the 'copyFromHost' collector was not found." ) }} + {{- end }} + + {{- if .name }} + name: {{ .name }} + {{- end }} + + {{- if .collectorName }} + collectorName: {{ .collectorName }} + {{- end }} + + {{- if .timeout }} + timeout: {{ .timeout }} + {{- end }} + + {{- if .namespace }} + namespace: {{ .namespace }} + {{- end }} + + {{- if .extractArchive }} + extractArchive: {{ .extractArchive }} + {{- end }} + + {{- if .imagePullPolicy }} + imagePullPolicy: {{ .imagePullPolicy }} + {{- end }} + + {{- if .imagePullSecret }} + imagePullSecret: {{ .imagePullSecret }} + {{- end }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_data.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_data.tpl new file mode 100644 index 00000000..ebc74dd1 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_data.tpl @@ -0,0 +1,19 @@ +{{- define "replicated-library.troubleshoot.collector.data" -}} +- {{ .ContextNames.collector }}: + {{- with .ContextValues.collector }} + {{- if .collectorName }} + collectorName: {{ .collectorName }} + {{- end }} + + {{- if .name }} + name: {{ .name }} + {{- end }} + + {{- if .data }} + data: {{ .data }} + {{- else }} + {{- fail (printf "The 'data' for the 'data' collector was not found." ) }} + {{- end }} + + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_exec.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_exec.tpl new file mode 100644 index 00000000..9e3afe16 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_exec.tpl @@ -0,0 +1,69 @@ +{{- define "replicated-library.troubleshoot.collector.exec" -}} +- {{ .ContextNames.collector }}: + {{- with .ContextValues.collector }} + {{- if eq .appName "*" }} + selector: + - app.kubernetes.io/name={{ include "replicated-library.names.name" $ }} + - app.kubernetes.io/instance={{ $.Release.Name }} + {{- else if .appName }} + {{- if index $.Values.apps .appName }} + {{- $_ := set $.ContextNames "app" .appName }} + selector: + {{- range (include "replicated-library.labels.selectorLabels" $ | splitList "\n" ) }} + {{- printf "- %s" . | replace ": " "=" | nindent 6 }} + {{- end }} + {{- $_ := unset $.ContextNames "app" }} + {{- else }} + {{- fail (printf "Matching app for AppName (%s) was not found" .appName) }} + {{- end }} + {{- else if .selector }} + selector: + {{- .selector | toYaml | nindent 6}} + {{- else }} + {{- fail (printf "Either 'selector', or 'appName' were found for the 'exec' collector.") }} + {{- end }} + + {{- if .command }} + {{- range .command }} + - {{ . }} + {{- end }} + {{- else -}} + {{- fail (printf "The 'command' for the 'exec' collector was not found.") }} + {{- end }} + + {{- if .collectorName }} + collectorName: {{ .collectorName }} + {{- end }} + + {{- if .name }} + name: {{ .name }} + {{- end }} + + {{- if .containerName }} + containerName: {{ .containerName }} + {{- end }} + + {{- if .namespace }} + namespace: {{ .namespace }} + {{- else }} + namespace: {{ $.Release.Namespace }} + {{- end }} + + {{- if .exclude }} + exclude: {{ .exclude }} + {{- end }} + + {{- if .timeout }} + timeout: {{ .timeout }} + {{- end }} + + {{- if .args }} + args: + {{- range .args }} + - {{ . }} + {{- end }} + {{- end }} + + {{- end }} + +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_general.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_general.tpl new file mode 100644 index 00000000..8900476c --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_general.tpl @@ -0,0 +1,8 @@ +{{- define "replicated-library.troubleshoot.collector.general" -}} +- {{ .ContextNames.collector }}: + {{- with .ContextValues.collector }} + {{- . | toYaml | nindent 4 }} + {{- else -}} + {{ "{}" | indent 1 }} + {{- end }} +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_logs.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_logs.tpl new file mode 100644 index 00000000..d008aab3 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_logs.tpl @@ -0,0 +1,58 @@ +{{- define "replicated-library.troubleshoot.collector.logs" -}} +- {{ .ContextNames.collector }}: + {{- with .ContextValues.collector }} + {{- if eq .appName "*" }} + selector: + - app.kubernetes.io/name={{ include "replicated-library.names.name" $ }} + - app.kubernetes.io/instance={{ $.Release.Name }} + {{- else if .appName }} + {{- if index $.Values.apps .appName }} + {{- $_ := set $.ContextNames "app" .appName }} + selector: + {{- range (include "replicated-library.labels.selectorLabels" $ | splitList "\n" ) }} + {{- printf "- %s" . | replace ": " "=" | nindent 6 }} + {{- end }} + {{- $_ := unset $.ContextNames "app" }} + {{- else }} + {{- fail (printf "Matching app for AppName (%s) was not found" .appName) }} + {{- end }} + {{- else if .selector }} + selector: + {{- .selector | toYaml | nindent 6}} + {{- else }} + {{- fail (printf "Either 'selector', or 'appName' were found for the 'logs' collector.") }} + {{- end }} + + {{- if .collectorName }} + collectorName: {{ .collectorName }} + {{- end }} + + {{- if .name }} + name: {{ .name }} + {{- else -}} + {{- fail (printf "The 'name' for the 'logs' collector was not found.") }} + {{- end }} + + {{- if .containerNames }} + containerNames: + {{- range .containerNames }} + - {{ . }} + {{- end }} + {{- end }} + + {{- if .limits }} + limits: + maxAge: {{ default "720h" .limits.maxAge }} + maxLines: {{ default 10000 .limits.maxLines }} + maxBytes: {{ default 5000000 .limits.maxBytes }} + {{- end }} + + {{- if .namespace }} + namespace: {{ .namespace }} + {{- else }} + namespace: {{ $.Release.Namespace }} + {{- end }} + + {{- end }} + +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_secrets.tpl b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_secrets.tpl new file mode 100644 index 00000000..e9549b1a --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_secrets.tpl @@ -0,0 +1,35 @@ +{{- define "replicated-library.troubleshoot.collector.secret" -}} +- {{ .ContextNames.collector }}: + {{- with .ContextValues.collector }} + {{- if eq .secretName "*" -}} + selector: + - app.kubernetes.io/name={{ include "replicated-library.names.name" . }} + - app.kubernetes.io/instance={{ .Release.Name }} + {{- else if .secretName -}} + name: {{ .secretName }} + {{- else if .selector -}} + selector: + {{- .selector | toYaml | nindent 6}} + {{- else if .name }} + name: {{ .name }} + {{- else }} + {{- fail (printf "Neither 'selector', 'name', nor 'secretName' were found for the 'secret' collector." .) }} + {{- end }} + + {{- if .collectorName }} + collectorName: {{ .collectorName }} + {{- end }} + + {{- if .namespace }} + namespace: {{ .namespace }} + {{- else }} + namespace: {{ $.Release.Namespace }} + {{- end }} + + {{- if .key }} + key: {{ .key }} + {{- end }} + + {{- end }} + +{{- end }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/values-example.yaml b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/values-example.yaml new file mode 100644 index 00000000..759930f1 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/values-example.yaml @@ -0,0 +1,557 @@ +global: + # -- Set additional global labels. + labels: {} + # -- Set additional global annotations. + annotations: {} + # -- Set the full object prefix, defaults to releasName-ChartName if not set. This value takes precedence over nameOverride. + # Set to "-" to disable object name prefixing. + fullNameOverride: + # -- Set an override for the ChartName, defaults to ChartName if not set. + nameOverride: + # -- When `true`, the feature to automatically re-deploy an App's pod when a ConfigMap or Secret changes is enabled. + appReload: true + +# -- Configure the apps for the chart here. +# Apps can be added by adding a dictionary key similar to the 'example' app. +# By default the name of the app will be the name of the dictionary key +# TODO: nameOverride +# TODO: Ensure sha annotations on app are working +# @default -- See below +apps: + example: + # -- Enable the app + # Each app represents a single controller type (deployment, daemonset, statefulset) + enabled: false + # -- Specify the controller type. + # Valid options are deployment, daemonset or statefulset + type: deployment + # The serviceName is required for type = statefulset. + # It can be set manually on the application or will be set automatically to the first service which is mapped to this app. + serviceName: + # -- Set the replica count. Only used for deployment and statefulset + replicas: 1 + + # -- Specify one or more image pull secrets for the app + imagePullSecrets: [] + + # -- Specify any initContainers here as dictionary items. Each initContainer should have its own key. + containers: + example: + image: + # -- Specify the image repository for the container + repository: nginx + # -- Specify the image tag for the container + tag: latest + # -- Specify the image pull policy for the container + pullPolicy: + + # -- Override the command for the container + command: [] + # -- Override the arguments for the container + args: [] + + # -- Environment variables. Template enabled. + # Syntax options: + # a. DATABASE_USER: USERNAME + # b. - name: DATABASE_USER + # USERNAME + # c. - name: DATABASE_USER + # valueFrom: + # secretKeyRef: + # name: db-user + # key: USER + # d. - name: DATABASE_USER + # valueFrom: + # configMapKeyRef: + # name: db_user + # key: DB_USER + env: + # -- Secrets and/or ConfigMaps that will be loaded as environment variables. + # [[ref]](https://unofficial-kubernetes.readthedocs.io/en/latest/tasks/configure-pod-container/configmap/#use-case-consume-configmap-in-environment-variables) + envFrom: [] + + # -- Specify the ports for the container + # [[ref]](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#ports) + ports: [] + # -- Specify a list of volumes mounts in the container. + volumeMounts: [] + # -- Specify probes for the container + # [[ref]](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) + probes: + # -- Specify the readiness probes for the container + readinessProbe: {} + # -- Specify the liveness probes for the container + livenessProbe: {} + # -- Specify the startup probes for the container + startupProbe: {} + securityContext: {} + # -- Configure the lifecycle for the container + lifecycle: {} + + termination: + # -- Configure the path at which the file to which the container's termination message will be written. + # -- [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle-1)] + messagePath: + # -- Indicate how the container's termination message should be populated. + # Valid options are `File` and `FallbackToLogsOnError`. + # -- [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle-1)] + messagePolicy: + # -- Duration in seconds the pod needs to terminate gracefully + # -- [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle)] + gracePeriodSeconds: + + # -- Set the resource requests / limits for the container. + resources: {} + + # -- Specify any initContainers here as dictionary items. Each initContainer should have its own key. + # The dictionary item key will determine the order. + # All of the same values from .Values.apps.example.containers are valid here with the exception of probes. + initContainers: {} + + # -- Specify a list of volumes that get mounted to the app. + # persistentVolumeClaims which are present and enabled in the persistence configuraiton will have the prefix added automatically. + volumes: [] + + # -- Set annotations on the deployment/statefulset/daemonset + annotations: {} + # -- Set labels on the deployment/statefulset/daemonset + labels: {} + + # -- Specifies whether a service account token should be automatically mounted. + automountServiceAccountToken: true + # TODO: apps.*.serviceAccount template + # serviceAccount: + # # -- Specifies whether a service account should be created + # create: false + # # -- Annotations to add to the service account + # annotations: {} + # # -- The name of the service account to use. + # # If not set and create is true, a name is generated using the fullname template + # name: "" + # # -- If rules are specified, a matching Role and RoleBinding is created for the service account + # rules: [ + # # - apiGroups: [""] + # # resources: ["pods"] + # # verbs: ["get", "watch", "list"] + # ] + + # -- Set statefulset podManagementPolicy, valid values are Parallel and OrderedReady (default). + podManagementPolicy: + # -- Set annotations on the pod + podAnnotations: {} + # -- Set labels on the pod + podLabels: {} + + # -- Set the controller upgrade strategy + # For Deployments, valid values are Recreate and RollingUpdate. + # For StatefulSets, valid values are OnDelete and RollingUpdate. + # For Daemonsets, valid values are OnDelete and RollingUpdate. + strategy: + rollingUpdate: + # -- Set deployment RollingUpdate max unavailable + unavailable: + # -- Set deployment RollingUpdate max surge + surge: + # -- Set statefulset RollingUpdate partition + partition: + # -- ReplicaSet revision history limit + revisionHistoryLimit: 3 + + # -- Custom priority class for different treatment by the scheduler + priorityClassName: # system-node-critical + # -- Allow specifying a runtimeClassName other than the default one (ie: nvidia) + runtimeClassName: # nvidia + # -- Allows specifying a custom scheduler name + schedulerName: # awkward-dangerous-scheduler + # -- Allows specifying explicit hostname setting + hostname: + # -- When using hostNetwork make sure you set dnsPolicy to `ClusterFirstWithHostNet` + hostNetwork: false + # -- Defaults to "ClusterFirst" if hostNetwork is false and "ClusterFirstWithHostNet" if hostNetwork is true. + dnsPolicy: # ClusterFirst + # -- Optional DNS settings, configuring the ndots option may resolve nslookup issues on some Kubernetes setups. + dnsConfig: {} + # -- Enable/disable the generation of environment variables for services. + # [[ref]](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#accessing-the-service) + enableServiceLinks: true + # -- Configure the Security Context for the Pod + podSecurityContext: {} + + # -- Used to create individual disks for each instance when type: StatefulSet + volumeClaimTemplates: [] + + # -- Node selection constraint + # [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector) + nodeSelector: {} + + # -- Defines affinity constraint rules. + # [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) + affinity: {} + + # -- Defines topologySpreadConstraint rules. + # [[ref]](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) + topologySpreadConstraints: [] + # - maxSkew: + # topologyKey: + # whenUnsatisfiable: + # labelSelector: + + # -- Specify taint tolerations + # [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) + tolerations: [] + + # -- Use hostAliases to add custom entries to /etc/hosts - mapping IP addresses to hostnames. + # [[ref]](https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/) + hostAliases: [] + # - ip: "192.168.1.100" + # hostnames: + # - "example.com" + # - "www.example.com" + +# -- Configure the secrets for the chart here. +# Secrets can be added by adding a dictionary key similar to the 'exampleSecret' secret. +# By default the name of the secret will be the name of the dictionary key +# TODO: nameOverride +# TODO: Ensure sha annotations on app are working +# @default -- See below +secrets: + exampleSecret: + # -- Enables or disables the secret + enabled: false + # -- Labels to add to the secret + labels: {} + # -- Annotations to add to the secret + annotations: {} + # -- configMap data content. Helm template enabled. + data: + {} + # foo: bar + # -- Override the name of this object. Default name if not overwritten will be releaseName-ChartName-objectName + fullNameOverride: + # option to select secret type; default is Opaque + # example: set type: kubernetes.io/tls for secrets that contain tls data. + type: + # -- When `true`, the feature to automatically re-deploy an App's pod when the Secret changes is enabled. + appReload: true + +# -- Configure the configmaps for the chart here. +# Configmaps can be added by adding a dictionary key similar to the 'exampleConfig' configmap. +# By default the name of the configmap will be the name of the dictionary key +# TODO: nameOverride +# TODO: Ensure sha annotations on app are working +# @default -- See below +configmaps: + exampleConfig: + # -- Enables or disables the configMap + enabled: false + # -- Labels to add to the configMap + labels: {} + # -- Annotations to add to the configMap + annotations: {} + # -- configMap data content. Helm template enabled. + data: + {} + # foo: bar + # -- Override the name of this object. Default name if not overwritten will be releaseName-ChartName-objectName + fullNameOverride: + # -- When `true`, the feature to automatically re-deploy an App's pod when the ConfigMap changes is enabled. + appReload: true + +# -- Configure the services for the chart here. +# Services can be added by adding a dictionary key similar to the 'example' service. +# By default the name of the service will be the name of the dictionary key +# TODO: nameOverride +# @default -- See below +services: + example: + # -- Enables or disables the service + enabled: false + # -- Optional list of apps to attach this service. This corresponds to apps configured in the `apps` key + appName: + - example + # -- Override the name of this object. Default name if not overwritten will be releaseName-ChartName-objectName + fullNameOverride: + # -- Set the service type + type: ClusterIP + # -- Label sleector(s) for the service to associate Pods as Endpoints. This takes precedence over services.*.appName + selector: {} + # -- Set the clusterIP + # To deploy a headless service, set clusterIP: "None" + clusterIP: + # -- Specify the externalTrafficPolicy for the service. Options: Cluster, Local + # -- [[ref](https://kubernetes.io/docs/tutorials/services/source-ip/)] + externalTrafficPolicy: + # -- Specify the ip policy. Options: SingleStack, PreferDualStack, RequireDualStack + ipFamilyPolicy: + # -- The ip families that should be used. Options: IPv4, IPv6 + ipFamilies: [] + # -- Provide additional annotations which may be required. + annotations: {} + # -- Provide additional labels which may be required. + labels: {} + # -- Configure the Service port information here. + # Additional ports can be added by adding a dictionary key similar to the 'http' service. + # @default -- See below + ports: + http: + # -- Enables or disables the port + enabled: true + # -- The port number + port: + # -- Port protocol. + # Support values are `HTTP`, `HTTPS`, `TCP` and `UDP`. + # HTTPS and HTTPS spawn a TCP service and get used for internal URL and name generation + protocol: HTTP + # -- Specify a service targetPort if you wish to differ the service port from the application port. + # If `targetPort` is specified, this port number is used in the container definition instead of + # the `port` value. Therefore named ports are not supported for this field. + targetPort: + # -- Specify the nodePort value for the LoadBalancer and NodePort service types. + # [[ref]](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport) + nodePort: + +# -- Configure the ingresses for the chart here. +# Ingresses can be added by adding a dictionary key similar to the 'example' ingress. +# Name of the ingress object will be the name of the dictionary key +# @default -- See below +ingresses: + example: + # -- Enables or disables the ingress + enabled: false + # -- Name of the service to attach this ingress. This corresponds to an service configured un the `services` key + serviceName: example + # -- Override the name of this object. Default name if not overwritten will be releaseName-ChartName-objectName + fullNameOverride: + # -- Provide additional annotations + annotations: {} + # -- Provide additional labels + labels: {} + # -- Set the ingressClass that is used for this ingress. + # Requires Kubernetes >=1.19 + ingressClassName: # "nginx" + # -- Configure the hosts for the ingress + hosts: + - host: chart-example.local + paths: + - path: / + pathType: Prefix + service: + # -- Service Name for the path. By default this is ingresses.example.serviceName if not overwritten + # TODO: NOT IMPLEMENTED + name: + port: + tls: [] + +# -- Configure volumes for the chart here. +# Persistence items can be added by adding a dictionary key similar to the 'example' key. +# Name of the persistence object will be the name of the dictionary key unless overwritten with persistence.*.nameOverride +# @default -- See below +persistence: + example: + # -- Enables or disables the volume + enabled: false + + # -- Volume type. Available options are ["persistentVolume," "persistentVolumeClaim"] + # type.persistentVolume creates a PV and a PVC pair and uses the PVC as a volume on the app + # type.persistentVolumeClaim creates a new PVC or uses an existing PVC as a volume on the app + # TODO: type.persistentVolume not implemented + type: persistentVolumeClaim + + # -- Override the name of this object. Default name if not overwritten will be releaseName-ChartName-objectName + fullNameOverride: + + # -- Configure a persistentVolume and persistentVolumeClaim pair to be mounted to the app's primary container + # TODO: Not implemented + persistentVolume: + # -- PersistentVolumeClaim spec + # [[ref]](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) + spec: + capacity: + storage: 1Gi + accessModes: + - ReadWriteOnce + reclaimPolicy: + - Recycle + hostPath: + path: /tmp/data1 + + # -- Configure a Persistent Volume Claim to be mounted to the app's primary container + persistentVolumeClaim: + # -- Existing Persistent Volume Claim name. Takes precedence over persistentVolumeClaim.spec + existingClaim: + # -- PersistentVolumeClaim spec + # [[ref]](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) + spec: + accessModes: + - ReadWriteOnce + volumeMode: Filesystem + persistentVolumeReclaimPolicy: Retain + resources: + requests: + storage: 8Gi + storageClassName: slow + +# -- Configure the serviceAccounts for the chart here. +# ServiceAccounts can be added by adding a dictionary key similar to the 'example' serviceAccount. +# By default the name of the serviceAccount will be the name of the dictionary key unless overridden with serviceAccounts.*.nameOverride +# @default -- See below +serviceAccounts: + example: + # -- Enables or disables the service account + enabled: false + # -- Labels to add to the service account + labels: {} + # -- Annotations to add to the service account + annotations: {} + # -- Override the name of this object. Default name if not overwritten will be releaseName-ChartName-objectName + fullNameOverride: + +# -- Configure the roles for the chart here. +# Roles can be added by adding a dictionary key similar to the 'example' role. +# By default the name of the role will be the name of the dictionary key unless overridden with roles.*.nameOverride +# TODO: implement aggregated ClusterRoles +# @default -- See below +roles: + example: + # -- Enables or disables the role + enabled: false + # -- Labels to add to the role + labels: {} + # -- Annotations to add to the role + annotations: {} + # -- Override the name of this object. Default name if not overwritten will be releaseName-ChartName-objectName + fullNameOverride: + # -- Type of role. Must be either: ["Role", "ClusterRole"] + kind: Role + # -- Define the selectors used for aggregated ClusterRoles. Only used with ClusterRoles. + aggregationRule: {} + # clusterRoleSelectors: + # - matchLabels: + # rbac.example.com/aggregate-to-admin: "true" + # -- Configure the rules for the role + rules: [] + +# -- A rule must be express in the Kubernetes RBAC rule format +# - apiGroups: +# - "" +# resources: +# - "pods" +# verbs: +# - "get" +# - "watch" +# - "list" +# -- Configure the roleBindings for the chart here. +# RoleBindings can be added by adding a dictionary key similar to the 'example' roleBinding. +# By default the name of the roleBinding will be the name of the dictionary key unless overridden with roleBindings.*.nameOverride +# @default -- See below +roleBindings: + example: + # -- Enables or disables the roleBinding + enabled: false + # -- Labels to add to the clusterRole + labels: {} + # -- Annotations to add to the clusterRole + annotations: {} + # -- Override the name of this object. Default name if not overwritten will be releaseName-ChartName-objectName + fullNameOverride: + # -- Type of roleBinding. Must be either: ["RoleBinding", "ClusterRoleBinding"] + kind: RoleBinding + # -- Name of the service account to bind to the role + subjects: + # -- A list of one or more ServiceAccount descriptions. + # -- Name of the service account to bind to the role + - name: example + # The namespace of the service account subject. Optional. If no namespace is provided, then the namespace of the chart will be used. + namespace: + # -- Kind of the service account to bind to the role. Optional. Defaults to ServiceAccount. Must be one of: ["ServiceAccount", "User", "Group"]. Currently, only ServiceAccount is supported. + kind: ServiceAccount + # -- The Role to bind to the ServiceAccount + roleRef: + # -- Type of roleBinding. Must be either: ["RoleBinding", "ClusterRoleBinding"]. If the roleBinding is a ClusterRoleBinding, then roleRef.kind must be set to ClusterRole + kind: Role + # -- Name of the Role to bind to subjects. If roleRef.kind: is set to ClusterRoleBinding, then name must be the name of a ClusterRole + name: example +# -- Configure the troubleshoot for the chart here. +# troubleshoot can be added by adding a dictionary key. +# By default the supportBundle default spec from replicated will be disabled and not installed +troubleshoot: + # -- Specify the type of troubleshoot, Preflight or SupportBundle + support-bundles: + replicated: + # -- Enables or disables the support bundle + enabled: true + # -- Default spec to install + uri: https://raw.githubusercontent.com/replicatedhq/troubleshoot-specs/main/in-cluster/default.yaml + # -- Add custom support bundles here + my-custom-bundle: + enabled: true + collectors: + - clusterInfo: {} + - clusterResources: {} + - ceph: {} + - longhorn: {} + - logs: + collectorName: example + selector: + app: example + namespace: default + containerNames: + - example + - logs: + name: example + # -- Simply use the exact name of application for the appName. + appName: example + - logs: + name: all + # -- Use the wildcard *, if you wish to select all applications generated by this chart + appName: "*" + - logs: + collectorName: some-postgres-db + selector: + app: some-postgres-db + - configMap: + # -- Simply use the exact name of configMap generated by this chart or another external configMap + configMapName: "example-configmap" + # -- Define namespace where the ConfigMap exists + namespace: default + includeAllData: true + - configMap: + # -- Use the wildcard *, if you wish to select all configMaps generated by this chart + configMapName: "*" + # -- Current namespace of helm release will be the default namespace for the ConfigMap to collect, if you don't specify a namespace + includeAllData: true + - secret: + # -- Simply use the exact name of secret for the secretName generated by this chart or another external configMap + secretName: example-secret-registry + # -- Define namespace where the secret exists or leave blank for the current namespace of helm release + namespace: default + key: .dockerconfigjson + - secret: + # -- Use the wildcard *, if you wish to select all secrets generated by this chart + secretName: "*" + # -- Current namespace of helm release will be the default namespace for the secret to collect, if you don't specify a namespace + preflights: + # -- Add custom support preflight spec here + my-preflights: + # -- Specify the replicated preflight image for the container + image: replicated/preflight:latest + # -- Enables or disables the preflight + enabled: false + # -- Enable or disable the creation of RBAC roles to run the preflight + enableRBAC: false + # -- Add collectors and analyzers here + collectors: + - run: + collectorName: "static-hi" + image: "alpine:3" + command: ["echo", "hi static!"] + analyzers: + - textAnalyze: + checkName: Said hi! + fileName: /static-hi.log + regex: "hi static" + outcomes: + - fail: + message: Didn't say hi. + - pass: + message: Said hi! diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/values.yaml b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/values.yaml new file mode 100644 index 00000000..ac9c5110 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/values.yaml @@ -0,0 +1,91 @@ +# values.yaml +# For values.yaml configuration options and examples, refer to the values-example.yaml file. + +global: + # -- Set additional global labels. + labels: {} + # -- Set additional global annotations. + annotations: {} + # -- Set the full object prefix, defaults to releasName-ChartName if not set. This value takes precedence over nameOverride. + # Set to "-" to disable object name prefixing. + fullNameOverride: + # -- Set an override for the ChartName, defaults to ChartName if not set. + nameOverride: + # -- When `true``, the feature to automatically re-deploy an App's pods when a ConfigMap or Secret changes is enabled. + appReload: true + +defaults: + image: + pullPolicy: IfNotPresent + strategy: RollingUpdate + probes: + livenessProbe: + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 5 + terminationGracePeriodSeconds: 30 + readinessProbe: + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 5 + startupProbe: {} + +troubleshoot: + support-bundles: + replicated: + enabled: false + collectors: + - clusterInfo: {} + - clusterResources: {} + - ceph: {} + - longhorn: {} + - exec: + collectorName: weave-status + command: + - /home/weave/weave + args: + - --local + - status + containerName: weave + exclude: "" + name: kots/kurl/weave + namespace: kube-system + selector: + name: weave-net + timeout: 10s + - exec: + collectorName: weave-report + command: + - /home/weave/weave + args: + - --local + - report + containerName: weave + exclude: "" + name: kots/kurl/weave + namespace: kube-system + selector: + name: weave-net + timeout: 10s + - logs: + collectorName: weave-net + selector: + name: weave-net + namespace: kube-system + name: kots/kurl/weave + - logs: + collectorName: kube-flannel + selector: + app: flannel + namespace: kube-flannel + name: kots/kurl/flannel + - collectd: + collectorName: collectd + hostPath: /var/lib/collectd/rrd + image: alpine + imagePullPolicy: IfNotPresent + timeout: 5m diff --git a/applications/wg-easy/charts/wg-easy-upstream/templates/replicated-library.yaml b/applications/wg-easy/charts/wg-easy-upstream/templates/replicated-library.yaml new file mode 100644 index 00000000..699c6c04 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/templates/replicated-library.yaml @@ -0,0 +1,69 @@ +{{/* Make sure all variables are set properly */}} +{{- include "replicated-library.values.setup" . }} + +{{- define "hardcodedValues" -}} +{{- $wireguard := default dict .Values.wireguard -}} +{{- $password := default dict $wireguard.password -}} +apps: + wg-easy: + containers: + wg-container: + env: + WG_HOST: {{ required "external host name is required. Set wireguard.host" $wireguard.host }} + {{- if $wireguard.port }} + WG_PORT: {{ $wireguard.port }} + {{- end }} + {{- if $wireguard.mtu }} + WG_MTU: {{ $wireguard.mtu }} + {{- end }} + {{- if $wireguard.persistentKeepalive }} + WG_PERSISTENT_KEEPALIVE: {{ $wireguard.persistentKeepalive }} + {{- end }} + {{- if $wireguard.defaultAddress }} + WG_DEFAULT_ADDRESS: {{ $wireguard.defaultAddress }} + {{- end }} + {{- if $wireguard.defaultDns }} + WG_DEFAULT_DNS: {{ $wireguard.defaultDns }} + {{- end }} + {{- if $wireguard.allowedIps }} + WG_ALLOWED_IPS: {{ $wireguard.allowedIps }} + {{- end }} + {{- if $wireguard.preUp }} + WG_PRE_UP: {{ $wireguard.preUp }} + {{- end }} + {{- if $wireguard.postUp }} + WG_POST_UP: {{ $wireguard.postUp }} + {{- end }} + {{- if $wireguard.preDown }} + WG_PRE_DOWN: {{ $wireguard.preDown }} + {{- end }} + {{- if $wireguard.postDown }} + WG_POST_DOWN: {{ $wireguard.postDown }} + {{- end }} +{{- if $password }} + envFrom: + - secretRef: + name: {{ include "replicated-library.names.prefix" . }}-webpass +secrets: + webpass: + enabled: true + data: + PASSWORD: {{ $password }} +{{- end }} + +troubleshoot: + support-bundles: + wg-easy: # arbitrary name for your custom spec + enabled: true + collectors: + - logs: + name: wg-easy + collectorName: wg-easy + selector: + - app=wg-easy + namespace: {{ .Release.Namespace }} + containerNames: + - wg-easy +{{- end -}} +{{- $_ := mergeOverwrite .Values (include "hardcodedValues" . | fromYaml) -}} +{{- include "replicated-library.all" . }} diff --git a/applications/wg-easy/charts/wg-easy-upstream/values.yaml b/applications/wg-easy/charts/wg-easy-upstream/values.yaml new file mode 100644 index 00000000..5d7f7a29 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy-upstream/values.yaml @@ -0,0 +1,98 @@ +apps: + wg-easy: + enabled: true + type: deployment + replicas: 1 + podSecurityContext: + sysctls: + - name: net.ipv4.ip_forward + value: "1" + containers: + wg-container: + image: + repository: ghcr.io/wg-easy/wg-easy + tag: 9.0 + securityContext: + allowPrivilegeEscalation: false + capabilities: + add: + - NET_ADMIN + drop: [] + ports: + - containerPort: 51821 + protocol: TCP + - containerPort: 51820 + protocol: UDP + volumeMounts: + - mountPath: /etc/wireguard + name: config + resources: + requests: + cpu: 50m + memory: 50Mi + volumes: + - name: config + persistentVolumeClaim: + claimName: config +services: + web: + enabled: true + appName: + - wg-easy + type: ClusterIP + ipFamilyPolicy: SingleStack + ports: + http: + enabled: true + port: 51821 + protocol: HTTP + appProtocol: http + targetPort: 51821 + vpn: + enabled: true + appName: + - wg-easy + type: LoadBalancer + ports: + udp: + enabled: true + port: 51820 + protocol: UDP + appProtocol: udp + targetPort: 51820 +persistence: + config: + enabled: true + type: persistentVolumeClaim + persistentVolumeClaim: + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi + +# Wireguard configuration +wireguard: + # If password is defined will set a password on the web interface + #password: supersecure + # See https://github.com/WeeJeWel/wg-easy for configuration options + host: vpn.example.com + #port: + #mtu: + #persistentKeepalive: + #defaultAddress: + #defaultDns: + #allowedIps: + #preUp: + #postUp: + #preDown: + #postDown: + +# Troubleshoot +troubleshoot: + support-bundles: + # Replicated supplied default support bundle spec + replicated: + # -- Enables or disables the Replicated default support bundle + enabled: true diff --git a/applications/wg-easy/charts/wg-easy/Chart.lock b/applications/wg-easy/charts/wg-easy/Chart.lock new file mode 100644 index 00000000..a9480367 --- /dev/null +++ b/applications/wg-easy/charts/wg-easy/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: wg-easy + repository: file://../wg-easy-upstream + version: 1.0.0 +- name: templates + repository: file://../templates + version: 1.0.0 +digest: sha256:7b2acf7eb35e74172755aff2d1e71eae7805394db11eae3087defecefd0b5414 +generated: "2025-05-06T15:04:43.466431-04:00" diff --git a/applications/wg-easy/charts/wg-easy/Chart.yaml b/applications/wg-easy/charts/wg-easy/Chart.yaml index 5a78dd37..5dd1a786 100644 --- a/applications/wg-easy/charts/wg-easy/Chart.yaml +++ b/applications/wg-easy/charts/wg-easy/Chart.yaml @@ -4,7 +4,7 @@ apiVersion: v2 dependencies: - name: wg-easy version: '1.0.0' - repository: https://chris-sanders.github.io/helm-charts + repository: file://../wg-easy-upstream - name: templates version: '*' - repository: file://../charts/templates + repository: file://../templates From 015685d46678b300d62eac4c1445ee91a9a759ec Mon Sep 17 00:00:00 2001 From: Scott Rigby Date: Tue, 6 May 2025 15:23:48 -0400 Subject: [PATCH 05/14] Move wg-easy upstream chart to be a non-dependency subchart of our wrapper wg-easy chart Signed-off-by: Scott Rigby --- applications/wg-easy/charts/wg-easy/Chart.lock | 7 ++----- applications/wg-easy/charts/wg-easy/Chart.yaml | 3 --- .../charts/wg-easy}/.helmignore | 0 .../charts/wg-easy}/Chart.lock | 0 .../charts/wg-easy}/Chart.yaml | 0 .../{wg-easy-upstream => wg-easy/charts/wg-easy}/README.md | 0 .../charts/replicated-library/ADVANCED_TEMPLATING.md | 0 .../charts/wg-easy}/charts/replicated-library/Chart.yaml | 0 .../charts/wg-easy}/charts/replicated-library/FEATURES.md | 0 .../charts/wg-easy}/charts/replicated-library/README.md | 0 .../wg-easy}/charts/replicated-library/README.md.gotmpl | 0 .../charts/replicated-library/README_CHANGELOG.md.gotmpl | 0 .../charts/replicated-library/README_CONFIG.md.gotmpl | 0 .../wg-easy}/charts/replicated-library/templates/_all.tpl | 0 .../charts/replicated-library/templates/lib/_analyzer.tpl | 0 .../templates/lib/_analyzer_templates.tpl | 0 .../charts/replicated-library/templates/lib/_analyzers.tpl | 0 .../replicated-library/templates/lib/_annotations.tpl | 0 .../charts/replicated-library/templates/lib/_apps.tpl | 0 .../replicated-library/templates/lib/_capabilities.tpl | 0 .../charts/replicated-library/templates/lib/_collector.tpl | 0 .../replicated-library/templates/lib/_collectors.tpl | 0 .../charts/replicated-library/templates/lib/_configmap.tpl | 0 .../replicated-library/templates/lib/_configmaps.tpl | 0 .../charts/replicated-library/templates/lib/_container.tpl | 0 .../charts/replicated-library/templates/lib/_daemonset.tpl | 0 .../replicated-library/templates/lib/_deployment.tpl | 0 .../charts/replicated-library/templates/lib/_env_vars.tpl | 0 .../charts/replicated-library/templates/lib/_ingress.tpl | 0 .../charts/replicated-library/templates/lib/_ingresses.tpl | 0 .../replicated-library/templates/lib/_init_container.tpl | 0 .../charts/replicated-library/templates/lib/_labels.tpl | 0 .../charts/replicated-library/templates/lib/_names.tpl | 0 .../charts/replicated-library/templates/lib/_notes.tpl | 0 .../charts/replicated-library/templates/lib/_pod.tpl | 0 .../replicated-library/templates/lib/_pod_annotations.tpl | 0 .../replicated-library/templates/lib/_preflights.tpl | 0 .../charts/replicated-library/templates/lib/_pvc.tpl | 0 .../charts/replicated-library/templates/lib/_pvcs.tpl | 0 .../charts/replicated-library/templates/lib/_role.tpl | 0 .../replicated-library/templates/lib/_rolebinding.tpl | 0 .../replicated-library/templates/lib/_rolebindings.tpl | 0 .../charts/replicated-library/templates/lib/_roles.tpl | 0 .../charts/replicated-library/templates/lib/_secret.tpl | 0 .../charts/replicated-library/templates/lib/_secrets.tpl | 0 .../charts/replicated-library/templates/lib/_service.tpl | 0 .../replicated-library/templates/lib/_serviceaccount.tpl | 0 .../replicated-library/templates/lib/_serviceaccounts.tpl | 0 .../charts/replicated-library/templates/lib/_services.tpl | 0 .../replicated-library/templates/lib/_statefulset.tpl | 0 .../replicated-library/templates/lib/_support_bundle.tpl | 0 .../replicated-library/templates/lib/_troubleshoot.tpl | 0 .../charts/replicated-library/templates/lib/_values.tpl | 0 .../templates/lib/troubleshoot/_collector_collectd.tpl | 0 .../templates/lib/troubleshoot/_collector_configMap.tpl | 0 .../templates/lib/troubleshoot/_collector_copyFromHost.tpl | 0 .../templates/lib/troubleshoot/_collector_data.tpl | 0 .../templates/lib/troubleshoot/_collector_exec.tpl | 0 .../templates/lib/troubleshoot/_collector_general.tpl | 0 .../templates/lib/troubleshoot/_collector_logs.tpl | 0 .../templates/lib/troubleshoot/_collector_secrets.tpl | 0 .../wg-easy}/charts/replicated-library/values-example.yaml | 0 .../charts/wg-easy}/charts/replicated-library/values.yaml | 0 .../charts/wg-easy}/templates/replicated-library.yaml | 0 .../charts/wg-easy}/values.yaml | 0 65 files changed, 2 insertions(+), 8 deletions(-) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/.helmignore (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/Chart.lock (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/Chart.yaml (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/README.md (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/ADVANCED_TEMPLATING.md (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/Chart.yaml (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/FEATURES.md (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/README.md (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/README.md.gotmpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/README_CHANGELOG.md.gotmpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/README_CONFIG.md.gotmpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/_all.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_analyzer.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_analyzer_templates.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_analyzers.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_annotations.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_apps.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_capabilities.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_collector.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_collectors.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_configmap.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_configmaps.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_container.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_daemonset.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_deployment.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_env_vars.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_ingress.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_ingresses.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_init_container.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_labels.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_names.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_notes.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_pod.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_pod_annotations.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_preflights.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_pvc.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_pvcs.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_role.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_rolebinding.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_rolebindings.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_roles.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_secret.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_secrets.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_service.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_serviceaccount.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_serviceaccounts.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_services.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_statefulset.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_support_bundle.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_troubleshoot.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/_values.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/troubleshoot/_collector_collectd.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/troubleshoot/_collector_configMap.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/troubleshoot/_collector_copyFromHost.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/troubleshoot/_collector_data.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/troubleshoot/_collector_exec.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/troubleshoot/_collector_general.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/troubleshoot/_collector_logs.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/templates/lib/troubleshoot/_collector_secrets.tpl (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/values-example.yaml (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/charts/replicated-library/values.yaml (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/templates/replicated-library.yaml (100%) rename applications/wg-easy/charts/{wg-easy-upstream => wg-easy/charts/wg-easy}/values.yaml (100%) diff --git a/applications/wg-easy/charts/wg-easy/Chart.lock b/applications/wg-easy/charts/wg-easy/Chart.lock index a9480367..50409cc7 100644 --- a/applications/wg-easy/charts/wg-easy/Chart.lock +++ b/applications/wg-easy/charts/wg-easy/Chart.lock @@ -1,9 +1,6 @@ dependencies: -- name: wg-easy - repository: file://../wg-easy-upstream - version: 1.0.0 - name: templates repository: file://../templates version: 1.0.0 -digest: sha256:7b2acf7eb35e74172755aff2d1e71eae7805394db11eae3087defecefd0b5414 -generated: "2025-05-06T15:04:43.466431-04:00" +digest: sha256:9939fc386e44c7a8d0a274f270ec92ac70ac9858442b4f85638122044082da74 +generated: "2025-05-06T15:20:40.596254-04:00" diff --git a/applications/wg-easy/charts/wg-easy/Chart.yaml b/applications/wg-easy/charts/wg-easy/Chart.yaml index 5dd1a786..78ffbdcd 100644 --- a/applications/wg-easy/charts/wg-easy/Chart.yaml +++ b/applications/wg-easy/charts/wg-easy/Chart.yaml @@ -2,9 +2,6 @@ name: wg-easy version: 1.0.0 apiVersion: v2 dependencies: - - name: wg-easy - version: '1.0.0' - repository: file://../wg-easy-upstream - name: templates version: '*' repository: file://../templates diff --git a/applications/wg-easy/charts/wg-easy-upstream/.helmignore b/applications/wg-easy/charts/wg-easy/charts/wg-easy/.helmignore similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/.helmignore rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/.helmignore diff --git a/applications/wg-easy/charts/wg-easy-upstream/Chart.lock b/applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.lock similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/Chart.lock rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.lock diff --git a/applications/wg-easy/charts/wg-easy-upstream/Chart.yaml b/applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.yaml similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/Chart.yaml rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.yaml diff --git a/applications/wg-easy/charts/wg-easy-upstream/README.md b/applications/wg-easy/charts/wg-easy/charts/wg-easy/README.md similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/README.md rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/README.md diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/ADVANCED_TEMPLATING.md b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/ADVANCED_TEMPLATING.md similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/ADVANCED_TEMPLATING.md rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/ADVANCED_TEMPLATING.md diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/Chart.yaml b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/Chart.yaml similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/Chart.yaml rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/Chart.yaml diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/FEATURES.md b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/FEATURES.md similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/FEATURES.md rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/FEATURES.md diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README.md b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README.md similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README.md rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README.md diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README.md.gotmpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README.md.gotmpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README.md.gotmpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README.md.gotmpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README_CHANGELOG.md.gotmpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README_CHANGELOG.md.gotmpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README_CHANGELOG.md.gotmpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README_CHANGELOG.md.gotmpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README_CONFIG.md.gotmpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README_CONFIG.md.gotmpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/README_CONFIG.md.gotmpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README_CONFIG.md.gotmpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/_all.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/_all.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/_all.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/_all.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzer.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_analyzer.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzer.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_analyzer.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzer_templates.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_analyzer_templates.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzer_templates.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_analyzer_templates.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzers.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_analyzers.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_analyzers.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_analyzers.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_annotations.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_annotations.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_annotations.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_annotations.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_apps.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_apps.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_apps.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_apps.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_capabilities.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_capabilities.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_capabilities.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_capabilities.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_collector.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_collector.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_collector.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_collector.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_collectors.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_collectors.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_collectors.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_collectors.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_configmap.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_configmap.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_configmap.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_configmap.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_configmaps.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_configmaps.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_configmaps.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_configmaps.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_container.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_container.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_container.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_container.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_daemonset.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_daemonset.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_daemonset.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_daemonset.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_deployment.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_deployment.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_deployment.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_deployment.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_env_vars.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_env_vars.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_env_vars.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_env_vars.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_ingress.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_ingress.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_ingress.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_ingress.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_ingresses.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_ingresses.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_ingresses.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_ingresses.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_init_container.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_init_container.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_init_container.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_init_container.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_labels.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_labels.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_labels.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_labels.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_names.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_names.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_names.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_names.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_notes.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_notes.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_notes.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_notes.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pod.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pod.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pod.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pod.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pod_annotations.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pod_annotations.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pod_annotations.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pod_annotations.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_preflights.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_preflights.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_preflights.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_preflights.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pvc.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pvc.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pvc.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pvc.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pvcs.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pvcs.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_pvcs.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pvcs.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_role.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_role.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_role.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_role.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_rolebinding.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_rolebinding.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_rolebinding.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_rolebinding.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_rolebindings.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_rolebindings.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_rolebindings.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_rolebindings.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_roles.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_roles.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_roles.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_roles.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_secret.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_secret.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_secret.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_secret.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_secrets.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_secrets.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_secrets.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_secrets.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_service.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_service.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_service.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_service.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_serviceaccount.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_serviceaccount.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_serviceaccount.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_serviceaccount.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_serviceaccounts.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_serviceaccounts.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_serviceaccounts.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_serviceaccounts.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_services.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_services.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_services.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_services.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_statefulset.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_statefulset.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_statefulset.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_statefulset.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_support_bundle.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_support_bundle.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_support_bundle.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_support_bundle.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_troubleshoot.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_troubleshoot.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_troubleshoot.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_troubleshoot.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_values.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_values.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/_values.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_values.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_collectd.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_collectd.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_collectd.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_collectd.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_configMap.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_configMap.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_configMap.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_configMap.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_copyFromHost.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_copyFromHost.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_copyFromHost.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_copyFromHost.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_data.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_data.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_data.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_data.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_exec.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_exec.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_exec.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_exec.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_general.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_general.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_general.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_general.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_logs.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_logs.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_logs.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_logs.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_secrets.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_secrets.tpl similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/templates/lib/troubleshoot/_collector_secrets.tpl rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_secrets.tpl diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/values-example.yaml b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/values-example.yaml similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/values-example.yaml rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/values-example.yaml diff --git a/applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/values.yaml b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/values.yaml similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/charts/replicated-library/values.yaml rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/values.yaml diff --git a/applications/wg-easy/charts/wg-easy-upstream/templates/replicated-library.yaml b/applications/wg-easy/charts/wg-easy/charts/wg-easy/templates/replicated-library.yaml similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/templates/replicated-library.yaml rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/templates/replicated-library.yaml diff --git a/applications/wg-easy/charts/wg-easy-upstream/values.yaml b/applications/wg-easy/charts/wg-easy/charts/wg-easy/values.yaml similarity index 100% rename from applications/wg-easy/charts/wg-easy-upstream/values.yaml rename to applications/wg-easy/charts/wg-easy/charts/wg-easy/values.yaml From 743a0de4890ef54d911e35a0381481214bbb6988 Mon Sep 17 00:00:00 2001 From: Scott Rigby Date: Tue, 6 May 2025 15:24:32 -0400 Subject: [PATCH 06/14] Fix dep path for templates chart in all the other wrapper charts Signed-off-by: Scott Rigby --- applications/wg-easy/charts/cert-manager/Chart.yaml | 2 +- applications/wg-easy/charts/replicated-sdk/Chart.yaml | 2 +- applications/wg-easy/charts/traefik/Chart.yaml | 2 +- applications/wg-easy/docs/chart-structure.md | 2 +- applications/wg-easy/docs/development-workflow.md | 2 +- applications/wg-easy/docs/examples.md | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/applications/wg-easy/charts/cert-manager/Chart.yaml b/applications/wg-easy/charts/cert-manager/Chart.yaml index f2d64821..450e9609 100644 --- a/applications/wg-easy/charts/cert-manager/Chart.yaml +++ b/applications/wg-easy/charts/cert-manager/Chart.yaml @@ -7,4 +7,4 @@ dependencies: repository: https://charts.jetstack.io - name: templates version: '*' - repository: file://../charts/templates + repository: file://../templates diff --git a/applications/wg-easy/charts/replicated-sdk/Chart.yaml b/applications/wg-easy/charts/replicated-sdk/Chart.yaml index f933f479..2906a616 100644 --- a/applications/wg-easy/charts/replicated-sdk/Chart.yaml +++ b/applications/wg-easy/charts/replicated-sdk/Chart.yaml @@ -4,7 +4,7 @@ apiVersion: v2 dependencies: - name: templates version: '*' - repository: file://../charts/templates + repository: file://../templates - name: replicated repository: oci://registry.replicated.com/library version: 1.1.1 \ No newline at end of file diff --git a/applications/wg-easy/charts/traefik/Chart.yaml b/applications/wg-easy/charts/traefik/Chart.yaml index c73b0b63..4f54c2a6 100644 --- a/applications/wg-easy/charts/traefik/Chart.yaml +++ b/applications/wg-easy/charts/traefik/Chart.yaml @@ -8,4 +8,4 @@ dependencies: repository: https://traefik.github.io/charts - name: templates version: '*' - repository: file://../charts/templates + repository: file://../templates diff --git a/applications/wg-easy/docs/chart-structure.md b/applications/wg-easy/docs/chart-structure.md index a5463fca..45864941 100644 --- a/applications/wg-easy/docs/chart-structure.md +++ b/applications/wg-easy/docs/chart-structure.md @@ -39,7 +39,7 @@ dependencies: repository: https://charts.jetstack.io - name: templates version: '*' - repository: file://../charts/templates + repository: file://../templates ``` ### Customization Control diff --git a/applications/wg-easy/docs/development-workflow.md b/applications/wg-easy/docs/development-workflow.md index dd0d149d..29e359dc 100644 --- a/applications/wg-easy/docs/development-workflow.md +++ b/applications/wg-easy/docs/development-workflow.md @@ -36,7 +36,7 @@ Begin by defining and verifying chart dependencies. repository: https://charts.jetstack.io - name: templates version: '*' - repository: file://../charts/templates + repository: file://../templates ``` 2. Update dependencies: diff --git a/applications/wg-easy/docs/examples.md b/applications/wg-easy/docs/examples.md index 301753bc..69f44664 100644 --- a/applications/wg-easy/docs/examples.md +++ b/applications/wg-easy/docs/examples.md @@ -19,7 +19,7 @@ dependencies: repository: https://charts.jetstack.io - name: templates version: '*' - repository: file://../charts/templates + repository: file://../templates ``` ```bash @@ -176,7 +176,7 @@ dependencies: repository: https://helm.traefik.io/traefik - name: templates version: '*' - repository: file://../charts/templates + repository: file://../templates ``` ```yaml From 3f659348ddd0ab0fd55a86a17f7ac1b3601cbcaa Mon Sep 17 00:00:00 2001 From: ada mancini Date: Tue, 6 May 2025 15:32:02 -0400 Subject: [PATCH 07/14] add a "clean" task --- applications/wg-easy/Taskfile.yaml | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/applications/wg-easy/Taskfile.yaml b/applications/wg-easy/Taskfile.yaml index fd59723a..2eda25f2 100644 --- a/applications/wg-easy/Taskfile.yaml +++ b/applications/wg-easy/Taskfile.yaml @@ -447,6 +447,50 @@ tasks: # Confirm archiving echo "Customer '$CUSTOMER_NAME' (ID: {{.CUSTOMER_ID}}) successfully archived" + clean: + desc: Remove temporary Helm directories, chart dependencies, and release folder + silent: false + cmds: + - echo "Cleaning temporary directories and dependencies..." + - | + # Remove the release directory + if [ -d "./release" ]; then + echo "Removing release directory..." + rm -rf ./release + fi + + # Find and remove tmpcharts-* directories + echo "Removing temporary chart directories..." + find . -type d -name "tmpcharts-*" -print + find . -type d -name "tmpcharts-*" -exec rm -rf {} \; 2>/dev/null || true + + # Find charts directories that only contain .tgz files (dependencies) + echo "Removing chart dependency directories..." + for charts_dir in $(find . -type d -name "charts"); do + # Skip if the charts directory is in ./charts/ (which is our template charts directory) + if [[ "$charts_dir" == "./charts" || "$charts_dir" == "./charts/"* ]]; then + continue + fi + + # Check if the directory only contains .tgz files + NON_TGZ_FILES=$(find "$charts_dir" -type f -not -name "*.tgz" | wc -l | tr -d ' ') + TOTAL_FILES=$(find "$charts_dir" -type f | wc -l | tr -d ' ') + + if [ "$TOTAL_FILES" -gt 0 ] && [ "$NON_TGZ_FILES" -eq 0 ]; then + # Check if the directory contains any subdirectories + SUBDIRS=$(find "$charts_dir" -mindepth 1 -type d | wc -l | tr -d ' ') + + if [ "$SUBDIRS" -eq 0 ]; then + echo "Removing entire chart dependency directory: $charts_dir" + rm -rf "$charts_dir" + else + echo "Removing chart dependencies in $charts_dir (keeping subdirectories)" + rm -f "$charts_dir"/*.tgz + fi + fi + done + - echo "Cleaning complete!" + full-test-cycle: desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete silent: false From 4d079a8b52db979f7002c6e58b606aec46c53af8 Mon Sep 17 00:00:00 2001 From: Scott Rigby Date: Tue, 6 May 2025 15:36:35 -0400 Subject: [PATCH 08/14] Fix dep update (was max 2 dirs down from root) Signed-off-by: Scott Rigby --- applications/wg-easy/Taskfile.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/wg-easy/Taskfile.yaml b/applications/wg-easy/Taskfile.yaml index adf7f65b..cb598daa 100644 --- a/applications/wg-easy/Taskfile.yaml +++ b/applications/wg-easy/Taskfile.yaml @@ -131,7 +131,7 @@ tasks: - echo "Updating Helm dependencies for all charts..." - | # Find all charts and update their dependencies - for chart_dir in $(find . -maxdepth 2 -name "Chart.yaml" | xargs dirname); do + for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do echo "Updating dependency $chart_dir" helm dependency update "$chart_dir" done From fdd29ad66524bd83ac0942ae2b54bfda68b71836 Mon Sep 17 00:00:00 2001 From: Scott Rigby Date: Tue, 6 May 2025 15:44:51 -0400 Subject: [PATCH 09/14] Update gitignore to not ignore subchart dirs, and not ignore Chart.lock files (these are good to commit in general) Signed-off-by: Scott Rigby --- .gitignore | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitignore b/.gitignore index 40e7995f..7a6cfe09 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,6 @@ **/charts/*.tgz **/.specstory/ - -# Ignore Helm dependency directories -**/charts/*.lock - # General files to ignore *.log *.gz @@ -53,8 +49,6 @@ applications/mlflow/tests/.venv/ # wg-easy specific *.kubeconfig applications/wg-easy/release/ -applications/wg-easy/*/charts/ -applications/wg-easy/*/Chart.lock .aider* # SpecStory explanation file .specstory/.what-is-this.md From f2d47a636d2903aca80156b57cdd0eead5d0b431 Mon Sep 17 00:00:00 2001 From: Scott Rigby Date: Tue, 6 May 2025 15:45:43 -0400 Subject: [PATCH 10/14] Commit Chart.lock files Signed-off-by: Scott Rigby --- applications/wg-easy/charts/cert-manager/Chart.lock | 9 +++++++++ applications/wg-easy/charts/replicated-sdk/Chart.lock | 9 +++++++++ applications/wg-easy/charts/traefik/Chart.lock | 9 +++++++++ 3 files changed, 27 insertions(+) create mode 100644 applications/wg-easy/charts/cert-manager/Chart.lock create mode 100644 applications/wg-easy/charts/replicated-sdk/Chart.lock create mode 100644 applications/wg-easy/charts/traefik/Chart.lock diff --git a/applications/wg-easy/charts/cert-manager/Chart.lock b/applications/wg-easy/charts/cert-manager/Chart.lock new file mode 100644 index 00000000..90b49255 --- /dev/null +++ b/applications/wg-easy/charts/cert-manager/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: cert-manager + repository: https://charts.jetstack.io + version: v1.14.5 +- name: templates + repository: file://../templates + version: 1.0.0 +digest: sha256:ab86a335f7f473446968c607ed7920bf4ce29f625e5ff6175be17bb2e1101a32 +generated: "2025-05-06T15:35:47.871225-04:00" diff --git a/applications/wg-easy/charts/replicated-sdk/Chart.lock b/applications/wg-easy/charts/replicated-sdk/Chart.lock new file mode 100644 index 00000000..fffac1cf --- /dev/null +++ b/applications/wg-easy/charts/replicated-sdk/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: templates + repository: file://../templates + version: 1.0.0 +- name: replicated + repository: oci://registry.replicated.com/library + version: 1.1.1 +digest: sha256:bb2c4743fae54061dfde5812086300bf9ed7c86f9f4d80ccb0858df407d21a2a +generated: "2025-05-06T15:35:43.881588-04:00" diff --git a/applications/wg-easy/charts/traefik/Chart.lock b/applications/wg-easy/charts/traefik/Chart.lock new file mode 100644 index 00000000..aadcaee4 --- /dev/null +++ b/applications/wg-easy/charts/traefik/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: traefik + repository: https://traefik.github.io/charts + version: 28.0.0 +- name: templates + repository: file://../templates + version: 1.0.0 +digest: sha256:14c6de6f10918ec6bbe2d6e99408da62b362fc7950ce8793ebaaa4693ffdeb75 +generated: "2025-05-06T15:35:53.545992-04:00" From d9f5f8d8c477e3e8678c165d804a9a990ad23c9c Mon Sep 17 00:00:00 2001 From: ada mancini Date: Tue, 6 May 2025 09:27:40 -0400 Subject: [PATCH 11/14] set VERSION var by default --- applications/wg-easy/Taskfile.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/applications/wg-easy/Taskfile.yaml b/applications/wg-easy/Taskfile.yaml index cb598daa..ec38f0ab 100644 --- a/applications/wg-easy/Taskfile.yaml +++ b/applications/wg-easy/Taskfile.yaml @@ -133,7 +133,7 @@ tasks: # Find all charts and update their dependencies for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do echo "Updating dependency $chart_dir" - helm dependency update "$chart_dir" + helm dependency update --skip-refresh "$chart_dir" done - echo "All dependencies updated!" @@ -283,8 +283,10 @@ tasks: release-create: desc: Create and promote a release using the Replicated CLI silent: false + run: once vars: CHANNEL: '{{.CHANNEL | default "Unstable"}}' + VERSION: '{{.VERSION | default "0.0.1"}}' RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}' requires: vars: [APP_SLUG, VERSION] From 3806a82c46b5065a91bfd03f35b0feb8cee3cb7a Mon Sep 17 00:00:00 2001 From: ada mancini Date: Tue, 6 May 2025 11:47:37 -0400 Subject: [PATCH 12/14] release create and customer create tasks --- applications/wg-easy/Taskfile.yaml | 108 +++++++++++++++++++++-- applications/wg-easy/taskfiles/utils.yml | 34 +++++++ 2 files changed, 133 insertions(+), 9 deletions(-) diff --git a/applications/wg-easy/Taskfile.yaml b/applications/wg-easy/Taskfile.yaml index ec38f0ab..e46be59e 100644 --- a/applications/wg-easy/Taskfile.yaml +++ b/applications/wg-easy/Taskfile.yaml @@ -6,7 +6,13 @@ includes: vars: # Application configuration - APP_SLUG: '{{.REPLICATED_APP | default "wg-easy"}}' + APP_NAME: '{{.REPLICATED_APP | default "wg-easy"}}' + APP_SLUG: '{{.REPLICATED_APP_SLUG | default "wg-easy-cre"}}' + + # Release configuration + RELEASE_CHANNELd: '{{.RELEASE_CHANNEL | default "Unstable"}}' + RELEASE_VERSION: '{{.RELEASE_VERSION | default "0.0.1"}}' + RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}' # Cluster configuration CLUSTER_NAME: '{{.CLUSTER_NAME | default "test-cluster"}}' @@ -137,8 +143,8 @@ tasks: done - echo "All dependencies updated!" - ports-expose: - desc: Expose configured ports and capture exposed URLs + cluster-ports-expose: + desc: Expose configured ports for a cluster and capture exposed URLs silent: false run: once status: @@ -166,8 +172,8 @@ tasks: deps: - cluster-create - helm-deploy: - desc: Deploy all charts using helmfile + helm-install: + desc: Install all charts using helmfile silent: false cmds: - echo "Installing all charts via helmfile" @@ -185,10 +191,10 @@ tasks: # Deploy with helmfile echo "Using $ENV_VARS" eval "KUBECONFIG={{.KUBECONFIG_FILE}} $ENV_VARS helmfile sync --wait" - - echo "All charts deployed!" + - echo "All charts installed!" deps: - setup-kubeconfig - - ports-expose + - cluster-ports-expose cluster-delete: desc: Delete all test clusters with matching name and clean up kubeconfig @@ -300,6 +306,53 @@ tasks: deps: - release-prepare + customer-create: + desc: Create a new customer or get existing customer with matching name and return their ID + silent: false + run: once + vars: + CUSTOMER_NAME: '{{.CUSTOMER_NAME | default "test-customer"}}' + CUSTOMER_EMAIL: '{{.CUSTOMER_EMAIL | default "test@example.com"}}' + CHANNEL: '{{.CHANNEL | default "Unstable"}}' + LICENSE_TYPE: '{{.LICENSE_TYPE | default "dev"}}' + EXPIRES_IN: '{{.EXPIRES_IN | default ""}}' + requires: + vars: [APP_SLUG] + cmds: + - | + # First check if customer already exists + echo "Looking for existing customer {{.CUSTOMER_NAME}} for app {{.APP_SLUG}}..." + EXISTING_CUSTOMER=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.name=="{{.CUSTOMER_NAME}}") | .id' | head -1) + + if [ -n "$EXISTING_CUSTOMER" ]; then + echo "Found existing customer {{.CUSTOMER_NAME}} with ID: $EXISTING_CUSTOMER" + echo "$EXISTING_CUSTOMER" + exit 0 + fi + + # No existing customer found, create a new one + echo "Creating new customer {{.CUSTOMER_NAME}} for app {{.APP_SLUG}}..." + + # Build the command with optional expiration + CMD="replicated customer create \ + --app {{.APP_SLUG}} \ + --name {{.CUSTOMER_NAME}} \ + --email {{.CUSTOMER_EMAIL}} \ + --channel {{.CHANNEL}} \ + --type {{.LICENSE_TYPE}} \ + --output json" + + # Add expiration if specified + if [ -n "{{.EXPIRES_IN}}" ]; then + CMD="$CMD --expires-in {{.EXPIRES_IN}}" + fi + + # Create the customer and capture the output + CUSTOMER_JSON=$($CMD) + + # Extract and output just the customer ID + echo "$CUSTOMER_JSON" | jq -r '.id' + gcp-vm-create: desc: Create a simple GCP VM instance silent: false @@ -357,14 +410,51 @@ tasks: GCP_ZONE: '{{.GCP_ZONE}}' VM_NAME: '{{.VM_NAME}}' + customer-ls: + desc: List customers for the application + silent: false + vars: + OUTPUT_FORMAT: '{{.OUTPUT_FORMAT | default "table"}}' + requires: + vars: [APP_SLUG] + cmds: + - echo "Listing customers for app {{.APP_SLUG}}..." + - replicated customer ls --app {{.APP_SLUG}} --output {{.OUTPUT_FORMAT}} + + customer-delete: + desc: Archive a customer by ID + silent: false + vars: + CUSTOMER_ID: '{{.CUSTOMER_ID}}' + requires: + vars: [APP_SLUG, CUSTOMER_ID] + cmds: + - echo "Archiving customer with ID {{.CUSTOMER_ID}} from app {{.APP_SLUG}}..." + - | + # Verify customer exists before attempting to archive + CUSTOMER_EXISTS=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.id=="{{.CUSTOMER_ID}}") | .id') + if [ -z "$CUSTOMER_EXISTS" ]; then + echo "Error: Customer with ID {{.CUSTOMER_ID}} not found for app {{.APP_SLUG}}" + exit 1 + fi + + # Get customer name for confirmation message + CUSTOMER_NAME=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.id=="{{.CUSTOMER_ID}}") | .name') + + # Archive the customer + replicated customer archive {{.CUSTOMER_ID}} --app {{.APP_SLUG}} + + # Confirm archiving + echo "Customer '$CUSTOMER_NAME' (ID: {{.CUSTOMER_ID}}) successfully archived" + full-test-cycle: desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete silent: false cmds: - task: cluster-create - task: setup-kubeconfig - - task: ports-expose + - task: cluster-ports-expose - task: dependencies-update - - task: helm-deploy + - task: helm-install - task: test - task: cluster-delete diff --git a/applications/wg-easy/taskfiles/utils.yml b/applications/wg-easy/taskfiles/utils.yml index 7b3a14de..67e26e6f 100644 --- a/applications/wg-easy/taskfiles/utils.yml +++ b/applications/wg-easy/taskfiles/utils.yml @@ -132,6 +132,40 @@ tasks: echo "TF_EXPOSED_URL=$TF_EXPOSED_URL TF_EXPOSED_HTTP_URL=$TF_EXPOSED_HTTP_URL" fi + vendor-api-auth: + desc: Verify authorization against Replicated Vendor API + silent: false + vars: + API_TOKEN: '{{.REPLICATED_API_TOKEN | default (env "REPLICATED_API_TOKEN")}}' + cmds: + - | + echo "Verifying Replicated Vendor API authorization..." + + # Check if API token is provided + if [ -z "{{.API_TOKEN}}" ]; then + echo "ERROR: No API token provided." + echo "Please set the REPLICATED_API_TOKEN environment variable or provide it as a task variable." + echo "You can generate an API token in the Replicated Vendor Portal under 'API Tokens'." + echo "Documentation: https://docs.replicated.com/reference/vendor-api-using" + exit 1 + fi + + # Make API request to check authentication + AUTH_RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \ + -H "Authorization: {{.API_TOKEN}}" \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + "https://api.replicated.com/vendor/v3/auth") + + if [ "$AUTH_RESPONSE" = "200" ]; then + echo "Authentication successful! Token is valid." + exit 0 + else + echo "ERROR: Authentication failed with status code $AUTH_RESPONSE." + echo "Please check your API token and try again." + exit 1 + fi + gcp-operations: desc: GCP VM operations internal: true From 734972fb3ca2fef22b301038d4cbdd7642d2a34a Mon Sep 17 00:00:00 2001 From: ada mancini Date: Tue, 6 May 2025 15:32:02 -0400 Subject: [PATCH 13/14] add a "clean" task --- applications/wg-easy/Taskfile.yaml | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/applications/wg-easy/Taskfile.yaml b/applications/wg-easy/Taskfile.yaml index e46be59e..d0fc9f53 100644 --- a/applications/wg-easy/Taskfile.yaml +++ b/applications/wg-easy/Taskfile.yaml @@ -447,6 +447,50 @@ tasks: # Confirm archiving echo "Customer '$CUSTOMER_NAME' (ID: {{.CUSTOMER_ID}}) successfully archived" + clean: + desc: Remove temporary Helm directories, chart dependencies, and release folder + silent: false + cmds: + - echo "Cleaning temporary directories and dependencies..." + - | + # Remove the release directory + if [ -d "./release" ]; then + echo "Removing release directory..." + rm -rf ./release + fi + + # Find and remove tmpcharts-* directories + echo "Removing temporary chart directories..." + find . -type d -name "tmpcharts-*" -print + find . -type d -name "tmpcharts-*" -exec rm -rf {} \; 2>/dev/null || true + + # Find charts directories that only contain .tgz files (dependencies) + echo "Removing chart dependency directories..." + for charts_dir in $(find . -type d -name "charts"); do + # Skip if the charts directory is in ./charts/ (which is our template charts directory) + if [[ "$charts_dir" == "./charts" || "$charts_dir" == "./charts/"* ]]; then + continue + fi + + # Check if the directory only contains .tgz files + NON_TGZ_FILES=$(find "$charts_dir" -type f -not -name "*.tgz" | wc -l | tr -d ' ') + TOTAL_FILES=$(find "$charts_dir" -type f | wc -l | tr -d ' ') + + if [ "$TOTAL_FILES" -gt 0 ] && [ "$NON_TGZ_FILES" -eq 0 ]; then + # Check if the directory contains any subdirectories + SUBDIRS=$(find "$charts_dir" -mindepth 1 -type d | wc -l | tr -d ' ') + + if [ "$SUBDIRS" -eq 0 ]; then + echo "Removing entire chart dependency directory: $charts_dir" + rm -rf "$charts_dir" + else + echo "Removing chart dependencies in $charts_dir (keeping subdirectories)" + rm -f "$charts_dir"/*.tgz + fi + fi + done + - echo "Cleaning complete!" + full-test-cycle: desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete silent: false From 797828cc395f1c9168fb0ba32fe9b47e5b3c28b3 Mon Sep 17 00:00:00 2001 From: ada mancini Date: Tue, 6 May 2025 15:58:00 -0400 Subject: [PATCH 14/14] update task for charts folder under charts/ --- applications/wg-easy/Taskfile.yaml | 44 ++++++++++-------------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/applications/wg-easy/Taskfile.yaml b/applications/wg-easy/Taskfile.yaml index d0fc9f53..8d5dc9f5 100644 --- a/applications/wg-easy/Taskfile.yaml +++ b/applications/wg-easy/Taskfile.yaml @@ -276,10 +276,10 @@ tasks: - echo "Packaging Helm charts..." - | # Find top-level directories containing Chart.yaml files - for chart_dir in $(find . -maxdepth 2 -name "Chart.yaml" | xargs dirname); do + for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do echo "Packaging chart: $chart_dir" # Navigate to chart directory, package it, and move the resulting .tgz to release folder - (cd "$chart_dir" && helm package . && mv *.tgz ../release/) + (cd "$chart_dir" && helm package . && mv *.tgz ../../release/) done - echo "Release files prepared in ./release/ directory" @@ -458,37 +458,21 @@ tasks: echo "Removing release directory..." rm -rf ./release fi - - # Find and remove tmpcharts-* directories + + # Find and remove tmpcharts-* directories in charts/ echo "Removing temporary chart directories..." + find charts/ -type d -name "tmpcharts-*" -print + find charts/ -type d -name "tmpcharts-*" -exec rm -rf {} \; 2>/dev/null || true + + # Clean up chart dependencies (.tgz files) in charts/*/charts/ + echo "Removing chart dependencies..." + find charts/ -path "*/charts/*.tgz" -type f -print + find charts/ -path "*/charts/*.tgz" -type f -delete + + # Clean up any tmpcharts directories in subdirectories + echo "Cleaning up any remaining tmpcharts directories..." find . -type d -name "tmpcharts-*" -print find . -type d -name "tmpcharts-*" -exec rm -rf {} \; 2>/dev/null || true - - # Find charts directories that only contain .tgz files (dependencies) - echo "Removing chart dependency directories..." - for charts_dir in $(find . -type d -name "charts"); do - # Skip if the charts directory is in ./charts/ (which is our template charts directory) - if [[ "$charts_dir" == "./charts" || "$charts_dir" == "./charts/"* ]]; then - continue - fi - - # Check if the directory only contains .tgz files - NON_TGZ_FILES=$(find "$charts_dir" -type f -not -name "*.tgz" | wc -l | tr -d ' ') - TOTAL_FILES=$(find "$charts_dir" -type f | wc -l | tr -d ' ') - - if [ "$TOTAL_FILES" -gt 0 ] && [ "$NON_TGZ_FILES" -eq 0 ]; then - # Check if the directory contains any subdirectories - SUBDIRS=$(find "$charts_dir" -mindepth 1 -type d | wc -l | tr -d ' ') - - if [ "$SUBDIRS" -eq 0 ]; then - echo "Removing entire chart dependency directory: $charts_dir" - rm -rf "$charts_dir" - else - echo "Removing chart dependencies in $charts_dir (keeping subdirectories)" - rm -f "$charts_dir"/*.tgz - fi - fi - done - echo "Cleaning complete!" full-test-cycle: