├── .all-contributorsrc ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug-report.md │ ├── config.yml │ └── feature-request.md ├── PAUL.yaml ├── PULL_REQUEST_TEMPLATE.md ├── ct-install.yaml ├── ct-lint.yaml ├── label-commenter-config.yml ├── renovate.json5 └── workflows │ ├── charts-lint-test.yaml │ ├── charts-release.yaml │ ├── metadata-label-commenter.yaml │ ├── metadata-label-issues-prs.yaml │ ├── metadata-label-pr-ci-status.yaml │ └── pre-commit-check.yaml ├── .gitignore ├── .helmdocsignore ├── .pre-commit-config.yaml ├── .taskfiles ├── Taskfile_chart.yml ├── Taskfile_darwin.yml ├── Taskfile_linux.yml └── Taskfile_windows.yml ├── .vscode ├── extensions.json └── launch.json ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── Taskfile.yml ├── charts ├── incubator │ └── .gitkeep └── stable │ └── common │ ├── .helmignore │ ├── Chart.yaml │ ├── README.md │ ├── README.md.gotmpl │ ├── README_CHANGELOG.md.gotmpl │ ├── README_CONFIG.md.gotmpl │ ├── templates │ ├── _all.tpl │ ├── _configmap.tpl │ ├── _daemonset.tpl │ ├── _deployment.tpl │ ├── _ingress.tpl │ ├── _notes.tpl │ ├── _pvc.tpl │ ├── _secret.tpl │ ├── _service.tpl │ ├── _serviceaccount.tpl │ ├── _statefulset.tpl │ ├── addons │ │ ├── code-server │ │ │ ├── _codeserver.tpl │ │ │ ├── _container.tpl │ │ │ ├── _secret.tpl │ │ │ └── _volume.tpl │ │ ├── netshoot │ │ │ ├── _container.tpl │ │ │ └── _netshoot.tpl │ │ ├── promtail │ │ │ ├── _configmap.tpl │ │ │ ├── _container.tpl │ │ │ ├── _promtail.tpl │ │ │ └── _volume.tpl │ │ └── vpn │ │ │ ├── _configmap.tpl │ │ │ ├── _networkpolicy.tpl │ │ │ ├── _secret.tpl │ │ │ ├── _volume.tpl │ │ │ ├── _vpn.tpl │ │ │ ├── gluetun │ │ │ ├── _addon.tpl │ │ │ └── _container.tpl │ │ │ ├── openvpn │ │ │ ├── _addon.tpl │ │ │ ├── _container.tpl │ │ │ └── _secret.tpl │ │ │ └── wireguard │ │ │ ├── _addon.tpl │ │ │ └── _container.tpl │ ├── classes │ │ ├── _HorizontalPodAutoscaler.tpl │ │ ├── _configmap.tpl │ │ ├── _ingress.tpl │ │ ├── _pvc.tpl │ │ ├── _service.tpl │ │ └── _service_ports.tpl │ └── lib │ │ ├── chart │ │ ├── _annotations.tpl │ │ ├── _capabilities.tpl │ │ ├── _labels.tpl │ │ ├── _names.tpl │ │ └── _values.tpl │ │ └── controller │ │ ├── _container.tpl │ │ ├── _env_vars.tpl │ │ ├── _pod.tpl │ │ ├── _ports.tpl │ │ ├── _probes.tpl │ │ ├── _volumemounts.tpl │ │ └── _volumes.tpl │ └── values.yaml ├── hack ├── gen-helm-docs.sh ├── gen-helmignore.sh └── templates │ ├── .helmignore │ ├── README.md.gotmpl │ ├── README_CHANGELOG.md.gotmpl │ └── README_CONFIG.md.gotmpl └── helper-charts └── common-test ├── .helmignore ├── Chart.yaml ├── README.md ├── charts └── common ├── ci ├── basic-values.yaml ├── codeserver-values.yaml ├── netshoot-values.yaml └── promtail-values.yaml ├── templates ├── NOTES.txt └── common.yaml ├── tests ├── addons │ ├── codeserver_test.yaml │ ├── netshoot_test.yaml │ └── vpn_test.yaml ├── configmap │ ├── metadata_test.yaml │ ├── names_test.yaml │ └── pod_metadata_test.yaml ├── container │ ├── args_test.yaml │ ├── command_test.yaml │ ├── env_test.yaml │ ├── envfrom_test.yaml │ ├── ports_test.yaml │ └── volumemounts_test.yaml ├── controller │ ├── metadata_daemonset_test.yaml │ ├── metadata_deployment_test.yaml │ ├── metadata_statefulset_test.yaml │ └── type_test.yaml ├── ingress │ ├── metadata_test.yaml │ ├── presence_test.yaml │ ├── service_reference_test.yaml │ ├── tls_test.yaml │ └── values_test.yaml ├── persistence │ ├── claimnames_test.yaml │ ├── emptydir_test.yaml │ ├── hostpath_test.yaml │ ├── types_test.yaml │ └── volumeclaimtemplates_test.yaml ├── pod │ ├── additionalcontainers_test.yaml │ ├── initcontainers_test.yaml │ ├── network_test.yaml │ └── replicas_test.yaml ├── pvc │ ├── metadata_test.yaml │ ├── names_test.yaml │ └── storageclass_test.yaml └── service │ ├── metadata_test.yaml │ ├── names_test.yaml │ ├── port_names_test.yaml │ ├── port_protocols_test.yaml │ └── values_test.yaml └── values.yaml /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "library-charts", 3 | "projectOwner": "k8s-at-home", 4 | "repoType": "github", 5 | "repoHost": "https://github.com", 6 | "files": [ 7 | "README.md" 8 | ], 9 | "imageSize": 100, 10 | "commit": false, 11 | "contributors": [ 12 | { 13 | "login": "bjw-s", 14 | "name": "Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs", 15 | "avatar_url": "https://avatars.githubusercontent.com/u/6213398?v=4", 16 | "profile": "https://github.com/bjw-s", 17 | "contributions": [ 18 | "code" 19 | ] 20 | }, 21 | { 22 | "login": "onedr0p", 23 | "name": "ᗪєνιη ᗷυнʟ", 24 | "avatar_url": "https://avatars.githubusercontent.com/u/213795?v=4", 25 | "profile": "https://github.com/onedr0p", 26 | "contributions": [ 27 | "code" 28 | ] 29 | }, 30 | { 31 | "login": "angelnu", 32 | "name": "Angel Nunez Mencias", 33 | "avatar_url": "https://avatars.githubusercontent.com/u/4406403?v=4", 34 | "profile": "https://github.com/angelnu", 35 | "contributions": [ 36 | "code" 37 | ] 38 | }, 39 | { 40 | "login": "wrmilling", 41 | "name": "Winston R. Milling", 42 | "avatar_url": "https://avatars.githubusercontent.com/u/6162814?v=4", 43 | "profile": "https://winston.milli.ng/", 44 | "contributions": [ 45 | "code" 46 | ] 47 | }, 48 | { 49 | "login": "dirtycajunrice", 50 | "name": "Nicholas St. Germain", 51 | "avatar_url": "https://avatars.githubusercontent.com/u/15788890?v=4", 52 | "profile": "https://cajun.pro/", 53 | "contributions": [ 54 | "code" 55 | ] 56 | }, 57 | { 58 | "login": "billtomturner", 59 | "name": "billtomturner", 60 | "avatar_url": "https://avatars.githubusercontent.com/u/65121940?v=4", 61 | "profile": "https://github.com/billtomturner", 62 | "contributions": [ 63 | "code" 64 | ] 65 | }, 66 | { 67 | "login": "jr0dd", 68 | "name": "jr0dd", 69 | "avatar_url": "https://avatars.githubusercontent.com/u/285797?v=4", 70 | "profile": "https://github.com/jr0dd", 71 | "contributions": [ 72 | "code" 73 | ] 74 | }, 75 | { 76 | "login": "allenporter", 77 | "name": "Allen Porter", 78 | "avatar_url": "https://avatars.githubusercontent.com/u/6026418?v=4", 79 | "profile": "https://github.com/allenporter", 80 | "contributions": [ 81 | "doc" 82 | ] 83 | }, 84 | { 85 | "login": "AlexanderBabel", 86 | "name": "Alex Babel", 87 | "avatar_url": "https://avatars.githubusercontent.com/u/13570439?v=4", 88 | "profile": "http://alexbabel.com", 89 | "contributions": [ 90 | "code" 91 | ] 92 | }, 93 | { 94 | "login": "Cian911", 95 | "name": "Cian Gallagher", 96 | "avatar_url": "https://avatars.githubusercontent.com/u/4751449?v=4", 97 | "profile": "https://ciangallagher.net", 98 | "contributions": [ 99 | "code" 100 | ] 101 | } 102 | ], 103 | "contributorsPerLine": 7, 104 | "commitConvention": "none", 105 | "skipCi": true 106 | } 107 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners 2 | * @onedr0p @bjw-s @billimek @carpenike @Truxnell 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | # Details 11 | 12 | **Helm chart name and version:** 13 | 14 | 15 | 16 | **What steps did you take and what happened:** 17 | 18 | 19 | 20 | **Relevant Helm values:** 21 | 22 | 23 | 24 | **What did you expect to happen:** 25 | 26 | **Anything else you would like to add:** 27 | 28 | 29 | 30 | **Additional Information:** 31 | 32 | 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | blank_issues_enabled: true 4 | contact_links: 5 | - name: Ask a question 6 | url: https://github.com/k8s-at-home/organization/discussions 7 | about: Please ask and answer questions here. 8 | - name: Discuss on Discord 9 | url: https://discord.com/invite/sTMX7Vh 10 | about: Join our Discord community 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | # Details 11 | 12 | **Helm chart name:** 13 | 14 | 15 | 16 | **Describe the solution you'd like:** 17 | 18 | 19 | 20 | **Anything else you would like to add:** 21 | 22 | 23 | 24 | **Additional Information:** 25 | 26 | 27 | -------------------------------------------------------------------------------- /.github/PAUL.yaml: -------------------------------------------------------------------------------- 1 | maintainers: 2 | - billimek 3 | - bjw-s 4 | - carpenike 5 | - onedr0p 6 | labels: true 7 | empty_description_check: 8 | enabled: true 9 | enforced: false 10 | branch_destroyer: 11 | enabled: true 12 | protected_branches: 13 | - main 14 | - gh-pages 15 | pull_requests: 16 | automated_merge: false 17 | cats_enabled: true 18 | dogs_enabled: true 19 | allow_approval: true 20 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | **Description of the change** 14 | 15 | 16 | 17 | **Benefits** 18 | 19 | 20 | 21 | **Possible drawbacks** 22 | 23 | 24 | 25 | **Applicable issues** 26 | 27 | 28 | - fixes # 29 | 30 | **Additional information** 31 | 32 | 33 | 34 | **Checklist** 35 | - [ ] Chart version bumped in `Chart.yaml` according to [semver](http://semver.org/). 36 | -------------------------------------------------------------------------------- /.github/ct-install.yaml: -------------------------------------------------------------------------------- 1 | remote: origin 2 | target-branch: main 3 | helm-extra-args: --timeout 600s 4 | chart-dirs: 5 | - helper-charts 6 | chart-repos: 7 | - k8s-at-home-libraries=https://library-charts.k8s-at-home.com 8 | -------------------------------------------------------------------------------- /.github/ct-lint.yaml: -------------------------------------------------------------------------------- 1 | remote: origin 2 | target-branch: main 3 | helm-extra-args: --timeout 600s 4 | chart-dirs: 5 | - charts/incubator 6 | - charts/stable 7 | chart-repos: 8 | - k8s-at-home-libraries=https://library-charts.k8s-at-home.com 9 | -------------------------------------------------------------------------------- /.github/label-commenter-config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | labels: 3 | - name: kind:incomplete-template 4 | labeled: 5 | issue: 6 | body: | 7 | :wave: @{{ issue.user.login }}, please follow the template provided. 8 | action: close 9 | locking: lock 10 | lock_reason: resolved 11 | 12 | - name: kind:support 13 | labeled: 14 | issue: 15 | body: | 16 | :wave: @{{ issue.user.login }}, we use the issue tracker exclusively 17 | for bug reports and feature requests. However, this issue appears 18 | to be a support request. Please use our support channels 19 | to get help. 20 | - [Docs](https://docs.k8s-at-home.com/) 21 | - [Discord](https://discord.gg/sTMX7Vh) 22 | - [GitHub Discussions](https://github.com/k8s-at-home/organization/discussions) 23 | action: close 24 | 25 | - name: kind:incomplete-docs 26 | labeled: 27 | pr: 28 | body: | 29 | :wave: @{{ pull_request.user.login }}, thanks for taking the time to submit this PR. 🙏🏽 30 | 31 | We have noticed that the chart documentation has not been completely updated for this PR. 32 | Could you please make sure that the following items have been updated: 33 | - `version` in `Chart.yaml` has been updated per [semver](http://semver.org/) 34 | - `README_CHANGELOG.md.gotmpl` contains a summary of the updates for this new version 35 | - [Documentation strings](https://github.com/norwoodj/helm-docs#valuesyaml-metadata) have been added to the keys in `values.yaml`. 36 | 37 | Afterwards you can run `./hack/gen-helm-docs.sh stable ` again to update the chart's `README.md` file. 38 | 39 | - name: kind:incorrect-title 40 | labeled: 41 | pr: 42 | body: | 43 | :wave: @{{ pull_request.user.login }}, thanks for taking the time to submit this PR. 🙏🏽 44 | 45 | We have noticed that the PR title does not adhere to our desired format. 46 | Could you please make sure that it follows the pattern `[] `? 47 | Example: `[radarr] Update image version`. 48 | 49 | Thanks! 50 | -------------------------------------------------------------------------------- /.github/renovate.json5: -------------------------------------------------------------------------------- 1 | { 2 | "enabled": true, 3 | "dependencyDashboard": true, 4 | "dependencyDashboardTitle": "Renovate Dashboard", 5 | "assigneesFromCodeOwners": true, 6 | "reviewersFromCodeOwners": true, 7 | "suppressNotifications": ["prIgnoreNotification"], 8 | "rebaseWhen": "conflicted", 9 | "prConcurrentLimit": 5, 10 | "helm-values": { 11 | "enabled": false 12 | }, 13 | "helmv3": { 14 | "fileMatch": [ 15 | "incubator/.+/Chart\\.yaml$", 16 | "stable/.+/Chart\\.yaml$" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.github/workflows/charts-lint-test.yaml: -------------------------------------------------------------------------------- 1 | name: "Charts: Lint and test" 2 | 3 | on: 4 | pull_request: 5 | paths: 6 | - '.github/workflows/charts-lint-test.yaml' 7 | - 'charts/**' 8 | - 'helper-charts/**' 9 | 10 | jobs: 11 | lint: 12 | name: Lint charts 13 | runs-on: ubuntu-20.04 14 | outputs: 15 | changed: ${{ steps.list-changed.outputs.changed }} 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v3 19 | with: 20 | fetch-depth: 0 21 | 22 | - name: Install Helm 23 | uses: azure/setup-helm@v3 24 | with: 25 | version: v3.5.4 26 | 27 | - uses: actions/setup-python@v4 28 | with: 29 | python-version: 3.7 30 | 31 | - name: Set up chart-testing 32 | uses: helm/chart-testing-action@v2.2.1 33 | 34 | - name: Run chart-testing (list-changed) 35 | id: list-changed 36 | run: | 37 | changed=$(ct list-changed --config .github/ct-lint.yaml) 38 | if [[ -n "$changed" ]]; then 39 | echo "::set-output name=changed::true" 40 | fi 41 | 42 | - name: Run chart-testing (lint) 43 | id: lint 44 | if: steps.list-changed.outputs.changed == 'true' 45 | run: ct lint --config .github/ct-lint.yaml 46 | 47 | unittest: 48 | needs: 49 | - lint 50 | name: Run unit tests 51 | runs-on: ubuntu-20.04 52 | steps: 53 | - name: Checkout 54 | uses: actions/checkout@v3 55 | with: 56 | fetch-depth: 0 57 | 58 | - name: Install Helm 59 | uses: azure/setup-helm@v3 60 | with: 61 | version: v3.5.4 62 | 63 | - name: Run tests 64 | run: | 65 | helm plugin install https://github.com/vbehar/helm3-unittest --version v1.0.16 66 | cd helper-charts/common-test/ 67 | helm unittest -f "tests/**/*_test.yaml" . 68 | 69 | install: 70 | needs: 71 | - lint 72 | name: Install charts 73 | runs-on: ubuntu-20.04 74 | steps: 75 | - name: Checkout 76 | uses: actions/checkout@v3 77 | with: 78 | fetch-depth: 0 79 | 80 | - name: Install Helm 81 | uses: azure/setup-helm@v3 82 | with: 83 | version: v3.5.4 84 | 85 | - uses: actions/setup-python@v4 86 | with: 87 | python-version: 3.7 88 | 89 | - name: Set up chart-testing 90 | uses: helm/chart-testing-action@v2.2.1 91 | 92 | - name: Create k3d cluster 93 | uses: nolar/setup-k3d-k3s@v1 94 | with: 95 | version: v1.19 96 | if: needs.lint.outputs.changed == 'true' 97 | 98 | - name: Run chart-testing (install) 99 | run: ct install --config .github/ct-install.yaml 100 | if: needs.lint.outputs.changed == 'true' 101 | -------------------------------------------------------------------------------- /.github/workflows/charts-release.yaml: -------------------------------------------------------------------------------- 1 | name: "Charts: Release" 2 | 3 | concurrency: helm-release 4 | 5 | on: 6 | workflow_dispatch: 7 | push: 8 | branches: 9 | - main 10 | paths: 11 | - 'charts/**' 12 | 13 | jobs: 14 | generate-readme: 15 | name: Auto-generate chart README 16 | runs-on: ubuntu-20.04 17 | steps: 18 | - name: Get k8s-at-home token 19 | id: get-app-token 20 | uses: getsentry/action-github-app-token@v1 21 | with: 22 | app_id: ${{ secrets.K8S_AT_HOME_APP_ID }} 23 | private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }} 24 | 25 | - name: Checkout 26 | uses: actions/checkout@v3 27 | with: 28 | token: ${{ steps.get-app-token.outputs.token }} 29 | ref: ${{ github.ref }} 30 | 31 | - uses: dorny/paths-filter@v2 32 | id: filter 33 | with: 34 | base: ${{ github.ref }} 35 | list-files: shell 36 | filters: | 37 | addedOrModified: 38 | - added|modified: 'charts/**' 39 | 40 | - name: Install Helm 41 | if: steps.filter.outputs.addedOrModified == 'true' 42 | uses: azure/setup-helm@v3 43 | with: 44 | version: v3.5.4 45 | 46 | - uses: actions/setup-python@v4 47 | if: steps.filter.outputs.addedOrModified == 'true' 48 | with: 49 | python-version: 3.7 50 | 51 | - name: Install helm-docs 52 | if: steps.filter.outputs.addedOrModified == 'true' 53 | run: | 54 | wget -O /tmp/helm-docs.deb https://github.com/norwoodj/helm-docs/releases/download/v1.5.0/helm-docs_1.5.0_linux_amd64.deb 55 | sudo dpkg -i /tmp/helm-docs.deb 56 | 57 | - name: Run against changed charts 58 | if: steps.filter.outputs.addedOrModified == 'true' 59 | run: | 60 | CHARTS=() 61 | PATHS=(${{ steps.filter.outputs.addedOrModified_files }}) 62 | # Get only the chart paths 63 | for i in "${PATHS[@]}" 64 | do 65 | IFS='/' read -r -a path_parts <<< "$i" 66 | CHARTS+=("${path_parts[1]}/${path_parts[2]}") 67 | done 68 | 69 | # Remove duplicates 70 | CHARTS=( `for i in ${CHARTS[@]}; do echo $i; done | sort -u` ) 71 | 72 | for i in "${CHARTS[@]}" 73 | do 74 | echo "Rendering README for chart ${i}" 75 | IFS='/' read -r -a chart_parts <<< "$i" 76 | if [ -f "charts/${chart_parts[0]}"/"${chart_parts[1]}/Chart.yaml" ]; then 77 | ./hack/gen-helm-docs.sh "${chart_parts[0]}" "${chart_parts[1]}" 78 | fi 79 | echo "" 80 | done 81 | 82 | - name: Create commit 83 | if: steps.filter.outputs.addedOrModified == 'true' 84 | uses: stefanzweifel/git-auto-commit-action@v4 85 | with: 86 | push_options: --force 87 | commit_message: Auto-generate chart README [no ci] 88 | commit_user_name: k8s-at-home[bot] 89 | commit_user_email: k8s-at-home[bot]@users.noreply.github.com 90 | commit_author: k8s-at-home[bot] 91 | file_pattern: charts/**/ 92 | 93 | release-charts: 94 | runs-on: ubuntu-20.04 95 | needs: 96 | - generate-readme 97 | steps: 98 | - name: Get k8s-at-home token 99 | id: get-app-token 100 | uses: getsentry/action-github-app-token@v1 101 | with: 102 | app_id: ${{ secrets.K8S_AT_HOME_APP_ID }} 103 | private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }} 104 | 105 | - name: Checkout 106 | uses: actions/checkout@v3 107 | with: 108 | token: ${{ steps.get-app-token.outputs.token }} 109 | ref: main 110 | fetch-depth: 0 111 | 112 | - name: Configure Git 113 | run: | 114 | git config user.name "k8s-at-home[bot]" 115 | git config user.email "k8s-at-home[bot]@users.noreply.github.com" 116 | 117 | - name: Install Helm 118 | uses: azure/setup-helm@v3 119 | with: 120 | version: v3.5.4 121 | 122 | - name: Run chart-releaser 123 | uses: helm/chart-releaser-action@v1.4.0 124 | with: 125 | charts_dir: charts/* 126 | charts_repo_url: https://library-charts.k8s-at-home.com 127 | env: 128 | CR_TOKEN: "${{ steps.get-app-token.outputs.token }}" 129 | CR_SKIP_EXISTING: "true" 130 | -------------------------------------------------------------------------------- /.github/workflows/metadata-label-commenter.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: 'Metadata: Label Commenter' 3 | 4 | on: 5 | issues: 6 | types: 7 | - labeled 8 | - unlabeled 9 | pull_request_target: 10 | types: 11 | - labeled 12 | - unlabeled 13 | 14 | permissions: 15 | contents: read 16 | issues: write 17 | pull-requests: write 18 | 19 | jobs: 20 | comment: 21 | name: Label commenter 22 | runs-on: ubuntu-20.04 23 | steps: 24 | - uses: getsentry/action-github-app-token@v1 25 | id: get-app-token 26 | with: 27 | app_id: ${{ secrets.K8S_AT_HOME_APP_ID }} 28 | private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }} 29 | 30 | - uses: actions/checkout@v3 31 | with: 32 | token: ${{ steps.get-app-token.outputs.token }} 33 | ref: main 34 | 35 | - uses: peaceiris/actions-label-commenter@v1 36 | with: 37 | github_token: ${{ steps.get-app-token.outputs.token }} 38 | -------------------------------------------------------------------------------- /.github/workflows/metadata-label-issues-prs.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Metadata: Label issues and pull requests" 3 | 4 | on: 5 | issues: 6 | types: 7 | - opened 8 | - edited 9 | - closed 10 | - reopened 11 | pull_request_target: 12 | types: 13 | - opened 14 | - edited 15 | - closed 16 | - reopened 17 | - ready_for_review 18 | - synchronize 19 | 20 | jobs: 21 | label: 22 | name: Label issues and pull requests 23 | runs-on: ubuntu-20.04 24 | steps: 25 | - uses: getsentry/action-github-app-token@v1 26 | id: get-app-token 27 | with: 28 | app_id: ${{ secrets.K8S_AT_HOME_APP_ID }} 29 | private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }} 30 | 31 | - uses: Videndum/label-mastermind@2.1.3 32 | with: 33 | GITHUB_TOKEN: ${{ steps.get-app-token.outputs.token }} 34 | configJSON: | 35 | { 36 | "releaseMastermind": { 37 | "labels": { 38 | "kind:incorrect-title": { 39 | "name": "kind:incorrect-title", 40 | "colour": "#ffb700", 41 | "description": "Incorrect title" 42 | } 43 | }, 44 | "runners": [ 45 | { 46 | "root": ".", 47 | "versioning": { 48 | "source": "milestones", 49 | "type": "other" 50 | }, 51 | "pr": { 52 | "labels": { 53 | "kind:incorrect-title": { 54 | "requires": 2, 55 | "conditions": [ 56 | { 57 | "type": "creatorMatches", 58 | "pattern": "^(?!renovate).+" 59 | }, 60 | { 61 | "type": "titleMatches", 62 | "pattern": "^(?!\\[[a-z0-9\\-]+\\]\\s[A-Z0-9].+).+" 63 | } 64 | ] 65 | } 66 | } 67 | } 68 | } 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /.github/workflows/metadata-label-pr-ci-status.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Metadata: Label pull requests CI status" 3 | 4 | on: 5 | workflow_run: 6 | workflows: 7 | - "Pre-commit consistency check" 8 | - "Charts: Lint and test" 9 | types: 10 | - completed 11 | 12 | jobs: 13 | label-precommit: 14 | name: Label pre-commit status 15 | runs-on: ubuntu-20.04 16 | if: "${{ github.event.workflow.name == 'Pre-commit consistency check' }}" 17 | steps: 18 | - uses: getsentry/action-github-app-token@v1 19 | id: get-app-token 20 | with: 21 | app_id: ${{ secrets.K8S_AT_HOME_APP_ID }} 22 | private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }} 23 | 24 | - name: "Get information about the origin 'CI' run" 25 | uses: potiuk/get-workflow-origin@v1_3 26 | id: source-run-info 27 | with: 28 | token: ${{ steps.get-app-token.outputs.token }} 29 | sourceRunId: ${{ github.event.workflow_run.id }} 30 | 31 | - name: Label precommit success 32 | uses: andymckay/labeler@1.0.4 33 | if: ${{ github.event.workflow_run.conclusion == 'success' }} 34 | with: 35 | repo-token: ${{ steps.get-app-token.outputs.token }} 36 | issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }} 37 | add-labels: "precommit:ok" 38 | remove-labels: "precommit:failed" 39 | 40 | - name: Label precommit failure 41 | uses: andymckay/labeler@1.0.4 42 | if: ${{ github.event.workflow_run.conclusion == 'failure' }} 43 | with: 44 | repo-token: ${{ steps.get-app-token.outputs.token }} 45 | issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }} 46 | add-labels: "precommit:failed" 47 | remove-labels: "precommit:ok" 48 | 49 | label-lint-install: 50 | name: Label lint and install status 51 | runs-on: ubuntu-20.04 52 | if: "${{ github.event.workflow.name == 'Charts: Lint and test' }}" 53 | steps: 54 | - uses: getsentry/action-github-app-token@v1 55 | id: get-app-token 56 | with: 57 | app_id: ${{ secrets.K8S_AT_HOME_APP_ID }} 58 | private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }} 59 | 60 | - name: "Get information about the origin 'CI' run" 61 | uses: potiuk/get-workflow-origin@v1_3 62 | id: source-run-info 63 | with: 64 | token: ${{ steps.get-app-token.outputs.token }} 65 | sourceRunId: ${{ github.event.workflow_run.id }} 66 | 67 | - name: "Get workflow job status" 68 | uses: actions/github-script@v6 69 | id: get-workflow-jobs 70 | with: 71 | github-token: ${{ steps.get-app-token.outputs.token }} 72 | script: | 73 | let result = new Object 74 | 75 | const wfJobs = await github.rest.actions.listJobsForWorkflowRun({ 76 | owner: context.repo.owner, 77 | repo: context.repo.repo, 78 | run_id: context.payload.workflow_run.id, 79 | }) 80 | 81 | for (const job of wfJobs.data.jobs) { 82 | if (job.name === 'Lint charts') { 83 | result['lint'] = job.conclusion 84 | } else if (job.name === 'Run unit tests') { 85 | result['unittest'] = job.conclusion 86 | } else if (job.name === 'Install charts') { 87 | result['install'] = job.conclusion 88 | } 89 | } 90 | 91 | console.log(result) 92 | return result 93 | 94 | - name: Label lint success 95 | uses: andymckay/labeler@1.0.4 96 | if: ${{ fromJSON(steps.get-workflow-jobs.outputs.result).lint == 'success' }} 97 | with: 98 | repo-token: ${{ steps.get-app-token.outputs.token }} 99 | issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }} 100 | add-labels: "lint:ok" 101 | remove-labels: "lint:failed" 102 | 103 | - name: Label lint failure 104 | uses: andymckay/labeler@1.0.4 105 | if: ${{ fromJSON(steps.get-workflow-jobs.outputs.result).lint == 'failure' }} 106 | with: 107 | repo-token: ${{ steps.get-app-token.outputs.token }} 108 | issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }} 109 | add-labels: "lint:failed" 110 | remove-labels: "lint:ok" 111 | 112 | - name: Label unittest success 113 | uses: andymckay/labeler@1.0.4 114 | if: ${{ fromJSON(steps.get-workflow-jobs.outputs.result).unittest == 'success' }} 115 | with: 116 | repo-token: ${{ steps.get-app-token.outputs.token }} 117 | issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }} 118 | add-labels: "unittest:ok" 119 | remove-labels: "unittest:failed" 120 | 121 | - name: Label unittest failure 122 | uses: andymckay/labeler@1.0.4 123 | if: ${{ fromJSON(steps.get-workflow-jobs.outputs.result).unittest == 'failure' }} 124 | with: 125 | repo-token: ${{ steps.get-app-token.outputs.token }} 126 | issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }} 127 | add-labels: "unittest:failed" 128 | remove-labels: "unittest:ok" 129 | 130 | - name: Label install success 131 | uses: andymckay/labeler@1.0.4 132 | if: ${{ fromJSON(steps.get-workflow-jobs.outputs.result).install == 'success' }} 133 | with: 134 | repo-token: ${{ steps.get-app-token.outputs.token }} 135 | issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }} 136 | add-labels: "install:ok" 137 | remove-labels: "install:failed" 138 | 139 | - name: Label install failure 140 | uses: andymckay/labeler@1.0.4 141 | if: ${{ fromJSON(steps.get-workflow-jobs.outputs.result).install == 'failure' }} 142 | with: 143 | repo-token: ${{ steps.get-app-token.outputs.token }} 144 | issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }} 145 | add-labels: "install:failed" 146 | remove-labels: "install:ok" 147 | -------------------------------------------------------------------------------- /.github/workflows/pre-commit-check.yaml: -------------------------------------------------------------------------------- 1 | name: "Pre-commit consistency check" 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | 7 | concurrency: 8 | group: ${{ github.head_ref }}-precommit 9 | cancel-in-progress: true 10 | 11 | jobs: 12 | pre-commit-check: 13 | name: Run pre-commit checks 14 | runs-on: ubuntu-20.04 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v3 18 | with: 19 | fetch-depth: 0 20 | 21 | - uses: dorny/paths-filter@v2 22 | id: filter 23 | with: 24 | list-files: shell 25 | filters: | 26 | addedOrModified: 27 | - added|modified: '**' 28 | 29 | # run only if changed files were detected 30 | - name: Run against changes 31 | uses: pre-commit/action@v3.0.0 32 | if: steps.filter.outputs.addedOrModified == 'true' 33 | with: 34 | extra_args: --files ${{ steps.filter.outputs.addedOrModified_files }} 35 | 36 | # run if no changed files were detected (e.g. workflow_dispatch on master branch) 37 | - name: Run against all files 38 | uses: pre-commit/action@v3.0.0 39 | if: steps.filter.outputs.addedOrModified != 'true' 40 | with: 41 | extra_args: --all-files 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Developer dependencies 2 | .bin 3 | 4 | # IDE resources 5 | .vscode 6 | .idea 7 | .devcontainer/ 8 | 9 | # Helm resources 10 | charts/*/Chart.lock 11 | charts/*/charts 12 | helper-charts/*/Chart.lock 13 | helper-charts/*/charts 14 | 15 | # Other rsources 16 | .env 17 | .envrc 18 | Gemfile.lock 19 | 20 | # Trash 21 | .DS_Store 22 | 23 | # Testing 24 | __snapshot__/ 25 | -------------------------------------------------------------------------------- /.helmdocsignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/k8s-at-home/library-charts/1b8b81ceb368e378c01aaf826142cfd948a93042/.helmdocsignore -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # See https://pre-commit.com for more information 2 | repos: 3 | - repo: https://github.com/pre-commit/pre-commit-hooks 4 | rev: v4.0.1 5 | hooks: 6 | - id: trailing-whitespace 7 | - id: end-of-file-fixer 8 | - id: fix-byte-order-marker 9 | - id: mixed-line-ending 10 | - id: check-merge-conflict 11 | - id: check-case-conflict 12 | - id: check-docstring-first 13 | 14 | - repo: https://github.com/Lucas-C/pre-commit-hooks 15 | rev: v1.1.10 16 | hooks: 17 | - id: remove-crlf 18 | - id: remove-tabs 19 | -------------------------------------------------------------------------------- /.taskfiles/Taskfile_chart.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3' 3 | 4 | tasks: 5 | lint: 6 | desc: lint your chart code 7 | dir: "{{.GIT_ROOT}}/charts/{{.CHART_TYPE}}/{{.CHART}}" 8 | cmds: 9 | - helm lint 10 | deps: 11 | - dependency 12 | - check-chart 13 | 14 | ct-lint: 15 | desc: run `ct lint` on your chart code 16 | cmds: 17 | - docker run --rm -it --user $(id -u):$(id -g) -e "HELM_CONFIG_HOME=/tmp/helm" -e "HELM_CACHE_HOME=/tmp/helm" -v {{.GIT_ROOT}}:/ci -w /ci quay.io/helmpack/chart-testing:latest ct lint --charts "charts/{{.CHART_TYPE}}/{{.CHART}}" --config /ci/.github/ct-lint.yaml 18 | deps: 19 | - check-chart 20 | - lint 21 | 22 | helm-docs: 23 | desc: generate helm-docs 24 | dir: "{{.GIT_ROOT}}/hack" 25 | cmds: 26 | - ./gen-helm-docs.sh "{{.CHART_TYPE}}" "{{.CHART}}" 27 | deps: 28 | - check-chart 29 | 30 | # Checks Parameters 31 | check-chart: 32 | cmds: 33 | - test ! -z "{{.CHART_TYPE}}" || (echo "Please define CHART_TYPE parameter"; exit 1) 34 | - test ! -z "{{.CHART}}" || (echo "Please define CHART parameter"; exit 1) 35 | silent: true 36 | -------------------------------------------------------------------------------- /.taskfiles/Taskfile_darwin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3' 3 | 4 | # Todo: add all darwin requirements 5 | 6 | env: 7 | URL_GOREPLACE: https://github.com/webdevops/go-replace/releases/download/1.1.2/gr-64-osx 8 | 9 | tasks: 10 | install: 11 | desc: Install all developer dependencies 12 | deps: 13 | - distrib-requirements 14 | 15 | distrib-requirements: 16 | desc: Check needed distribution packages 17 | cmds: 18 | - task deps:need BIN=wget 19 | - task deps:need BIN=python3 20 | - task deps:need BIN=docker 21 | silent: true 22 | 23 | need: 24 | desc: Check needed binary is present 25 | cmds: 26 | - type {{.BIN}} 2>&1 >/dev/null || (echo "Please install {{.BIN}}"; exit 1) 27 | silent: true 28 | -------------------------------------------------------------------------------- /.taskfiles/Taskfile_linux.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3' 3 | 4 | env: 5 | URL_GOREPLACE: https://github.com/webdevops/go-replace/releases/download/1.1.2/gr-64-linux 6 | URL_HELM: https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 7 | 8 | tasks: 9 | install: 10 | desc: Install all developer dependencies 11 | deps: 12 | - distrib-requirements 13 | - helm 14 | - pre-commit 15 | 16 | distrib-requirements: 17 | desc: Check needed distribution packages 18 | cmds: 19 | - task deps:need BIN=wget 20 | - task deps:need BIN=python3 21 | - task deps:need BIN=docker 22 | silent: true 23 | 24 | need: 25 | desc: Check needed binary is present 26 | cmds: 27 | - type {{.BIN}} 2>&1 >/dev/null || (echo "Please install {{.BIN}}"; exit 1) 28 | silent: true 29 | 30 | helm: 31 | desc: Install helm client 32 | cmds: 33 | - echo "Installing helm" 34 | - wget -q -O - "$URL_HELM" | USE_SUDO=false HELM_INSTALL_DIR=.bin bash 35 | status: 36 | - test -e .bin/helm 37 | deps: 38 | - distrib-requirements 39 | silent: true 40 | 41 | pre-commit: 42 | desc: Install a precommit pip package 43 | cmds: 44 | - echo "Installing pre-commit" 45 | - python3 -m pip install --user pre-commit 46 | status: 47 | - type pre-commit 48 | deps: 49 | - distrib-requirements 50 | silent: true 51 | -------------------------------------------------------------------------------- /.taskfiles/Taskfile_windows.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3' 3 | 4 | # Todo: add windows requirements 5 | 6 | tasks: 7 | default: 8 | cmds: 9 | - task -l 10 | silent: true 11 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-kubernetes-tools.vscode-kubernetes-tools", 4 | "ms-vscode-remote.remote-containers", 5 | "golang.go", 6 | "mrmlnc.vscode-json5" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "stable/common tests", 9 | "type": "go", 10 | "request": "launch", 11 | "mode": "test", 12 | "program": "${workspaceRoot}/charts/stable/common/tests/", 13 | "args": ["-test.v"], 14 | "showLog": true 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Library Charts 2 | 3 | # Helm charts 4 | 5 | [![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-) 6 | 7 | 8 | Most of our application Helm charts consume our Common library Helm chart. 9 | 10 | ## Background 11 | 12 | In Helm 3, their team introduced the concept of a 13 | [Library chart](https://helm.sh/docs/topics/library_charts/). 14 | 15 | > A library chart is a type of Helm chart that defines chart primitives or 16 | definitions which can be shared by Helm templates in other charts. This 17 | allows users to share snippets of code that can be re-used across charts, 18 | avoiding repetition and keeping charts DRY. 19 | 20 | The common library was created because we saw many charts requiring only a 21 | few select configuration options in their Helm charts. 22 | 23 | In order to stay somewhat DRY (Don't Repeat Yourself) and keeping with Helm 3 24 | usage for a Library chart, we saw this pattern and decided it was worth it for 25 | us to create a library. This means each one of these app charts has a 26 | dependency on what we call the `common` library. 27 | 28 | ## Changelog 29 | 30 | To view the changelog for the common library see 31 | [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common#changelog). 32 | 33 | ## Support 34 | 35 | We have a few outlets for getting support with our projects: 36 | 37 | - Visit our [Docs](https://docs.k8s-at-home.com/). 38 | - Bugs or feature requests should be opened in an [issue](https://github.com/k8s-at-home/library-charts/issues/new/choose). 39 | - Questions or comments should be discussed in our [Discord](https://discord.gg/sTMX7Vh) or via [GitHub discussions](https://github.com/k8s-at-home/organization/discussions). 40 | 41 | ## Contributors ✨ 42 | 43 | Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |

Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs

💻

ᗪєνιη ᗷυнʟ

💻

Angel Nunez Mencias

💻

Winston R. Milling

💻

Nicholas St. Germain

💻

billtomturner

💻

jr0dd

💻

Allen Porter

📖

Alex Babel

💻

Cian Gallagher

💻
64 | 65 | 66 | 67 | 68 | 69 | 70 | This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! 71 | -------------------------------------------------------------------------------- /Taskfile.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3' 3 | 4 | vars: 5 | GIT_ROOT: 6 | sh: git rev-parse --show-toplevel 7 | 8 | includes: 9 | deps: .taskfiles/Taskfile_{{OS}}.yml 10 | chart: .taskfiles/Taskfile_chart.yml 11 | 12 | tasks: 13 | default: 14 | cmds: 15 | - task -l 16 | silent: true 17 | -------------------------------------------------------------------------------- /charts/incubator/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/k8s-at-home/library-charts/1b8b81ceb368e378c01aaf826142cfd948a93042/charts/incubator/.gitkeep -------------------------------------------------------------------------------- /charts/stable/common/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj 22 | .vscode/ 23 | # OWNERS file for Kubernetes 24 | OWNERS 25 | # helm-docs templates 26 | *.gotmpl 27 | # Test files 28 | tests/ 29 | -------------------------------------------------------------------------------- /charts/stable/common/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: common 3 | description: Function library for k8s-at-home charts 4 | type: library 5 | version: 4.5.2 6 | kubeVersion: ">=1.16.0-0" 7 | keywords: 8 | - k8s-at-home 9 | - common 10 | home: https://github.com/k8s-at-home/library-charts/tree/main/stable/common 11 | maintainers: 12 | - name: bjw-s 13 | email: me@bjw-s.dev 14 | - name: onedr0p 15 | email: devin.kray@gmail.com 16 | - name: dirtycajunrice 17 | email: nick@cajun.pro 18 | -------------------------------------------------------------------------------- /charts/stable/common/README.md.gotmpl: -------------------------------------------------------------------------------- 1 | {{- define "custom.repository.organization" -}} 2 | k8s-at-home 3 | {{- end -}} 4 | 5 | {{- define "custom.repository.url" -}} 6 | https://github.com/k8s-at-home/charts 7 | {{- end -}} 8 | 9 | {{- define "custom.helm.url" -}} 10 | https://k8s-at-home.com/charts/ 11 | {{- end -}} 12 | 13 | {{- define "custom.helm.path" -}} 14 | {{ template "custom.repository.organization" . }}/{{ template "chart.name" . }} 15 | {{- end -}} 16 | 17 | {{- define "custom.notes" -}} 18 | {{- end -}} 19 | 20 | {{- define "custom.requirements" -}} 21 | ## Requirements 22 | 23 | {{ template "chart.kubeVersionLine" . }} 24 | {{- end -}} 25 | 26 | {{- define "custom.dependencies" -}} 27 | ## Dependencies 28 | 29 | {{ template "chart.requirementsTable" . }} 30 | {{- end -}} 31 | 32 | {{- define "custom.install" -}} 33 | ## Installing the Chart 34 | 35 | This is a [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm). 36 | 37 | **WARNING: THIS CHART IS NOT MEANT TO BE INSTALLED DIRECTLY** 38 | {{- end -}} 39 | 40 | {{- define "custom.usage" -}} 41 | {{- end -}} 42 | 43 | {{- define "custom.configuration.header" -}} 44 | ## Configuration 45 | {{- end -}} 46 | 47 | {{- define "custom.configuration.readValues" -}} 48 | Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values. 49 | {{- end -}} 50 | 51 | {{- define "custom.valuesSection" -}} 52 | ## Values 53 | 54 | **Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common) 55 | 56 | {{ template "chart.valuesTable" . }} 57 | {{- end -}} 58 | 59 | {{- define "custom.support" -}} 60 | ## Support 61 | 62 | - See the [Docs](https://docs.k8s-at-home.com/our-helm-charts/getting-started/) 63 | - Open an [issue](https://github.com/k8s-at-home/charts/issues/new/choose) 64 | - Ask a [question](https://github.com/k8s-at-home/organization/discussions) 65 | - Join our [Discord](https://discord.gg/sTMX7Vh) community 66 | {{- end -}} 67 | 68 | {{ template "chart.header" . }} 69 | 70 | {{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }} 71 | 72 | {{ template "chart.description" . }} 73 | 74 | {{ template "custom.notes" . }} 75 | 76 | {{ template "chart.sourcesSection" . }} 77 | 78 | {{ template "custom.requirements" . }} 79 | 80 | {{ template "custom.dependencies" . }} 81 | 82 | {{ template "custom.install" . }} 83 | 84 | {{ template "custom.usage" . }} 85 | 86 | {{ template "custom.configuration.header" . }} 87 | 88 | {{ template "custom.configuration.readValues" . }} 89 | 90 | {{ template "custom.custom.configuration" . }} 91 | 92 | {{ template "custom.valuesSection" . }} 93 | 94 | {{ template "custom.changelog" . }} 95 | 96 | {{ template "custom.support" . }} 97 | 98 | {{ template "helm-docs.versionFooter" . }} 99 | {{ "" }} 100 | -------------------------------------------------------------------------------- /charts/stable/common/README_CONFIG.md.gotmpl: -------------------------------------------------------------------------------- 1 | {{- define "custom.notes" -}} 2 | Since a lot of the {{ template "custom.repository.organization" . }} charts follow a similar pattern, this library was built to reduce maintenance cost between the charts that use it and try achieve a goal of being DRY. 3 | {{- end -}} 4 | 5 | {{- define "custom.custom.configuration.header" -}} 6 | ## Custom configuration 7 | {{- end -}} 8 | 9 | {{- define "custom.custom.configuration" -}} 10 | {{ template "custom.custom.configuration.header" . }} 11 | 12 | N/A 13 | {{- end -}} 14 | 15 | {{- define "custom.usage" }} 16 | ## Using this library 17 | 18 | Include this chart as a dependency in your `Chart.yaml` e.g. 19 | 20 | ```yaml 21 | # Chart.yaml 22 | dependencies: 23 | - name: common 24 | version: 4.5.1 25 | repository: {{ template "custom.helm.url" }} 26 | ``` 27 | 28 | For more information, take a look at the [Docs](http://docs.k8s-at-home.com/our-helm-charts/common-library/). 29 | {{- end -}} 30 | -------------------------------------------------------------------------------- /charts/stable/common/templates/_all.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Main entrypoint for the common library chart. It will render all underlying templates based on the provided values. 3 | */}} 4 | {{- define "common.all" -}} 5 | {{- /* Merge the local chart values and the common chart defaults */ -}} 6 | {{- include "common.values.setup" . }} 7 | 8 | {{- /* Enable code-server add-on if required */ -}} 9 | {{- if .Values.addons.codeserver.enabled }} 10 | {{- include "common.addon.codeserver" . }} 11 | {{- end -}} 12 | 13 | {{- /* Enable VPN add-on if required */ -}} 14 | {{- if .Values.addons.vpn.enabled }} 15 | {{- include "common.addon.vpn" . }} 16 | {{- end -}} 17 | 18 | {{- /* Enable promtail add-on if required */ -}} 19 | {{- if .Values.addons.promtail.enabled }} 20 | {{- include "common.addon.promtail" . }} 21 | {{- end -}} 22 | 23 | {{- /* Enable netshoot add-on if required */ -}} 24 | {{- if .Values.addons.netshoot.enabled }} 25 | {{- include "common.addon.netshoot" . }} 26 | {{- end -}} 27 | 28 | {{ include "common.configmap" . | nindent 0 }} 29 | 30 | {{- /* Build the templates */ -}} 31 | {{- include "common.pvc" . }} 32 | 33 | {{- if .Values.serviceAccount.create -}} 34 | {{- include "common.serviceAccount" . }} 35 | {{- end -}} 36 | 37 | {{- if .Values.controller.enabled }} 38 | {{- if eq .Values.controller.type "deployment" }} 39 | {{- include "common.deployment" . | nindent 0 }} 40 | {{ else if eq .Values.controller.type "daemonset" }} 41 | {{- include "common.daemonset" . | nindent 0 }} 42 | {{ else if eq .Values.controller.type "statefulset" }} 43 | {{- include "common.statefulset" . | nindent 0 }} 44 | {{ else }} 45 | {{- fail (printf "Not a valid controller.type (%s)" .Values.controller.type) }} 46 | {{- end -}} 47 | {{- end -}} 48 | 49 | {{ include "common.classes.hpa" . | nindent 0 }} 50 | 51 | {{ include "common.service" . | nindent 0 }} 52 | 53 | {{ include "common.ingress" . | nindent 0 }} 54 | 55 | {{- if .Values.secret -}} 56 | {{ include "common.secret" . | nindent 0 }} 57 | {{- end -}} 58 | {{- end -}} 59 | -------------------------------------------------------------------------------- /charts/stable/common/templates/_configmap.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Renders the configMap objects required by the chart. 3 | */}} 4 | {{- define "common.configmap" -}} 5 | {{- /* Generate named configMaps as required */ -}} 6 | {{- range $name, $configmap := .Values.configmap }} 7 | {{- if $configmap.enabled -}} 8 | {{- $configmapValues := $configmap -}} 9 | 10 | {{/* set the default nameOverride to the configMap name */}} 11 | {{- if not $configmapValues.nameOverride -}} 12 | {{- $_ := set $configmapValues "nameOverride" $name -}} 13 | {{ end -}} 14 | 15 | {{- $_ := set $ "ObjectValues" (dict "configmap" $configmapValues) -}} 16 | {{- include "common.classes.configmap" $ }} 17 | {{- end }} 18 | {{- end }} 19 | {{- end }} 20 | -------------------------------------------------------------------------------- /charts/stable/common/templates/_daemonset.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | This template serves as the blueprint for the DaemonSet objects that are created 3 | within the common library. 4 | */}} 5 | {{- define "common.daemonset" }} 6 | --- 7 | apiVersion: apps/v1 8 | kind: DaemonSet 9 | metadata: 10 | name: {{ include "common.names.fullname" . }} 11 | {{- with (merge (.Values.controller.labels | default dict) (include "common.labels" $ | fromYaml)) }} 12 | labels: {{- toYaml . | nindent 4 }} 13 | {{- end }} 14 | {{- with (merge (.Values.controller.annotations | default dict) (include "common.annotations" $ | fromYaml)) }} 15 | annotations: {{- toYaml . | nindent 4 }} 16 | {{- end }} 17 | spec: 18 | revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }} 19 | selector: 20 | matchLabels: 21 | {{- include "common.labels.selectorLabels" . | nindent 6 }} 22 | template: 23 | metadata: 24 | {{- with include ("common.podAnnotations") . }} 25 | annotations: 26 | {{- . | nindent 8 }} 27 | {{- end }} 28 | labels: 29 | {{- include "common.labels.selectorLabels" . | nindent 8 }} 30 | {{- with .Values.podLabels }} 31 | {{- toYaml . | nindent 8 }} 32 | {{- end }} 33 | spec: 34 | {{- include "common.controller.pod" . | nindent 6 }} 35 | {{- end }} 36 | -------------------------------------------------------------------------------- /charts/stable/common/templates/_deployment.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | This template serves as the blueprint for the Deployment objects that are created 3 | within the common library. 4 | */}} 5 | {{- define "common.deployment" }} 6 | --- 7 | apiVersion: apps/v1 8 | kind: Deployment 9 | metadata: 10 | name: {{ include "common.names.fullname" . }} 11 | {{- with (merge (.Values.controller.labels | default dict) (include "common.labels" $ | fromYaml)) }} 12 | labels: {{- toYaml . | nindent 4 }} 13 | {{- end }} 14 | {{- with (merge (.Values.controller.annotations | default dict) (include "common.annotations" $ | fromYaml)) }} 15 | annotations: {{- toYaml . | nindent 4 }} 16 | {{- end }} 17 | spec: 18 | revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }} 19 | replicas: {{ .Values.controller.replicas }} 20 | {{- $strategy := default "Recreate" .Values.controller.strategy }} 21 | {{- if and (ne $strategy "Recreate") (ne $strategy "RollingUpdate") }} 22 | {{- fail (printf "Not a valid strategy type for Deployment (%s)" $strategy) }} 23 | {{- end }} 24 | strategy: 25 | type: {{ $strategy }} 26 | {{- with .Values.controller.rollingUpdate }} 27 | {{- if and (eq $strategy "RollingUpdate") (or .surge .unavailable) }} 28 | rollingUpdate: 29 | {{- with .unavailable }} 30 | maxUnavailable: {{ . }} 31 | {{- end }} 32 | {{- with .surge }} 33 | maxSurge: {{ . }} 34 | {{- end }} 35 | {{- end }} 36 | {{- end }} 37 | selector: 38 | matchLabels: 39 | {{- include "common.labels.selectorLabels" . | nindent 6 }} 40 | template: 41 | metadata: 42 | {{- with include ("common.podAnnotations") . }} 43 | annotations: 44 | {{- . | nindent 8 }} 45 | {{- end }} 46 | labels: 47 | {{- include "common.labels.selectorLabels" . | nindent 8 }} 48 | {{- with .Values.podLabels }} 49 | {{- toYaml . | nindent 8 }} 50 | {{- end }} 51 | spec: 52 | {{- include "common.controller.pod" . | nindent 6 }} 53 | {{- end }} 54 | -------------------------------------------------------------------------------- /charts/stable/common/templates/_ingress.tpl: -------------------------------------------------------------------------------- 1 | {{/* Renders the Ingress objects required by the chart */}} 2 | {{- define "common.ingress" -}} 3 | {{- /* Generate named ingresses as required */ -}} 4 | {{- range $name, $ingress := .Values.ingress }} 5 | {{- if $ingress.enabled -}} 6 | {{- $ingressValues := $ingress -}} 7 | 8 | {{/* set defaults */}} 9 | {{- if and (not $ingressValues.nameOverride) (ne $name (include "common.ingress.primary" $)) -}} 10 | {{- $_ := set $ingressValues "nameOverride" $name -}} 11 | {{- end -}} 12 | 13 | {{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}} 14 | {{- include "common.classes.ingress" $ }} 15 | {{- end }} 16 | {{- end }} 17 | {{- end }} 18 | 19 | {{/* Return the name of the primary ingress object */}} 20 | {{- define "common.ingress.primary" -}} 21 | {{- $enabledIngresses := dict -}} 22 | {{- range $name, $ingress := .Values.ingress -}} 23 | {{- if $ingress.enabled -}} 24 | {{- $_ := set $enabledIngresses $name . -}} 25 | {{- end -}} 26 | {{- end -}} 27 | 28 | {{- $result := "" -}} 29 | {{- range $name, $ingress := $enabledIngresses -}} 30 | {{- if and (hasKey $ingress "primary") $ingress.primary -}} 31 | {{- $result = $name -}} 32 | {{- end -}} 33 | {{- end -}} 34 | 35 | {{- if not $result -}} 36 | {{- $result = keys $enabledIngresses | first -}} 37 | {{- end -}} 38 | {{- $result -}} 39 | {{- end -}} 40 | -------------------------------------------------------------------------------- /charts/stable/common/templates/_notes.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Default NOTES.txt content. 3 | */}} 4 | {{- define "common.notes.defaultNotes" -}} 5 | 6 | {{- $primaryIngress := get .Values.ingress (include "common.ingress.primary" .) -}} 7 | {{- $primaryService := get .Values.service (include "common.service.primary" .) -}} 8 | {{- $primaryPort := "" -}} 9 | {{- if $primaryService -}} 10 | {{- $primaryPort = get $primaryService.ports (include "common.classes.service.ports.primary" (dict "serviceName" (include "common.service.primary" .) "values" $primaryService)) -}} 11 | {{- end -}} 12 | 13 | {{- $prefix := "http" -}} 14 | {{- if $primaryPort }} 15 | {{- if hasKey $primaryPort "protocol" }} 16 | {{- if eq $primaryPort.protocol "HTTPS" }} 17 | {{- $prefix = "https" }} 18 | {{- end }} 19 | {{- end }} 20 | {{- end }} 21 | 22 | {{- if $primaryIngress }} 23 | 1. Access the application by visiting one of these URL's: 24 | {{ range $primaryIngress.hosts }} 25 | {{- $protocol := "http" -}} 26 | {{ if $primaryIngress.tls -}} 27 | {{- $prefix = "https" -}} 28 | {{ end -}} 29 | {{- $host := .host -}} 30 | {{ if .hostTpl -}} 31 | {{- $host = tpl .hostTpl $ -}} 32 | {{ end }} 33 | {{- $path := (first .paths).path | default "/" -}} 34 | {{ if (first .paths).pathTpl -}} 35 | {{- $path = tpl (first .paths).pathTpl $ -}} 36 | {{ end }} 37 | - {{ $protocol }}://{{- $host }}{{- $path }} 38 | {{- end }} 39 | {{- else if and $primaryService $primaryPort }} 40 | 1. Get the application URL by running these commands: 41 | {{- if contains "NodePort" $primaryService.type }} 42 | export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.names.fullname" . }}) 43 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") 44 | echo {{ $prefix }}://$NODE_IP:$NODE_PORT 45 | {{- else if contains "LoadBalancer" $primaryService.type }} 46 | NOTE: It may take a few minutes for the LoadBalancer IP to be available. 47 | You can watch the status of by running 'kubectl get svc -w {{ include "common.names.fullname" . }}' 48 | export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') 49 | echo {{ $prefix }}://$SERVICE_IP:{{ $primaryPort.port }} 50 | {{- else if contains "ClusterIP" $primaryService.type }} 51 | export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "common.names.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") 52 | echo "Visit {{ $prefix }}://127.0.0.1:8080 to use your application" 53 | kubectl port-forward $POD_NAME 8080:{{ $primaryPort.port }} 54 | {{- end }} 55 | {{- end }} 56 | {{- end -}} 57 | -------------------------------------------------------------------------------- /charts/stable/common/templates/_pvc.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Renders the Persistent Volume Claim objects required by the chart. 3 | */}} 4 | {{- define "common.pvc" -}} 5 | {{- /* Generate pvc as required */ -}} 6 | {{- range $index, $PVC := .Values.persistence }} 7 | {{- if and $PVC.enabled (eq (default "pvc" $PVC.type) "pvc") (not $PVC.existingClaim) -}} 8 | {{- $persistenceValues := $PVC -}} 9 | {{- if not $persistenceValues.nameOverride -}} 10 | {{- $_ := set $persistenceValues "nameOverride" $index -}} 11 | {{- end -}} 12 | {{- $_ := set $ "ObjectValues" (dict "persistence" $persistenceValues) -}} 13 | {{- include "common.classes.pvc" $ | nindent 0 -}} 14 | {{- end }} 15 | {{- end }} 16 | {{- end }} 17 | -------------------------------------------------------------------------------- /charts/stable/common/templates/_secret.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The Secret object to be created. 3 | */}} 4 | {{- define "common.secret" }} 5 | --- 6 | apiVersion: v1 7 | kind: Secret 8 | metadata: 9 | name: {{ include "common.names.fullname" . }} 10 | labels: {{- include "common.labels" $ | nindent 4 }} 11 | annotations: {{- include "common.annotations" $ | nindent 4 }} 12 | type: Opaque 13 | {{- with .Values.secret }} 14 | stringData: 15 | {{- toYaml . | nindent 2 }} 16 | {{- end }} 17 | {{- end }} 18 | -------------------------------------------------------------------------------- /charts/stable/common/templates/_service.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Renders the Service objects required by the chart. 3 | */}} 4 | {{- define "common.service" -}} 5 | {{- /* Generate named services as required */ -}} 6 | {{- range $name, $service := .Values.service }} 7 | {{- if $service.enabled -}} 8 | {{- $serviceValues := $service -}} 9 | 10 | {{/* set the default nameOverride to the service name */}} 11 | {{- if and (not $serviceValues.nameOverride) (ne $name (include "common.service.primary" $)) -}} 12 | {{- $_ := set $serviceValues "nameOverride" $name -}} 13 | {{ end -}} 14 | 15 | {{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}} 16 | {{- include "common.classes.service" $ }} 17 | {{- end }} 18 | {{- end }} 19 | {{- end }} 20 | 21 | {{/* 22 | Return the primary service object 23 | */}} 24 | {{- define "common.service.primary" -}} 25 | {{- $enabledServices := dict -}} 26 | {{- range $name, $service := .Values.service -}} 27 | {{- if $service.enabled -}} 28 | {{- $_ := set $enabledServices $name . -}} 29 | {{- end -}} 30 | {{- end -}} 31 | 32 | {{- $result := "" -}} 33 | {{- range $name, $service := $enabledServices -}} 34 | {{- if and (hasKey $service "primary") $service.primary -}} 35 | {{- $result = $name -}} 36 | {{- end -}} 37 | {{- end -}} 38 | 39 | {{- if not $result -}} 40 | {{- $result = keys $enabledServices | first -}} 41 | {{- end -}} 42 | {{- $result -}} 43 | {{- end -}} 44 | -------------------------------------------------------------------------------- /charts/stable/common/templates/_serviceaccount.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The ServiceAccount object to be created. 3 | */}} 4 | {{- define "common.serviceAccount" }} 5 | --- 6 | apiVersion: v1 7 | kind: ServiceAccount 8 | metadata: 9 | name: {{ include "common.names.serviceAccountName" . }} 10 | labels: {{- include "common.labels" $ | nindent 4 }} 11 | {{- with (merge (.Values.serviceAccount.annotations | default dict) (include "common.annotations" $ | fromYaml)) }} 12 | annotations: {{- toYaml . | nindent 4 }} 13 | {{- end }} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /charts/stable/common/templates/_statefulset.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | This template serves as the blueprint for the StatefulSet objects that are created 3 | within the common library. 4 | */}} 5 | {{- define "common.statefulset" }} 6 | --- 7 | apiVersion: apps/v1 8 | kind: StatefulSet 9 | metadata: 10 | name: {{ include "common.names.fullname" . }} 11 | {{- with (merge (.Values.controller.labels | default dict) (include "common.labels" $ | fromYaml)) }} 12 | labels: {{- toYaml . | nindent 4 }} 13 | {{- end }} 14 | {{- with (merge (.Values.controller.annotations | default dict) (include "common.annotations" $ | fromYaml)) }} 15 | annotations: {{- toYaml . | nindent 4 }} 16 | {{- end }} 17 | spec: 18 | revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }} 19 | replicas: {{ .Values.controller.replicas }} 20 | podManagementPolicy: {{ default "OrderedReady" .Values.controller.podManagementPolicy }} 21 | {{- $strategy := default "RollingUpdate" .Values.controller.strategy }} 22 | {{- if and (ne $strategy "OnDelete") (ne $strategy "RollingUpdate") }} 23 | {{- fail (printf "Not a valid strategy type for StatefulSet (%s)" $strategy) }} 24 | {{- end }} 25 | updateStrategy: 26 | type: {{ $strategy }} 27 | {{- if and (eq $strategy "RollingUpdate") .Values.controller.rollingUpdate.partition }} 28 | rollingUpdate: 29 | partition: {{ .Values.controller.rollingUpdate.partition }} 30 | {{- end }} 31 | selector: 32 | matchLabels: 33 | {{- include "common.labels.selectorLabels" . | nindent 6 }} 34 | serviceName: {{ include "common.names.fullname" . }} 35 | template: 36 | metadata: 37 | {{- with include ("common.podAnnotations") . }} 38 | annotations: 39 | {{- . | nindent 8 }} 40 | {{- end }} 41 | labels: 42 | {{- include "common.labels.selectorLabels" . | nindent 8 }} 43 | {{- with .Values.podLabels }} 44 | {{- toYaml . | nindent 8 }} 45 | {{- end }} 46 | spec: 47 | {{- include "common.controller.pod" . | nindent 6 }} 48 | volumeClaimTemplates: 49 | {{- range $index, $vct := .Values.volumeClaimTemplates }} 50 | - metadata: 51 | name: {{ $vct.name }} 52 | spec: 53 | accessModes: 54 | - {{ required (printf "accessMode is required for vCT %v" $vct.name) $vct.accessMode | quote }} 55 | resources: 56 | requests: 57 | storage: {{ required (printf "size is required for PVC %v" $vct.name) $vct.size | quote }} 58 | {{- if $vct.storageClass }} 59 | storageClassName: {{ if (eq "-" $vct.storageClass) }}""{{- else }}{{ $vct.storageClass | quote }}{{- end }} 60 | {{- end }} 61 | {{- end }} 62 | {{- end }} 63 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/code-server/_codeserver.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Template to render code-server addon 3 | It will include / inject the required templates based on the given values. 4 | */}} 5 | {{- define "common.addon.codeserver" -}} 6 | {{- if .Values.addons.codeserver.enabled -}} 7 | {{/* Append the code-server container to the additionalContainers */}} 8 | {{- $container := include "common.addon.codeserver.container" . | fromYaml -}} 9 | {{- if $container -}} 10 | {{- $_ := set .Values.additionalContainers "addon-codeserver" $container -}} 11 | {{- end -}} 12 | 13 | {{/* Include the deployKeySecret if not empty */}} 14 | {{- $secret := include "common.addon.codeserver.deployKeySecret" . -}} 15 | {{- if $secret -}} 16 | {{- $secret | nindent 0 -}} 17 | {{- end -}} 18 | 19 | {{/* Append the secret volume to the volumes */}} 20 | {{- $volume := include "common.addon.codeserver.deployKeyVolumeSpec" . | fromYaml -}} 21 | {{- if $volume -}} 22 | {{- $_ := set .Values.persistence "deploykey" (dict "enabled" "true" "mountPath" "-" "type" "custom" "volumeSpec" $volume) -}} 23 | {{- end -}} 24 | 25 | {{/* Add the code-server service */}} 26 | {{- if .Values.addons.codeserver.service.enabled -}} 27 | {{- $serviceValues := .Values.addons.codeserver.service -}} 28 | {{- $_ := set $serviceValues "nameOverride" "codeserver" -}} 29 | {{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}} 30 | {{- include "common.classes.service" $ -}} 31 | {{- $_ := unset $ "ObjectValues" -}} 32 | {{- end -}} 33 | 34 | {{/* Add the code-server ingress */}} 35 | {{- if .Values.addons.codeserver.ingress.enabled -}} 36 | {{- $ingressValues := .Values.addons.codeserver.ingress -}} 37 | {{- $_ := set $ingressValues "nameOverride" "codeserver" -}} 38 | 39 | {{/* Determine the target service name & port */}} 40 | {{- $svcName := printf "%v-codeserver" (include "common.names.fullname" .) -}} 41 | {{- $svcPort := .Values.addons.codeserver.service.ports.codeserver.port -}} 42 | {{- range $_, $host := $ingressValues.hosts -}} 43 | {{- $_ := set (index $host.paths 0) "service" (dict "name" $svcName "port" $svcPort) -}} 44 | {{- end -}} 45 | {{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}} 46 | {{- include "common.classes.ingress" $ -}} 47 | {{- $_ := unset $ "ObjectValues" -}} 48 | {{- end -}} 49 | {{- end -}} 50 | {{- end -}} 51 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/code-server/_container.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The code-server sidecar container to be inserted. 3 | */}} 4 | {{- define "common.addon.codeserver.container" -}} 5 | {{- if lt (len .Values.addons.codeserver.volumeMounts) 1 }} 6 | {{- fail "At least 1 volumeMount is required for codeserver container" }} 7 | {{- end -}} 8 | name: codeserver 9 | image: "{{ .Values.addons.codeserver.image.repository }}:{{ .Values.addons.codeserver.image.tag }}" 10 | imagePullPolicy: {{ .Values.addons.codeserver.pullPolicy }} 11 | {{- with .Values.addons.codeserver.securityContext }} 12 | securityContext: 13 | {{- toYaml . | nindent 2 }} 14 | {{- end }} 15 | {{- with .Values.addons.codeserver.env }} 16 | env: 17 | {{- range $k, $v := . }} 18 | - name: {{ $k }} 19 | value: {{ $v | quote }} 20 | {{- end }} 21 | {{- end }} 22 | ports: 23 | - name: codeserver 24 | containerPort: {{ .Values.addons.codeserver.service.ports.codeserver.port }} 25 | protocol: TCP 26 | args: 27 | {{- range .Values.addons.codeserver.args }} 28 | - {{ . | quote }} 29 | {{- end }} 30 | - "--port" 31 | - "{{ .Values.addons.codeserver.service.ports.codeserver.port }}" 32 | - {{ .Values.addons.codeserver.workingDir | default (first .Values.addons.codeserver.volumeMounts).mountPath }} 33 | volumeMounts: 34 | {{- with .Values.addons.codeserver.volumeMounts }} 35 | {{- toYaml . | nindent 2 }} 36 | {{- end }} 37 | {{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 .Values.addons.codeserver.git.deployKeySecret }} 38 | - name: deploykey 39 | mountPath: /root/.ssh/id_rsa 40 | subPath: id_rsa 41 | {{- end }} 42 | {{- with .Values.addons.codeserver.resources }} 43 | resources: 44 | {{- toYaml . | nindent 2 }} 45 | {{- end }} 46 | {{- end -}} 47 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/code-server/_secret.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The OpenVPN credentials secrets to be included. 3 | */}} 4 | {{- define "common.addon.codeserver.deployKeySecret" -}} 5 | {{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 }} 6 | --- 7 | apiVersion: v1 8 | kind: Secret 9 | metadata: 10 | name: {{ template "common.names.fullname" . }}-deploykey 11 | labels: {{- include "common.labels" $ | nindent 4 }} 12 | annotations: {{- include "common.annotations" $ | nindent 4 }} 13 | type: Opaque 14 | {{- if .Values.addons.codeserver.git.deployKey }} 15 | stringData: 16 | id_rsa: {{ .Values.addons.codeserver.git.deployKey | quote }} 17 | {{- else }} 18 | data: 19 | id_rsa: {{ .Values.addons.codeserver.git.deployKeyBase64 | quote }} 20 | {{- end }} 21 | {{- end }} 22 | {{- end -}} 23 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/code-server/_volume.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The volume (referencing git deploykey) to be inserted into additionalVolumes. 3 | */}} 4 | {{- define "common.addon.codeserver.deployKeyVolumeSpec" -}} 5 | {{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 .Values.addons.codeserver.git.deployKeySecret }} 6 | secret: 7 | {{- if .Values.addons.codeserver.git.deployKeySecret }} 8 | secretName: {{ .Values.addons.codeserver.git.deployKeySecret }} 9 | {{- else }} 10 | secretName: {{ include "common.names.fullname" . }}-deploykey 11 | {{- end }} 12 | defaultMode: 256 13 | items: 14 | - key: id_rsa 15 | path: id_rsa 16 | {{- end -}} 17 | {{- end -}} 18 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/netshoot/_container.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The netshoot sidecar container to be inserted. 3 | */}} 4 | {{- define "common.addon.netshoot.container" -}} 5 | name: netshoot 6 | image: "{{ .Values.addons.netshoot.image.repository }}:{{ .Values.addons.netshoot.image.tag }}" 7 | imagePullPolicy: {{ .Values.addons.netshoot.pullPolicy }} 8 | {{- with .Values.addons.netshoot.securityContext }} 9 | securityContext: 10 | {{- toYaml . | nindent 2 }} 11 | {{- end }} 12 | {{- with .Values.addons.netshoot.env }} 13 | env: 14 | {{- range $k, $v := . }} 15 | - name: {{ $k }} 16 | value: {{ $v | quote }} 17 | {{- end }} 18 | {{- end }} 19 | command: 20 | - /bin/sh 21 | - -c 22 | - sleep infinity 23 | {{- with .Values.addons.netshoot.resources }} 24 | resources: 25 | {{- toYaml . | nindent 2 }} 26 | {{- end }} 27 | {{- end -}} 28 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/netshoot/_netshoot.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Template to render netshoot addon 3 | It will include / inject the required templates based on the given values. 4 | */}} 5 | {{- define "common.addon.netshoot" -}} 6 | {{- if .Values.addons.netshoot.enabled -}} 7 | {{/* Append the netshoot container to the additionalContainers */}} 8 | {{- $container := include "common.addon.netshoot.container" . | fromYaml -}} 9 | {{- if $container -}} 10 | {{- $_ := set .Values.additionalContainers "addon-netshoot" $container -}} 11 | {{- end -}} 12 | {{- end -}} 13 | {{- end -}} 14 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/promtail/_configmap.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The promtail config to be included. 3 | */}} 4 | {{- define "common.addon.promtail.configmap" -}} 5 | {{- if .Values.addons.promtail.enabled }} 6 | --- 7 | apiVersion: v1 8 | kind: ConfigMap 9 | metadata: 10 | name: {{ include "common.names.fullname" . }}-promtail 11 | labels: {{- include "common.labels" $ | nindent 4 }} 12 | annotations: {{- include "common.annotations" $ | nindent 4 }} 13 | data: 14 | promtail.yaml: | 15 | server: 16 | http_listen_port: 9080 17 | grpc_listen_port: 0 18 | positions: 19 | filename: /tmp/positions.yaml 20 | {{- with .Values.addons.promtail.loki }} 21 | client: 22 | url: {{ . }} 23 | {{- end }} 24 | scrape_configs: 25 | {{- range .Values.addons.promtail.logs }} 26 | - job_name: {{ .name }} 27 | static_configs: 28 | - targets: 29 | - localhost 30 | labels: 31 | job: {{ .name }} 32 | __path__: "{{ .path }}" 33 | {{- end }} 34 | {{- end -}} 35 | {{- end -}} 36 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/promtail/_container.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The promtail sidecar container to be inserted. 3 | */}} 4 | {{- define "common.addon.promtail.container" -}} 5 | {{- if lt (len .Values.addons.promtail.volumeMounts) 1 }} 6 | {{- fail "At least 1 volumeMount is required for the promtail container" }} 7 | {{- end -}} 8 | name: promtail 9 | image: "{{ .Values.addons.promtail.image.repository }}:{{ .Values.addons.promtail.image.tag }}" 10 | imagePullPolicy: {{ .Values.addons.promtail.pullPolicy }} 11 | {{- with .Values.addons.promtail.securityContext }} 12 | securityContext: 13 | {{- toYaml . | nindent 2 }} 14 | {{- end }} 15 | {{- with .Values.addons.promtail.env }} 16 | env: 17 | {{- range $k, $v := . }} 18 | - name: {{ $k }} 19 | value: {{ $v | quote }} 20 | {{- end }} 21 | {{- end }} 22 | args: 23 | {{- range .Values.addons.promtail.args }} 24 | - {{ . | quote }} 25 | {{- end }} 26 | - "-config.file=/etc/promtail/promtail.yaml" 27 | volumeMounts: 28 | - name: promtail-config 29 | mountPath: /etc/promtail/promtail.yaml 30 | subPath: promtail.yaml 31 | readOnly: true 32 | {{- with .Values.addons.promtail.volumeMounts }} 33 | {{- toYaml . | nindent 2 }} 34 | {{- end }} 35 | {{- with .Values.addons.promtail.resources }} 36 | resources: 37 | {{- toYaml . | nindent 2 }} 38 | {{- end }} 39 | {{- end -}} 40 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/promtail/_promtail.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Template to render promtail addon 3 | It will include / inject the required templates based on the given values. 4 | */}} 5 | {{- define "common.addon.promtail" -}} 6 | {{- if .Values.addons.promtail.enabled -}} 7 | {{/* Append the promtail container to the additionalContainers */}} 8 | {{- $container := include "common.addon.promtail.container" . | fromYaml -}} 9 | {{- if $container -}} 10 | {{- $_ := set .Values.additionalContainers "addon-promtail" $container -}} 11 | {{- end -}} 12 | 13 | {{/* Include the configmap if not empty */}} 14 | {{- $configmap := include "common.addon.promtail.configmap" . -}} 15 | {{- if $configmap -}} 16 | {{- $configmap | nindent 0 -}} 17 | {{- end -}} 18 | 19 | {{/* Append the promtail config volume to the volumes */}} 20 | {{- $volume := include "common.addon.promtail.volumeSpec" . | fromYaml -}} 21 | {{- if $volume -}} 22 | {{- $_ := set .Values.persistence "promtail-config" (dict "enabled" "true" "mountPath" "-" "type" "custom" "volumeSpec" $volume) -}} 23 | {{- end -}} 24 | {{- end -}} 25 | {{- end -}} 26 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/promtail/_volume.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The volume (referencing config) to be inserted into additionalVolumes. 3 | */}} 4 | {{- define "common.addon.promtail.volumeSpec" -}} 5 | configMap: 6 | name: {{ include "common.names.fullname" . }}-promtail 7 | {{- end -}} 8 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/vpn/_configmap.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The VPN config and scripts to be included. 3 | */}} 4 | {{- define "common.addon.vpn.configmap" -}} 5 | {{- if or .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down }} 6 | --- 7 | apiVersion: v1 8 | kind: ConfigMap 9 | metadata: 10 | name: {{ include "common.names.fullname" . }}-vpn 11 | labels: {{- include "common.labels" $ | nindent 4 }} 12 | annotations: {{- include "common.annotations" $ | nindent 4 }} 13 | data: 14 | {{- with .Values.addons.vpn.scripts.up }} 15 | up.sh: |- 16 | {{- . | nindent 4}} 17 | {{- end }} 18 | {{- with .Values.addons.vpn.scripts.down }} 19 | down.sh: |- 20 | {{- . | nindent 4}} 21 | {{- end }} 22 | {{- end -}} 23 | {{- end -}} 24 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/vpn/_networkpolicy.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Blueprint for the NetworkPolicy object that can be included in the addon. 3 | */}} 4 | {{- define "common.addon.vpn.networkpolicy" -}} 5 | {{- if .Values.addons.vpn.networkPolicy.enabled }} 6 | --- 7 | kind: NetworkPolicy 8 | apiVersion: networking.k8s.io/v1 9 | metadata: 10 | name: {{ include "common.names.fullname" . }} 11 | {{- with (merge (.Values.addons.vpn.networkPolicy.labels | default dict) (include "common.labels" $ | fromYaml)) }} 12 | labels: {{- toYaml . | nindent 4 }} 13 | {{- end }} 14 | {{- with (merge (.Values.addons.vpn.networkPolicy.annotations | default dict) (include "common.annotations" $ | fromYaml)) }} 15 | annotations: {{- toYaml . | nindent 4 }} 16 | {{- end }} 17 | spec: 18 | podSelector: 19 | {{- with (merge .Values.addons.vpn.networkPolicy.podSelectorLabels (include "common.labels.selectorLabels" . | fromYaml)) }} 20 | matchLabels: {{- toYaml . | nindent 6 }} 21 | {{- end }} 22 | policyTypes: 23 | - Egress 24 | egress: 25 | {{- with .Values.addons.vpn.networkPolicy.egress }} 26 | {{- . | toYaml | nindent 4 }} 27 | {{- end -}} 28 | {{- end -}} 29 | {{- end -}} 30 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/vpn/_secret.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The OpenVPN config secret to be included. 3 | */}} 4 | {{- define "common.addon.vpn.secret" -}} 5 | {{- if and .Values.addons.vpn.configFile (not .Values.addons.vpn.configFileSecret) }} 6 | --- 7 | apiVersion: v1 8 | kind: Secret 9 | metadata: 10 | name: {{ include "common.names.fullname" . }}-vpnconfig 11 | labels: {{- include "common.labels" $ | nindent 4 }} 12 | annotations: {{- include "common.annotations" $ | nindent 4 }} 13 | stringData: 14 | {{- with .Values.addons.vpn.configFile }} 15 | vpnConfigfile: |- 16 | {{- . | nindent 4}} 17 | {{- end }} 18 | {{- end -}} 19 | {{- end -}} 20 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/vpn/_volume.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The volume (referencing VPN scripts) to be inserted into additionalVolumes. 3 | */}} 4 | {{- define "common.addon.vpn.scriptsVolumeSpec" -}} 5 | {{- if or .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down -}} 6 | configMap: 7 | name: {{ include "common.names.fullname" . }}-vpn 8 | items: 9 | {{- if .Values.addons.vpn.scripts.up }} 10 | - key: up.sh 11 | path: up.sh 12 | mode: 0777 13 | {{- end }} 14 | {{- if .Values.addons.vpn.scripts.down }} 15 | - key: down.sh 16 | path: down.sh 17 | mode: 0777 18 | {{- end }} 19 | {{- end -}} 20 | {{- end -}} 21 | 22 | {{/* 23 | The volume (referencing VPN config) to be inserted into additionalVolumes. 24 | */}} 25 | {{- define "common.addon.vpn.configVolumeSpec" -}} 26 | {{- if or .Values.addons.vpn.configFile .Values.addons.vpn.configFileSecret -}} 27 | secret: 28 | {{- if .Values.addons.vpn.configFileSecret }} 29 | secretName: {{ .Values.addons.vpn.configFileSecret }} 30 | {{- else }} 31 | secretName: {{ include "common.names.fullname" . }}-vpnconfig 32 | {{- end }} 33 | items: 34 | - key: vpnConfigfile 35 | path: vpnConfigfile 36 | {{- end -}} 37 | {{- end -}} 38 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/vpn/_vpn.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Template to render VPN addon 3 | It will include / inject the required templates based on the given values. 4 | */}} 5 | {{- define "common.addon.vpn" -}} 6 | {{- if .Values.addons.vpn.enabled -}} 7 | {{- if eq "openvpn" .Values.addons.vpn.type -}} 8 | {{- include "common.addon.openvpn" . }} 9 | {{- end -}} 10 | 11 | {{- if eq "wireguard" .Values.addons.vpn.type -}} 12 | {{- include "common.addon.wireguard" . }} 13 | {{- end -}} 14 | 15 | {{- if eq "gluetun" .Values.addons.vpn.type -}} 16 | {{- include "common.addon.gluetun" . }} 17 | {{- end -}} 18 | 19 | {{/* Include the configmap if not empty */}} 20 | {{- $configmap := include "common.addon.vpn.configmap" . -}} 21 | {{- if $configmap -}} 22 | {{- $configmap | nindent 0 -}} 23 | {{- end -}} 24 | 25 | {{/* Include the secret if not empty */}} 26 | {{- $secret := include "common.addon.vpn.secret" . -}} 27 | {{- if $secret -}} 28 | {{- $secret | nindent 0 -}} 29 | {{- end -}} 30 | 31 | {{/* Append the vpn scripts volume to the volumes */}} 32 | {{- $scriptVolume := include "common.addon.vpn.scriptsVolumeSpec" . | fromYaml -}} 33 | {{- if $scriptVolume -}} 34 | {{- $_ := set .Values.persistence "vpnscript" (dict "enabled" "true" "mountPath" "-" "type" "custom" "volumeSpec" $scriptVolume) -}} 35 | {{- end -}} 36 | 37 | {{/* Append the vpn config volume to the volumes */}} 38 | {{- $configVolume := include "common.addon.vpn.configVolumeSpec" . | fromYaml }} 39 | {{ if $configVolume -}} 40 | {{- $_ := set .Values.persistence "vpnconfig" (dict "enabled" "true" "mountPath" "-" "type" "custom" "volumeSpec" $configVolume) -}} 41 | {{- end -}} 42 | 43 | {{/* Include the networkpolicy if not empty */}} 44 | {{- $networkpolicy := include "common.addon.vpn.networkpolicy" . -}} 45 | {{- if $networkpolicy -}} 46 | {{- $networkpolicy | nindent 0 -}} 47 | {{- end -}} 48 | {{- end -}} 49 | {{- end -}} 50 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/vpn/gluetun/_addon.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Template to render gluetun addon. It will add the container to the list of additionalContainers. 3 | */}} 4 | */}} 5 | {{- define "common.addon.gluetun" -}} 6 | {{/* Append the gluetun container to the additionalContainers */}} 7 | {{- $container := fromYaml (include "common.addon.gluetun.container" .) -}} 8 | {{- if $container -}} 9 | {{- $_ := set .Values.additionalContainers "addon-gluetun" $container -}} 10 | {{- end -}} 11 | {{- end -}} 12 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/vpn/gluetun/_container.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The gluetun sidecar container to be inserted. 3 | */}} 4 | {{- define "common.addon.gluetun.container" -}} 5 | name: gluetun 6 | image: "{{ .Values.addons.vpn.gluetun.image.repository }}:{{ .Values.addons.vpn.gluetun.image.tag }}" 7 | imagePullPolicy: {{ .Values.addons.vpn.gluetun.pullPolicy }} 8 | {{- with .Values.addons.vpn.securityContext }} 9 | securityContext: 10 | {{- toYaml . | nindent 2 }} 11 | {{- end }} 12 | {{- with .Values.addons.vpn.env }} 13 | env: 14 | {{- . | toYaml | nindent 2 }} 15 | {{- end }} 16 | {{- with .Values.addons.vpn.envFrom }} 17 | envFrom: 18 | {{- . | toYaml | nindent 2 }} 19 | {{- end }} 20 | {{- with .Values.addons.vpn.args }} 21 | args: 22 | {{- . | toYaml | nindent 2 }} 23 | {{- end }} 24 | {{- if or .Values.addons.vpn.configFile .Values.addons.vpn.configFileSecret .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down .Values.addons.vpn.additionalVolumeMounts .Values.persistence.shared.enabled }} 25 | volumeMounts: 26 | {{- if or .Values.addons.vpn.configFile .Values.addons.vpn.configFileSecret }} 27 | - name: vpnconfig 28 | mountPath: /gluetun/config.conf 29 | subPath: vpnConfigfile 30 | {{- end }} 31 | {{- if .Values.addons.vpn.scripts.up }} 32 | - name: vpnscript 33 | mountPath: /gluetun/scripts/up.sh 34 | subPath: up.sh 35 | {{- end }} 36 | {{- if .Values.addons.vpn.scripts.down }} 37 | - name: vpnscript 38 | mountPath: /gluetun/scripts/down.sh 39 | subPath: down.sh 40 | {{- end }} 41 | {{- if .Values.persistence.shared.enabled }} 42 | - mountPath: {{ .Values.persistence.shared.mountPath }} 43 | name: shared 44 | {{- end }} 45 | {{- with .Values.addons.vpn.additionalVolumeMounts }} 46 | {{- toYaml . | nindent 2 }} 47 | {{- end }} 48 | {{- end }} 49 | {{- with .Values.addons.vpn.livenessProbe }} 50 | livenessProbe: 51 | {{- toYaml . | nindent 2 }} 52 | {{- end -}} 53 | {{- with .Values.addons.vpn.resources }} 54 | resources: 55 | {{- toYaml . | nindent 2 }} 56 | {{- end }} 57 | {{- end -}} 58 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/vpn/openvpn/_addon.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Template to render OpenVPN addon. It will add the container to the list of additionalContainers 3 | and add a credentials secret if speciffied. 4 | */}} 5 | {{- define "common.addon.openvpn" -}} 6 | {{/* Append the openVPN container to the additionalContainers */}} 7 | {{- $container := include "common.addon.openvpn.container" . | fromYaml -}} 8 | {{- if $container -}} 9 | {{- $_ := set .Values.additionalContainers "addon-openvpn" $container -}} 10 | {{- end -}} 11 | 12 | {{/* Include the secret if not empty */}} 13 | {{- $secret := include "common.addon.openvpn.secret" . -}} 14 | {{- if $secret -}} 15 | {{- $secret | nindent 0 -}} 16 | {{- end -}} 17 | {{- end -}} 18 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/vpn/openvpn/_container.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The OpenVPN sidecar container to be inserted. 3 | */}} 4 | {{- define "common.addon.openvpn.container" -}} 5 | name: openvpn 6 | image: "{{ .Values.addons.vpn.openvpn.image.repository }}:{{ .Values.addons.vpn.openvpn.image.tag }}" 7 | imagePullPolicy: {{ .Values.addons.vpn.openvpn.pullPolicy }} 8 | {{- with .Values.addons.vpn.securityContext }} 9 | securityContext: 10 | {{- toYaml . | nindent 2 }} 11 | {{- end }} 12 | {{- with .Values.addons.vpn.env }} 13 | env: 14 | {{- . | toYaml | nindent 2 }} 15 | {{- end }} 16 | {{- with .Values.addons.vpn.envFrom }} 17 | envFrom: 18 | {{- . | toYaml | nindent 2 }} 19 | {{- end }} 20 | {{- with .Values.addons.vpn.args }} 21 | args: 22 | {{- . | toYaml | nindent 2 }} 23 | {{- end }} 24 | {{- if or .Values.addons.vpn.openvpn.auth .Values.addons.vpn.openvpn.authSecret }} 25 | envFrom: 26 | - secretRef: 27 | {{- if .Values.addons.vpn.openvpn.authSecret }} 28 | name: {{ .Values.addons.vpn.openvpn.authSecret }} 29 | {{- else }} 30 | name: {{ include "common.names.fullname" . }}-openvpn 31 | {{- end }} 32 | {{- end }} 33 | {{- if or .Values.addons.vpn.configFile .Values.addons.vpn.configFileSecret .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down .Values.addons.vpn.additionalVolumeMounts .Values.persistence.shared.enabled }} 34 | volumeMounts: 35 | {{- if or .Values.addons.vpn.configFile .Values.addons.vpn.configFileSecret }} 36 | - name: vpnconfig 37 | mountPath: /vpn/vpn.conf 38 | subPath: vpnConfigfile 39 | {{- end }} 40 | {{- if .Values.addons.vpn.scripts.up }} 41 | - name: vpnscript 42 | mountPath: /vpn/up.sh 43 | subPath: up.sh 44 | {{- end }} 45 | {{- if .Values.addons.vpn.scripts.down }} 46 | - name: vpnscript 47 | mountPath: /vpn/down.sh 48 | subPath: down.sh 49 | {{- end }} 50 | {{- if .Values.persistence.shared.enabled }} 51 | - mountPath: {{ .Values.persistence.shared.mountPath }} 52 | name: shared 53 | {{- end }} 54 | {{- with .Values.addons.vpn.additionalVolumeMounts }} 55 | {{- toYaml . | nindent 2 }} 56 | {{- end }} 57 | {{- end }} 58 | {{- with .Values.addons.vpn.livenessProbe }} 59 | livenessProbe: 60 | {{- toYaml . | nindent 2 }} 61 | {{- end -}} 62 | {{- with .Values.addons.vpn.resources }} 63 | resources: 64 | {{- toYaml . | nindent 2 }} 65 | {{- end }} 66 | {{- end -}} 67 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/vpn/openvpn/_secret.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The OpenVPN credentials secrets to be included. 3 | */}} 4 | {{- define "common.addon.openvpn.secret" -}} 5 | {{- with .Values.addons.vpn.openvpn.auth }} 6 | --- 7 | apiVersion: v1 8 | kind: Secret 9 | metadata: 10 | name: {{ include "common.names.fullname" $ }}-openvpn 11 | labels: {{- include "common.labels" $ | nindent 4 }} 12 | annotations: {{- include "common.annotations" $ | nindent 4 }} 13 | data: 14 | VPN_AUTH: {{ . | b64enc }} 15 | {{- end -}} 16 | {{- end -}} 17 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/vpn/wireguard/_addon.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Template to render Wireguard addon. It will add the container to the list of additionalContainers. 3 | */}} 4 | */}} 5 | {{- define "common.addon.wireguard" -}} 6 | {{/* Append the Wireguard container to the additionalContainers */}} 7 | {{- $container := fromYaml (include "common.addon.wireguard.container" .) -}} 8 | {{- if $container -}} 9 | {{- $_ := set .Values.additionalContainers "addon-wireguard" $container -}} 10 | {{- end -}} 11 | {{- end -}} 12 | -------------------------------------------------------------------------------- /charts/stable/common/templates/addons/vpn/wireguard/_container.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | The Wireguard sidecar container to be inserted. 3 | */}} 4 | {{- define "common.addon.wireguard.container" -}} 5 | name: wireguard 6 | image: "{{ .Values.addons.vpn.wireguard.image.repository }}:{{ .Values.addons.vpn.wireguard.image.tag }}" 7 | imagePullPolicy: {{ .Values.addons.vpn.wireguard.pullPolicy }} 8 | {{- with .Values.addons.vpn.securityContext }} 9 | securityContext: 10 | {{- toYaml . | nindent 2 }} 11 | {{- end }} 12 | {{- with .Values.addons.vpn.env }} 13 | env: 14 | {{- . | toYaml | nindent 2 }} 15 | {{- end }} 16 | {{- with .Values.addons.vpn.envFrom }} 17 | envFrom: 18 | {{- . | toYaml | nindent 2 }} 19 | {{- end }} 20 | {{- with .Values.addons.vpn.args }} 21 | args: 22 | {{- . | toYaml | nindent 2 }} 23 | {{- end }} 24 | {{- if or .Values.addons.vpn.configFile .Values.addons.vpn.configFileSecret .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down .Values.addons.vpn.additionalVolumeMounts .Values.persistence.shared.enabled }} 25 | volumeMounts: 26 | {{- if or .Values.addons.vpn.configFile .Values.addons.vpn.configFileSecret }} 27 | - name: vpnconfig 28 | mountPath: /etc/wireguard/wg0.conf 29 | subPath: vpnConfigfile 30 | {{- end }} 31 | {{- if .Values.addons.vpn.scripts.up }} 32 | - name: vpnscript 33 | mountPath: /config/up.sh 34 | subPath: up.sh 35 | {{- end }} 36 | {{- if .Values.addons.vpn.scripts.down }} 37 | - name: vpnscript 38 | mountPath: /config/down.sh 39 | subPath: down.sh 40 | {{- end }} 41 | {{- if .Values.persistence.shared.enabled }} 42 | - mountPath: {{ .Values.persistence.shared.mountPath }} 43 | name: shared 44 | {{- end }} 45 | {{- with .Values.addons.vpn.additionalVolumeMounts }} 46 | {{- toYaml . | nindent 2 }} 47 | {{- end }} 48 | {{- end }} 49 | {{- with .Values.addons.vpn.livenessProbe }} 50 | livenessProbe: 51 | {{- toYaml . | nindent 2 }} 52 | {{- end -}} 53 | {{- with .Values.addons.vpn.resources }} 54 | resources: 55 | {{- toYaml . | nindent 2 }} 56 | {{- end }} 57 | {{- end -}} 58 | -------------------------------------------------------------------------------- /charts/stable/common/templates/classes/_HorizontalPodAutoscaler.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | This template serves as a blueprint for horizontal pod autoscaler objects that are created 3 | using the common library. 4 | */}} 5 | {{- define "common.classes.hpa" -}} 6 | {{- if .Values.autoscaling.enabled -}} 7 | {{- $hpaName := include "common.names.fullname" . -}} 8 | {{- $targetName := include "common.names.fullname" . }} 9 | --- 10 | apiVersion: autoscaling/v2beta1 11 | kind: HorizontalPodAutoscaler 12 | metadata: 13 | name: {{ $hpaName }} 14 | labels: {{- include "common.labels" $ | nindent 4 }} 15 | annotations: {{- include "common.annotations" $ | nindent 4 }} 16 | spec: 17 | scaleTargetRef: 18 | apiVersion: apps/v1 19 | kind: {{ include "common.names.controllerType" . }} 20 | name: {{ .Values.autoscaling.target | default $targetName }} 21 | minReplicas: {{ .Values.autoscaling.minReplicas | default 1 }} 22 | maxReplicas: {{ .Values.autoscaling.maxReplicas | default 3 }} 23 | metrics: 24 | {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} 25 | - type: Resource 26 | resource: 27 | name: cpu 28 | targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} 29 | {{- end }} 30 | {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} 31 | - type: Resource 32 | resource: 33 | name: memory 34 | targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} 35 | {{- end }} 36 | {{- end -}} 37 | {{- end -}} 38 | -------------------------------------------------------------------------------- /charts/stable/common/templates/classes/_configmap.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | This template serves as a blueprint for all configMap objects that are created 3 | within the common library. 4 | */}} 5 | {{- define "common.classes.configmap" -}} 6 | {{- $fullName := include "common.names.fullname" . -}} 7 | {{- $configMapName := $fullName -}} 8 | {{- $values := .Values.configmap -}} 9 | 10 | {{- if hasKey . "ObjectValues" -}} 11 | {{- with .ObjectValues.configmap -}} 12 | {{- $values = . -}} 13 | {{- end -}} 14 | {{ end -}} 15 | 16 | {{- if and (hasKey $values "nameOverride") $values.nameOverride -}} 17 | {{- $configMapName = printf "%v-%v" $configMapName $values.nameOverride -}} 18 | {{- end }} 19 | --- 20 | apiVersion: v1 21 | kind: ConfigMap 22 | metadata: 23 | name: {{ $configMapName }} 24 | {{- with (merge ($values.labels | default dict) (include "common.labels" $ | fromYaml)) }} 25 | labels: {{- toYaml . | nindent 4 }} 26 | {{- end }} 27 | {{- with (merge ($values.annotations | default dict) (include "common.annotations" $ | fromYaml)) }} 28 | annotations: {{- toYaml . | nindent 4 }} 29 | {{- end }} 30 | data: 31 | {{- with $values.data }} 32 | {{- tpl (toYaml .) $ | nindent 2 }} 33 | {{- end }} 34 | {{- end }} 35 | -------------------------------------------------------------------------------- /charts/stable/common/templates/classes/_ingress.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | This template serves as a blueprint for all Ingress objects that are created 3 | within the common library. 4 | */}} 5 | {{- define "common.classes.ingress" -}} 6 | {{- $fullName := include "common.names.fullname" . -}} 7 | {{- $ingressName := $fullName -}} 8 | {{- $values := .Values.ingress -}} 9 | 10 | {{- if hasKey . "ObjectValues" -}} 11 | {{- with .ObjectValues.ingress -}} 12 | {{- $values = . -}} 13 | {{- end -}} 14 | {{ end -}} 15 | 16 | {{- if and (hasKey $values "nameOverride") $values.nameOverride -}} 17 | {{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}} 18 | {{- end -}} 19 | 20 | {{- $primaryService := get .Values.service (include "common.service.primary" .) -}} 21 | {{- $defaultServiceName := $fullName -}} 22 | {{- if and (hasKey $primaryService "nameOverride") $primaryService.nameOverride -}} 23 | {{- $defaultServiceName = printf "%v-%v" $defaultServiceName $primaryService.nameOverride -}} 24 | {{- end -}} 25 | {{- $defaultServicePort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}} 26 | {{- $isStable := include "common.capabilities.ingress.isStable" . }} 27 | --- 28 | apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }} 29 | kind: Ingress 30 | metadata: 31 | name: {{ $ingressName }} 32 | {{- with (merge ($values.labels | default dict) (include "common.labels" $ | fromYaml)) }} 33 | labels: {{- toYaml . | nindent 4 }} 34 | {{- end }} 35 | {{- with (merge ($values.annotations | default dict) (include "common.annotations" $ | fromYaml)) }} 36 | annotations: {{- toYaml . | nindent 4 }} 37 | {{- end }} 38 | spec: 39 | {{- if and $isStable $values.ingressClassName }} 40 | ingressClassName: {{ $values.ingressClassName }} 41 | {{- end }} 42 | {{- if $values.tls }} 43 | tls: 44 | {{- range $values.tls }} 45 | - hosts: 46 | {{- range .hosts }} 47 | - {{ tpl . $ | quote }} 48 | {{- end }} 49 | {{- if .secretName }} 50 | secretName: {{ tpl .secretName $ | quote}} 51 | {{- end }} 52 | {{- end }} 53 | {{- end }} 54 | rules: 55 | {{- range $values.hosts }} 56 | - host: {{ tpl .host $ | quote }} 57 | http: 58 | paths: 59 | {{- range .paths }} 60 | {{- $service := $defaultServiceName -}} 61 | {{- $port := $defaultServicePort.port -}} 62 | {{- if .service -}} 63 | {{- $service = default $service .service.name -}} 64 | {{- $port = default $port .service.port -}} 65 | {{- end }} 66 | - path: {{ tpl .path $ | quote }} 67 | {{- if $isStable }} 68 | pathType: {{ default "Prefix" .pathType }} 69 | {{- end }} 70 | backend: 71 | {{- if $isStable }} 72 | service: 73 | name: {{ $service }} 74 | port: 75 | number: {{ $port }} 76 | {{- else }} 77 | serviceName: {{ $service }} 78 | servicePort: {{ $port }} 79 | {{- end }} 80 | {{- end }} 81 | {{- end }} 82 | {{- end }} 83 | -------------------------------------------------------------------------------- /charts/stable/common/templates/classes/_pvc.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | This template serves as a blueprint for all PersistentVolumeClaim objects that are created 3 | within the common library. 4 | */}} 5 | {{- define "common.classes.pvc" -}} 6 | {{- $values := .Values.persistence -}} 7 | {{- if hasKey . "ObjectValues" -}} 8 | {{- with .ObjectValues.persistence -}} 9 | {{- $values = . -}} 10 | {{- end -}} 11 | {{ end -}} 12 | {{- $pvcName := include "common.names.fullname" . -}} 13 | {{- if and (hasKey $values "nameOverride") $values.nameOverride -}} 14 | {{- if not (eq $values.nameOverride "-") -}} 15 | {{- $pvcName = printf "%v-%v" $pvcName $values.nameOverride -}} 16 | {{ end -}} 17 | {{ end }} 18 | --- 19 | kind: PersistentVolumeClaim 20 | apiVersion: v1 21 | metadata: 22 | name: {{ $pvcName }} 23 | {{- with (merge ($values.labels | default dict) (include "common.labels" $ | fromYaml)) }} 24 | labels: {{- toYaml . | nindent 4 }} 25 | {{- end }} 26 | annotations: 27 | {{- if $values.retain }} 28 | "helm.sh/resource-policy": keep 29 | {{- end }} 30 | {{- with (merge ($values.annotations | default dict) (include "common.annotations" $ | fromYaml)) }} 31 | {{- toYaml . | nindent 4 }} 32 | {{- end }} 33 | spec: 34 | accessModes: 35 | - {{ required (printf "accessMode is required for PVC %v" $pvcName) $values.accessMode | quote }} 36 | resources: 37 | requests: 38 | storage: {{ required (printf "size is required for PVC %v" $pvcName) $values.size | quote }} 39 | {{- if $values.storageClass }} 40 | storageClassName: {{ if (eq "-" $values.storageClass) }}""{{- else }}{{ $values.storageClass | quote }}{{- end }} 41 | {{- end }} 42 | {{- if $values.volumeName }} 43 | volumeName: {{ $values.volumeName | quote }} 44 | {{- end }} 45 | {{- end -}} 46 | -------------------------------------------------------------------------------- /charts/stable/common/templates/classes/_service.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | This template serves as a blueprint for all Service objects that are created 3 | within the common library. 4 | */}} 5 | {{- define "common.classes.service" -}} 6 | {{- $values := .Values.service -}} 7 | {{- if hasKey . "ObjectValues" -}} 8 | {{- with .ObjectValues.service -}} 9 | {{- $values = . -}} 10 | {{- end -}} 11 | {{ end -}} 12 | 13 | {{- $serviceName := include "common.names.fullname" . -}} 14 | {{- if and (hasKey $values "nameOverride") $values.nameOverride -}} 15 | {{- $serviceName = printf "%v-%v" $serviceName $values.nameOverride -}} 16 | {{ end -}} 17 | {{- $svcType := $values.type | default "" -}} 18 | {{- $primaryPort := get $values.ports (include "common.classes.service.ports.primary" (dict "values" $values)) }} 19 | --- 20 | apiVersion: v1 21 | kind: Service 22 | metadata: 23 | name: {{ $serviceName }} 24 | {{- with (merge ($values.labels | default dict) (include "common.labels" $ | fromYaml)) }} 25 | labels: {{- toYaml . | nindent 4 }} 26 | {{- end }} 27 | annotations: 28 | {{- if eq ( $primaryPort.protocol | default "" ) "HTTPS" }} 29 | traefik.ingress.kubernetes.io/service.serversscheme: https 30 | {{- end }} 31 | {{- with (merge ($values.annotations | default dict) (include "common.annotations" $ | fromYaml)) }} 32 | {{ toYaml . | nindent 4 }} 33 | {{- end }} 34 | spec: 35 | {{- if (or (eq $svcType "ClusterIP") (empty $svcType)) }} 36 | type: ClusterIP 37 | {{- if $values.clusterIP }} 38 | clusterIP: {{ $values.clusterIP }} 39 | {{end}} 40 | {{- else if eq $svcType "LoadBalancer" }} 41 | type: {{ $svcType }} 42 | {{- if $values.loadBalancerIP }} 43 | loadBalancerIP: {{ $values.loadBalancerIP }} 44 | {{- end }} 45 | {{- if $values.loadBalancerSourceRanges }} 46 | loadBalancerSourceRanges: 47 | {{ toYaml $values.loadBalancerSourceRanges | nindent 4 }} 48 | {{- end -}} 49 | {{- else }} 50 | type: {{ $svcType }} 51 | {{- end }} 52 | {{- if $values.externalTrafficPolicy }} 53 | externalTrafficPolicy: {{ $values.externalTrafficPolicy }} 54 | {{- end }} 55 | {{- if $values.sessionAffinity }} 56 | sessionAffinity: {{ $values.sessionAffinity }} 57 | {{- if $values.sessionAffinityConfig }} 58 | sessionAffinityConfig: 59 | {{ toYaml $values.sessionAffinityConfig | nindent 4 }} 60 | {{- end -}} 61 | {{- end }} 62 | {{- with $values.externalIPs }} 63 | externalIPs: 64 | {{- toYaml . | nindent 4 }} 65 | {{- end }} 66 | {{- if $values.publishNotReadyAddresses }} 67 | publishNotReadyAddresses: {{ $values.publishNotReadyAddresses }} 68 | {{- end }} 69 | {{- if $values.ipFamilyPolicy }} 70 | ipFamilyPolicy: {{ $values.ipFamilyPolicy }} 71 | {{- end }} 72 | {{- with $values.ipFamilies }} 73 | ipFamilies: 74 | {{ toYaml . | nindent 4 }} 75 | {{- end }} 76 | ports: 77 | {{- range $name, $port := $values.ports }} 78 | {{- if $port.enabled }} 79 | - port: {{ $port.port }} 80 | targetPort: {{ $port.targetPort | default $name }} 81 | {{- if $port.protocol }} 82 | {{- if or ( eq $port.protocol "HTTP" ) ( eq $port.protocol "HTTPS" ) ( eq $port.protocol "TCP" ) }} 83 | protocol: TCP 84 | {{- else }} 85 | protocol: {{ $port.protocol }} 86 | {{- end }} 87 | {{- else }} 88 | protocol: TCP 89 | {{- end }} 90 | name: {{ $name }} 91 | {{- if (and (eq $svcType "NodePort") (not (empty $port.nodePort))) }} 92 | nodePort: {{ $port.nodePort }} 93 | {{ end }} 94 | {{- end }} 95 | {{- end }} 96 | selector: 97 | {{- include "common.labels.selectorLabels" . | nindent 4 }} 98 | {{- end }} 99 | -------------------------------------------------------------------------------- /charts/stable/common/templates/classes/_service_ports.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Return the primary port for a given Service object. 3 | */}} 4 | {{- define "common.classes.service.ports.primary" -}} 5 | {{- $enabledPorts := dict -}} 6 | {{- range $name, $port := .values.ports -}} 7 | {{- if $port.enabled -}} 8 | {{- $_ := set $enabledPorts $name . -}} 9 | {{- end -}} 10 | {{- end -}} 11 | 12 | {{- if eq 0 (len $enabledPorts) }} 13 | {{- fail (printf "No ports are enabled for service \"%s\"!" .serviceName) }} 14 | {{- end }} 15 | 16 | {{- $result := "" -}} 17 | {{- range $name, $port := $enabledPorts -}} 18 | {{- if and (hasKey $port "primary") $port.primary -}} 19 | {{- $result = $name -}} 20 | {{- end -}} 21 | {{- end -}} 22 | 23 | {{- if not $result -}} 24 | {{- $result = keys $enabledPorts | first -}} 25 | {{- end -}} 26 | {{- $result -}} 27 | {{- end -}} 28 | -------------------------------------------------------------------------------- /charts/stable/common/templates/lib/chart/_annotations.tpl: -------------------------------------------------------------------------------- 1 | {{/* Common annotations shared across objects */}} 2 | {{- define "common.annotations" -}} 3 | {{- with .Values.global.annotations }} 4 | {{- range $k, $v := . }} 5 | {{- $name := $k }} 6 | {{- $value := tpl $v $ }} 7 | {{ $name }}: {{ quote $value }} 8 | {{- end }} 9 | {{- end }} 10 | {{- end -}} 11 | 12 | {{/* Determine the Pod annotations used in the controller */}} 13 | {{- define "common.podAnnotations" -}} 14 | {{- if .Values.podAnnotations -}} 15 | {{- tpl (toYaml .Values.podAnnotations) . | nindent 0 -}} 16 | {{- end -}} 17 | 18 | {{- $configMapsFound := false -}} 19 | {{- range $name, $configmap := .Values.configmap -}} 20 | {{- if $configmap.enabled -}} 21 | {{- $configMapsFound = true -}} 22 | {{- end -}} 23 | {{- end -}} 24 | {{- if $configMapsFound -}} 25 | {{- printf "checksum/config: %v" (include ("common.configmap") . | sha256sum) | nindent 0 -}} 26 | {{- end -}} 27 | {{- end -}} 28 | -------------------------------------------------------------------------------- /charts/stable/common/templates/lib/chart/_capabilities.tpl: -------------------------------------------------------------------------------- 1 | {{/* Allow KubeVersion to be overridden. */}} 2 | {{- define "common.capabilities.ingress.kubeVersion" -}} 3 | {{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride -}} 4 | {{- end -}} 5 | 6 | {{/* Return the appropriate apiVersion for Ingress objects */}} 7 | {{- define "common.capabilities.ingress.apiVersion" -}} 8 | {{- print "networking.k8s.io/v1" -}} 9 | {{- if semverCompare "<1.19" (include "common.capabilities.ingress.kubeVersion" .) -}} 10 | {{- print "beta1" -}} 11 | {{- end -}} 12 | {{- end -}} 13 | 14 | {{/* Check Ingress stability */}} 15 | {{- define "common.capabilities.ingress.isStable" -}} 16 | {{- if eq (include "common.capabilities.ingress.apiVersion" .) "networking.k8s.io/v1" -}} 17 | {{- true -}} 18 | {{- end -}} 19 | {{- end -}} 20 | -------------------------------------------------------------------------------- /charts/stable/common/templates/lib/chart/_labels.tpl: -------------------------------------------------------------------------------- 1 | {{/* Common labels shared across objects */}} 2 | {{- define "common.labels" -}} 3 | helm.sh/chart: {{ include "common.names.chart" . }} 4 | {{ include "common.labels.selectorLabels" . }} 5 | {{- if .Chart.AppVersion }} 6 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} 7 | {{- end }} 8 | app.kubernetes.io/managed-by: {{ .Release.Service }} 9 | {{- with .Values.global.labels }} 10 | {{- range $k, $v := . }} 11 | {{- $name := $k }} 12 | {{- $value := tpl $v $ }} 13 | {{ $name }}: {{ quote $value }} 14 | {{- end }} 15 | {{- end }} 16 | {{- end -}} 17 | 18 | {{/* Selector labels shared across objects */}} 19 | {{- define "common.labels.selectorLabels" -}} 20 | app.kubernetes.io/name: {{ include "common.names.name" . }} 21 | app.kubernetes.io/instance: {{ .Release.Name }} 22 | {{- end -}} 23 | -------------------------------------------------------------------------------- /charts/stable/common/templates/lib/chart/_names.tpl: -------------------------------------------------------------------------------- 1 | {{/* Expand the name of the chart */}} 2 | {{- define "common.names.name" -}} 3 | {{- $globalNameOverride := "" -}} 4 | {{- if hasKey .Values "global" -}} 5 | {{- $globalNameOverride = (default $globalNameOverride .Values.global.nameOverride) -}} 6 | {{- end -}} 7 | {{- default .Chart.Name (default .Values.nameOverride $globalNameOverride) | trunc 63 | trimSuffix "-" -}} 8 | {{- end -}} 9 | 10 | {{/* 11 | Create a default fully qualified app name. 12 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 13 | If release name contains chart name it will be used as a full name. 14 | */}} 15 | {{- define "common.names.fullname" -}} 16 | {{- $name := include "common.names.name" . -}} 17 | {{- $globalFullNameOverride := "" -}} 18 | {{- if hasKey .Values "global" -}} 19 | {{- $globalFullNameOverride = (default $globalFullNameOverride .Values.global.fullnameOverride) -}} 20 | {{- end -}} 21 | {{- if or .Values.fullnameOverride $globalFullNameOverride -}} 22 | {{- $name = default .Values.fullnameOverride $globalFullNameOverride -}} 23 | {{- else -}} 24 | {{- if contains $name .Release.Name -}} 25 | {{- $name = .Release.Name -}} 26 | {{- else -}} 27 | {{- $name = printf "%s-%s" .Release.Name $name -}} 28 | {{- end -}} 29 | {{- end -}} 30 | {{- trunc 63 $name | trimSuffix "-" -}} 31 | {{- end -}} 32 | 33 | {{/* Create chart name and version as used by the chart label */}} 34 | {{- define "common.names.chart" -}} 35 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 36 | {{- end -}} 37 | 38 | {{/* Create the name of the ServiceAccount to use */}} 39 | {{- define "common.names.serviceAccountName" -}} 40 | {{- if .Values.serviceAccount.create -}} 41 | {{- default (include "common.names.fullname" .) .Values.serviceAccount.name -}} 42 | {{- else -}} 43 | {{- default "default" .Values.serviceAccount.name -}} 44 | {{- end -}} 45 | {{- end -}} 46 | 47 | {{/* Return the properly cased version of the controller type */}} 48 | {{- define "common.names.controllerType" -}} 49 | {{- if eq .Values.controller.type "deployment" -}} 50 | {{- print "Deployment" -}} 51 | {{- else if eq .Values.controller.type "daemonset" -}} 52 | {{- print "DaemonSet" -}} 53 | {{- else if eq .Values.controller.type "statefulset" -}} 54 | {{- print "StatefulSet" -}} 55 | {{- else -}} 56 | {{- fail (printf "Not a valid controller.type (%s)" .Values.controller.type) -}} 57 | {{- end -}} 58 | {{- end -}} 59 | -------------------------------------------------------------------------------- /charts/stable/common/templates/lib/chart/_values.tpl: -------------------------------------------------------------------------------- 1 | {{/* Merge the local chart values and the common chart defaults */}} 2 | {{- define "common.values.setup" -}} 3 | {{- if .Values.common -}} 4 | {{- $defaultValues := deepCopy .Values.common -}} 5 | {{- $userValues := deepCopy (omit .Values "common") -}} 6 | {{- $mergedValues := mustMergeOverwrite $defaultValues $userValues -}} 7 | {{- $_ := set . "Values" (deepCopy $mergedValues) -}} 8 | {{- end -}} 9 | {{- end -}} 10 | -------------------------------------------------------------------------------- /charts/stable/common/templates/lib/controller/_container.tpl: -------------------------------------------------------------------------------- 1 | {{- /* The main container included in the controller */ -}} 2 | {{- define "common.controller.mainContainer" -}} 3 | - name: {{ include "common.names.fullname" . }} 4 | image: {{ printf "%s:%s" .Values.image.repository (default .Chart.AppVersion .Values.image.tag) | quote }} 5 | imagePullPolicy: {{ .Values.image.pullPolicy }} 6 | {{- with .Values.command }} 7 | command: 8 | {{- if kindIs "string" . }} 9 | - {{ . }} 10 | {{- else }} 11 | {{ toYaml . | nindent 4 }} 12 | {{- end }} 13 | {{- end }} 14 | {{- with .Values.args }} 15 | args: 16 | {{- if kindIs "string" . }} 17 | - {{ . }} 18 | {{- else }} 19 | {{ toYaml . | nindent 4 }} 20 | {{- end }} 21 | {{- end }} 22 | {{- with .Values.securityContext }} 23 | securityContext: 24 | {{- toYaml . | nindent 4 }} 25 | {{- end }} 26 | {{- with .Values.lifecycle }} 27 | lifecycle: 28 | {{- toYaml . | nindent 4 }} 29 | {{- end }} 30 | {{- with .Values.termination.messagePath }} 31 | terminationMessagePath: {{ . }} 32 | {{- end }} 33 | {{- with .Values.termination.messagePolicy }} 34 | terminationMessagePolicy: {{ . }} 35 | {{- end }} 36 | 37 | {{- with .Values.env }} 38 | env: 39 | {{- get (fromYaml (include "common.controller.env_vars" $)) "env" | toYaml | nindent 4 -}} 40 | {{- end }} 41 | {{- if or .Values.envFrom .Values.secret }} 42 | envFrom: 43 | {{- with .Values.envFrom }} 44 | {{- toYaml . | nindent 4 }} 45 | {{- end }} 46 | {{- if .Values.secret }} 47 | - secretRef: 48 | name: {{ include "common.names.fullname" . }} 49 | {{- end }} 50 | {{- end }} 51 | ports: 52 | {{- include "common.controller.ports" . | trim | nindent 4 }} 53 | {{- with (include "common.controller.volumeMounts" . | trim) }} 54 | volumeMounts: 55 | {{- nindent 4 . }} 56 | {{- end }} 57 | {{- include "common.controller.probes" . | trim | nindent 2 }} 58 | {{- with .Values.resources }} 59 | resources: 60 | {{- toYaml . | nindent 4 }} 61 | {{- end }} 62 | {{- end -}} 63 | -------------------------------------------------------------------------------- /charts/stable/common/templates/lib/controller/_env_vars.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Environment variables used by containers. 3 | */}} 4 | {{- define "common.controller.env_vars" -}} 5 | {{- $values := .Values.env -}} 6 | {{- if hasKey . "ObjectValues" -}} 7 | {{- with .ObjectValues.env -}} 8 | {{- $values = . -}} 9 | {{- end -}} 10 | {{- end -}} 11 | 12 | {{- with $values -}} 13 | {{- $result := list -}} 14 | {{- range $k, $v := . -}} 15 | {{- $name := $k -}} 16 | {{- $value := $v -}} 17 | {{- if kindIs "int" $name -}} 18 | {{- $name = required "environment variables as a list of maps require a name field" $value.name -}} 19 | {{- end -}} 20 | 21 | {{- if kindIs "map" $value -}} 22 | {{- if hasKey $value "value" -}} 23 | {{- $envValue := $value.value | toString -}} 24 | {{- $result = append $result (dict "name" $name "value" (tpl $envValue $)) -}} 25 | {{- else if hasKey $value "valueFrom" -}} 26 | {{- $result = append $result (dict "name" $name "valueFrom" $value.valueFrom) -}} 27 | {{- else -}} 28 | {{- $result = append $result (dict "name" $name "valueFrom" $value) -}} 29 | {{- end -}} 30 | {{- end -}} 31 | {{- if not (kindIs "map" $value) -}} 32 | {{- if kindIs "string" $value -}} 33 | {{- $result = append $result (dict "name" $name "value" (tpl $value $)) -}} 34 | {{- else if or (kindIs "float64" $value) (kindIs "bool" $value) -}} 35 | {{- $result = append $result (dict "name" $name "value" ($value | toString)) -}} 36 | {{- else -}} 37 | {{- $result = append $result (dict "name" $name "value" $value) -}} 38 | {{- end -}} 39 | {{- end -}} 40 | {{- end -}} 41 | {{- toYaml (dict "env" $result) | nindent 0 -}} 42 | {{- end -}} 43 | {{- end -}} 44 | -------------------------------------------------------------------------------- /charts/stable/common/templates/lib/controller/_pod.tpl: -------------------------------------------------------------------------------- 1 | {{- /* 2 | The pod definition included in the controller. 3 | */ -}} 4 | {{- define "common.controller.pod" -}} 5 | {{- with .Values.imagePullSecrets }} 6 | imagePullSecrets: 7 | {{- toYaml . | nindent 2 }} 8 | {{- end }} 9 | serviceAccountName: {{ include "common.names.serviceAccountName" . }} 10 | automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} 11 | {{- with .Values.podSecurityContext }} 12 | securityContext: 13 | {{- toYaml . | nindent 2 }} 14 | {{- end }} 15 | {{- with .Values.priorityClassName }} 16 | priorityClassName: {{ . }} 17 | {{- end }} 18 | {{- with .Values.runtimeClassName }} 19 | runtimeClassName: {{ . }} 20 | {{- end }} 21 | {{- with .Values.schedulerName }} 22 | schedulerName: {{ . }} 23 | {{- end }} 24 | {{- with .Values.hostNetwork }} 25 | hostNetwork: {{ . }} 26 | {{- end }} 27 | {{- with .Values.hostname }} 28 | hostname: {{ . }} 29 | {{- end }} 30 | {{- if .Values.dnsPolicy }} 31 | dnsPolicy: {{ .Values.dnsPolicy }} 32 | {{- else if .Values.hostNetwork }} 33 | dnsPolicy: ClusterFirstWithHostNet 34 | {{- else }} 35 | dnsPolicy: ClusterFirst 36 | {{- end }} 37 | {{- with .Values.dnsConfig }} 38 | dnsConfig: 39 | {{- toYaml . | nindent 2 }} 40 | {{- end }} 41 | enableServiceLinks: {{ .Values.enableServiceLinks }} 42 | {{- with .Values.termination.gracePeriodSeconds }} 43 | terminationGracePeriodSeconds: {{ . }} 44 | {{- end }} 45 | {{- if .Values.initContainers }} 46 | initContainers: 47 | {{- $initContainers := list }} 48 | {{- range $index, $key := (keys .Values.initContainers | uniq | sortAlpha) }} 49 | {{- $container := get $.Values.initContainers $key }} 50 | {{- if not $container.name -}} 51 | {{- $_ := set $container "name" $key }} 52 | {{- end }} 53 | {{- if $container.env -}} 54 | {{- $_ := set $ "ObjectValues" (dict "env" $container.env) -}} 55 | {{- $newEnv := fromYaml (include "common.controller.env_vars" $) -}} 56 | {{- $_ := unset $.ObjectValues "env" -}} 57 | {{- $_ := set $container "env" $newEnv.env }} 58 | {{- end }} 59 | {{- $initContainers = append $initContainers $container }} 60 | {{- end }} 61 | {{- tpl (toYaml $initContainers) $ | nindent 2 }} 62 | {{- end }} 63 | containers: 64 | {{- include "common.controller.mainContainer" . | nindent 2 }} 65 | {{- with .Values.additionalContainers }} 66 | {{- $additionalContainers := list }} 67 | {{- range $name, $container := . }} 68 | {{- if not $container.name -}} 69 | {{- $_ := set $container "name" $name }} 70 | {{- end }} 71 | {{- if $container.env -}} 72 | {{- $_ := set $ "ObjectValues" (dict "env" $container.env) -}} 73 | {{- $newEnv := fromYaml (include "common.controller.env_vars" $) -}} 74 | {{- $_ := set $container "env" $newEnv.env }} 75 | {{- $_ := unset $.ObjectValues "env" -}} 76 | {{- end }} 77 | {{- $additionalContainers = append $additionalContainers $container }} 78 | {{- end }} 79 | {{- tpl (toYaml $additionalContainers) $ | nindent 2 }} 80 | {{- end }} 81 | {{- with (include "common.controller.volumes" . | trim) }} 82 | volumes: 83 | {{- nindent 2 . }} 84 | {{- end }} 85 | {{- with .Values.hostAliases }} 86 | hostAliases: 87 | {{- toYaml . | nindent 2 }} 88 | {{- end }} 89 | {{- with .Values.nodeSelector }} 90 | nodeSelector: 91 | {{- toYaml . | nindent 2 }} 92 | {{- end }} 93 | {{- with .Values.affinity }} 94 | affinity: 95 | {{- toYaml . | nindent 2 }} 96 | {{- end }} 97 | {{- with .Values.topologySpreadConstraints }} 98 | topologySpreadConstraints: 99 | {{- toYaml . | nindent 2 }} 100 | {{- end }} 101 | {{- with .Values.tolerations }} 102 | tolerations: 103 | {{- toYaml . | nindent 2 }} 104 | {{- end }} 105 | {{- end -}} 106 | -------------------------------------------------------------------------------- /charts/stable/common/templates/lib/controller/_ports.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Ports included by the controller. 3 | */}} 4 | {{- define "common.controller.ports" -}} 5 | {{- $ports := list -}} 6 | {{- range .Values.service -}} 7 | {{- if .enabled -}} 8 | {{- range $name, $port := .ports -}} 9 | {{- $_ := set $port "name" $name -}} 10 | {{- $ports = mustAppend $ports $port -}} 11 | {{- end }} 12 | {{- end }} 13 | {{- end }} 14 | 15 | {{/* export/render the list of ports */}} 16 | {{- if $ports -}} 17 | {{- range $_ := $ports }} 18 | {{- if .enabled }} 19 | - name: {{ .name }} 20 | {{- if and .targetPort (kindIs "string" .targetPort) }} 21 | {{- fail (printf "Our charts do not support named ports for targetPort. (port name %s, targetPort %s)" .name .targetPort) }} 22 | {{- end }} 23 | containerPort: {{ .targetPort | default .port }} 24 | {{- if .protocol }} 25 | {{- if or ( eq .protocol "HTTP" ) ( eq .protocol "HTTPS" ) ( eq .protocol "TCP" ) }} 26 | protocol: TCP 27 | {{- else }} 28 | protocol: {{ .protocol }} 29 | {{- end }} 30 | {{- else }} 31 | protocol: TCP 32 | {{- end }} 33 | {{- end}} 34 | {{- end -}} 35 | {{- end -}} 36 | {{- end -}} 37 | -------------------------------------------------------------------------------- /charts/stable/common/templates/lib/controller/_probes.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Probes selection logic. 3 | */}} 4 | {{- define "common.controller.probes" -}} 5 | {{- $primaryService := get .Values.service (include "common.service.primary" .) -}} 6 | {{- $primaryPort := "" -}} 7 | {{- if $primaryService -}} 8 | {{- $primaryPort = get $primaryService.ports (include "common.classes.service.ports.primary" (dict "serviceName" (include "common.service.primary" .) "values" $primaryService)) -}} 9 | {{- end -}} 10 | 11 | {{- range $probeName, $probe := .Values.probes }} 12 | {{- if $probe.enabled -}} 13 | {{- "" | nindent 0 }} 14 | {{- $probeName }}Probe: 15 | {{- if $probe.custom -}} 16 | {{- $probe.spec | toYaml | nindent 2 }} 17 | {{- else }} 18 | {{- if and $primaryService $primaryPort -}} 19 | {{- "tcpSocket:" | nindent 2 }} 20 | {{- if $primaryPort.targetPort }} 21 | {{- printf "port: %v" $primaryPort.targetPort | nindent 4 }} 22 | {{- else}} 23 | {{- printf "port: %v" $primaryPort.port | nindent 4 }} 24 | {{- end }} 25 | {{- printf "initialDelaySeconds: %v" $probe.spec.initialDelaySeconds | nindent 2 }} 26 | {{- printf "failureThreshold: %v" $probe.spec.failureThreshold | nindent 2 }} 27 | {{- printf "timeoutSeconds: %v" $probe.spec.timeoutSeconds | nindent 2 }} 28 | {{- printf "periodSeconds: %v" $probe.spec.periodSeconds | nindent 2 }} 29 | {{- end }} 30 | {{- end }} 31 | {{- end }} 32 | {{- end }} 33 | {{- end }} 34 | -------------------------------------------------------------------------------- /charts/stable/common/templates/lib/controller/_volumemounts.tpl: -------------------------------------------------------------------------------- 1 | {{/* Volumes included by the controller */}} 2 | {{- define "common.controller.volumeMounts" -}} 3 | {{- range $persistenceIndex, $persistenceItem := .Values.persistence }} 4 | {{- if $persistenceItem.enabled -}} 5 | {{- if kindIs "slice" $persistenceItem.subPath -}} 6 | {{- if $persistenceItem.mountPath -}} 7 | {{- fail (printf "Cannot use persistence.mountPath with a subPath list (%s)" $persistenceIndex) }} 8 | {{- end -}} 9 | {{- range $subPathIndex, $subPathItem := $persistenceItem.subPath }} 10 | - name: {{ $persistenceIndex }} 11 | subPath: {{ required "subPaths as a list of maps require a path field" $subPathItem.path }} 12 | mountPath: {{ required "subPaths as a list of maps require an explicit mountPath field" $subPathItem.mountPath }} 13 | {{- with $subPathItem.readOnly }} 14 | readOnly: {{ . }} 15 | {{- end }} 16 | {{- with $subPathItem.mountPropagation }} 17 | mountPropagation: {{ . }} 18 | {{- end }} 19 | {{- end -}} 20 | {{- else -}} 21 | {{/* Set the default mountPath to / */}} 22 | {{- $mountPath := (printf "/%v" $persistenceIndex) -}} 23 | {{- if eq "hostPath" (default "pvc" $persistenceItem.type) -}} 24 | {{- $mountPath = $persistenceItem.hostPath -}} 25 | {{- end -}} 26 | {{/* Use the specified mountPath if provided */}} 27 | {{- with $persistenceItem.mountPath -}} 28 | {{- $mountPath = . -}} 29 | {{- end }} 30 | {{- if ne $mountPath "-" }} 31 | - name: {{ $persistenceIndex }} 32 | mountPath: {{ $mountPath }} 33 | {{- with $persistenceItem.subPath }} 34 | subPath: {{ . }} 35 | {{- end }} 36 | {{- with $persistenceItem.readOnly }} 37 | readOnly: {{ . }} 38 | {{- end }} 39 | {{- with $persistenceItem.mountPropagation }} 40 | mountPropagation: {{ . }} 41 | {{- end }} 42 | {{- end }} 43 | {{- end -}} 44 | {{- end -}} 45 | {{- end }} 46 | 47 | {{- if eq .Values.controller.type "statefulset" }} 48 | {{- range $index, $vct := .Values.volumeClaimTemplates }} 49 | - mountPath: {{ $vct.mountPath }} 50 | name: {{ $vct.name }} 51 | {{- if $vct.subPath }} 52 | subPath: {{ $vct.subPath }} 53 | {{- end }} 54 | {{- end }} 55 | {{- end }} 56 | {{- end -}} 57 | -------------------------------------------------------------------------------- /charts/stable/common/templates/lib/controller/_volumes.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Volumes included by the controller. 3 | */}} 4 | {{- define "common.controller.volumes" -}} 5 | {{- range $index, $persistence := .Values.persistence }} 6 | {{- if $persistence.enabled }} 7 | - name: {{ $index }} 8 | {{- if eq (default "pvc" $persistence.type) "pvc" }} 9 | {{- $pvcName := (include "common.names.fullname" $) -}} 10 | {{- if $persistence.existingClaim }} 11 | {{- /* Always prefer an existingClaim if that is set */}} 12 | {{- $pvcName = $persistence.existingClaim -}} 13 | {{- else -}} 14 | {{- /* Otherwise refer to the PVC name */}} 15 | {{- if $persistence.nameOverride -}} 16 | {{- if not (eq $persistence.nameOverride "-") -}} 17 | {{- $pvcName = (printf "%s-%s" (include "common.names.fullname" $) $persistence.nameOverride) -}} 18 | {{- end -}} 19 | {{- else -}} 20 | {{- $pvcName = (printf "%s-%s" (include "common.names.fullname" $) $index) -}} 21 | {{- end -}} 22 | {{- end }} 23 | persistentVolumeClaim: 24 | claimName: {{ $pvcName }} 25 | {{- else if or (eq $persistence.type "configMap") (eq $persistence.type "secret") }} 26 | {{- $objectName := (required (printf "name not set for persistence item %s" $index) $persistence.name) }} 27 | {{- $objectName = tpl $objectName $ }} 28 | {{- if eq $persistence.type "configMap" }} 29 | configMap: 30 | name: {{ $objectName }} 31 | {{- else }} 32 | secret: 33 | secretName: {{ $objectName }} 34 | {{- end }} 35 | {{- with $persistence.defaultMode }} 36 | defaultMode: {{ . }} 37 | {{- end }} 38 | {{- with $persistence.items }} 39 | items: 40 | {{- toYaml . | nindent 6 }} 41 | {{- end }} 42 | {{- else if eq $persistence.type "emptyDir" }} 43 | {{- $emptyDir := dict -}} 44 | {{- with $persistence.medium -}} 45 | {{- $_ := set $emptyDir "medium" . -}} 46 | {{- end -}} 47 | {{- with $persistence.sizeLimit -}} 48 | {{- $_ := set $emptyDir "sizeLimit" . -}} 49 | {{- end }} 50 | emptyDir: {{- $emptyDir | toYaml | nindent 4 }} 51 | {{- else if eq $persistence.type "hostPath" }} 52 | hostPath: 53 | path: {{ required "hostPath not set" $persistence.hostPath }} 54 | {{- with $persistence.hostPathType }} 55 | type: {{ . }} 56 | {{- end }} 57 | {{- else if eq $persistence.type "nfs" }} 58 | nfs: 59 | server: {{ required "server not set" $persistence.server }} 60 | path: {{ required "path not set" $persistence.path }} 61 | {{- else if eq $persistence.type "custom" }} 62 | {{- toYaml $persistence.volumeSpec | nindent 2 }} 63 | {{- else }} 64 | {{- fail (printf "Not a valid persistence.type (%s)" .Values.persistence.type) }} 65 | {{- end }} 66 | {{- end }} 67 | {{- end }} 68 | {{- end }} 69 | -------------------------------------------------------------------------------- /hack/gen-helm-docs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | 4 | # Generate helm-docs for Helm charts 5 | # Usage ./gen-helm-docs.sh [stable/incubator] [chart] 6 | 7 | # require helm-docs 8 | command -v helm-docs >/dev/null 2>&1 || { 9 | echo >&2 "helm-docs (https://github.com/norwoodj/helm-docs) is not installed. Aborting." 10 | exit 1 11 | } 12 | 13 | # Absolute path of repository 14 | repository=$(git rev-parse --show-toplevel) 15 | 16 | # Templates to copy into each chart directory 17 | readme_template="${repository}/hack/templates/README.md.gotmpl" 18 | readme_config_template="${repository}/hack/templates/README_CONFIG.md.gotmpl" 19 | readme_changelog_template="${repository}/hack/templates/README_CHANGELOG.md.gotmpl" 20 | 21 | # Gather all charts using the common library, excluding common-test 22 | charts=$(find "${repository}" -name "Chart.yaml") 23 | 24 | # Allow for a specific chart to be passed in as a argument 25 | if [ $# -ge 1 ] && [ -n "$1" ] && [ -n "$2" ]; then 26 | charts="${repository}/charts/$1/$2/Chart.yaml" 27 | root="$(dirname "${charts}")" 28 | if [ ! -f "$charts" ]; then 29 | echo "File ${charts} does not exist." 30 | exit 1 31 | fi 32 | else 33 | root="${repository}/charts/stable" 34 | fi 35 | 36 | for chart in ${charts}; do 37 | chart_directory="$(dirname "${chart}")" 38 | echo "-] Copying templates to ${chart_directory}" 39 | # Copy README template into each Chart directory, overwrite if exists 40 | cp "${readme_template}" "${chart_directory}" 41 | # Copy CONFIG template to each Chart directory, do not overwrite if exists 42 | cp -n "${readme_config_template}" "${chart_directory}" || true 43 | # Copy CHANGELOG template to each Chart directory, do not overwrite if exists 44 | cp -n "${readme_changelog_template}" "${chart_directory}" || true 45 | done 46 | 47 | # Run helm-docs for charts using the common library and the common library itself 48 | helm-docs \ 49 | --ignore-file="${repository}/.helmdocsignore" \ 50 | --template-files="$(basename "${readme_template}")" \ 51 | --template-files="$(basename "${readme_config_template}")" \ 52 | --template-files="$(basename "${readme_changelog_template}")" \ 53 | --chart-search-root="${root}" 54 | -------------------------------------------------------------------------------- /hack/gen-helmignore.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | 4 | # 5 | # Generate common charts .helmignore files 6 | # 7 | 8 | # Absolute path of repository 9 | repository=$(git rev-parse --show-toplevel) 10 | 11 | # Templates to copy into each chart directory 12 | helmignore="${repository}/hack/templates/.helmignore" 13 | 14 | # Gather all charts using the common library, excluding common-test 15 | charts=$(find "${repository}" -name "Chart.yaml" -exec grep -l "\- name\: common" {} \;) 16 | 17 | for chart in ${charts}; do 18 | chart_directory="$(dirname "${chart}")" 19 | # Copy .helmignore into each Chart directory, overwrite if exists 20 | cp "${helmignore}" "${chart_directory}" 21 | done 22 | -------------------------------------------------------------------------------- /hack/templates/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj 22 | .vscode/ 23 | # OWNERS file for Kubernetes 24 | OWNERS 25 | # helm-docs templates 26 | *.gotmpl 27 | -------------------------------------------------------------------------------- /hack/templates/README.md.gotmpl: -------------------------------------------------------------------------------- 1 | {{- define "custom.repository.organization" -}} 2 | k8s-at-home 3 | {{- end -}} 4 | 5 | {{- define "custom.repository.url" -}} 6 | https://github.com/k8s-at-home/charts 7 | {{- end -}} 8 | 9 | {{- define "custom.helm.url" -}} 10 | https://k8s-at-home.com/charts/ 11 | {{- end -}} 12 | 13 | {{- define "custom.helm.path" -}} 14 | {{ template "custom.repository.organization" . }}/{{ template "chart.name" . }} 15 | {{- end -}} 16 | 17 | {{- define "custom.notes" -}} 18 | {{- end -}} 19 | 20 | {{- define "custom.requirements" -}} 21 | ## Requirements 22 | 23 | {{ template "chart.kubeVersionLine" . }} 24 | {{- end -}} 25 | 26 | {{- define "custom.dependencies" -}} 27 | ## Dependencies 28 | 29 | {{ template "chart.requirementsTable" . }} 30 | {{- end -}} 31 | 32 | {{- define "custom.install" -}} 33 | ## Installing the Chart 34 | 35 | This is a [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm). 36 | 37 | **WARNING: THIS CHART IS NOT MEANT TO BE INSTALLED DIRECTLY** 38 | {{- end -}} 39 | 40 | {{- define "custom.usage" -}} 41 | {{- end -}} 42 | 43 | {{- define "custom.configuration.header" -}} 44 | ## Configuration 45 | {{- end -}} 46 | 47 | {{- define "custom.configuration.readValues" -}} 48 | Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values. 49 | {{- end -}} 50 | 51 | {{- define "custom.valuesSection" -}} 52 | ## Values 53 | 54 | **Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common) 55 | 56 | {{ template "chart.valuesTable" . }} 57 | {{- end -}} 58 | 59 | {{- define "custom.support" -}} 60 | ## Support 61 | 62 | - See the [Docs](https://docs.k8s-at-home.com/our-helm-charts/getting-started/) 63 | - Open an [issue](https://github.com/k8s-at-home/charts/issues/new/choose) 64 | - Ask a [question](https://github.com/k8s-at-home/organization/discussions) 65 | - Join our [Discord](https://discord.gg/sTMX7Vh) community 66 | {{- end -}} 67 | 68 | {{ template "chart.header" . }} 69 | 70 | {{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }} 71 | 72 | {{ template "chart.description" . }} 73 | 74 | {{ template "custom.notes" . }} 75 | 76 | {{ template "chart.sourcesSection" . }} 77 | 78 | {{ template "custom.requirements" . }} 79 | 80 | {{ template "custom.dependencies" . }} 81 | 82 | {{ template "custom.install" . }} 83 | 84 | {{ template "custom.usage" . }} 85 | 86 | {{ template "custom.configuration.header" . }} 87 | 88 | {{ template "custom.configuration.readValues" . }} 89 | 90 | {{ template "custom.custom.configuration" . }} 91 | 92 | {{ template "custom.valuesSection" . }} 93 | 94 | {{ template "custom.changelog" . }} 95 | 96 | {{ template "custom.support" . }} 97 | 98 | {{ template "helm-docs.versionFooter" . }} 99 | {{ "" }} 100 | -------------------------------------------------------------------------------- /hack/templates/README_CHANGELOG.md.gotmpl: -------------------------------------------------------------------------------- 1 | {{- define "custom.changelog.header" -}} 2 | ## Changelog 3 | {{- end -}} 4 | 5 | {{- define "custom.changelog" -}} 6 | {{ template "custom.changelog.header" . }} 7 | 8 | All notable changes to this application Helm chart will be documented in this file but does not include changes from our common library. To read those click [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/commonREADME.md#Changelog). 9 | 10 | 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). 11 | 12 | ### [1.0.0] 13 | 14 | #### Added 15 | 16 | - N/A 17 | 18 | #### Changed 19 | 20 | - N/A 21 | 22 | #### Removed 23 | 24 | - N/A 25 | 26 | [1.0.0]: #1.0.0 27 | {{- end -}} 28 | -------------------------------------------------------------------------------- /hack/templates/README_CONFIG.md.gotmpl: -------------------------------------------------------------------------------- 1 | {{- define "custom.custom.configuration.header" -}} 2 | ## Custom configuration 3 | {{- end -}} 4 | 5 | {{- define "custom.custom.configuration" -}} 6 | {{ template "custom.custom.configuration.header" . }} 7 | 8 | N/A 9 | {{- end -}} 10 | -------------------------------------------------------------------------------- /helper-charts/common-test/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj 22 | .vscode/ 23 | # OWNERS file for Kubernetes 24 | OWNERS 25 | # helm-docs templates 26 | *.gotmpl 27 | # Test files 28 | tests/ 29 | -------------------------------------------------------------------------------- /helper-charts/common-test/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: common-test 3 | description: Helper chart to test different use cases of the common library 4 | version: 0.1.0 5 | kubeVersion: ">=1.16.0-0" 6 | keywords: 7 | - k8s-at-home 8 | - common 9 | home: https://github.com/k8s-at-home/library-charts/tree/main/stable/common-test 10 | maintainers: 11 | - name: bjw-s 12 | email: me@bjw-s.dev 13 | dependencies: 14 | - name: common 15 | repository: file://../../charts/stable/common 16 | version: n/a 17 | -------------------------------------------------------------------------------- /helper-charts/common-test/README.md: -------------------------------------------------------------------------------- 1 | # common-test 2 | 3 | ![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) 4 | 5 | Helper chart to test different use cases of the common library 6 | 7 | **Homepage:** 8 | 9 | ## Maintainers 10 | 11 | | Name | Email | Url | 12 | | ---- | ------ | --- | 13 | | bjw-s | me@bjw-s.dev | | 14 | 15 | ## Requirements 16 | 17 | Kubernetes: `>=1.16.0-0` 18 | 19 | | Repository | Name | Version | 20 | |------------|------|---------| 21 | | file://../common | common | n/a | 22 | 23 | ## Values 24 | 25 | | Key | Type | Default | Description | 26 | |-----|------|---------|-------------| 27 | | image.pullPolicy | string | `"IfNotPresent"` | | 28 | | image.repository | string | `"b4bz/homer"` | | 29 | | image.tag | string | `"latest"` | | 30 | | ingress.enabled | bool | `true` | | 31 | | service.port.port | int | `8080` | | 32 | -------------------------------------------------------------------------------- /helper-charts/common-test/charts/common: -------------------------------------------------------------------------------- 1 | ../../../charts/stable/common -------------------------------------------------------------------------------- /helper-charts/common-test/ci/basic-values.yaml: -------------------------------------------------------------------------------- 1 | image: 2 | repository: b4bz/homer 3 | tag: latest 4 | pullPolicy: IfNotPresent 5 | 6 | service: 7 | main: 8 | ports: 9 | http: 10 | port: 8080 11 | 12 | ingress: 13 | main: 14 | enabled: true 15 | 16 | probes: 17 | liveness: 18 | enabled: true 19 | readiness: 20 | enabled: true 21 | startup: 22 | enabled: true 23 | -------------------------------------------------------------------------------- /helper-charts/common-test/ci/codeserver-values.yaml: -------------------------------------------------------------------------------- 1 | image: 2 | repository: b4bz/homer 3 | tag: latest 4 | pullPolicy: IfNotPresent 5 | 6 | service: 7 | main: 8 | ports: 9 | http: 10 | port: 8080 11 | 12 | ingress: 13 | main: 14 | enabled: true 15 | 16 | persistence: 17 | config: 18 | enabled: true 19 | emptyDir: 20 | enabled: true 21 | mountPath: /www/assets 22 | 23 | addons: 24 | codeserver: 25 | enabled: true 26 | workingDir: "/www/assets" 27 | ingress: 28 | main: 29 | enabled: true 30 | volumeMounts: 31 | - name: config 32 | mountPath: /www/assets 33 | -------------------------------------------------------------------------------- /helper-charts/common-test/ci/netshoot-values.yaml: -------------------------------------------------------------------------------- 1 | image: 2 | repository: b4bz/homer 3 | tag: latest 4 | pullPolicy: IfNotPresent 5 | 6 | service: 7 | main: 8 | ports: 9 | http: 10 | port: 8080 11 | 12 | ingress: 13 | main: 14 | enabled: true 15 | 16 | probes: 17 | liveness: 18 | enabled: true 19 | readiness: 20 | enabled: true 21 | startup: 22 | enabled: true 23 | 24 | addons: 25 | netshoot: 26 | enabled: true 27 | -------------------------------------------------------------------------------- /helper-charts/common-test/ci/promtail-values.yaml: -------------------------------------------------------------------------------- 1 | image: 2 | repository: ghcr.io/k8s-at-home/qbittorrent 3 | tag: latest 4 | pullPolicy: IfNotPresent 5 | 6 | service: 7 | main: 8 | ports: 9 | http: 10 | port: 8080 11 | 12 | persistence: 13 | config: 14 | enabled: true 15 | emptyDir: 16 | enabled: true 17 | mountPath: /config 18 | 19 | addons: 20 | promtail: 21 | enabled: true 22 | loki: http://loki.monitoring.svc.cluster.local:3100/loki/api/v1/push 23 | logs: 24 | - name: qbittorrent 25 | path: /config/data/qBittorrent/logs/*.log 26 | volumeMounts: 27 | - name: config 28 | mountPath: /config 29 | readOnly: true 30 | -------------------------------------------------------------------------------- /helper-charts/common-test/templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | {{- include "common.notes.defaultNotes" . -}} 2 | -------------------------------------------------------------------------------- /helper-charts/common-test/templates/common.yaml: -------------------------------------------------------------------------------- 1 | {{ include "common.all" . }} 2 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/addons/codeserver_test.yaml: -------------------------------------------------------------------------------- 1 | suite: addon codeserver 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - hasDocuments: 8 | count: 2 9 | - documentIndex: &DeploymentDocument 0 10 | isKind: 11 | of: Deployment 12 | - documentIndex: 1 13 | isKind: 14 | of: Service 15 | - documentIndex: *DeploymentDocument 16 | not: true 17 | equal: 18 | path: spec.template.spec.containers[0].name 19 | value: codeserver 20 | 21 | - it: addon enabled should pass 22 | set: 23 | addons: 24 | codeserver: 25 | enabled: true 26 | volumeMounts: 27 | - name: "config" 28 | mountPath: "/data/config" 29 | asserts: 30 | - hasDocuments: 31 | count: 3 32 | - documentIndex: 0 33 | isKind: 34 | of: Service 35 | - documentIndex: &DeploymentDocument 1 36 | isKind: 37 | of: Deployment 38 | - documentIndex: &AddonServiceDocument 2 39 | isKind: 40 | of: Service 41 | - documentIndex: *DeploymentDocument 42 | equal: 43 | path: spec.template.spec.containers[1].name 44 | value: codeserver 45 | - documentIndex: *AddonServiceDocument 46 | equal: 47 | path: metadata.name 48 | value: RELEASE-NAME-common-test 49 | 50 | - it: addon enabled with deployKey should pass 51 | set: 52 | addons: 53 | codeserver: 54 | enabled: true 55 | git: 56 | deployKey: test 57 | volumeMounts: 58 | - name: "config" 59 | mountPath: "/data/config" 60 | asserts: 61 | - hasDocuments: 62 | count: 4 63 | - documentIndex: &AddonDeployKeySecretDocument 0 64 | isKind: 65 | of: Secret 66 | - documentIndex: &DeploymentDocument 2 67 | isKind: 68 | of: Deployment 69 | - documentIndex: *DeploymentDocument 70 | contains: 71 | path: spec.template.spec.containers[1].volumeMounts 72 | content: 73 | mountPath: /root/.ssh/id_rsa 74 | name: deploykey 75 | subPath: id_rsa 76 | - documentIndex: *DeploymentDocument 77 | contains: 78 | path: spec.template.spec.volumes 79 | content: 80 | name: deploykey 81 | secret: 82 | defaultMode: 256 83 | items: 84 | - key: id_rsa 85 | path: id_rsa 86 | secretName: RELEASE-NAME-common-test-deploykey 87 | - documentIndex: *AddonDeployKeySecretDocument 88 | equal: 89 | path: metadata.name 90 | value: RELEASE-NAME-common-test-deploykey 91 | 92 | - it: addon enabled with InlineBase64 deployKey should pass 93 | set: 94 | addons: 95 | codeserver: 96 | enabled: true 97 | git: 98 | deployKeyBase64: dGVzdEtleQ== 99 | volumeMounts: 100 | - name: "config" 101 | mountPath: "/data/config" 102 | asserts: 103 | - hasDocuments: 104 | count: 4 105 | - documentIndex: &AddonDeployKeySecretDocument 0 106 | isKind: 107 | of: Secret 108 | - documentIndex: &DeploymentDocument 2 109 | isKind: 110 | of: Deployment 111 | - documentIndex: *DeploymentDocument 112 | contains: 113 | path: spec.template.spec.containers[1].volumeMounts 114 | content: 115 | mountPath: /root/.ssh/id_rsa 116 | name: deploykey 117 | subPath: id_rsa 118 | - documentIndex: *DeploymentDocument 119 | contains: 120 | path: spec.template.spec.volumes 121 | content: 122 | name: deploykey 123 | secret: 124 | defaultMode: 256 125 | items: 126 | - key: id_rsa 127 | path: id_rsa 128 | secretName: RELEASE-NAME-common-test-deploykey 129 | - documentIndex: *AddonDeployKeySecretDocument 130 | equal: 131 | path: metadata.name 132 | value: RELEASE-NAME-common-test-deploykey 133 | 134 | - it: addon enabled with existingSecret deployKey should pass 135 | set: 136 | addons: 137 | codeserver: 138 | enabled: true 139 | git: 140 | deployKeySecret: test-secret 141 | volumeMounts: 142 | - name: "config" 143 | mountPath: "/data/config" 144 | asserts: 145 | - hasDocuments: 146 | count: 3 147 | - documentIndex: &DeploymentDocument 1 148 | isKind: 149 | of: Deployment 150 | - documentIndex: *DeploymentDocument 151 | contains: 152 | path: spec.template.spec.containers[1].volumeMounts 153 | content: 154 | mountPath: /root/.ssh/id_rsa 155 | name: deploykey 156 | subPath: id_rsa 157 | - documentIndex: *DeploymentDocument 158 | contains: 159 | path: spec.template.spec.volumes 160 | content: 161 | name: deploykey 162 | secret: 163 | defaultMode: 256 164 | items: 165 | - key: id_rsa 166 | path: id_rsa 167 | secretName: test-secret 168 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/addons/netshoot_test.yaml: -------------------------------------------------------------------------------- 1 | suite: addon netshoot 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - hasDocuments: 8 | count: 2 9 | - documentIndex: &DeploymentDocument 0 10 | isKind: 11 | of: Deployment 12 | - documentIndex: 1 13 | isKind: 14 | of: Service 15 | - documentIndex: *DeploymentDocument 16 | not: true 17 | equal: 18 | path: spec.template.spec.containers[0].name 19 | value: netshoot 20 | 21 | - it: addon enabled should pass 22 | set: 23 | addons: 24 | netshoot: 25 | enabled: true 26 | asserts: 27 | - hasDocuments: 28 | count: 2 29 | - documentIndex: &DeploymentDocument 0 30 | isKind: 31 | of: Deployment 32 | - documentIndex: 1 33 | isKind: 34 | of: Service 35 | - documentIndex: *DeploymentDocument 36 | equal: 37 | path: spec.template.spec.containers[1].name 38 | value: netshoot 39 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/addons/vpn_test.yaml: -------------------------------------------------------------------------------- 1 | suite: addon vpn 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - hasDocuments: 8 | count: 2 9 | - documentIndex: &DeploymentDocument 0 10 | isKind: 11 | of: Deployment 12 | - documentIndex: 1 13 | isKind: 14 | of: Service 15 | - documentIndex: *DeploymentDocument 16 | not: true 17 | equal: 18 | path: spec.template.spec.containers[0].name 19 | value: vpn 20 | 21 | - it: addon enabled should pass 22 | set: 23 | addons: 24 | vpn: 25 | enabled: true 26 | asserts: 27 | - hasDocuments: 28 | count: 2 29 | - documentIndex: &DeploymentDocument 0 30 | isKind: 31 | of: Deployment 32 | - documentIndex: 1 33 | isKind: 34 | of: Service 35 | - documentIndex: *DeploymentDocument 36 | equal: 37 | path: spec.template.spec.containers[1].name 38 | value: openvpn 39 | 40 | - it: addon enabled with configFile should pass 41 | set: 42 | addons: 43 | vpn: 44 | enabled: true 45 | configFile: test 46 | asserts: 47 | - hasDocuments: 48 | count: 3 49 | - documentIndex: &AddonVPNConfigSecretDocument 0 50 | isKind: 51 | of: Secret 52 | - documentIndex: &DeploymentDocument 1 53 | isKind: 54 | of: Deployment 55 | - documentIndex: *DeploymentDocument 56 | contains: 57 | path: spec.template.spec.containers[1].volumeMounts 58 | content: 59 | mountPath: /vpn/vpn.conf 60 | name: vpnconfig 61 | subPath: vpnConfigfile 62 | - documentIndex: *DeploymentDocument 63 | contains: 64 | path: spec.template.spec.volumes 65 | content: 66 | name: vpnconfig 67 | secret: 68 | items: 69 | - key: vpnConfigfile 70 | path: vpnConfigfile 71 | secretName: RELEASE-NAME-common-test-vpnconfig 72 | - documentIndex: *AddonVPNConfigSecretDocument 73 | equal: 74 | path: metadata.name 75 | value: RELEASE-NAME-common-test-vpnconfig 76 | 77 | - it: addon enabled with existing configFile secret should pass 78 | set: 79 | addons: 80 | vpn: 81 | enabled: true 82 | configFileSecret: test-secret 83 | asserts: 84 | - hasDocuments: 85 | count: 2 86 | - documentIndex: &DeploymentDocument 0 87 | isKind: 88 | of: Deployment 89 | - documentIndex: *DeploymentDocument 90 | contains: 91 | path: spec.template.spec.containers[1].volumeMounts 92 | content: 93 | mountPath: /vpn/vpn.conf 94 | name: vpnconfig 95 | subPath: vpnConfigfile 96 | - documentIndex: *DeploymentDocument 97 | contains: 98 | path: spec.template.spec.volumes 99 | content: 100 | name: vpnconfig 101 | secret: 102 | items: 103 | - key: vpnConfigfile 104 | path: vpnConfigfile 105 | secretName: test-secret 106 | 107 | - it: addon enabled with managed secret should pass 108 | set: 109 | addons: 110 | vpn: 111 | enabled: true 112 | openvpn: 113 | auth: | 114 | 115 | asserts: 116 | - hasDocuments: 117 | count: 3 118 | - documentIndex: &SecretDocument 0 119 | isKind: 120 | of: Secret 121 | - documentIndex: &DeploymentDocument 1 122 | isKind: 123 | of: Deployment 124 | - documentIndex: 2 125 | isKind: 126 | of: Service 127 | - documentIndex: *DeploymentDocument 128 | not: true 129 | equal: 130 | path: spec.template.spec.containers[0].name 131 | value: vpn 132 | 133 | - it: addon enabled with custom env vars dict should pass 134 | set: 135 | addons: 136 | vpn: 137 | enabled: true 138 | env: 139 | int: 1 140 | float: 1.5 141 | string: value_of_env 142 | template: "{{ .Release.Name }}-admin" 143 | asserts: 144 | - hasDocuments: 145 | count: 2 146 | - documentIndex: &DeploymentDocument 0 147 | isKind: 148 | of: Deployment 149 | - documentIndex: &ServiceDocument 1 150 | isKind: 151 | of: Service 152 | - documentIndex: *DeploymentDocument 153 | not: true 154 | equal: 155 | path: spec.template.spec.containers[1].name 156 | value: vpn 157 | - documentIndex: *DeploymentDocument 158 | equal: 159 | path: spec.template.spec.containers[1].env[0] 160 | value: 161 | name: float 162 | value: "1.5" 163 | - documentIndex: *DeploymentDocument 164 | equal: 165 | path: spec.template.spec.containers[1].env[1] 166 | value: 167 | name: int 168 | value: "1" 169 | - documentIndex: *DeploymentDocument 170 | equal: 171 | path: spec.template.spec.containers[1].env[2] 172 | value: 173 | name: string 174 | value: value_of_env 175 | - documentIndex: *DeploymentDocument 176 | equal: 177 | path: spec.template.spec.containers[1].env[3] 178 | value: 179 | name: template 180 | value: RELEASE-NAME-admin 181 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/configmap/metadata_test.yaml: -------------------------------------------------------------------------------- 1 | suite: configmap metadata 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default metadata should pass 6 | set: 7 | configmap: 8 | config: 9 | enabled: true 10 | asserts: 11 | - documentIndex: &ConfigmapDocument 0 12 | isKind: 13 | of: ConfigMap 14 | - documentIndex: *ConfigmapDocument 15 | isNull: 16 | path: metadata.annotations 17 | - documentIndex: *ConfigmapDocument 18 | equal: 19 | path: metadata.labels 20 | value: 21 | app.kubernetes.io/instance: RELEASE-NAME 22 | app.kubernetes.io/managed-by: Helm 23 | app.kubernetes.io/name: common-test 24 | helm.sh/chart: common-test-0.1.0 25 | 26 | - it: custom metadata should pass 27 | set: 28 | configmap: 29 | config: 30 | enabled: true 31 | annotations: 32 | test_annotation: test 33 | labels: 34 | test_label: test 35 | asserts: 36 | - documentIndex: &ConfigmapDocument 0 37 | isKind: 38 | of: ConfigMap 39 | - documentIndex: *ConfigmapDocument 40 | equal: 41 | path: metadata.annotations 42 | value: 43 | test_annotation: test 44 | - documentIndex: *ConfigmapDocument 45 | equal: 46 | path: metadata.labels 47 | value: 48 | app.kubernetes.io/instance: RELEASE-NAME 49 | app.kubernetes.io/managed-by: Helm 50 | app.kubernetes.io/name: common-test 51 | helm.sh/chart: common-test-0.1.0 52 | test_label: test 53 | 54 | - it: custom metadata with global metadata should pass 55 | set: 56 | global: 57 | labels: 58 | global_label: test 59 | annotations: 60 | global_annotation: test 61 | configmap: 62 | config: 63 | enabled: true 64 | annotations: 65 | test_annotation: test 66 | labels: 67 | test_label: test 68 | asserts: 69 | - documentIndex: &ConfigmapDocument 0 70 | isKind: 71 | of: ConfigMap 72 | - documentIndex: *ConfigmapDocument 73 | equal: 74 | path: metadata.annotations 75 | value: 76 | global_annotation: test 77 | test_annotation: test 78 | - documentIndex: *ConfigmapDocument 79 | equal: 80 | path: metadata.labels 81 | value: 82 | app.kubernetes.io/instance: RELEASE-NAME 83 | app.kubernetes.io/managed-by: Helm 84 | app.kubernetes.io/name: common-test 85 | global_label: test 86 | helm.sh/chart: common-test-0.1.0 87 | test_label: test 88 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/configmap/names_test.yaml: -------------------------------------------------------------------------------- 1 | suite: configMap names 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - hasDocuments: 8 | count: 2 9 | - documentIndex: 0 10 | not: true 11 | isKind: 12 | of: ConfigMap 13 | - documentIndex: 1 14 | not: true 15 | isKind: 16 | of: ConfigMap 17 | 18 | - it: with disabled configMap should pass 19 | set: 20 | configmap: 21 | config: 22 | enabled: false 23 | asserts: 24 | - hasDocuments: 25 | count: 2 26 | - documentIndex: 0 27 | not: true 28 | isKind: 29 | of: ConfigMap 30 | - documentIndex: 1 31 | not: true 32 | isKind: 33 | of: ConfigMap 34 | 35 | - it: with multiple configMap should pass 36 | set: 37 | configmap: 38 | config: 39 | enabled: true 40 | data: 41 | foo: bar 42 | secondary: 43 | enabled: true 44 | asserts: 45 | - hasDocuments: 46 | count: 4 47 | - documentIndex: 0 48 | isKind: 49 | of: ConfigMap 50 | - documentIndex: 0 51 | isNotNull: 52 | path: metadata.name 53 | - documentIndex: 1 54 | isKind: 55 | of: ConfigMap 56 | - documentIndex: 1 57 | isNotNull: 58 | path: metadata.name 59 | 60 | - it: default name should pass 61 | set: 62 | configmap: 63 | config: 64 | enabled: true 65 | asserts: 66 | - hasDocuments: 67 | count: 3 68 | - documentIndex: 0 69 | isKind: 70 | of: ConfigMap 71 | - documentIndex: 0 72 | equal: 73 | path: metadata.name 74 | value: RELEASE-NAME-common-test-config 75 | 76 | - it: with nameOverride should pass 77 | set: 78 | configmap: 79 | config: 80 | enabled: true 81 | nameOverride: http 82 | asserts: 83 | - hasDocuments: 84 | count: 3 85 | - documentIndex: 0 86 | isKind: 87 | of: ConfigMap 88 | - documentIndex: 0 89 | equal: 90 | path: metadata.name 91 | value: RELEASE-NAME-common-test-http 92 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/configmap/pod_metadata_test.yaml: -------------------------------------------------------------------------------- 1 | suite: configmap Pod metadata 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default metadata should pass 6 | set: 7 | configmap: 8 | config: 9 | enabled: true 10 | asserts: 11 | - documentIndex: &ControllerDoc 1 12 | isKind: 13 | of: Deployment 14 | - documentIndex: *ControllerDoc 15 | equal: 16 | path: spec.template.metadata.annotations 17 | value: 18 | checksum/config: 13f83afec54139bc9b797ac55ba4d79494f6fd94c0159101836ef127bec95a28 19 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/container/args_test.yaml: -------------------------------------------------------------------------------- 1 | suite: container args override 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - documentIndex: 0 8 | isKind: 9 | of: Deployment 10 | - documentIndex: 0 11 | isNull: 12 | path: spec.template.spec.containers[0].args 13 | 14 | - it: single string should pass 15 | set: 16 | args: sleep infinity 17 | asserts: 18 | - documentIndex: 0 19 | isKind: 20 | of: Deployment 21 | - documentIndex: 0 22 | equal: 23 | path: spec.template.spec.containers[0].args 24 | value: 25 | - sleep infinity 26 | 27 | - it: list of strings should pass 28 | set: 29 | args: 30 | - sleep 31 | - infinity 32 | asserts: 33 | - documentIndex: 0 34 | isKind: 35 | of: Deployment 36 | - documentIndex: 0 37 | equal: 38 | path: spec.template.spec.containers[0].args 39 | value: 40 | - sleep 41 | - infinity 42 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/container/command_test.yaml: -------------------------------------------------------------------------------- 1 | suite: container command override 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - documentIndex: 0 8 | isKind: 9 | of: Deployment 10 | - documentIndex: 0 11 | isNull: 12 | path: spec.template.spec.containers[0].command 13 | 14 | - it: single string should pass 15 | set: 16 | command: /bin/sh 17 | asserts: 18 | - documentIndex: 0 19 | isKind: 20 | of: Deployment 21 | - documentIndex: 0 22 | equal: 23 | path: spec.template.spec.containers[0].command 24 | value: 25 | - /bin/sh 26 | 27 | - it: list of strings should pass 28 | set: 29 | command: 30 | - /bin/sh 31 | - -c 32 | asserts: 33 | - documentIndex: 0 34 | isKind: 35 | of: Deployment 36 | - documentIndex: 0 37 | equal: 38 | path: spec.template.spec.containers[0].command 39 | value: 40 | - /bin/sh 41 | - -c 42 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/container/env_test.yaml: -------------------------------------------------------------------------------- 1 | suite: container env values 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - documentIndex: &DeploymentDoc 0 8 | isKind: 9 | of: Deployment 10 | - documentIndex: *DeploymentDoc 11 | isNull: 12 | path: spec.template.spec.containers[0].env 13 | 14 | - it: KeyValue string should pass 15 | set: 16 | env: 17 | string: value_of_env 18 | asserts: 19 | - documentIndex: &DeploymentDoc 0 20 | isKind: 21 | of: Deployment 22 | - documentIndex: *DeploymentDoc 23 | equal: 24 | path: spec.template.spec.containers[0].env[0] 25 | value: 26 | name: string 27 | value: value_of_env 28 | 29 | - it: KeyValue float should pass 30 | set: 31 | env: 32 | string: 4.2 33 | asserts: 34 | - documentIndex: &DeploymentDoc 0 35 | isKind: 36 | of: Deployment 37 | - documentIndex: *DeploymentDoc 38 | equal: 39 | path: spec.template.spec.containers[0].env[0] 40 | value: 41 | name: string 42 | value: "4.2" 43 | 44 | - it: KeyValue int should pass 45 | set: 46 | env: 47 | string: 1 48 | asserts: 49 | - documentIndex: &DeploymentDoc 0 50 | isKind: 51 | of: Deployment 52 | - documentIndex: *DeploymentDoc 53 | equal: 54 | path: spec.template.spec.containers[0].env[0] 55 | value: 56 | name: string 57 | value: "1" 58 | 59 | - it: List should pass 60 | set: 61 | env: 62 | - name: STATIC_ENV_FROM_LIST 63 | value: STATIC_ENV_VALUE_FROM_LIST 64 | asserts: 65 | - documentIndex: &DeploymentDoc 0 66 | isKind: 67 | of: Deployment 68 | - documentIndex: *DeploymentDoc 69 | equal: 70 | path: spec.template.spec.containers[0].env[0] 71 | value: 72 | name: STATIC_ENV_FROM_LIST 73 | value: STATIC_ENV_VALUE_FROM_LIST 74 | 75 | - it: Explicit ValueFrom in list should pass 76 | set: 77 | env: 78 | - name: DYNAMIC_ENV_FROM_LIST 79 | valueFrom: 80 | fieldRef: 81 | fieldPath: spec.nodeName 82 | asserts: 83 | - documentIndex: &DeploymentDoc 0 84 | isKind: 85 | of: Deployment 86 | - documentIndex: *DeploymentDoc 87 | equal: 88 | path: spec.template.spec.containers[0].env[0] 89 | value: 90 | name: DYNAMIC_ENV_FROM_LIST 91 | valueFrom: 92 | fieldRef: 93 | fieldPath: spec.nodeName 94 | 95 | - it: Implicit ValueFrom should pass 96 | set: 97 | env: 98 | DYNAMIC_ENV: 99 | fieldRef: 100 | fieldPath: spec.nodeName 101 | asserts: 102 | - documentIndex: &DeploymentDoc 0 103 | isKind: 104 | of: Deployment 105 | - documentIndex: *DeploymentDoc 106 | equal: 107 | path: spec.template.spec.containers[0].env[0] 108 | value: 109 | name: DYNAMIC_ENV 110 | valueFrom: 111 | fieldRef: 112 | fieldPath: spec.nodeName 113 | 114 | - it: Templated value should pass 115 | set: 116 | env: 117 | DYNAMIC_ENV: "{{ .Release.Name }}-admin" 118 | asserts: 119 | - documentIndex: &DeploymentDoc 0 120 | isKind: 121 | of: Deployment 122 | - documentIndex: *DeploymentDoc 123 | equal: 124 | path: spec.template.spec.containers[0].env[0] 125 | value: 126 | name: DYNAMIC_ENV 127 | value: RELEASE-NAME-admin 128 | 129 | - it: Combined KeyValue with Explicit ValueFrom should pass 130 | set: 131 | env: 132 | STATIC_ENV: static 133 | DYNAMIC_ENV: 134 | valueFrom: 135 | fieldRef: 136 | fieldPath: spec.nodeName 137 | asserts: 138 | - documentIndex: &DeploymentDoc 0 139 | isKind: 140 | of: Deployment 141 | - documentIndex: *DeploymentDoc 142 | equal: 143 | path: spec.template.spec.containers[0].env[0] 144 | value: 145 | name: DYNAMIC_ENV 146 | valueFrom: 147 | fieldRef: 148 | fieldPath: spec.nodeName 149 | - documentIndex: *DeploymentDoc 150 | equal: 151 | path: spec.template.spec.containers[0].env[1] 152 | value: 153 | name: STATIC_ENV 154 | value: static 155 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/container/envfrom_test.yaml: -------------------------------------------------------------------------------- 1 | suite: container envFrom values 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - documentIndex: &DeploymentDoc 0 8 | isKind: 9 | of: Deployment 10 | - documentIndex: *DeploymentDoc 11 | isNull: 12 | path: spec.template.spec.containers[0].envFrom 13 | 14 | - it: explicit envFrom should pass 15 | set: 16 | envFrom: 17 | - secretRef: 18 | name: myCustomSecret 19 | asserts: 20 | - documentIndex: &DeploymentDoc 0 21 | isKind: 22 | of: Deployment 23 | - documentIndex: *DeploymentDoc 24 | equal: 25 | path: spec.template.spec.containers[0].envFrom[0] 26 | value: 27 | secretRef: 28 | name: myCustomSecret 29 | 30 | - it: from secret should pass 31 | set: 32 | secret: 33 | STATIC_SECRET: value_of_secret 34 | asserts: 35 | - documentIndex: &DeploymentDoc 0 36 | isKind: 37 | of: Deployment 38 | - documentIndex: *DeploymentDoc 39 | equal: 40 | path: spec.template.spec.containers[0].envFrom[0] 41 | value: 42 | secretRef: 43 | name: RELEASE-NAME-common-test 44 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/container/ports_test.yaml: -------------------------------------------------------------------------------- 1 | suite: container ports 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - documentIndex: 0 8 | isKind: 9 | of: Deployment 10 | - documentIndex: 0 11 | equal: 12 | path: spec.template.spec.containers[0].ports[0] 13 | value: 14 | containerPort: null 15 | name: http 16 | protocol: TCP 17 | 18 | - it: custom port should pass 19 | set: 20 | service: 21 | main: 22 | ports: 23 | http: 24 | enabled: false 25 | server: 26 | enabled: true 27 | port: 8080 28 | asserts: 29 | - documentIndex: 0 30 | isKind: 31 | of: Deployment 32 | - documentIndex: 0 33 | equal: 34 | path: spec.template.spec.containers[0].ports[0] 35 | value: 36 | containerPort: 8080 37 | name: server 38 | protocol: TCP 39 | 40 | - it: HTTP protocol should pass 41 | set: 42 | service: 43 | main: 44 | ports: 45 | http: 46 | protocol: HTTP 47 | asserts: 48 | - documentIndex: 0 49 | isKind: 50 | of: Deployment 51 | - documentIndex: 0 52 | equal: 53 | path: spec.template.spec.containers[0].ports[0] 54 | value: 55 | containerPort: null 56 | name: http 57 | protocol: TCP 58 | 59 | - it: HTTPS protocol should pass 60 | set: 61 | service: 62 | main: 63 | ports: 64 | http: 65 | protocol: HTTPS 66 | asserts: 67 | - documentIndex: 0 68 | isKind: 69 | of: Deployment 70 | - documentIndex: 0 71 | equal: 72 | path: spec.template.spec.containers[0].ports[0] 73 | value: 74 | containerPort: null 75 | name: http 76 | protocol: TCP 77 | 78 | - it: UDP protocol should pass 79 | set: 80 | service: 81 | main: 82 | ports: 83 | http: 84 | protocol: UDP 85 | asserts: 86 | - documentIndex: 0 87 | isKind: 88 | of: Deployment 89 | - documentIndex: 0 90 | equal: 91 | path: spec.template.spec.containers[0].ports[0] 92 | value: 93 | containerPort: null 94 | name: http 95 | protocol: UDP 96 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/container/volumemounts_test.yaml: -------------------------------------------------------------------------------- 1 | suite: container volumeMounts 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: no persistence should pass 6 | asserts: 7 | - documentIndex: &DeploymentDoc 0 8 | isKind: 9 | of: Deployment 10 | - documentIndex: *DeploymentDoc 11 | isNull: 12 | path: spec.template.spec.containers[0].volumeMounts 13 | 14 | - it: default should pass 15 | set: 16 | persistence: 17 | config: 18 | enabled: true 19 | asserts: 20 | - documentIndex: &DeploymentDoc 1 21 | isKind: 22 | of: Deployment 23 | - documentIndex: *DeploymentDoc 24 | equal: 25 | path: spec.template.spec.containers[0].volumeMounts[0] 26 | value: 27 | name: config 28 | mountPath: /config 29 | 30 | - it: emptyDir should pass 31 | set: 32 | persistence: 33 | cache: 34 | enabled: true 35 | type: emptyDir 36 | asserts: 37 | - documentIndex: &DeploymentDoc 0 38 | isKind: 39 | of: Deployment 40 | - documentIndex: *DeploymentDoc 41 | equal: 42 | path: spec.template.spec.containers[0].volumeMounts[0] 43 | value: 44 | name: cache 45 | mountPath: /cache 46 | 47 | - it: custom mountPath should pass 48 | set: 49 | persistence: 50 | config: 51 | enabled: true 52 | mountPath: /custom 53 | accessMode: ReadWriteMany 54 | size: 1G 55 | asserts: 56 | - documentIndex: &DeploymentDoc 1 57 | isKind: 58 | of: Deployment 59 | - documentIndex: *DeploymentDoc 60 | equal: 61 | path: spec.template.spec.containers[0].volumeMounts[0] 62 | value: 63 | name: config 64 | mountPath: /custom 65 | 66 | - it: mount with subPath should pass 67 | set: 68 | persistence: 69 | config: 70 | enabled: true 71 | existingClaim: myClaim 72 | subPath: "mySubPath" 73 | asserts: 74 | - documentIndex: &DeploymentDoc 0 75 | isKind: 76 | of: Deployment 77 | - documentIndex: *DeploymentDoc 78 | equal: 79 | path: spec.template.spec.containers[0].volumeMounts[0] 80 | value: 81 | name: config 82 | mountPath: /config 83 | subPath: mySubPath 84 | 85 | - it: hostPath with custom mountPath should pass 86 | set: 87 | persistence: 88 | config: 89 | enabled: true 90 | type: hostPath 91 | mountPath: /data 92 | hostPath: /tmp 93 | asserts: 94 | - documentIndex: &DeploymentDoc 0 95 | isKind: 96 | of: Deployment 97 | - documentIndex: *DeploymentDoc 98 | equal: 99 | path: spec.template.spec.containers[0].volumeMounts[0] 100 | value: 101 | name: config 102 | mountPath: /data 103 | 104 | - it: hostPath mount with subPath should pass 105 | set: 106 | persistence: 107 | config: 108 | enabled: true 109 | type: hostPath 110 | hostPath: /dev 111 | subPath: mySubPath 112 | asserts: 113 | - documentIndex: &DeploymentDoc 0 114 | isKind: 115 | of: Deployment 116 | - documentIndex: *DeploymentDoc 117 | equal: 118 | path: spec.template.spec.containers[0].volumeMounts[0] 119 | value: 120 | name: config 121 | mountPath: /dev 122 | subPath: mySubPath 123 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/controller/metadata_daemonset_test.yaml: -------------------------------------------------------------------------------- 1 | suite: controller metadata daemonset 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default metadata should pass 6 | set: 7 | controller.type: daemonset 8 | asserts: 9 | - documentIndex: &ControllerDoc 0 10 | isKind: 11 | of: DaemonSet 12 | - documentIndex: *ControllerDoc 13 | isNull: 14 | path: metadata.annotations 15 | - documentIndex: *ControllerDoc 16 | equal: 17 | path: metadata.labels 18 | value: 19 | app.kubernetes.io/instance: RELEASE-NAME 20 | app.kubernetes.io/managed-by: Helm 21 | app.kubernetes.io/name: common-test 22 | helm.sh/chart: common-test-0.1.0 23 | 24 | - it: custom metadata should pass 25 | set: 26 | controller: 27 | type: daemonset 28 | annotations: 29 | test_annotation: test 30 | labels: 31 | test_label: test 32 | asserts: 33 | - documentIndex: &ControllerDoc 0 34 | isKind: 35 | of: DaemonSet 36 | - documentIndex: *ControllerDoc 37 | equal: 38 | path: metadata.annotations 39 | value: 40 | test_annotation: test 41 | - documentIndex: *ControllerDoc 42 | equal: 43 | path: metadata.labels 44 | value: 45 | app.kubernetes.io/instance: RELEASE-NAME 46 | app.kubernetes.io/managed-by: Helm 47 | app.kubernetes.io/name: common-test 48 | helm.sh/chart: common-test-0.1.0 49 | test_label: test 50 | 51 | - it: custom metadata with global metadata should pass 52 | set: 53 | global: 54 | labels: 55 | global_label: test 56 | annotations: 57 | global_annotation: test 58 | controller: 59 | type: daemonset 60 | annotations: 61 | test_annotation: test 62 | labels: 63 | test_label: test 64 | asserts: 65 | - documentIndex: &ControllerDoc 0 66 | isKind: 67 | of: DaemonSet 68 | - documentIndex: *ControllerDoc 69 | equal: 70 | path: metadata.annotations 71 | value: 72 | global_annotation: test 73 | test_annotation: test 74 | - documentIndex: *ControllerDoc 75 | equal: 76 | path: metadata.labels 77 | value: 78 | app.kubernetes.io/instance: RELEASE-NAME 79 | app.kubernetes.io/managed-by: Helm 80 | app.kubernetes.io/name: common-test 81 | global_label: test 82 | helm.sh/chart: common-test-0.1.0 83 | test_label: test 84 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/controller/metadata_deployment_test.yaml: -------------------------------------------------------------------------------- 1 | suite: controller metadata deployment 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default metadata should pass 6 | set: 7 | controller.type: deployment 8 | asserts: 9 | - documentIndex: &ControllerDoc 0 10 | isKind: 11 | of: Deployment 12 | - documentIndex: *ControllerDoc 13 | isNull: 14 | path: metadata.annotations 15 | - documentIndex: *ControllerDoc 16 | equal: 17 | path: metadata.labels 18 | value: 19 | app.kubernetes.io/instance: RELEASE-NAME 20 | app.kubernetes.io/managed-by: Helm 21 | app.kubernetes.io/name: common-test 22 | helm.sh/chart: common-test-0.1.0 23 | 24 | - it: custom metadata should pass 25 | set: 26 | controller: 27 | type: deployment 28 | annotations: 29 | test_annotation: test 30 | labels: 31 | test_label: test 32 | asserts: 33 | - documentIndex: &ControllerDoc 0 34 | isKind: 35 | of: Deployment 36 | - documentIndex: *ControllerDoc 37 | equal: 38 | path: metadata.annotations 39 | value: 40 | test_annotation: test 41 | - documentIndex: *ControllerDoc 42 | equal: 43 | path: metadata.labels 44 | value: 45 | app.kubernetes.io/instance: RELEASE-NAME 46 | app.kubernetes.io/managed-by: Helm 47 | app.kubernetes.io/name: common-test 48 | helm.sh/chart: common-test-0.1.0 49 | test_label: test 50 | 51 | - it: custom metadata with global metadata should pass 52 | set: 53 | global: 54 | labels: 55 | global_label: test 56 | annotations: 57 | global_annotation: test 58 | controller: 59 | type: deployment 60 | annotations: 61 | test_annotation: test 62 | labels: 63 | test_label: test 64 | asserts: 65 | - documentIndex: &ControllerDoc 0 66 | isKind: 67 | of: Deployment 68 | - documentIndex: *ControllerDoc 69 | equal: 70 | path: metadata.annotations 71 | value: 72 | global_annotation: test 73 | test_annotation: test 74 | - documentIndex: *ControllerDoc 75 | equal: 76 | path: metadata.labels 77 | value: 78 | app.kubernetes.io/instance: RELEASE-NAME 79 | app.kubernetes.io/managed-by: Helm 80 | app.kubernetes.io/name: common-test 81 | global_label: test 82 | helm.sh/chart: common-test-0.1.0 83 | test_label: test 84 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/controller/metadata_statefulset_test.yaml: -------------------------------------------------------------------------------- 1 | suite: controller metadata statefulset 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default metadata should pass 6 | set: 7 | controller.type: statefulset 8 | asserts: 9 | - documentIndex: &ControllerDoc 0 10 | isKind: 11 | of: StatefulSet 12 | - documentIndex: *ControllerDoc 13 | isNull: 14 | path: metadata.annotations 15 | - documentIndex: *ControllerDoc 16 | equal: 17 | path: metadata.labels 18 | value: 19 | app.kubernetes.io/instance: RELEASE-NAME 20 | app.kubernetes.io/managed-by: Helm 21 | app.kubernetes.io/name: common-test 22 | helm.sh/chart: common-test-0.1.0 23 | 24 | - it: custom metadata should pass 25 | set: 26 | controller: 27 | type: statefulset 28 | annotations: 29 | test_annotation: test 30 | labels: 31 | test_label: test 32 | asserts: 33 | - documentIndex: &ControllerDoc 0 34 | isKind: 35 | of: StatefulSet 36 | - documentIndex: *ControllerDoc 37 | equal: 38 | path: metadata.annotations 39 | value: 40 | test_annotation: test 41 | - documentIndex: *ControllerDoc 42 | equal: 43 | path: metadata.labels 44 | value: 45 | app.kubernetes.io/instance: RELEASE-NAME 46 | app.kubernetes.io/managed-by: Helm 47 | app.kubernetes.io/name: common-test 48 | helm.sh/chart: common-test-0.1.0 49 | test_label: test 50 | 51 | - it: custom metadata with global metadata should pass 52 | set: 53 | global: 54 | labels: 55 | global_label: test 56 | annotations: 57 | global_annotation: test 58 | controller: 59 | type: statefulset 60 | annotations: 61 | test_annotation: test 62 | labels: 63 | test_label: test 64 | asserts: 65 | - documentIndex: &ControllerDoc 0 66 | isKind: 67 | of: StatefulSet 68 | - documentIndex: *ControllerDoc 69 | equal: 70 | path: metadata.annotations 71 | value: 72 | global_annotation: test 73 | test_annotation: test 74 | - documentIndex: *ControllerDoc 75 | equal: 76 | path: metadata.labels 77 | value: 78 | app.kubernetes.io/instance: RELEASE-NAME 79 | app.kubernetes.io/managed-by: Helm 80 | app.kubernetes.io/name: common-test 81 | global_label: test 82 | helm.sh/chart: common-test-0.1.0 83 | test_label: test 84 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/controller/type_test.yaml: -------------------------------------------------------------------------------- 1 | suite: controller types 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - documentIndex: &ControllerDoc 0 8 | isKind: 9 | of: Deployment 10 | - documentIndex: *ControllerDoc 11 | equal: 12 | path: metadata.name 13 | value: RELEASE-NAME-common-test 14 | 15 | - it: daemonset should pass 16 | set: 17 | controller.type: daemonset 18 | asserts: 19 | - documentIndex: &ControllerDoc 0 20 | isKind: 21 | of: DaemonSet 22 | - documentIndex: *ControllerDoc 23 | equal: 24 | path: metadata.name 25 | value: RELEASE-NAME-common-test 26 | 27 | - it: statefulset should pass 28 | set: 29 | controller.type: statefulset 30 | asserts: 31 | - documentIndex: &ControllerDoc 0 32 | isKind: 33 | of: StatefulSet 34 | - documentIndex: *ControllerDoc 35 | equal: 36 | path: metadata.name 37 | value: RELEASE-NAME-common-test 38 | 39 | - it: disabled should pass 40 | set: 41 | controller.enabled: false 42 | asserts: 43 | - hasDocuments: 44 | count: 1 45 | - documentIndex: &ControllerDoc 0 46 | not: true 47 | isKind: 48 | of: StatefulSet 49 | - documentIndex: *ControllerDoc 50 | not: true 51 | isKind: 52 | of: DaemonSet 53 | - documentIndex: *ControllerDoc 54 | not: true 55 | isKind: 56 | of: Controller 57 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/ingress/metadata_test.yaml: -------------------------------------------------------------------------------- 1 | suite: ingress metadata 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default metadata should pass 6 | set: 7 | ingress.main.enabled: true 8 | asserts: 9 | - documentIndex: &IngressDocument 2 10 | isKind: 11 | of: Ingress 12 | - documentIndex: *IngressDocument 13 | isNull: 14 | path: metadata.annotations 15 | - documentIndex: *IngressDocument 16 | equal: 17 | path: metadata.labels 18 | value: 19 | app.kubernetes.io/instance: RELEASE-NAME 20 | app.kubernetes.io/managed-by: Helm 21 | app.kubernetes.io/name: common-test 22 | helm.sh/chart: common-test-0.1.0 23 | 24 | - it: custom metadata should pass 25 | set: 26 | ingress.main: 27 | enabled: true 28 | annotations: 29 | test_annotation: test 30 | labels: 31 | test_label: test 32 | asserts: 33 | - documentIndex: &IngressDocument 2 34 | isKind: 35 | of: Ingress 36 | - documentIndex: *IngressDocument 37 | equal: 38 | path: metadata.annotations 39 | value: 40 | test_annotation: test 41 | - documentIndex: *IngressDocument 42 | equal: 43 | path: metadata.labels 44 | value: 45 | app.kubernetes.io/instance: RELEASE-NAME 46 | app.kubernetes.io/managed-by: Helm 47 | app.kubernetes.io/name: common-test 48 | helm.sh/chart: common-test-0.1.0 49 | test_label: test 50 | 51 | - it: custom metadata with global metadata should pass 52 | set: 53 | global: 54 | labels: 55 | global_label: test 56 | annotations: 57 | global_annotation: test 58 | ingress.main: 59 | enabled: true 60 | annotations: 61 | test_annotation: test 62 | labels: 63 | test_label: test 64 | asserts: 65 | - documentIndex: &IngressDocument 2 66 | isKind: 67 | of: Ingress 68 | - documentIndex: *IngressDocument 69 | equal: 70 | path: metadata.annotations 71 | value: 72 | global_annotation: test 73 | test_annotation: test 74 | - documentIndex: *IngressDocument 75 | equal: 76 | path: metadata.labels 77 | value: 78 | app.kubernetes.io/instance: RELEASE-NAME 79 | app.kubernetes.io/managed-by: Helm 80 | app.kubernetes.io/name: common-test 81 | global_label: test 82 | helm.sh/chart: common-test-0.1.0 83 | test_label: test 84 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/ingress/presence_test.yaml: -------------------------------------------------------------------------------- 1 | suite: ingress presence 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - hasDocuments: 8 | count: 2 9 | - documentIndex: 0 10 | not: true 11 | isKind: 12 | of: Ingress 13 | - documentIndex: 1 14 | not: true 15 | isKind: 16 | of: Ingress 17 | 18 | - it: explicitly disabled should pass 19 | set: 20 | ingress.main.enabled: false 21 | asserts: 22 | - hasDocuments: 23 | count: 2 24 | - documentIndex: 0 25 | not: true 26 | isKind: 27 | of: Ingress 28 | - documentIndex: 1 29 | not: true 30 | isKind: 31 | of: Ingress 32 | 33 | - it: explicitly enabled should pass 34 | set: 35 | ingress.main.enabled: true 36 | asserts: 37 | - hasDocuments: 38 | count: 3 39 | - documentIndex: 0 40 | not: true 41 | isKind: 42 | of: Ingress 43 | - documentIndex: 1 44 | not: true 45 | isKind: 46 | of: Ingress 47 | - documentIndex: 2 48 | isKind: 49 | of: Ingress 50 | 51 | - it: multiple enabled should pass 52 | set: 53 | ingress.main.enabled: true 54 | ingress.test.enabled: true 55 | asserts: 56 | - hasDocuments: 57 | count: 4 58 | - documentIndex: 0 59 | not: true 60 | isKind: 61 | of: Ingress 62 | - documentIndex: 1 63 | not: true 64 | isKind: 65 | of: Ingress 66 | - documentIndex: 2 67 | isKind: 68 | of: Ingress 69 | - documentIndex: 3 70 | isKind: 71 | of: Ingress 72 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/ingress/service_reference_test.yaml: -------------------------------------------------------------------------------- 1 | suite: ingress service reference 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | set: 7 | ingress.main.enabled: true 8 | asserts: 9 | - documentIndex: &IngressDocument 2 10 | isKind: 11 | of: Ingress 12 | - documentIndex: *IngressDocument 13 | equal: 14 | path: spec.rules[0].http.paths[0].backend 15 | value: 16 | serviceName: RELEASE-NAME-common-test 17 | servicePort: null 18 | 19 | - it: custom service reference should pass 20 | set: 21 | ingress.main: 22 | enabled: true 23 | hosts: 24 | - host: chart-test.local 25 | paths: 26 | - path: / 27 | service: 28 | name: pathService 29 | port: 1234 30 | asserts: 31 | - documentIndex: &IngressDocument 2 32 | isKind: 33 | of: Ingress 34 | - documentIndex: *IngressDocument 35 | equal: 36 | path: spec.rules[0].http.paths[0].backend 37 | value: 38 | serviceName: pathService 39 | servicePort: 1234 40 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/ingress/tls_test.yaml: -------------------------------------------------------------------------------- 1 | suite: ingress tls 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | set: 7 | ingress.main.enabled: true 8 | asserts: 9 | - documentIndex: &IngressDocument 2 10 | isKind: 11 | of: Ingress 12 | - documentIndex: *IngressDocument 13 | isNull: 14 | path: spec.tls 15 | 16 | - it: tls enabled should pass 17 | set: 18 | ingress.main: 19 | enabled: true 20 | tls: 21 | - secretName: test 22 | hosts: 23 | - hostname 24 | asserts: 25 | - documentIndex: &IngressDocument 2 26 | isKind: 27 | of: Ingress 28 | - documentIndex: *IngressDocument 29 | equal: 30 | path: spec.tls[0] 31 | value: 32 | secretName: test 33 | hosts: 34 | - hostname 35 | 36 | - it: tls enabled without secret should pass 37 | set: 38 | ingress.main: 39 | enabled: true 40 | tls: 41 | - hosts: 42 | - hostname 43 | asserts: 44 | - documentIndex: &IngressDocument 2 45 | isKind: 46 | of: Ingress 47 | - documentIndex: *IngressDocument 48 | equal: 49 | path: spec.tls[0] 50 | value: 51 | hosts: 52 | - hostname 53 | 54 | - it: tls enabled with secret template should pass 55 | set: 56 | ingress.main: 57 | enabled: true 58 | tls: 59 | - secretName: "{{ .Release.Name }}-secret" 60 | hosts: 61 | - hostname 62 | asserts: 63 | - documentIndex: &IngressDocument 2 64 | isKind: 65 | of: Ingress 66 | - documentIndex: *IngressDocument 67 | equal: 68 | path: spec.tls[0] 69 | value: 70 | secretName: RELEASE-NAME-secret 71 | hosts: 72 | - hostname 73 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/ingress/values_test.yaml: -------------------------------------------------------------------------------- 1 | suite: ingress values 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | set: 7 | ingress.main.enabled: true 8 | asserts: 9 | - documentIndex: &IngressDocument 2 10 | isKind: 11 | of: Ingress 12 | - documentIndex: *IngressDocument 13 | equal: 14 | path: spec.rules[0].host 15 | value: chart-example.local 16 | - documentIndex: *IngressDocument 17 | equal: 18 | path: spec.rules[0].http.paths[0].path 19 | value: "/" 20 | 21 | - it: custom host and path should pass 22 | set: 23 | ingress.main: 24 | enabled: true 25 | hosts: 26 | - host: chart-test.local 27 | paths: 28 | - path: /test 29 | asserts: 30 | - documentIndex: &IngressDocument 2 31 | isKind: 32 | of: Ingress 33 | - documentIndex: *IngressDocument 34 | equal: 35 | path: spec.rules[0].host 36 | value: chart-test.local 37 | - documentIndex: *IngressDocument 38 | equal: 39 | path: spec.rules[0].http.paths[0].path 40 | value: "/test" 41 | 42 | - it: host with template should pass 43 | set: 44 | ingress.main: 45 | enabled: true 46 | hosts: 47 | - host: "{{ .Release.Name }}.hostname" 48 | asserts: 49 | - documentIndex: &IngressDocument 2 50 | isKind: 51 | of: Ingress 52 | - documentIndex: *IngressDocument 53 | equal: 54 | path: spec.rules[0].host 55 | value: RELEASE-NAME.hostname 56 | 57 | - it: path with template should pass 58 | set: 59 | ingress.main: 60 | enabled: true 61 | hosts: 62 | - host: chart-test.local 63 | paths: 64 | - path: "/{{ .Release.Name }}.path" 65 | asserts: 66 | - documentIndex: &IngressDocument 2 67 | isKind: 68 | of: Ingress 69 | - documentIndex: *IngressDocument 70 | equal: 71 | path: spec.rules[0].http.paths[0].path 72 | value: "/RELEASE-NAME.path" 73 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/persistence/claimnames_test.yaml: -------------------------------------------------------------------------------- 1 | suite: persistence claimnames 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | set: 7 | persistence: 8 | config: 9 | enabled: true 10 | asserts: 11 | - documentIndex: 1 12 | isKind: 13 | of: Deployment 14 | - documentIndex: 1 15 | equal: 16 | path: spec.template.spec.volumes[0] 17 | value: 18 | name: config 19 | persistentVolumeClaim: 20 | claimName: RELEASE-NAME-common-test-config 21 | 22 | - it: with existingClaim should pass 23 | set: 24 | persistence: 25 | existingClaim: 26 | enabled: true 27 | existingClaim: myClaim 28 | asserts: 29 | - documentIndex: 0 30 | isKind: 31 | of: Deployment 32 | - documentIndex: 0 33 | equal: 34 | path: spec.template.spec.volumes[0] 35 | value: 36 | name: existingClaim 37 | persistentVolumeClaim: 38 | claimName: myClaim 39 | 40 | - it: disabled suffix should pass 41 | set: 42 | persistence: 43 | claimWithoutSuffix: 44 | enabled: true 45 | nameOverride: "-" 46 | accessMode: ReadWriteMany 47 | size: 1G 48 | asserts: 49 | - documentIndex: 1 50 | isKind: 51 | of: Deployment 52 | - documentIndex: 1 53 | equal: 54 | path: spec.template.spec.volumes[0] 55 | value: 56 | name: claimWithoutSuffix 57 | persistentVolumeClaim: 58 | claimName: RELEASE-NAME-common-test 59 | 60 | - it: custom suffix should pass 61 | set: 62 | persistence: 63 | claimWithNameOverride: 64 | enabled: true 65 | nameOverride: suffix 66 | accessMode: ReadWriteMany 67 | size: 1G 68 | asserts: 69 | - documentIndex: 1 70 | isKind: 71 | of: Deployment 72 | - documentIndex: 1 73 | equal: 74 | path: spec.template.spec.volumes[0] 75 | value: 76 | name: claimWithNameOverride 77 | persistentVolumeClaim: 78 | claimName: RELEASE-NAME-common-test-suffix 79 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/persistence/emptydir_test.yaml: -------------------------------------------------------------------------------- 1 | suite: persistence emptydir 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default emptyDir should pass 6 | set: 7 | persistence: 8 | config: 9 | enabled: true 10 | type: emptyDir 11 | asserts: 12 | - documentIndex: 0 13 | isKind: 14 | of: Deployment 15 | - documentIndex: 0 16 | equal: 17 | path: spec.template.spec.volumes[0] 18 | value: 19 | name: config 20 | emptyDir: {} 21 | 22 | - it: emptyDir with medium should pass 23 | set: 24 | persistence: 25 | config: 26 | enabled: true 27 | type: emptyDir 28 | medium: memory 29 | asserts: 30 | - documentIndex: 0 31 | isKind: 32 | of: Deployment 33 | - documentIndex: 0 34 | equal: 35 | path: spec.template.spec.volumes[0] 36 | value: 37 | name: config 38 | emptyDir: 39 | medium: memory 40 | 41 | - it: emptyDir with medium and sizeLimit should pass 42 | set: 43 | persistence: 44 | config: 45 | enabled: true 46 | type: emptyDir 47 | medium: memory 48 | sizeLimit: 1Gi 49 | asserts: 50 | - documentIndex: 0 51 | isKind: 52 | of: Deployment 53 | - documentIndex: 0 54 | equal: 55 | path: spec.template.spec.volumes[0] 56 | value: 57 | name: config 58 | emptyDir: 59 | medium: memory 60 | sizeLimit: 1Gi 61 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/persistence/hostpath_test.yaml: -------------------------------------------------------------------------------- 1 | suite: persistence hostpath 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: hostPath should pass 6 | set: 7 | persistence: 8 | hostpathmounts-data: 9 | enabled: true 10 | type: hostPath 11 | hostPath: "/tmp1" 12 | mountPath: "/data" 13 | asserts: 14 | - documentIndex: 0 15 | isKind: 16 | of: Deployment 17 | - documentIndex: 0 18 | equal: 19 | path: spec.template.spec.volumes[0] 20 | value: 21 | name: hostpathmounts-data 22 | hostPath: 23 | path: /tmp1 24 | 25 | - it: hostPath with type should pass 26 | set: 27 | persistence: 28 | hostpathmounts-with-type: 29 | enabled: true 30 | type: hostPath 31 | hostPath: "/tmp2" 32 | hostPathType: "Directory" 33 | mountPath: "/data2" 34 | asserts: 35 | - documentIndex: 0 36 | isKind: 37 | of: Deployment 38 | - documentIndex: 0 39 | equal: 40 | path: spec.template.spec.volumes[0] 41 | value: 42 | name: hostpathmounts-with-type 43 | hostPath: 44 | path: /tmp2 45 | type: Directory 46 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/persistence/types_test.yaml: -------------------------------------------------------------------------------- 1 | suite: persistence types 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: custom persistence type should pass 6 | set: 7 | persistence: 8 | custom-mount: 9 | enabled: true 10 | type: custom 11 | volumeSpec: 12 | downwardAPI: 13 | items: 14 | - path: "labels" 15 | fieldRef: 16 | fieldPath: metadata.labels 17 | asserts: 18 | - documentIndex: 0 19 | isKind: 20 | of: Deployment 21 | - documentIndex: 0 22 | equal: 23 | path: spec.template.spec.volumes[0] 24 | value: 25 | name: custom-mount 26 | downwardAPI: 27 | items: 28 | - fieldRef: 29 | fieldPath: metadata.labels 30 | path: labels 31 | 32 | - it: configmap persistence type should pass 33 | set: 34 | persistence: 35 | configmap: 36 | enabled: true 37 | type: configMap 38 | name: mySettings 39 | asserts: 40 | - documentIndex: 0 41 | isKind: 42 | of: Deployment 43 | - documentIndex: 0 44 | equal: 45 | path: spec.template.spec.volumes[0] 46 | value: 47 | name: configmap 48 | configMap: 49 | name: mySettings 50 | 51 | - it: configmap persistence type with name template should pass 52 | set: 53 | persistence: 54 | configmap: 55 | enabled: true 56 | type: configMap 57 | name: "{{ include \"common.names.fullname\" $ }}-config" 58 | asserts: 59 | - documentIndex: 0 60 | isKind: 61 | of: Deployment 62 | - documentIndex: 0 63 | equal: 64 | path: spec.template.spec.volumes[0] 65 | value: 66 | name: configmap 67 | configMap: 68 | name: RELEASE-NAME-common-test-config 69 | 70 | - it: secret persistence type should pass 71 | set: 72 | persistence: 73 | secret: 74 | enabled: true 75 | type: secret 76 | name: mySettings 77 | asserts: 78 | - documentIndex: 0 79 | isKind: 80 | of: Deployment 81 | - documentIndex: 0 82 | equal: 83 | path: spec.template.spec.volumes[0] 84 | value: 85 | name: secret 86 | secret: 87 | secretName: mySettings 88 | 89 | - it: secret persistence type with name template should pass 90 | set: 91 | persistence: 92 | secret: 93 | enabled: true 94 | type: secret 95 | name: "{{ .Release.Name }}-config" 96 | asserts: 97 | - documentIndex: 0 98 | isKind: 99 | of: Deployment 100 | - documentIndex: 0 101 | equal: 102 | path: spec.template.spec.volumes[0] 103 | value: 104 | name: secret 105 | secret: 106 | secretName: RELEASE-NAME-config 107 | 108 | - it: nfs persistence type should pass 109 | set: 110 | persistence: 111 | nfs: 112 | enabled: true 113 | type: nfs 114 | server: 10.10.0.8 115 | path: /tank/nas/library 116 | asserts: 117 | - documentIndex: 0 118 | isKind: 119 | of: Deployment 120 | - documentIndex: 0 121 | equal: 122 | path: spec.template.spec.volumes[0] 123 | value: 124 | name: nfs 125 | nfs: 126 | path: /tank/nas/library 127 | server: 10.10.0.8 128 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/persistence/volumeclaimtemplates_test.yaml: -------------------------------------------------------------------------------- 1 | suite: persistence volumeclaimtemplates 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: volumeClaimTemplates should pass 6 | set: 7 | controller: 8 | type: statefulset 9 | volumeClaimTemplates: 10 | - name: "storage" 11 | accessMode: "ReadWriteOnce" 12 | size: "10Gi" 13 | storageClass: "storage" 14 | asserts: 15 | - documentIndex: 0 16 | isKind: 17 | of: StatefulSet 18 | - documentIndex: 0 19 | equal: 20 | path: spec.volumeClaimTemplates[0] 21 | value: 22 | metadata: 23 | name: storage 24 | spec: 25 | accessModes: 26 | - ReadWriteOnce 27 | resources: 28 | requests: 29 | storage: 10Gi 30 | storageClassName: storage 31 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/pod/additionalcontainers_test.yaml: -------------------------------------------------------------------------------- 1 | suite: pod additional containers 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: with explicit name should pass 6 | set: 7 | additionalContainers: 8 | additional1: 9 | name: template-test 10 | asserts: 11 | - documentIndex: 0 12 | isKind: 13 | of: Deployment 14 | - documentIndex: 0 15 | equal: 16 | path: spec.template.spec.containers[1].name 17 | value: template-test 18 | 19 | - it: with implicit name should pass 20 | set: 21 | additionalContainers: 22 | additional1: 23 | image: template-test 24 | asserts: 25 | - documentIndex: 0 26 | isKind: 27 | of: Deployment 28 | - documentIndex: 0 29 | equal: 30 | path: spec.template.spec.containers[1].name 31 | value: additional1 32 | 33 | - it: with templated name should pass 34 | set: 35 | additionalContainers: 36 | additional1: 37 | name: "{{ .Release.Name }}-container" 38 | asserts: 39 | - documentIndex: 0 40 | isKind: 41 | of: Deployment 42 | - documentIndex: 0 43 | equal: 44 | path: spec.template.spec.containers[1].name 45 | value: RELEASE-NAME-container 46 | 47 | - it: with custom env vars dict should pass 48 | set: 49 | env: 50 | main_env: value 51 | additionalContainers: 52 | additional1: 53 | env: 54 | int: 1 55 | float: 1.5 56 | string: value_of_env 57 | template: "{{ .Release.Name }}-admin" 58 | asserts: 59 | - documentIndex: &DeploymentDocument 0 60 | isKind: 61 | of: Deployment 62 | - documentIndex: *DeploymentDocument 63 | equal: 64 | path: spec.template.spec.containers[0].env[0] 65 | value: 66 | name: main_env 67 | value: "value" 68 | - documentIndex: *DeploymentDocument 69 | equal: 70 | path: spec.template.spec.containers[1].env[0] 71 | value: 72 | name: float 73 | value: "1.5" 74 | - documentIndex: *DeploymentDocument 75 | equal: 76 | path: spec.template.spec.containers[1].env[1] 77 | value: 78 | name: int 79 | value: "1" 80 | - documentIndex: *DeploymentDocument 81 | equal: 82 | path: spec.template.spec.containers[1].env[2] 83 | value: 84 | name: string 85 | value: value_of_env 86 | - documentIndex: *DeploymentDocument 87 | equal: 88 | path: spec.template.spec.containers[1].env[3] 89 | value: 90 | name: template 91 | value: RELEASE-NAME-admin 92 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/pod/initcontainers_test.yaml: -------------------------------------------------------------------------------- 1 | suite: pod initContainers 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: with explicit name should pass 6 | set: 7 | initContainers: 8 | init1: 9 | name: template-test 10 | asserts: 11 | - documentIndex: 0 12 | isKind: 13 | of: Deployment 14 | - documentIndex: 0 15 | equal: 16 | path: spec.template.spec.initContainers[0].name 17 | value: template-test 18 | 19 | - it: with implicit name should pass 20 | set: 21 | initContainers: 22 | init1: 23 | image: template-test 24 | asserts: 25 | - documentIndex: 0 26 | isKind: 27 | of: Deployment 28 | - documentIndex: 0 29 | equal: 30 | path: spec.template.spec.initContainers[0].name 31 | value: init1 32 | 33 | - it: with templated name should pass 34 | set: 35 | initContainers: 36 | init1: 37 | name: "{{ .Release.Name }}-container" 38 | asserts: 39 | - documentIndex: 0 40 | isKind: 41 | of: Deployment 42 | - documentIndex: 0 43 | equal: 44 | path: spec.template.spec.initContainers[0].name 45 | value: RELEASE-NAME-container 46 | 47 | - it: with custom env vars dict should pass 48 | set: 49 | initContainers: 50 | init1: 51 | env: 52 | int: 1 53 | float: 1.5 54 | string: value_of_env 55 | template: "{{ .Release.Name }}-admin" 56 | asserts: 57 | - documentIndex: &DeploymentDocument 0 58 | isKind: 59 | of: Deployment 60 | - documentIndex: *DeploymentDocument 61 | equal: 62 | path: spec.template.spec.initContainers[0].env[0] 63 | value: 64 | name: float 65 | value: "1.5" 66 | - documentIndex: *DeploymentDocument 67 | equal: 68 | path: spec.template.spec.initContainers[0].env[1] 69 | value: 70 | name: int 71 | value: "1" 72 | - documentIndex: *DeploymentDocument 73 | equal: 74 | path: spec.template.spec.initContainers[0].env[2] 75 | value: 76 | name: string 77 | value: value_of_env 78 | - documentIndex: *DeploymentDocument 79 | equal: 80 | path: spec.template.spec.initContainers[0].env[3] 81 | value: 82 | name: template 83 | value: RELEASE-NAME-admin 84 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/pod/network_test.yaml: -------------------------------------------------------------------------------- 1 | suite: pod replicas 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - documentIndex: 0 8 | isKind: 9 | of: Deployment 10 | - documentIndex: 0 11 | isNull: 12 | path: spec.template.spec.hostNetwork 13 | - documentIndex: 0 14 | equal: 15 | path: spec.template.spec.dnsPolicy 16 | value: ClusterFirst 17 | 18 | - it: hostNetwork disabled should pass 19 | set: 20 | hostNetwork: false 21 | asserts: 22 | - documentIndex: 0 23 | isKind: 24 | of: Deployment 25 | - documentIndex: 0 26 | isNull: 27 | path: spec.template.spec.hostNetwork 28 | - documentIndex: 0 29 | equal: 30 | path: spec.template.spec.dnsPolicy 31 | value: ClusterFirst 32 | 33 | - it: hostNetwork enabled should pass 34 | set: 35 | hostNetwork: true 36 | asserts: 37 | - documentIndex: 0 38 | isKind: 39 | of: Deployment 40 | - documentIndex: 0 41 | equal: 42 | path: spec.template.spec.hostNetwork 43 | value: true 44 | - documentIndex: 0 45 | equal: 46 | path: spec.template.spec.dnsPolicy 47 | value: ClusterFirstWithHostNet 48 | 49 | - it: custom dnsPolicy should pass 50 | set: 51 | dnsPolicy: None 52 | asserts: 53 | - documentIndex: 0 54 | isKind: 55 | of: Deployment 56 | - documentIndex: 0 57 | equal: 58 | path: spec.template.spec.dnsPolicy 59 | value: None 60 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/pod/replicas_test.yaml: -------------------------------------------------------------------------------- 1 | suite: pod replicas 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - documentIndex: 0 8 | isKind: 9 | of: Deployment 10 | - documentIndex: 0 11 | equal: 12 | path: spec.replicas 13 | value: 1 14 | 15 | - it: custom replicas should pass 16 | set: 17 | controller.replicas: 3 18 | asserts: 19 | - documentIndex: 0 20 | isKind: 21 | of: Deployment 22 | - documentIndex: 0 23 | equal: 24 | path: spec.replicas 25 | value: 3 26 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/pvc/metadata_test.yaml: -------------------------------------------------------------------------------- 1 | suite: pvc metadata 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | set: 7 | persistence.config.enabled: true 8 | asserts: 9 | - documentIndex: &PersistentVolumeClaimDocument 0 10 | isKind: 11 | of: PersistentVolumeClaim 12 | - documentIndex: *PersistentVolumeClaimDocument 13 | isNull: 14 | path: metadata.annotations 15 | - documentIndex: *PersistentVolumeClaimDocument 16 | equal: 17 | path: metadata.labels 18 | value: 19 | app.kubernetes.io/instance: RELEASE-NAME 20 | app.kubernetes.io/managed-by: Helm 21 | app.kubernetes.io/name: common-test 22 | helm.sh/chart: common-test-0.1.0 23 | 24 | - it: retain enabled should pass 25 | set: 26 | persistence.config: 27 | enabled: true 28 | retain: true 29 | asserts: 30 | - documentIndex: &PersistentVolumeClaimDocument 0 31 | isKind: 32 | of: PersistentVolumeClaim 33 | - documentIndex: *PersistentVolumeClaimDocument 34 | equal: 35 | path: metadata.annotations 36 | value: 37 | helm.sh/resource-policy: keep 38 | - documentIndex: *PersistentVolumeClaimDocument 39 | equal: 40 | path: metadata.labels 41 | value: 42 | app.kubernetes.io/instance: RELEASE-NAME 43 | app.kubernetes.io/managed-by: Helm 44 | app.kubernetes.io/name: common-test 45 | helm.sh/chart: common-test-0.1.0 46 | 47 | - it: custom metadata should pass 48 | set: 49 | persistence.config: 50 | enabled: true 51 | labels: 52 | test_label: test 53 | annotations: 54 | test_annotation: test 55 | asserts: 56 | - documentIndex: &PersistentVolumeClaimDocument 0 57 | isKind: 58 | of: PersistentVolumeClaim 59 | - documentIndex: *PersistentVolumeClaimDocument 60 | equal: 61 | path: metadata.annotations 62 | value: 63 | test_annotation: test 64 | - documentIndex: *PersistentVolumeClaimDocument 65 | equal: 66 | path: metadata.labels 67 | value: 68 | app.kubernetes.io/instance: RELEASE-NAME 69 | app.kubernetes.io/managed-by: Helm 70 | app.kubernetes.io/name: common-test 71 | helm.sh/chart: common-test-0.1.0 72 | test_label: test 73 | 74 | - it: custom metadata with global metadata should pass 75 | set: 76 | global: 77 | labels: 78 | global_label: test 79 | annotations: 80 | global_annotation: test 81 | persistence.config: 82 | enabled: true 83 | labels: 84 | test_label: test 85 | annotations: 86 | test_annotation: test 87 | asserts: 88 | - documentIndex: &PersistentVolumeClaimDocument 0 89 | isKind: 90 | of: PersistentVolumeClaim 91 | - documentIndex: *PersistentVolumeClaimDocument 92 | equal: 93 | path: metadata.annotations 94 | value: 95 | test_annotation: test 96 | global_annotation: test 97 | - documentIndex: *PersistentVolumeClaimDocument 98 | equal: 99 | path: metadata.labels 100 | value: 101 | app.kubernetes.io/instance: RELEASE-NAME 102 | app.kubernetes.io/managed-by: Helm 103 | app.kubernetes.io/name: common-test 104 | global_label: test 105 | helm.sh/chart: common-test-0.1.0 106 | test_label: test 107 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/pvc/names_test.yaml: -------------------------------------------------------------------------------- 1 | suite: pvc names 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: disabled should pass 6 | asserts: 7 | - hasDocuments: 8 | count: 2 9 | - documentIndex: 0 10 | not: true 11 | isKind: 12 | of: PersistentVolumeClaim 13 | - documentIndex: 1 14 | not: true 15 | isKind: 16 | of: PersistentVolumeClaim 17 | 18 | - it: default should pass 19 | set: 20 | persistence.config.enabled: true 21 | asserts: 22 | - hasDocuments: 23 | count: 3 24 | - documentIndex: &PersistentVolumeClaimDocument 0 25 | isKind: 26 | of: PersistentVolumeClaim 27 | - documentIndex: 1 28 | not: true 29 | isKind: 30 | of: PersistentVolumeClaim 31 | - documentIndex: 2 32 | not: true 33 | isKind: 34 | of: PersistentVolumeClaim 35 | - documentIndex: *PersistentVolumeClaimDocument 36 | equal: 37 | path: metadata.name 38 | value: RELEASE-NAME-common-test-config 39 | 40 | - it: without suffix should pass 41 | set: 42 | persistence.config: 43 | enabled: true 44 | nameOverride: "-" 45 | asserts: 46 | - documentIndex: &PersistentVolumeClaimDocument 0 47 | isKind: 48 | of: PersistentVolumeClaim 49 | - documentIndex: *PersistentVolumeClaimDocument 50 | equal: 51 | path: metadata.name 52 | value: RELEASE-NAME-common-test 53 | 54 | - it: with custom suffix should pass 55 | set: 56 | persistence.config: 57 | enabled: true 58 | nameOverride: "custom" 59 | asserts: 60 | - documentIndex: &PersistentVolumeClaimDocument 0 61 | isKind: 62 | of: PersistentVolumeClaim 63 | - documentIndex: *PersistentVolumeClaimDocument 64 | equal: 65 | path: metadata.name 66 | value: RELEASE-NAME-common-test-custom 67 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/pvc/storageclass_test.yaml: -------------------------------------------------------------------------------- 1 | suite: pvc storageclass 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | set: 7 | persistence.config.enabled: true 8 | asserts: 9 | - documentIndex: &PersistentVolumeClaimDocument 0 10 | isKind: 11 | of: PersistentVolumeClaim 12 | - documentIndex: *PersistentVolumeClaimDocument 13 | isNull: 14 | path: spec.storageClassName 15 | 16 | - it: custom should pass 17 | set: 18 | persistence.config: 19 | enabled: true 20 | storageClass: custom 21 | asserts: 22 | - documentIndex: &PersistentVolumeClaimDocument 0 23 | isKind: 24 | of: PersistentVolumeClaim 25 | - documentIndex: *PersistentVolumeClaimDocument 26 | equal: 27 | path: spec.storageClassName 28 | value: custom 29 | 30 | - it: empty should pass 31 | set: 32 | persistence.config: 33 | enabled: true 34 | storageClass: "-" 35 | asserts: 36 | - documentIndex: &PersistentVolumeClaimDocument 0 37 | isKind: 38 | of: PersistentVolumeClaim 39 | - documentIndex: *PersistentVolumeClaimDocument 40 | equal: 41 | path: spec.storageClassName 42 | value: "" 43 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/service/metadata_test.yaml: -------------------------------------------------------------------------------- 1 | suite: service metadata 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default metadata should pass 6 | asserts: 7 | - documentIndex: &ServiceDocument 1 8 | isKind: 9 | of: Service 10 | - documentIndex: *ServiceDocument 11 | isNull: 12 | path: metadata.annotations 13 | - documentIndex: *ServiceDocument 14 | equal: 15 | path: metadata.labels 16 | value: 17 | app.kubernetes.io/instance: RELEASE-NAME 18 | app.kubernetes.io/managed-by: Helm 19 | app.kubernetes.io/name: common-test 20 | helm.sh/chart: common-test-0.1.0 21 | 22 | - it: custom metadata should pass 23 | set: 24 | service: 25 | main: 26 | annotations: 27 | test_annotation: test 28 | labels: 29 | test_label: test 30 | asserts: 31 | - documentIndex: &ServiceDocument 1 32 | isKind: 33 | of: Service 34 | - documentIndex: *ServiceDocument 35 | equal: 36 | path: metadata.annotations 37 | value: 38 | test_annotation: test 39 | - documentIndex: *ServiceDocument 40 | equal: 41 | path: metadata.labels 42 | value: 43 | app.kubernetes.io/instance: RELEASE-NAME 44 | app.kubernetes.io/managed-by: Helm 45 | app.kubernetes.io/name: common-test 46 | helm.sh/chart: common-test-0.1.0 47 | test_label: test 48 | 49 | - it: custom metadata with global metadata should pass 50 | set: 51 | global: 52 | labels: 53 | global_label: test 54 | annotations: 55 | global_annotation: test 56 | service: 57 | main: 58 | annotations: 59 | test_annotation: test 60 | labels: 61 | test_label: test 62 | asserts: 63 | - documentIndex: &ServiceDocument 1 64 | isKind: 65 | of: Service 66 | - documentIndex: *ServiceDocument 67 | equal: 68 | path: metadata.annotations 69 | value: 70 | global_annotation: test 71 | test_annotation: test 72 | - documentIndex: *ServiceDocument 73 | equal: 74 | path: metadata.labels 75 | value: 76 | app.kubernetes.io/instance: RELEASE-NAME 77 | app.kubernetes.io/managed-by: Helm 78 | app.kubernetes.io/name: common-test 79 | global_label: test 80 | helm.sh/chart: common-test-0.1.0 81 | test_label: test 82 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/service/names_test.yaml: -------------------------------------------------------------------------------- 1 | suite: service names 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - hasDocuments: 8 | count: 2 9 | - documentIndex: &ServiceDocument 1 10 | isKind: 11 | of: Service 12 | - documentIndex: *ServiceDocument 13 | equal: 14 | path: metadata.name 15 | value: RELEASE-NAME-common-test 16 | 17 | - it: custom name suffix should pass 18 | set: 19 | service: 20 | main: 21 | nameOverride: http 22 | asserts: 23 | - documentIndex: &ServiceDocument 1 24 | isKind: 25 | of: Service 26 | - documentIndex: *ServiceDocument 27 | equal: 28 | path: metadata.name 29 | value: RELEASE-NAME-common-test-http 30 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/service/port_names_test.yaml: -------------------------------------------------------------------------------- 1 | suite: service port names 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - hasDocuments: 8 | count: 2 9 | - documentIndex: &ServiceDocument 1 10 | isKind: 11 | of: Service 12 | - documentIndex: *ServiceDocument 13 | equal: 14 | path: spec.ports[0] 15 | value: 16 | name: http 17 | port: null 18 | protocol: TCP 19 | targetPort: http 20 | 21 | - it: custom name should pass 22 | set: 23 | service: 24 | main: 25 | ports: 26 | http: 27 | enabled: false 28 | server: 29 | enabled: true 30 | port: 8080 31 | asserts: 32 | - documentIndex: &ServiceDocument 1 33 | isKind: 34 | of: Service 35 | - documentIndex: *ServiceDocument 36 | equal: 37 | path: spec.ports[0] 38 | value: 39 | name: server 40 | port: 8080 41 | protocol: TCP 42 | targetPort: server 43 | 44 | - it: custom target port should pass 45 | set: 46 | service: 47 | main: 48 | ports: 49 | http: 50 | enabled: true 51 | targetPort: 80 52 | asserts: 53 | - documentIndex: &ServiceDocument 1 54 | isKind: 55 | of: Service 56 | - documentIndex: *ServiceDocument 57 | equal: 58 | path: spec.ports[0] 59 | value: 60 | name: http 61 | port: null 62 | protocol: TCP 63 | targetPort: 80 64 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/service/port_protocols_test.yaml: -------------------------------------------------------------------------------- 1 | suite: service protocols 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: default should pass 6 | asserts: 7 | - hasDocuments: 8 | count: 2 9 | - documentIndex: &ServiceDocument 1 10 | isKind: 11 | of: Service 12 | - documentIndex: *ServiceDocument 13 | equal: 14 | path: spec.ports[0].protocol 15 | value: TCP 16 | 17 | - it: explicit TCP should pass 18 | set: 19 | service.main.ports.http.protocol: TCP 20 | asserts: 21 | - documentIndex: &ServiceDocument 1 22 | isKind: 23 | of: Service 24 | - documentIndex: *ServiceDocument 25 | equal: 26 | path: spec.ports[0].protocol 27 | value: TCP 28 | 29 | - it: explicit UDP should pass 30 | set: 31 | service.main.ports.http.protocol: UDP 32 | asserts: 33 | - documentIndex: &ServiceDocument 1 34 | isKind: 35 | of: Service 36 | - documentIndex: *ServiceDocument 37 | equal: 38 | path: spec.ports[0].protocol 39 | value: UDP 40 | 41 | - it: explicit HTTP should pass 42 | set: 43 | service.main.ports.http.protocol: HTTP 44 | asserts: 45 | - documentIndex: &ServiceDocument 1 46 | isKind: 47 | of: Service 48 | - documentIndex: *ServiceDocument 49 | equal: 50 | path: spec.ports[0].protocol 51 | value: TCP 52 | - documentIndex: *ServiceDocument 53 | isNull: 54 | path: metadata.annotations 55 | 56 | - it: explicit HTTPS should pass 57 | set: 58 | service.main.ports.http.protocol: HTTPS 59 | asserts: 60 | - documentIndex: &ServiceDocument 1 61 | isKind: 62 | of: Service 63 | - documentIndex: *ServiceDocument 64 | equal: 65 | path: spec.ports[0].protocol 66 | value: TCP 67 | - documentIndex: *ServiceDocument 68 | equal: 69 | path: metadata.annotations 70 | value: 71 | traefik.ingress.kubernetes.io/service.serversscheme: https 72 | -------------------------------------------------------------------------------- /helper-charts/common-test/tests/service/values_test.yaml: -------------------------------------------------------------------------------- 1 | suite: service values 2 | templates: 3 | - common.yaml 4 | tests: 5 | - it: externalTrafficPolicy should pass for NodePort service 6 | set: 7 | service: 8 | main: 9 | type: NodePort 10 | externalTrafficPolicy: Local 11 | asserts: 12 | - documentIndex: &ServiceDocument 1 13 | isKind: 14 | of: Service 15 | - documentIndex: *ServiceDocument 16 | equal: 17 | path: spec.externalTrafficPolicy 18 | value: Local 19 | 20 | - it: externalTrafficPolicy should pass for LoadBalancer service 21 | set: 22 | service: 23 | main: 24 | type: LoadBalancer 25 | externalTrafficPolicy: Local 26 | asserts: 27 | - documentIndex: &ServiceDocument 1 28 | isKind: 29 | of: Service 30 | - documentIndex: *ServiceDocument 31 | equal: 32 | path: spec.externalTrafficPolicy 33 | value: Local 34 | -------------------------------------------------------------------------------- /helper-charts/common-test/values.yaml: -------------------------------------------------------------------------------- 1 | image: 2 | repository: b4bz/homer 3 | tag: latest 4 | pullPolicy: IfNotPresent 5 | --------------------------------------------------------------------------------