diff --git a/.gitignore b/.gitignore index b6ae2d13..08372041 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ *.tgz # Ignore IDE and editor folders +.cursorindexingignore .idea/ .vscode/ *.swp @@ -42,6 +43,9 @@ __pycache__/ # Cursor .cursor/ +# Claude +.claude/ + # Mlflow specific applications/mlflow/tests/.venv/ **/charts/.rendered-templates/ @@ -53,3 +57,5 @@ applications/wg-easy/release/ # SpecStory explanation file .specstory/.what-is-this.md *.tar.gz + +**/.claude/settings.local.json diff --git a/applications/wg-easy/CLAUDE.md b/applications/wg-easy/CLAUDE.md new file mode 100644 index 00000000..a7211b3e --- /dev/null +++ b/applications/wg-easy/CLAUDE.md @@ -0,0 +1,219 @@ +# CLAUDE.md for WG-Easy Helm Chart Development + +This file contains common commands and workflows for working with the WG-Easy Helm chart project. + +## Core Principles + +The WG-Easy Helm Chart pattern is built on five fundamental principles: + +### 1. Progressive Complexity + +Start simple with individual chart validation and progressively move to more complex environments. This allows issues to be caught early when they are easier to fix. + +- Begin with local chart validation +- Move to single chart deployments +- Progress to multi-chart integration +- Finally test in production-like environments + +### 2. Fast Feedback Loops + +Get immediate feedback at each development stage by automating testing and validation. This shortens the overall development cycle. + +- Automated chart validation +- Quick cluster creation and deployment +- Standardized testing at each stage +- Fast iteration between changes + +### 3. Reproducible Steps + +Ensure consistent environments and processes across all stages of development, eliminating "works on my machine" issues. + +- Consistent chart configurations +- Automated environment setup +- Deterministic dependency management +- Standardized deployment procedures + +### 4. Modular Configuration + +Allow different components to own their configuration independently, which can be merged at release time. + +- Per-chart configuration files +- Automatic configuration merging +- Clear ownership boundaries +- Simplified collaborative development + +### 5. Automation First + +Use tools to automate repetitive tasks, reducing human error and increasing development velocity. + +- Task-based workflow automation +- Helmfile for orchestration +- Automated validation and testing +- Streamlined release process + +## Project Filesystem Layout + +- `charts/` - Contains all Helm 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 +- `taskfiles/` - Task utility functions +- `helmfile.yaml.gotmpl` - Defines chart installation order +- `Taskfile.yaml` - Main task definitions + +## Architecture Overview + +Key components: +- **Taskfile**: Orchestrates the workflow with automated tasks +- **Helmfile**: Manages chart dependencies and installation order +- **Wrapped Charts**: Encapsulate upstream charts for consistency +- **Shared Templates**: Provide reusable components across charts +- **Replicated Integration**: Enables enterprise distribution + +## `wg-easy` Chart + +wg-easy uses the `bjw-s/common` [library chart](https://github.com/bjw-s-labs/helm-charts/tree/main) to generate Kubernetes resources. Library charts are commonly used to create DRY templates when authoring Helm charts. + +Example values inputs to the bjw-s/common library chart are defined at https://github.com/bjw-s-labs/helm-charts/blob/main/charts/library/common/values.yaml and the schema for validation is defined at https://github.com/bjw-s-labs/helm-charts/blob/main/charts/library/common/values.schema.json + +## `templates` Chart + +The `templates` chart is imported as a dependency in Chart.yaml and is used to generate some common Kubernetes resources like Traefik routes. + +## Development Environment Setup + +```bash +# Start the development container +task dev:start + +# Get a shell in the development container +task dev:shell + +# Stop the development container +task dev:stop + +# Rebuild the development container image +task dev:build-image +``` + +## Cluster Management + +```bash +# Create a test cluster (K3s by default) +task cluster-create + +# Get information about the current cluster +task cluster-list + +# Set up kubeconfig for the test cluster +task setup-kubeconfig + +# Expose ports for the cluster +task cluster-ports-expose + +# Delete the test cluster +task cluster-delete +``` + +## Chart Development + +```bash +# Update Helm dependencies for all charts +task dependencies-update + +# Install all charts using Helmfile +task helm-install + +# Run tests +task test + +# Full test cycle (create cluster, deploy, test, delete) +task full-test-cycle +``` + +## Release Management + +```bash +# Prepare release files +task release-prepare + +# Create and promote a release +task release-create RELEASE_VERSION=x.y.z RELEASE_CHANNEL=Unstable + +# Customer management +task customer-create CUSTOMER_NAME=example +task customer-ls +task customer-delete CUSTOMER_ID=your-customer-id +``` + +## Customization Options + +Common variables that can be overridden: + +```bash +# Cluster configuration +CLUSTER_NAME=test-cluster +K8S_VERSION=1.32.2 +DISK_SIZE=100 +INSTANCE_TYPE=r1.small +DISTRIBUTION=k3s + +# Release configuration +RELEASE_CHANNEL=Unstable +RELEASE_VERSION=0.0.1 +RELEASE_NOTES="Release notes" + +# Application configuration +APP_SLUG=wg-easy-cre +``` + +## Claude Code Configuration + +When using Claude Code with this repository, use these timeout settings for long-running operations: + +- `task helm-install`: Use 1200000ms (20 minutes) timeout - double the helmfile timeout of 600s +- `task full-test-cycle`: Use 1800000ms (30 minutes) timeout - accounts for cluster creation + deployment + testing +- `task cluster-create`: Use 600000ms (10 minutes) timeout - double typical cluster creation time + +Example: When running `task helm-install` via Bash tool, use `timeout: 1200000` parameter. + +## Common Workflows + +### Local Development + +1. Start development container: `task dev:start` +2. Get a shell in the container: `task dev:shell` +3. Create a test cluster: `task cluster-create` +4. Set up kubeconfig: `task setup-kubeconfig` +5. Update dependencies: `task dependencies-update` +6. Deploy charts: `task helm-install` +7. Run tests: `task test` +8. Clean up: `task cluster-delete` + +### Creating a Release + +1. Update chart versions in respective `Chart.yaml` files +2. Prepare release files: `task release-prepare` +3. Create and promote release: `task release-create RELEASE_VERSION=x.y.z RELEASE_CHANNEL=Unstable` + +### Testing a Release + +1. Create a customer if needed: `task customer-create CUSTOMER_NAME=test-customer` +2. Create a test cluster: `task cluster-create` +3. Set up kubeconfig: `task setup-kubeconfig` +4. Expose ports: `task cluster-ports-expose` +5. Deploy application: `task helm-install` +6. Run tests: `task test` +7. Clean up: `task cluster-delete` + +## Additional Resources + +- [Chart Structure Guide](docs/chart-structure.md) +- [Development Workflow](docs/development-workflow.md) +- [Task Reference](docs/task-reference.md) +- [Replicated Integration](docs/replicated-integration.md) +- [Example Patterns](docs/examples.md) \ No newline at end of file diff --git a/applications/wg-easy/Taskfile.yaml b/applications/wg-easy/Taskfile.yaml index d025f66a..1c5eb454 100644 --- a/applications/wg-easy/Taskfile.yaml +++ b/applications/wg-easy/Taskfile.yaml @@ -6,17 +6,16 @@ includes: vars: # Application configuration - APP_NAME: '{{.REPLICATED_APP | default "wg-easy"}}' - APP_SLUG: '{{.REPLICATED_APP_SLUG | default "wg-easy-cre"}}' + APP_SLUG: '{{.REPLICATED_APP | default "wg-easy-cre"}}' # Release configuration - RELEASE_CHANNELd: '{{.RELEASE_CHANNEL | default "Unstable"}}' + RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}' RELEASE_VERSION: '{{.RELEASE_VERSION | default "0.0.1"}}' RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}' REPLICATED_LICENSE_ID: '{{.REPLICATED_LICENSE_ID}}' # Cluster configuration - CLUSTER_NAME: '{{.CLUSTER_NAME | default (printf "%s-cluster" (or (env "USER") "wg-easy-dev"))}}' + CLUSTER_NAME: '{{.CLUSTER_NAME | default (printf "%s-cluster" (or (env "USER") "wg-easy-dev"))}}' K8S_VERSION: '{{.K8S_VERSION | default "1.32.2"}}' DISK_SIZE: '{{.DISK_SIZE | default "100"}}' INSTANCE_TYPE: '{{.INSTANCE_TYPE | default "r1.small"}}' @@ -27,8 +26,6 @@ vars: EXPOSE_PORTS: - port: 30443 protocol: https - - port: 30080 - protocol: http # GCP default configuration GCP_PROJECT: '{{.GCP_PROJECT | default "replicated-qa"}}' @@ -196,10 +193,10 @@ tasks: silent: false vars: DRY_RUN: '{{.DRY_RUN | default "false"}}' - cmds: + cmds: - | PREFLIGHT_FLAGS="" - if [ "{{.DRY_RUN}}" = "true" ]; then + if [ "{{.DRY_RUN}}" = "true" ]; then PREFLIGHT_FLAGS="--dry-run" fi @@ -215,8 +212,6 @@ tasks: silent: true vars: HELM_ENV: '{{.HELM_ENV | default "default"}}' - requires: - vars: [REPLICATED_LICENSE_ID] cmds: - echo "Installing all charts via helmfile" - | @@ -238,6 +233,28 @@ tasks: - setup-kubeconfig - cluster-ports-expose + helm-uninstall: + desc: Uninstall all charts using helm uninstall + silent: false + cmds: + - echo "Uninstalling all charts via helm" + - | + # Get cluster ID + CLUSTER_ID=$(replicated cluster ls --output json | jq -r '.[] | select(.name == "{{.CLUSTER_NAME}}") | .id') + if [ -z "$CLUSTER_ID" ]; then + echo "Error: Could not find cluster with name {{.CLUSTER_NAME}}" + exit 1 + fi + + # Get the list of installed releases and uninstall them + KUBECONFIG={{.KUBECONFIG_FILE}} helm list --all-namespaces -o json | jq -r '.[] | .name + " -n " + .namespace' | while read release; do + echo "Uninstalling helm release: $release" + KUBECONFIG={{.KUBECONFIG_FILE}} helm uninstall $release + done + - echo "All charts uninstalled!" + deps: + - setup-kubeconfig + cluster-delete: desc: Delete all test clusters with matching name and clean up kubeconfig silent: false @@ -276,23 +293,22 @@ tasks: - find ./replicated -name '*.yaml' -not -name 'config.yaml' -exec cp {} ./release/ \; 2>/dev/null || true # extract namespaces from helmChart files - - yq ea '[.spec.namespace] | unique' */replicated/helmChart-*.yaml | yq '.spec.additionalNamespaces *= load("/dev/stdin") | .spec.additionalNamespaces += "*" ' replicated/application.yaml > release/application.yaml.new + - echo "Extracting namespaces from helmChart files..." + - yq ea '[.spec.namespace] | unique' ./charts/*/replicated/helmChart-*.yaml | yq '.spec.additionalNamespaces *= load("/dev/stdin") | .spec.additionalNamespaces += "*" ' replicated/application.yaml > release/application.yaml.new + - cat release/application.yaml.new - mv release/application.yaml.new release/application.yaml # set helmChart versions from associated helm Chart.yaml - echo "Setting helmChart versions..." - | - while read directory; do - - echo $directory - parent=$(basename $(dirname $directory)) - + # Find all replicated directories and update helmChart files in one loop + find ./charts -maxdepth 2 -mindepth 2 -type d -name replicated | while read chartDir; do + echo $chartDir + parent=$(basename $(dirname $chartDir)) helmChartName="helmChart-$parent.yaml" - export version=$(yq -r '.version' $parent/Chart.yaml ) - - yq '.spec.chart.chartVersion = strenv(version) | .spec.chart.chartVersion style="single"' $directory/$helmChartName | tee release/$helmChartName - - done < <(find . -maxdepth 2 -mindepth 2 -type d -name replicated) + export version=$(yq -r '.version' $chartDir/../Chart.yaml ) + yq '.spec.chart.chartVersion = strenv(version) | .spec.chart.chartVersion style="single"' $chartDir/$helmChartName | tee release/$helmChartName + done # Merge config.yaml files - echo "Merging config.yaml files..." @@ -317,8 +333,8 @@ tasks: # Package Helm charts - echo "Packaging Helm charts..." - | - # Find top-level directories containing Chart.yaml files - for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do + # Find top-level directories containing Chart.yaml files, excluding the templates chart + for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | grep -v "charts/templates" | 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/) @@ -333,18 +349,18 @@ tasks: silent: false run: once vars: - CHANNEL: '{{.CHANNEL | default "Unstable"}}' - VERSION: '{{.VERSION | default "0.0.1"}}' + RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}' + RELEASE_VERSION: '{{.RELEASE_VERSION | default "0.0.1"}}' RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}' requires: - vars: [APP_SLUG, VERSION] + vars: [APP_SLUG, RELEASE_CHANNEL, RELEASE_VERSION] cmds: - - echo "Creating and promoting release for {{.APP_SLUG}} to channel {{.CHANNEL}}..." + - echo "Creating and promoting release for {{.APP_SLUG}} to channel {{.RELEASE_CHANNEL}}..." - | # Create and promote the release in one step echo "Creating release from files in ./release directory..." - replicated release create --app {{.APP_SLUG}} --yaml-dir ./release --release-notes "{{.RELEASE_NOTES}}" --promote {{.CHANNEL}} --version {{.VERSION}} - echo "Release version {{.VERSION}} created and promoted to channel {{.CHANNEL}}" + replicated release create --app {{.APP_SLUG}} --yaml-dir ./release --release-notes "{{.RELEASE_NOTES}}" --promote {{.RELEASE_CHANNEL}} --version {{.RELEASE_VERSION}} + echo "Release version {{.RELEASE_VERSION}} created and promoted to channel {{.RELEASE_CHANNEL}}" deps: - release-prepare @@ -355,7 +371,7 @@ tasks: vars: CUSTOMER_NAME: '{{.CUSTOMER_NAME | default "test-customer"}}' CUSTOMER_EMAIL: '{{.CUSTOMER_EMAIL | default "test@example.com"}}' - CHANNEL: '{{.CHANNEL | default "Unstable"}}' + RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}' LICENSE_TYPE: '{{.LICENSE_TYPE | default "dev"}}' EXPIRES_IN: '{{.EXPIRES_IN | default ""}}' requires: @@ -380,7 +396,7 @@ tasks: --app {{.APP_SLUG}} \ --name {{.CUSTOMER_NAME}} \ --email {{.CUSTOMER_EMAIL}} \ - --channel {{.CHANNEL}} \ + --channel {{.RELEASE_CHANNEL}} \ --type {{.LICENSE_TYPE}} \ --output json" @@ -433,7 +449,8 @@ tasks: desc: Setup Replicated embedded cluster on the GCP VM silent: false vars: - CHANNEL: '{{.CHANNEL | default "Unstable"}}' + RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}' + AUTH_TOKEN: '{{.AUTH_TOKEN | default "2usDXzovcJNcpn54yS5tFQVNvCq"}}' deps: - gcp-vm-create status: @@ -445,7 +462,7 @@ tasks: vars: OPERATION: "setup-embedded" APP_SLUG: '{{.APP_SLUG}}' - CHANNEL: '{{.CHANNEL}}' + RELEASE_CHANNEL: '{{.RELEASE_CHANNEL}}' AUTH_TOKEN: '{{.REPLICATED_LICENSE_ID}}' GCP_PROJECT: '{{.GCP_PROJECT}}' GCP_ZONE: '{{.GCP_ZONE}}' @@ -517,7 +534,7 @@ tasks: - echo "Cleaning complete!" full-test-cycle: - desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete + desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete, and clean up build artifacts silent: false cmds: - task: cluster-create @@ -599,13 +616,13 @@ tasks: SSH_BASE_CMD="$SSH_BASE_CMD -i {{.CMX_VM_PUBLIC_KEY}}" fi VM_SSH_CMD=$(replicated vm ls --output=json | jq -r ".[] | select(.name == \"{{.CMX_VM_NAME}}\") | \"$SSH_BASE_CMD -p \(.direct_ssh_port) {{.CMX_VM_USER}}@\(.direct_ssh_endpoint)\"") - + echo "SSH base command: $SSH_BASE_CMD" $VM_SSH_CMD << 'EOF' set -e echo 'Downloading {{.APP_NAME}} installer...' curl -f 'https://replicated.app/embedded/{{.APP_NAME}}/{{.CHANNEL}}' -H 'Authorization: {{.REPLICATED_LICENSE_ID}}' -o {{.APP_NAME}}-{{.CHANNEL}}.tgz - + echo 'Extracting installer...' tar -xvzf {{.APP_NAME}}-{{.CHANNEL}}.tgz @@ -623,4 +640,4 @@ tasks: echo "Visit above URL to access the Admin Console, password: {{.ADMIN_CONSOLE_PASSWORD}}" fi - + diff --git a/applications/wg-easy/charts/replicated/values.yaml b/applications/wg-easy/charts/replicated/values.yaml index 32fbdcb4..bbed9490 100644 --- a/applications/wg-easy/charts/replicated/values.yaml +++ b/applications/wg-easy/charts/replicated/values.yaml @@ -1 +1,3 @@ -# Values for replicated-sdk chart \ No newline at end of file +# Values for replicated-sdk chart +replicated: + enabled: true diff --git a/applications/wg-easy/charts/wg-easy/charts/wg-easy/.helmignore b/applications/wg-easy/charts/wg-easy/.helmignore similarity index 100% rename from applications/wg-easy/charts/wg-easy/charts/wg-easy/.helmignore rename to applications/wg-easy/charts/wg-easy/.helmignore diff --git a/applications/wg-easy/charts/wg-easy/Chart.lock b/applications/wg-easy/charts/wg-easy/Chart.lock index 50409cc7..b9b323fd 100644 --- a/applications/wg-easy/charts/wg-easy/Chart.lock +++ b/applications/wg-easy/charts/wg-easy/Chart.lock @@ -1,6 +1,9 @@ dependencies: +- name: common + repository: https://bjw-s-labs.github.io/helm-charts + version: 3.7.3 - name: templates repository: file://../templates version: 1.0.0 -digest: sha256:9939fc386e44c7a8d0a274f270ec92ac70ac9858442b4f85638122044082da74 -generated: "2025-05-06T15:20:40.596254-04:00" +digest: sha256:4299a659fd462eb3faa8d3edd7930d66aad60bb19842777aa8a54e89e8aeee6f +generated: "2025-05-09T10:01:18.649929-04:00" diff --git a/applications/wg-easy/charts/wg-easy/Chart.yaml b/applications/wg-easy/charts/wg-easy/Chart.yaml index 78ffbdcd..bf1d3b59 100644 --- a/applications/wg-easy/charts/wg-easy/Chart.yaml +++ b/applications/wg-easy/charts/wg-easy/Chart.yaml @@ -1,7 +1,15 @@ -name: wg-easy -version: 1.0.0 apiVersion: v2 dependencies: - - name: templates - version: '*' - repository: file://../templates +- name: common + repository: https://bjw-s-labs.github.io/helm-charts + version: 3.7.3 +- name: templates + version: '*' + repository: file://../templates +description: Simple wireguard with web configuration management +home: https://github.com/replicatedhq/platform-examples/ +maintainers: +- name: Replicated, Inc. + url: https://github.com/replicatedhq/platform-examples/ +name: wg-easy +version: 1.0.0 diff --git a/applications/wg-easy/charts/wg-easy/charts/wg-easy/README.md b/applications/wg-easy/charts/wg-easy/README.md similarity index 100% rename from applications/wg-easy/charts/wg-easy/charts/wg-easy/README.md rename to applications/wg-easy/charts/wg-easy/README.md diff --git a/applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.lock b/applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.lock deleted file mode 100644 index 08dd4d52..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.lock +++ /dev/null @@ -1,6 +0,0 @@ -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/charts/wg-easy/Chart.yaml b/applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.yaml deleted file mode 100644 index 216664a9..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.yaml +++ /dev/null @@ -1,13 +0,0 @@ -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/charts/wg-easy/charts/replicated-library/ADVANCED_TEMPLATING.md b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/ADVANCED_TEMPLATING.md deleted file mode 100644 index b3a8b0dd..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/ADVANCED_TEMPLATING.md +++ /dev/null @@ -1,165 +0,0 @@ -## 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/charts/wg-easy/charts/replicated-library/Chart.yaml b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/Chart.yaml deleted file mode 100644 index 616fb4ee..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/Chart.yaml +++ /dev/null @@ -1,14 +0,0 @@ -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/charts/wg-easy/charts/replicated-library/FEATURES.md b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/FEATURES.md deleted file mode 100644 index 75334ee5..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/FEATURES.md +++ /dev/null @@ -1,203 +0,0 @@ -## 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/charts/wg-easy/charts/replicated-library/README.md b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README.md deleted file mode 100644 index 3ba63968..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README.md +++ /dev/null @@ -1,273 +0,0 @@ -# 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/charts/wg-easy/charts/replicated-library/README.md.gotmpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README.md.gotmpl deleted file mode 100644 index 624e8073..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README.md.gotmpl +++ /dev/null @@ -1,83 +0,0 @@ -{{- 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/charts/wg-easy/charts/replicated-library/README_CHANGELOG.md.gotmpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README_CHANGELOG.md.gotmpl deleted file mode 100644 index df4182c2..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README_CHANGELOG.md.gotmpl +++ /dev/null @@ -1,216 +0,0 @@ -{{- 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/charts/wg-easy/charts/replicated-library/README_CONFIG.md.gotmpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README_CONFIG.md.gotmpl deleted file mode 100644 index 0be3e11c..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/README_CONFIG.md.gotmpl +++ /dev/null @@ -1,46 +0,0 @@ -{{- 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/charts/wg-easy/charts/replicated-library/templates/_all.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/_all.tpl deleted file mode 100644 index 8c000d05..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/_all.tpl +++ /dev/null @@ -1,32 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_analyzer.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_analyzer.tpl deleted file mode 100644 index 982f74f3..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_analyzer.tpl +++ /dev/null @@ -1,17 +0,0 @@ -{{/* -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/charts/wg-easy/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 deleted file mode 100644 index a2c5c5cc..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_analyzer_templates.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{{- 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/charts/wg-easy/charts/replicated-library/templates/lib/_analyzers.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_analyzers.tpl deleted file mode 100644 index 501a6559..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_analyzers.tpl +++ /dev/null @@ -1,16 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_annotations.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_annotations.tpl deleted file mode 100644 index 068055d6..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_annotations.tpl +++ /dev/null @@ -1,10 +0,0 @@ -{{/* 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/charts/wg-easy/charts/replicated-library/templates/lib/_apps.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_apps.tpl deleted file mode 100644 index 4476db83..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_apps.tpl +++ /dev/null @@ -1,26 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_capabilities.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_capabilities.tpl deleted file mode 100644 index 6d98986a..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_capabilities.tpl +++ /dev/null @@ -1,19 +0,0 @@ -{{/* 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/charts/wg-easy/charts/replicated-library/templates/lib/_collector.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_collector.tpl deleted file mode 100644 index 48444d45..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_collector.tpl +++ /dev/null @@ -1,31 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_collectors.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_collectors.tpl deleted file mode 100644 index 1af6efa3..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_collectors.tpl +++ /dev/null @@ -1,16 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_configmap.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_configmap.tpl deleted file mode 100644 index 14f0bac0..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_configmap.tpl +++ /dev/null @@ -1,28 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_configmaps.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_configmaps.tpl deleted file mode 100644 index 0a538453..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_configmaps.tpl +++ /dev/null @@ -1,16 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_container.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_container.tpl deleted file mode 100644 index 0954d7b9..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_container.tpl +++ /dev/null @@ -1,105 +0,0 @@ -{{- /* 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/charts/wg-easy/charts/replicated-library/templates/lib/_daemonset.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_daemonset.tpl deleted file mode 100644 index 6fde5ad2..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_daemonset.tpl +++ /dev/null @@ -1,58 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_deployment.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_deployment.tpl deleted file mode 100644 index 42b8ab1b..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_deployment.tpl +++ /dev/null @@ -1,63 +0,0 @@ -{{/* -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/charts/wg-easy/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 deleted file mode 100644 index 633dfbb2..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_env_vars.tpl +++ /dev/null @@ -1,44 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_ingress.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_ingress.tpl deleted file mode 100644 index cbb40ed3..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_ingress.tpl +++ /dev/null @@ -1,90 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_ingresses.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_ingresses.tpl deleted file mode 100644 index 5b2d188a..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_ingresses.tpl +++ /dev/null @@ -1,34 +0,0 @@ -{{/* -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/charts/wg-easy/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 deleted file mode 100644 index e0be592b..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_init_container.tpl +++ /dev/null @@ -1,69 +0,0 @@ -{{- /* 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/charts/wg-easy/charts/replicated-library/templates/lib/_labels.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_labels.tpl deleted file mode 100644 index a513183e..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_labels.tpl +++ /dev/null @@ -1,70 +0,0 @@ -{{/* 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/charts/wg-easy/charts/replicated-library/templates/lib/_names.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_names.tpl deleted file mode 100644 index 631fa605..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_names.tpl +++ /dev/null @@ -1,95 +0,0 @@ -{{/* 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/charts/wg-easy/charts/replicated-library/templates/lib/_notes.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_notes.tpl deleted file mode 100644 index cd675dd0..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_notes.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{{/* -Default NOTES.txt content. -*/}} diff --git a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pod.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pod.tpl deleted file mode 100644 index 51c30462..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pod.tpl +++ /dev/null @@ -1,116 +0,0 @@ -{{- /* -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/charts/wg-easy/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 deleted file mode 100644 index 7a76e3de..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pod_annotations.tpl +++ /dev/null @@ -1,93 +0,0 @@ -{{/* 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/charts/wg-easy/charts/replicated-library/templates/lib/_preflights.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_preflights.tpl deleted file mode 100644 index c8ec9bac..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_preflights.tpl +++ /dev/null @@ -1,171 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_pvc.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pvc.tpl deleted file mode 100644 index 547cd389..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pvc.tpl +++ /dev/null @@ -1,30 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_pvcs.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pvcs.tpl deleted file mode 100644 index de5c539c..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_pvcs.tpl +++ /dev/null @@ -1,19 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_role.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_role.tpl deleted file mode 100644 index 438c3c92..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_role.tpl +++ /dev/null @@ -1,44 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_rolebinding.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_rolebinding.tpl deleted file mode 100644 index a1ed7143..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_rolebinding.tpl +++ /dev/null @@ -1,48 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_rolebindings.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_rolebindings.tpl deleted file mode 100644 index 4aa123da..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_rolebindings.tpl +++ /dev/null @@ -1,12 +0,0 @@ -{{/* 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/charts/wg-easy/charts/replicated-library/templates/lib/_roles.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_roles.tpl deleted file mode 100644 index c7f61854..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_roles.tpl +++ /dev/null @@ -1,13 +0,0 @@ -{{/* 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/charts/wg-easy/charts/replicated-library/templates/lib/_secret.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_secret.tpl deleted file mode 100644 index 401fb1b7..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_secret.tpl +++ /dev/null @@ -1,29 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_secrets.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_secrets.tpl deleted file mode 100644 index 009a1970..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_secrets.tpl +++ /dev/null @@ -1,17 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_service.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_service.tpl deleted file mode 100644 index 7e7f6f56..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_service.tpl +++ /dev/null @@ -1,92 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_serviceaccount.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_serviceaccount.tpl deleted file mode 100644 index 15156bb1..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_serviceaccount.tpl +++ /dev/null @@ -1,23 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_serviceaccounts.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_serviceaccounts.tpl deleted file mode 100644 index b5fc3fdd..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_serviceaccounts.tpl +++ /dev/null @@ -1,13 +0,0 @@ -{{/* 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/charts/wg-easy/charts/replicated-library/templates/lib/_services.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_services.tpl deleted file mode 100644 index 636947c5..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_services.tpl +++ /dev/null @@ -1,17 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_statefulset.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_statefulset.tpl deleted file mode 100644 index bfd1aac2..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_statefulset.tpl +++ /dev/null @@ -1,93 +0,0 @@ -{{/* -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/charts/wg-easy/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 deleted file mode 100644 index 910b0577..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_support_bundle.tpl +++ /dev/null @@ -1,36 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_troubleshoot.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_troubleshoot.tpl deleted file mode 100644 index affa7f63..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_troubleshoot.tpl +++ /dev/null @@ -1,30 +0,0 @@ -{{/* -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/charts/wg-easy/charts/replicated-library/templates/lib/_values.tpl b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_values.tpl deleted file mode 100644 index 173f02da..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/_values.tpl +++ /dev/null @@ -1,9 +0,0 @@ -{{/* 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/charts/wg-easy/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 deleted file mode 100644 index a365096e..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_collectd.tpl +++ /dev/null @@ -1,46 +0,0 @@ -{{- 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/charts/wg-easy/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 deleted file mode 100644 index 2a9e3a68..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_configMap.tpl +++ /dev/null @@ -1,43 +0,0 @@ -{{- 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/charts/wg-easy/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 deleted file mode 100644 index 6756883b..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_copyFromHost.tpl +++ /dev/null @@ -1,44 +0,0 @@ -{{- 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/charts/wg-easy/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 deleted file mode 100644 index ebc74dd1..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_data.tpl +++ /dev/null @@ -1,19 +0,0 @@ -{{- 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/charts/wg-easy/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 deleted file mode 100644 index 9e3afe16..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_exec.tpl +++ /dev/null @@ -1,69 +0,0 @@ -{{- 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/charts/wg-easy/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 deleted file mode 100644 index 8900476c..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_general.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{{- 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/charts/wg-easy/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 deleted file mode 100644 index d008aab3..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_logs.tpl +++ /dev/null @@ -1,58 +0,0 @@ -{{- 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/charts/wg-easy/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 deleted file mode 100644 index e9549b1a..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/templates/lib/troubleshoot/_collector_secrets.tpl +++ /dev/null @@ -1,35 +0,0 @@ -{{- 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/charts/wg-easy/charts/replicated-library/values-example.yaml b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/values-example.yaml deleted file mode 100644 index 759930f1..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/values-example.yaml +++ /dev/null @@ -1,557 +0,0 @@ -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/charts/wg-easy/charts/replicated-library/values.yaml b/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/values.yaml deleted file mode 100644 index ac9c5110..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/charts/replicated-library/values.yaml +++ /dev/null @@ -1,91 +0,0 @@ -# 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/charts/wg-easy/templates/replicated-library.yaml b/applications/wg-easy/charts/wg-easy/charts/wg-easy/templates/replicated-library.yaml deleted file mode 100644 index 699c6c04..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/templates/replicated-library.yaml +++ /dev/null @@ -1,69 +0,0 @@ -{{/* 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/charts/wg-easy/values.yaml b/applications/wg-easy/charts/wg-easy/charts/wg-easy/values.yaml deleted file mode 100644 index 5d7f7a29..00000000 --- a/applications/wg-easy/charts/wg-easy/charts/wg-easy/values.yaml +++ /dev/null @@ -1,98 +0,0 @@ -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/templates/common.yaml b/applications/wg-easy/charts/wg-easy/templates/common.yaml new file mode 100644 index 00000000..6da812bd --- /dev/null +++ b/applications/wg-easy/charts/wg-easy/templates/common.yaml @@ -0,0 +1,14 @@ +--- +{{- include "bjw-s.common.loader.init" . }} + +{{- define "app-template.hardcodedValues" -}} +# Set the nameOverride based on the release name if no override has been set +{{ if not .Values.global.nameOverride }} +global: + nameOverride: "{{ .Release.Name }}" +{{ end }} +{{- end -}} +{{- $_ := mergeOverwrite .Values (include "app-template.hardcodedValues" . | fromYaml) -}} + +{{/* Render the templates */}} +{{ include "bjw-s.common.loader.generate" . }} diff --git a/applications/wg-easy/charts/wg-easy/values.yaml b/applications/wg-easy/charts/wg-easy/values.yaml index e033dfaa..5349c109 100644 --- a/applications/wg-easy/charts/wg-easy/values.yaml +++ b/applications/wg-easy/charts/wg-easy/values.yaml @@ -1,40 +1,131 @@ -wg-easy: - global: - fullNameOverride: public - apps: - wg-easy: - fullNameOverride: public - containers: - wg-container: - resources: - requests: - cpu: 5m - memory: 35Mi - persistence: - config: - persistentVolumeClaim: - spec: - resources: - requests: - storage: 1Gi - services: - vpn: - type: NodePort - wireguard: - password: "testpass" - host: "example.com" - port: 51820 # This is used in the postUp - defaultAddress: "10.10.10.x" - defaultDns: "1.1.1.1" - allowedIps: "0.0.0.0/5, 8.0.0.0/7, 11.0.0.0/8, 12.0.0.0/6, 16.0.0.0/4, 32.0.0.0/3, 64.0.0.0/2, 128.0.0.0/3, 160.0.0.0/5, 168.0.0.0/6, 172.0.0.0/12, 172.32.0.0/11, 172.64.0.0/10, 172.128.0.0/9, 173.0.0.0/8, 174.0.0.0/7, 176.0.0.0/4, 192.0.0.0/9, 192.128.0.0/11, 192.160.0.0/13, 192.169.0.0/16, 192.170.0.0/15, 192.172.0.0/14, 192.176.0.0/12, 192.192.0.0/10, 193.0.0.0/8, 194.0.0.0/7, 196.0.0.0/6, 200.0.0.0/5, 208.0.0.0/4, 224.0.0.0/3" - postUp: "iptables -A FORWARD -i wg0 -o eth0 -d 192.168.0.0/16,172.16.0.0/12,10.0.0.0/8 -j DROP; iptables -t nat -A POSTROUTING -s 10.10.10.0/24 -o eth0 -j MASQUERADE; iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT; iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT" +# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s-labs/helm-charts/app-template-3.7.3/charts/other/app-template/values.schema.json + +# Wireguard configuration +wireguard: +# If password is defined will set a password on the web interface +# password must be a bcrypted hash - use +# podman run ghcr.io/wg-easy/wg-easy wgpw YOUR_PASSWORD +# to generate a hash - default is literally YOUR_PASSWORD + password: '$2a$12$Zh4e0Lnbfhh3.EJTLKPApOCOZgjmaWm0eOMDI7YkoACKMjKPFs7.a' +# See https://github.com/WeeJeWel/wg-easy for configuration options + host: example.com + device: eth0 + port: 51820 # This is used in the postUp + defaultAddress: 10.10.10.x + defaultDns: 1.1.1.1 + allowedIps: 0.0.0.0/5, 8.0.0.0/7, 11.0.0.0/8, 12.0.0.0/6, 16.0.0.0/4, 32.0.0.0/3, 64.0.0.0/2, 128.0.0.0/3, 160.0.0.0/5, 168.0.0.0/6, 172.0.0.0/12, 172.32.0.0/11, 172.64.0.0/10, 172.128.0.0/9, 173.0.0.0/8, 174.0.0.0/7, 176.0.0.0/4, 192.0.0.0/9, 192.128.0.0/11, 192.160.0.0/13, 192.169.0.0/16, 192.170.0.0/15, 192.172.0.0/14, 192.176.0.0/12, 192.192.0.0/10, 193.0.0.0/8, 194.0.0.0/7, 196.0.0.0/6, 200.0.0.0/5, 208.0.0.0/4, 224.0.0.0/3 + postUp: iptables -A FORWARD -i wg0 -o eth0 -d 192.168.0.0/16,172.16.0.0/12,10.0.0.0/8 -j DROP; iptables -t nat -A POSTROUTING -s 10.10.10.0/24 -o eth0 -j MASQUERADE; iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT; iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT + +# Shared templates for Traefik routes templates: traefikRoutes: web-tls: - hostName: "example.com" - serviceName: public-web - servicePort: 51821 - web: - hostName: "example.com" - serviceName: public-web + hostName: '{{ dig "wireguard" "host" "example.com" .Values }}' + serviceName: wg-easy servicePort: 51821 + +controllers: + wg-easy: + serviceAccount: + name: default + pod: + enableServiceLinks: true + securityContext: + sysctls: + - name: net.ipv4.ip_forward + value: "1" + containers: + wg-container: + env: + # Host is required, no default makes sense + WG_HOST: '{{ required "external host name is required. Set wireguard.host" .Values.wireguard.host }}' + WG_DEVICE: '{{ dig "wireguard" "device" "eth0" .Values }}' + # Use dig with sensible defaults for all other parameters + WG_PORT: '{{ dig "wireguard" "port" "" .Values }}' + WG_MTU: '{{ dig "wireguard" "mtu" "" .Values}}' + WG_PERSISTENT_KEEPALIVE: '{{ dig "wireguard" "persistentKeepalive" "" .Values }}' + WG_DEFAULT_ADDRESS: '{{ dig "wireguard" "defaultAddress" "" .Values }}' + WG_DEFAULT_DNS: '{{ dig "wireguard" "defaultDns" "" .Values }}' + WG_ALLOWED_IPS: '{{ dig "wireguard" "allowedIps" "" .Values }}' + WG_PRE_UP: '{{ dig "wireguard" "preUp" "" .Values }}' + WG_POST_UP: '{{ dig "wireguard" "postUp" "" .Values }}' + WG_PRE_DOWN: '{{ dig "wireguard" "preDown" "" .Values }}' + WG_POST_DOWN: '{{ dig "wireguard" "postDown" "" .Values }}' + envFrom: + - secretRef: + identifier: webpass + image: + repository: ghcr.io/wg-easy/wg-easy + tag: 14.0 + pullPolicy: IfNotPresent + ports: + - containerPort: 51821 + protocol: TCP + - containerPort: 51820 + protocol: UDP + resources: + requests: + cpu: 50m + memory: 50Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + add: + - NET_ADMIN + - SYS_MODULE + probes: + liveness: + enabled: true + spec: + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 5 + readiness: + enabled: true + spec: + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 5 +secrets: + webpass: + enabled: true + stringData: + PASSWORD_HASH: '{{ dig "wireguard" "password" "$2a$12$Zh4e0Lnbfhh3.EJTLKPApOCOZgjmaWm0eOMDI7YkoACKMjKPFs7.a" .Values }}' +service: + web: + controller: wg-easy + enabled: true + type: ClusterIP + ipFamilyPolicy: SingleStack + ipFamilies: + - IPv4 + ports: + http: + enabled: true + port: 51821 + protocol: HTTP + primary: true + vpn: + controller: wg-easy + enabled: true + type: NodePort + ipFamilyPolicy: SingleStack + ipFamilies: + - IPv4 + ports: + udp: + enabled: true + port: 51820 + protocol: UDP +persistence: + config: + enabled: true + type: persistentVolumeClaim + storageClass: '' + accessMode: ReadWriteOnce + size: 1Gi + retain: false + globalMounts: + - path: /etc/wireguard diff --git a/applications/wg-easy/helmfile.yaml.gotmpl b/applications/wg-easy/helmfile.yaml.gotmpl index 6c0017b9..e23269e5 100644 --- a/applications/wg-easy/helmfile.yaml.gotmpl +++ b/applications/wg-easy/helmfile.yaml.gotmpl @@ -32,12 +32,14 @@ environments: - extras: enableReplicatedSDK: true --- +{{- if eq .Environment.Name "replicated" }} repositories: - name: registry.replicated.com oci: true url: registry.replicated.com username: '{{ .Values.username }}' password: '{{ .Values.password }}' +{{- end }} releases: # Install cert-manager with CRDs but without issuers @@ -49,7 +51,7 @@ releases: wait: true installed: true skipDeps: true - + # Install issuers separately after cert-manager is ready - name: cert-manager-issuers namespace: cert-manager @@ -61,7 +63,7 @@ releases: skipDeps: true needs: - cert-manager/cert-manager - + - name: traefik namespace: traefik chart: {{ .Values.chartSources.traefik }} @@ -79,7 +81,7 @@ releases: nodePort: 30080 websecure: nodePort: 30443 - + # Install replicated-sdk (only in replicated environment) - name: replicated namespace: replicated @@ -91,7 +93,7 @@ releases: skipDeps: true needs: - traefik/traefik - + - name: wg-easy namespace: wg-easy chart: {{ .Values.chartSources.wgEasy }} @@ -110,5 +112,3 @@ releases: traefikRoutes: web-tls: hostName: '{{ env "TF_EXPOSED_URL" }}' - web: - hostName: '{{ env "TF_EXPOSED_HTTP_URL" }}' diff --git a/applications/wg-easy/taskfiles/utils.yml b/applications/wg-easy/taskfiles/utils.yml index 67e26e6f..21f6d26e 100644 --- a/applications/wg-easy/taskfiles/utils.yml +++ b/applications/wg-easy/taskfiles/utils.yml @@ -114,22 +114,13 @@ tasks: # Get TF_EXPOSED_URL for HTTPS TF_EXPOSED_URL=$(replicated cluster port ls $CLUSTER_ID --output json | jq -r '.[] | select(.upstream_port == 30443 and .exposed_ports[0].protocol == "https") | .hostname' | head -n 1) - # Get TF_EXPOSED_HTTP_URL for HTTP - TF_EXPOSED_HTTP_URL=$(replicated cluster port ls $CLUSTER_ID --output json | jq -r '.[] | select(.upstream_port == 30080 and .exposed_ports[0].protocol == "http") | .hostname' | head -n 1) - if [ -z "$TF_EXPOSED_URL" ]; then echo "Error: Could not determine TF_EXPOSED_URL. HTTPS port is not properly exposed." echo "Please ensure the HTTPS port is exposed before deploying." exit 1 fi - if [ -z "$TF_EXPOSED_HTTP_URL" ]; then - echo "Error: Could not determine TF_EXPOSED_HTTP_URL. HTTP port is not properly exposed." - echo "Please ensure the HTTP port is exposed before deploying." - exit 1 - fi - - echo "TF_EXPOSED_URL=$TF_EXPOSED_URL TF_EXPOSED_HTTP_URL=$TF_EXPOSED_HTTP_URL" + echo "TF_EXPOSED_URL=$TF_EXPOSED_URL" fi vendor-api-auth: