From fb4e584c35374e5832117767386182f9c3e3bd23 Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 16 May 2024 11:53:53 -0400 Subject: [PATCH] lint: convert CRLF to LF and add newline at the end of file --- .github/dependabot.yml | 22 +- .github/workflows/develop.yml | 120 +++--- .github/workflows/helm-release.yml | 114 ++--- .github/workflows/helm-tests.yml | 144 +++---- .github/workflows/release.yml | 232 +++++------ .github/workflows/tests.yml | 480 +++++++++++----------- charts/sogo/.helmignore | 42 +- charts/sogo/Chart.yaml | 62 +-- charts/sogo/README.md | 68 +-- charts/sogo/templates/_helpers.tpl | 126 +++--- charts/sogo/templates/config.yaml | 28 +- charts/sogo/templates/db-secret.yaml | 26 -- charts/sogo/templates/deployment.yaml | 374 ++++++++--------- charts/sogo/templates/hpa.yaml | 46 +-- charts/sogo/templates/ingress.yaml | 92 ++--- charts/sogo/templates/rbac.yaml | 62 +-- charts/sogo/templates/secrets.yaml | 28 +- charts/sogo/templates/service.yaml | 74 ++-- charts/sogo/templates/serviceaccount.yaml | 22 +- ct.yaml | 10 +- 20 files changed, 1073 insertions(+), 1099 deletions(-) delete mode 100644 charts/sogo/templates/db-secret.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e85539e..debd3c9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,11 +1,11 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file - -version: 2 -updates: - - package-ecosystem: "docker" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "weekly" +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "docker" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index f2fe2df..5439aaf 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -1,61 +1,61 @@ ---- -name: Developer image -on: # yamllint disable-line rule:truthy - push: - branches: [main] - paths-ignore: - - 'README.md' - - 'sample-config.conf' - - 'sample-config.yaml' - - '.github/**' - -jobs: - check_versions: - name: Develop - Version checking - runs-on: ubuntu-latest - outputs: - version: ${{ steps.sogo.outputs.VERSION }} - steps: - - name: Get latest version of SOGo - id: sogo - run: | - echo "VERSION=$(curl -s https://api.github.com/repos/Alinto/sogo/releases/latest | jq -r '.tag_name' | sed 's/SOGo-//')" >> "$GITHUB_OUTPUT" - - # Builds the Dockerfile and pushes it to dockerhub and GHCR - develop: - name: Develop - Docker image - needs: check_versions - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Docker - GHCR Login - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Docker - Metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ghcr.io/${{ github.repository }} - tags: type=raw,value=dev - flavor: latest=false - - - name: Docker - Build / Push - uses: docker/build-push-action@v5 - with: - platforms: linux/amd64 - push: true - tags: ${{ steps.meta.outputs.tags }} - cache-from: type=gha - cache-to: type=gha,mode=max - build-args: | +--- +name: Developer image +on: # yamllint disable-line rule:truthy + push: + branches: [main] + paths-ignore: + - 'README.md' + - 'sample-config.conf' + - 'sample-config.yaml' + - '.github/**' + +jobs: + check_versions: + name: Develop - Version checking + runs-on: ubuntu-latest + outputs: + version: ${{ steps.sogo.outputs.VERSION }} + steps: + - name: Get latest version of SOGo + id: sogo + run: | + echo "VERSION=$(curl -s https://api.github.com/repos/Alinto/sogo/releases/latest | jq -r '.tag_name' | sed 's/SOGo-//')" >> "$GITHUB_OUTPUT" + + # Builds the Dockerfile and pushes it to dockerhub and GHCR + develop: + name: Develop - Docker image + needs: check_versions + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Docker - GHCR Login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker - Metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ github.repository }} + tags: type=raw,value=dev + flavor: latest=false + + - name: Docker - Build / Push + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | SOGO_VERSION=${{ needs.check_versions.outputs.version }} \ No newline at end of file diff --git a/.github/workflows/helm-release.yml b/.github/workflows/helm-release.yml index 4433635..fadb408 100644 --- a/.github/workflows/helm-release.yml +++ b/.github/workflows/helm-release.yml @@ -1,58 +1,58 @@ -name: Push - Helm Chart -on: - push: - branches: [main] - -jobs: - helm-chart-releaser: - name: Helm - Chart releaser - runs-on: ubuntu-latest - permissions: - contents: write - pages: write - packages: write - steps: - - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Git - Configure - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - - name: OCI - Login to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - # Pushes updates to index.yaml found in the gh-pages branch when a new version is detected - - name: Helm - chart-releaser - uses: helm/chart-releaser-action@v1.6.0 - with: - charts_dir: charts - pages_branch: gh-pages - mark_as_latest: false - skip_existing: true - config: ./charts/cr.yaml - env: - CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - - name: Helm - OCI Push to GHCR - run: | - if [ -z "$(ls -A .cr-release-packages)" ]; then - echo "No packages found under .cr-release-packages/" - exit 0 - fi - for pkg in .cr-release-packages/*; do - if [ -z "${pkg:-}" ]; then - break - fi - REPO="${{ github.repository }}" - echo "Pushing $pkg to ghcr.io/${REPO,,}" - helm push "$pkg" "oci://ghcr.io/${REPO,,}" +name: Push - Helm Chart +on: + push: + branches: [main] + +jobs: + helm-chart-releaser: + name: Helm - Chart releaser + runs-on: ubuntu-latest + permissions: + contents: write + pages: write + packages: write + steps: + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Git - Configure + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: OCI - Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Pushes updates to index.yaml found in the gh-pages branch when a new version is detected + - name: Helm - chart-releaser + uses: helm/chart-releaser-action@v1.6.0 + with: + charts_dir: charts + pages_branch: gh-pages + mark_as_latest: false + skip_existing: true + config: ./charts/cr.yaml + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + - name: Helm - OCI Push to GHCR + run: | + if [ -z "$(ls -A .cr-release-packages)" ]; then + echo "No packages found under .cr-release-packages/" + exit 0 + fi + for pkg in .cr-release-packages/*; do + if [ -z "${pkg:-}" ]; then + break + fi + REPO="${{ github.repository }}" + echo "Pushing $pkg to ghcr.io/${REPO,,}" + helm push "$pkg" "oci://ghcr.io/${REPO,,}" done \ No newline at end of file diff --git a/.github/workflows/helm-tests.yml b/.github/workflows/helm-tests.yml index da6ab04..97c020f 100644 --- a/.github/workflows/helm-tests.yml +++ b/.github/workflows/helm-tests.yml @@ -1,73 +1,73 @@ -name: Lint and Test Charts -on: pull_request -concurrency: - group: '${{ github.workflow }} @ ${{ github.ref }}' - cancel-in-progress: true -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Helm - chart-releaser - uses: helm/chart-releaser-action@v1.6.0 - with: - install_only: true - - - name: Helm - chart-testing - uses: helm/chart-testing-action@v2.6.1 - - - name: Helm - chart-testing - list-changed - id: list-changed - run: | - changed=$(ct list-changed --config ct.yaml) - if [[ -n "$changed" ]]; then - echo "changed=true" >> $GITHUB_OUTPUT - fi - - - name: Helm - chart-testing - lint - run: ct lint --check-version-increment=false --config ct.yaml - - e2e-test: - runs-on: ubuntu-latest - strategy: - matrix: - # Supported versions at https://kubernetes.io/releases/ - version: - - v1.26.13 # EOL 2024-02-28 - - v1.27.10 # EOL 2024-06-28 - - v1.28.6 # EOL 2024-10-28 - - v1.29.1 # EOL 2025-02-28 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Helm - chart-releaser - uses: helm/chart-releaser-action@v1.6.0 - with: - install_only: true - - - name: Helm - chart-testing - uses: helm/chart-testing-action@v2.6.1 - - - name: Helm - chart-testing - list-changed - id: list-changed - run: | - changed=$(ct list-changed --config ct.yaml) - if [[ -n "$changed" ]]; then - echo "changed=true" >> $GITHUB_OUTPUT - fi - - - name: K8S - Create Kind Cluster - uses: helm/kind-action@v1.8.0 - with: - node_image: kindest/node:${{ matrix.version }} - if: steps.list-changed.outputs.changed == 'true' - - - name: Helm - chart-testing - install +name: Lint and Test Charts +on: pull_request +concurrency: + group: '${{ github.workflow }} @ ${{ github.ref }}' + cancel-in-progress: true +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Helm - chart-releaser + uses: helm/chart-releaser-action@v1.6.0 + with: + install_only: true + + - name: Helm - chart-testing + uses: helm/chart-testing-action@v2.6.1 + + - name: Helm - chart-testing - list-changed + id: list-changed + run: | + changed=$(ct list-changed --config ct.yaml) + if [[ -n "$changed" ]]; then + echo "changed=true" >> $GITHUB_OUTPUT + fi + + - name: Helm - chart-testing - lint + run: ct lint --check-version-increment=false --config ct.yaml + + e2e-test: + runs-on: ubuntu-latest + strategy: + matrix: + # Supported versions at https://kubernetes.io/releases/ + version: + - v1.26.13 # EOL 2024-02-28 + - v1.27.10 # EOL 2024-06-28 + - v1.28.6 # EOL 2024-10-28 + - v1.29.1 # EOL 2025-02-28 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Helm - chart-releaser + uses: helm/chart-releaser-action@v1.6.0 + with: + install_only: true + + - name: Helm - chart-testing + uses: helm/chart-testing-action@v2.6.1 + + - name: Helm - chart-testing - list-changed + id: list-changed + run: | + changed=$(ct list-changed --config ct.yaml) + if [[ -n "$changed" ]]; then + echo "changed=true" >> $GITHUB_OUTPUT + fi + + - name: K8S - Create Kind Cluster + uses: helm/kind-action@v1.8.0 + with: + node_image: kindest/node:${{ matrix.version }} + if: steps.list-changed.outputs.changed == 'true' + + - name: Helm - chart-testing - install run: ct install --config ct.yaml --helm-extra-set-args='--set=server.resources=null --set=server.storage.main.size=1Gi' \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd654af..b2056c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,117 +1,117 @@ ---- -name: Release image -on: # yamllint disable-line rule:truthy - schedule: - - cron: '0 0 * * *' - workflow_dispatch: - -jobs: - check_versions: - name: Release - Version checking - runs-on: ubuntu-latest - outputs: - base_version: ${{ steps.sogo.outputs.VERSION }} - revision: ${{ steps.image.outputs.REVISION }} - next_revision: ${{ steps.image.outputs.NEXT_REVISION }} - release: ${{ steps.condition.outputs.RELEASE }} - steps: - - name: Get latest version of SOGo - id: sogo - run: | - echo "VERSION=$(curl -s https://api.github.com/repos/Alinto/sogo/releases/latest | jq -r '.tag_name' | sed 's/SOGo-//')" >> "$GITHUB_OUTPUT" - - - name: Get latest version of Docker image - id: image - run: | - RAW_LATEST_RELEASE=$(curl -s https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest) - - VERSION=$(echo "$RAW_LATEST_RELEASE" | jq -r '.tag_name') - echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT" - - echo "BASE_VERSION=$(echo "$VERSION" | sed 's/-.*//')" >> "$GITHUB_OUTPUT" - - REVISION=$([[ "$VERSION" == *-* ]] && echo "$VERSION" | sed 's/.*-//' || echo "") - echo "REVISION=$REVISION" >> "$GITHUB_OUTPUT" - - NEXT_REVISION=$([[ "$REVISION" =~ ^[0-9]+$ ]] && echo $(($REVISION + 1)) || echo 1) - echo "NEXT_REVISION=$NEXT_REVISION" >> "$GITHUB_OUTPUT" - - - name: Decide if release version or not - id: condition - env: - SOGO_VERSION: ${{steps.sogo.outputs.VERSION}} - DOCKER_VERSION: ${{steps.image.outputs.BASE_VERSION}} - DOCKER_REVISION: ${{steps.image.outputs.REVISION}} - ACTION_TRIGGER: ${{github.event_name}} - run: | - VERSIONS_ARE_EQUAL=$([ "$SOGO_VERSION" = "$DOCKER_VERSION" ] && echo "true" || echo "false") - - if [ "$ACTION_TRIGGER" = "workflow_dispatch" ] || [ "$VERSIONS_ARE_EQUAL" != "true" ]; then - RELEASE="true" - else - RELEASE="false" - fi - - echo "RELEASE=$RELEASE" >> "$GITHUB_OUTPUT" - - release: - name: Release - Docker image - needs: check_versions - runs-on: ubuntu-latest - if: needs.check_versions.outputs.release == 'true' - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Docker - Login - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Docker - GHCR Login - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Docker - Metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ${{ github.repository }} - ghcr.io/${{ github.repository }} - # generate Docker tags based on the following events/attributes - tags: | - type=raw,value=${{ needs.check_versions.outputs.base_version }} - type=raw,value=${{ needs.check_versions.outputs.base_version }}-${{ needs.check_versions.outputs.next_revision }} - flavor: latest=true - - - name: Docker - Build / Push - id: docker_build - uses: docker/build-push-action@v5 - with: - platforms: linux/amd64 - push: true - tags: ${{ steps.meta.outputs.tags }} - cache-from: type=gha - cache-to: type=gha,mode=max - build-args: | - SOGO_VERSION=${{ needs.check_versions.outputs.base_version }} - - - name: Github Release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ needs.check_versions.outputs.base_version }}-${{ needs.check_versions.outputs.next_revision }} - make_latest: 'true' - generate_release_notes: true - body: | +--- +name: Release image +on: # yamllint disable-line rule:truthy + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +jobs: + check_versions: + name: Release - Version checking + runs-on: ubuntu-latest + outputs: + base_version: ${{ steps.sogo.outputs.VERSION }} + revision: ${{ steps.image.outputs.REVISION }} + next_revision: ${{ steps.image.outputs.NEXT_REVISION }} + release: ${{ steps.condition.outputs.RELEASE }} + steps: + - name: Get latest version of SOGo + id: sogo + run: | + echo "VERSION=$(curl -s https://api.github.com/repos/Alinto/sogo/releases/latest | jq -r '.tag_name' | sed 's/SOGo-//')" >> "$GITHUB_OUTPUT" + + - name: Get latest version of Docker image + id: image + run: | + RAW_LATEST_RELEASE=$(curl -s https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest) + + VERSION=$(echo "$RAW_LATEST_RELEASE" | jq -r '.tag_name') + echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT" + + echo "BASE_VERSION=$(echo "$VERSION" | sed 's/-.*//')" >> "$GITHUB_OUTPUT" + + REVISION=$([[ "$VERSION" == *-* ]] && echo "$VERSION" | sed 's/.*-//' || echo "") + echo "REVISION=$REVISION" >> "$GITHUB_OUTPUT" + + NEXT_REVISION=$([[ "$REVISION" =~ ^[0-9]+$ ]] && echo $(($REVISION + 1)) || echo 1) + echo "NEXT_REVISION=$NEXT_REVISION" >> "$GITHUB_OUTPUT" + + - name: Decide if release version or not + id: condition + env: + SOGO_VERSION: ${{steps.sogo.outputs.VERSION}} + DOCKER_VERSION: ${{steps.image.outputs.BASE_VERSION}} + DOCKER_REVISION: ${{steps.image.outputs.REVISION}} + ACTION_TRIGGER: ${{github.event_name}} + run: | + VERSIONS_ARE_EQUAL=$([ "$SOGO_VERSION" = "$DOCKER_VERSION" ] && echo "true" || echo "false") + + if [ "$ACTION_TRIGGER" = "workflow_dispatch" ] || [ "$VERSIONS_ARE_EQUAL" != "true" ]; then + RELEASE="true" + else + RELEASE="false" + fi + + echo "RELEASE=$RELEASE" >> "$GITHUB_OUTPUT" + + release: + name: Release - Docker image + needs: check_versions + runs-on: ubuntu-latest + if: needs.check_versions.outputs.release == 'true' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Docker - Login + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Docker - GHCR Login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker - Metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }} + ghcr.io/${{ github.repository }} + # generate Docker tags based on the following events/attributes + tags: | + type=raw,value=${{ needs.check_versions.outputs.base_version }} + type=raw,value=${{ needs.check_versions.outputs.base_version }}-${{ needs.check_versions.outputs.next_revision }} + flavor: latest=true + + - name: Docker - Build / Push + id: docker_build + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + SOGO_VERSION=${{ needs.check_versions.outputs.base_version }} + + - name: Github Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ needs.check_versions.outputs.base_version }}-${{ needs.check_versions.outputs.next_revision }} + make_latest: 'true' + generate_release_notes: true + body: | SOGo Update: https://github.com/Alinto/sogo/releases/tag/SOGo-${{ needs.check_versions.outputs.base_version }} \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6e95ac5..4e3ef3c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,241 +1,241 @@ ---- -name: Tests -on: # yamllint disable-line rule:truthy - pull_request: - workflow_call: - -concurrency: - group: '${{ github.workflow }} @ ${{ github.ref }}' - cancel-in-progress: true - -jobs: - check_versions: - name: Tests - Version checking - runs-on: ubuntu-latest - outputs: - version: ${{ steps.sogo.outputs.VERSION }} - steps: - - name: Get latest version of SOGo - id: sogo - run: | - echo "VERSION=$(curl -s https://api.github.com/repos/Alinto/sogo/releases/latest | jq -r '.tag_name' | sed 's/SOGo-//')" >> "$GITHUB_OUTPUT" - - test_build: - name: Tests - Build image for testing - needs: check_versions - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and export to Docker - uses: docker/build-push-action@v5 - with: - file: ./Dockerfile - load: true - platforms: linux/amd64 - cache-from: type=gha - cache-to: type=gha,mode=max - tags: test-sogo:${{ github.run_id }} - outputs: type=docker,dest=/tmp/test-sogo-${{ github.run_id }}.tar - build-args: | - SOGO_VERSION=${{ needs.check_versions.outputs.version }} - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: test-sogo-${{ github.run_id }} - path: /tmp/test-sogo-${{ github.run_id }}.tar - - end_to_end_plist: - name: Tests - E2E Testing - needs: test_build - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Download artifact - uses: actions/download-artifact@v2 - with: - name: test-sogo-${{ github.run_id }} - path: /tmp - - - name: Load Docker image - env: - RUN_ID: ${{ github.run_id }} - run: | - docker load --input /tmp/test-sogo-$RUN_ID.tar - - - name: Setup test configurations - run: | - mkdir -p /tmp/test-sogo - plist_config=$(cat sample-config.conf) - echo "$plist_config" > /tmp/test-sogo/sogo.conf - - - name: Setup test PostgreSQL - run: | - docker network create test-sogo - docker run -d \ - --name test-postgres \ - --network test-sogo \ - -e POSTGRES_PASSWORD=sogo \ - -e POSTGRES_USER=sogo \ - -e POSTGRES_DB=sogo \ - postgres - - - name: Run test SOGo container - run: | - docker run -d \ - --name sogo \ - --network test-sogo \ - -p 80:80/tcp \ - -v /tmp/test-sogo/sogo.conf:/etc/sogo/sogo.conf \ - --stop-timeout 30 \ - test-sogo:${{ github.run_id }} - - - name: Wait for test SOGo container to start - run: | - TIMEOUT_SECONDS=180 - START_TIME=$(date +%s) - - while ! docker logs sogo 2>&1 | grep -q 'INFO success: sogo entered RUNNING state, process has stayed up for > than 1 seconds'; do - CURRENT_TIME=$(date +%s) - ELAPSED_TIME=$((CURRENT_TIME - START_TIME)) - - if [ $ELAPSED_TIME -gt $TIMEOUT_SECONDS ]; then - echo "Timeout reached. Server failed to start within $TIMEOUT_SECONDS seconds." - printf "\e[0;32m%s\e[0m\n" "*****Test container logs*****" - docker logs sogo - exit 1 - fi - - echo "Waiting for test SOGo container to start..." - sleep 5 - done - - - name: Test HTTP status code - run: | - TIMEOUT=60 - elapsed_time=0 - SUCCESS_CODE=302 - - while true; do - http_status=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:80/SOGo") - - if [ $http_status -eq $SUCCESS_CODE ]; then - echo "Health check successful. HTTP Status Code: $http_status" - exit 0 - fi - - elapsed_time=$((elapsed_time + 1)) - - if [ $elapsed_time -ge $TIMEOUT ]; then - echo "Timeout reached. HTTP Health check failed." - exit 1 - fi - - # Wait for a second before next health check - sleep 1 - done - - end_to_end_yaml: - name: Tests - E2E Testing (YAML Config) - needs: test_build - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Download artifact - uses: actions/download-artifact@v2 - with: - name: test-sogo-${{ github.run_id }} - path: /tmp - - - name: Load Docker image - env: - RUN_ID: ${{ github.run_id }} - run: | - docker load --input /tmp/test-sogo-$RUN_ID.tar - - - name: Setup test configurations - run: | - mkdir -p /tmp/test-sogo - yaml_config=$(cat sample-config.yaml) - echo "$yaml_config" > /tmp/test-sogo/sogo.yaml - - - name: Setup test PostgreSQL - run: | - docker network create test-sogo - docker run -d \ - --name test-postgres \ - --network test-sogo \ - -e POSTGRES_PASSWORD=sogo \ - -e POSTGRES_USER=sogo \ - -e POSTGRES_DB=sogo \ - postgres - - - name: Run test SOGo container - run: | - docker run -d \ - --name sogo \ - --network test-sogo \ - -p 80:80/tcp \ - -v /tmp/test-sogo/sogo.yaml:/etc/sogo/sogo.conf.d/00-test.yaml \ - --stop-timeout 30 \ - test-sogo:${{ github.run_id }} - - - name: Wait for test SOGo container to start - run: | - TIMEOUT_SECONDS=180 - START_TIME=$(date +%s) - - while ! docker logs sogo 2>&1 | grep -q 'INFO success: sogo entered RUNNING state, process has stayed up for > than 1 seconds'; do - CURRENT_TIME=$(date +%s) - ELAPSED_TIME=$((CURRENT_TIME - START_TIME)) - - if [ $ELAPSED_TIME -gt $TIMEOUT_SECONDS ]; then - echo "Timeout reached. Server failed to start within $TIMEOUT_SECONDS seconds." - printf "\e[0;32m%s\e[0m\n" "*****Test container logs*****" - docker logs sogo - exit 1 - fi - - echo "Waiting for test SOGo container to start..." - sleep 5 - done - - - name: Test HTTP status code - run: | - TIMEOUT=60 - elapsed_time=0 - SUCCESS_CODE=302 - - while true; do - http_status=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:80/SOGo") - - if [ $http_status -eq $SUCCESS_CODE ]; then - echo "Health check successful. HTTP Status Code: $http_status" - exit 0 - fi - - elapsed_time=$((elapsed_time + 1)) - - if [ $elapsed_time -ge $TIMEOUT ]; then - echo "Timeout reached. HTTP Health check failed." - exit 1 - fi - - # Wait for a second before next health check - sleep 1 +--- +name: Tests +on: # yamllint disable-line rule:truthy + pull_request: + workflow_call: + +concurrency: + group: '${{ github.workflow }} @ ${{ github.ref }}' + cancel-in-progress: true + +jobs: + check_versions: + name: Tests - Version checking + runs-on: ubuntu-latest + outputs: + version: ${{ steps.sogo.outputs.VERSION }} + steps: + - name: Get latest version of SOGo + id: sogo + run: | + echo "VERSION=$(curl -s https://api.github.com/repos/Alinto/sogo/releases/latest | jq -r '.tag_name' | sed 's/SOGo-//')" >> "$GITHUB_OUTPUT" + + test_build: + name: Tests - Build image for testing + needs: check_versions + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and export to Docker + uses: docker/build-push-action@v5 + with: + file: ./Dockerfile + load: true + platforms: linux/amd64 + cache-from: type=gha + cache-to: type=gha,mode=max + tags: test-sogo:${{ github.run_id }} + outputs: type=docker,dest=/tmp/test-sogo-${{ github.run_id }}.tar + build-args: | + SOGO_VERSION=${{ needs.check_versions.outputs.version }} + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: test-sogo-${{ github.run_id }} + path: /tmp/test-sogo-${{ github.run_id }}.tar + + end_to_end_plist: + name: Tests - E2E Testing + needs: test_build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: test-sogo-${{ github.run_id }} + path: /tmp + + - name: Load Docker image + env: + RUN_ID: ${{ github.run_id }} + run: | + docker load --input /tmp/test-sogo-$RUN_ID.tar + + - name: Setup test configurations + run: | + mkdir -p /tmp/test-sogo + plist_config=$(cat sample-config.conf) + echo "$plist_config" > /tmp/test-sogo/sogo.conf + + - name: Setup test PostgreSQL + run: | + docker network create test-sogo + docker run -d \ + --name test-postgres \ + --network test-sogo \ + -e POSTGRES_PASSWORD=sogo \ + -e POSTGRES_USER=sogo \ + -e POSTGRES_DB=sogo \ + postgres + + - name: Run test SOGo container + run: | + docker run -d \ + --name sogo \ + --network test-sogo \ + -p 80:80/tcp \ + -v /tmp/test-sogo/sogo.conf:/etc/sogo/sogo.conf \ + --stop-timeout 30 \ + test-sogo:${{ github.run_id }} + + - name: Wait for test SOGo container to start + run: | + TIMEOUT_SECONDS=180 + START_TIME=$(date +%s) + + while ! docker logs sogo 2>&1 | grep -q 'INFO success: sogo entered RUNNING state, process has stayed up for > than 1 seconds'; do + CURRENT_TIME=$(date +%s) + ELAPSED_TIME=$((CURRENT_TIME - START_TIME)) + + if [ $ELAPSED_TIME -gt $TIMEOUT_SECONDS ]; then + echo "Timeout reached. Server failed to start within $TIMEOUT_SECONDS seconds." + printf "\e[0;32m%s\e[0m\n" "*****Test container logs*****" + docker logs sogo + exit 1 + fi + + echo "Waiting for test SOGo container to start..." + sleep 5 + done + + - name: Test HTTP status code + run: | + TIMEOUT=60 + elapsed_time=0 + SUCCESS_CODE=302 + + while true; do + http_status=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:80/SOGo") + + if [ $http_status -eq $SUCCESS_CODE ]; then + echo "Health check successful. HTTP Status Code: $http_status" + exit 0 + fi + + elapsed_time=$((elapsed_time + 1)) + + if [ $elapsed_time -ge $TIMEOUT ]; then + echo "Timeout reached. HTTP Health check failed." + exit 1 + fi + + # Wait for a second before next health check + sleep 1 + done + + end_to_end_yaml: + name: Tests - E2E Testing (YAML Config) + needs: test_build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: test-sogo-${{ github.run_id }} + path: /tmp + + - name: Load Docker image + env: + RUN_ID: ${{ github.run_id }} + run: | + docker load --input /tmp/test-sogo-$RUN_ID.tar + + - name: Setup test configurations + run: | + mkdir -p /tmp/test-sogo + yaml_config=$(cat sample-config.yaml) + echo "$yaml_config" > /tmp/test-sogo/sogo.yaml + + - name: Setup test PostgreSQL + run: | + docker network create test-sogo + docker run -d \ + --name test-postgres \ + --network test-sogo \ + -e POSTGRES_PASSWORD=sogo \ + -e POSTGRES_USER=sogo \ + -e POSTGRES_DB=sogo \ + postgres + + - name: Run test SOGo container + run: | + docker run -d \ + --name sogo \ + --network test-sogo \ + -p 80:80/tcp \ + -v /tmp/test-sogo/sogo.yaml:/etc/sogo/sogo.conf.d/00-test.yaml \ + --stop-timeout 30 \ + test-sogo:${{ github.run_id }} + + - name: Wait for test SOGo container to start + run: | + TIMEOUT_SECONDS=180 + START_TIME=$(date +%s) + + while ! docker logs sogo 2>&1 | grep -q 'INFO success: sogo entered RUNNING state, process has stayed up for > than 1 seconds'; do + CURRENT_TIME=$(date +%s) + ELAPSED_TIME=$((CURRENT_TIME - START_TIME)) + + if [ $ELAPSED_TIME -gt $TIMEOUT_SECONDS ]; then + echo "Timeout reached. Server failed to start within $TIMEOUT_SECONDS seconds." + printf "\e[0;32m%s\e[0m\n" "*****Test container logs*****" + docker logs sogo + exit 1 + fi + + echo "Waiting for test SOGo container to start..." + sleep 5 + done + + - name: Test HTTP status code + run: | + TIMEOUT=60 + elapsed_time=0 + SUCCESS_CODE=302 + + while true; do + http_status=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:80/SOGo") + + if [ $http_status -eq $SUCCESS_CODE ]; then + echo "Health check successful. HTTP Status Code: $http_status" + exit 0 + fi + + elapsed_time=$((elapsed_time + 1)) + + if [ $elapsed_time -ge $TIMEOUT ]; then + echo "Timeout reached. HTTP Health check failed." + exit 1 + fi + + # Wait for a second before next health check + sleep 1 done \ No newline at end of file diff --git a/charts/sogo/.helmignore b/charts/sogo/.helmignore index daebc7d..f0c1319 100644 --- a/charts/sogo/.helmignore +++ b/charts/sogo/.helmignore @@ -1,21 +1,21 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*~ -# Various IDEs -.project -.idea/ -*.tmproj +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/charts/sogo/Chart.yaml b/charts/sogo/Chart.yaml index 9a08620..2738bd3 100644 --- a/charts/sogo/Chart.yaml +++ b/charts/sogo/Chart.yaml @@ -1,31 +1,31 @@ -apiVersion: v2 -name: sogo -version: 0.1.0 -description: A helm chart for the docker-sogo docker image -type: application -keywords: -- sogo -- alinto -- inverse -- mail -home: https://github.com/sonroyaalmerol/docker-sogo -sources: -- https://github.com/sonroyaalmerol/docker-sogo -maintainers: -- name: Son Roy Almerol - email: sogo@snry.me - url: https://github.com/sonroyaalmerol -icon: https://www.sogo.nu/img/sogo.svg -appVersion: "5.10.0-1" -deprecated: false -annotations: - artifacthub.io/license: MIT - artifacthub.io/links: | - - name: GitHub source - url: https://github.com/sonroyaalmerol/docker-sogo/ - artifacthub.io/images: | - - name: docker-sogo - image: sonroyaalmerol/docker-sogo:5.10.0-1 - artifacthub.io/screenshots: | - - title: SOGo - url: https://www.sogo.nu/img/screenshot.png \ No newline at end of file +apiVersion: v2 +name: sogo +version: 0.1.0 +description: A helm chart for the docker-sogo docker image +type: application +keywords: +- sogo +- alinto +- inverse +- mail +home: https://github.com/sonroyaalmerol/docker-sogo +sources: +- https://github.com/sonroyaalmerol/docker-sogo +maintainers: +- name: Son Roy Almerol + email: sogo@snry.me + url: https://github.com/sonroyaalmerol +icon: https://www.sogo.nu/img/sogo.svg +appVersion: "5.10.0-1" +deprecated: false +annotations: + artifacthub.io/license: MIT + artifacthub.io/links: | + - name: GitHub source + url: https://github.com/sonroyaalmerol/docker-sogo/ + artifacthub.io/images: | + - name: docker-sogo + image: sonroyaalmerol/docker-sogo:5.10.0-1 + artifacthub.io/screenshots: | + - title: SOGo + url: https://www.sogo.nu/img/screenshot.png diff --git a/charts/sogo/README.md b/charts/sogo/README.md index 2c8a487..ec7181d 100644 --- a/charts/sogo/README.md +++ b/charts/sogo/README.md @@ -1,35 +1,35 @@ -# SOGo Helm Chart - -[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/sogo&style=flat-square)](https://artifacthub.io/packages/search?repo=sogo) -[![GitHub License](https://img.shields.io/github/license/sonroyaalmerol/docker-sogo?style=flat-square)](https://github.com/sonroyaalmerol/docker-sogo/blob/main/LICENSE) -[![GitHub release](https://img.shields.io/github/v/release/sonroyaalmerol/docker-sogo?style=flat-square)](https://github.com/sonroyaalmerol/docker-sogo/releases) -[![GitHub Downloads](https://img.shields.io/github/downloads/sonroyaalmerol/docker-sogo/total?style=flat-square)](https://github.com/sonroyaalmerol/docker-sogo/releases) -[![OCI security profiles](https://img.shields.io/badge/oci%3A%2F%2F-sogo-blue?logo=kubernetes&logoColor=white&style=flat-square)](https://github.com/sonroyaalmerol/docker-sogo/packages) - - -A helm chart for the docker-sogo docker image - -> [!IMPORTANT] -> This chart is still not ready for deployment. Please use the Docker container manually for now. - -## Usage - -[Helm](https://helm.sh) must be installed to use the charts. -Please refer to Helm's [documentation](https://helm.sh/docs/) to get started. - -Once Helm is set up properly, add the repository as follows: - -```console -helm repo add sogo https://sonroyaalmerol.github.io/docker-sogo -``` - -Running `helm search repo sogo` should now display the chart and it's versions - -To install the helm chart, use -```console -helm install sogo sogo/sogo --create-namespace --namespace sogo -``` - -## Values - +# SOGo Helm Chart + +[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/sogo&style=flat-square)](https://artifacthub.io/packages/search?repo=sogo) +[![GitHub License](https://img.shields.io/github/license/sonroyaalmerol/docker-sogo?style=flat-square)](https://github.com/sonroyaalmerol/docker-sogo/blob/main/LICENSE) +[![GitHub release](https://img.shields.io/github/v/release/sonroyaalmerol/docker-sogo?style=flat-square)](https://github.com/sonroyaalmerol/docker-sogo/releases) +[![GitHub Downloads](https://img.shields.io/github/downloads/sonroyaalmerol/docker-sogo/total?style=flat-square)](https://github.com/sonroyaalmerol/docker-sogo/releases) +[![OCI security profiles](https://img.shields.io/badge/oci%3A%2F%2F-sogo-blue?logo=kubernetes&logoColor=white&style=flat-square)](https://github.com/sonroyaalmerol/docker-sogo/packages) + + +A helm chart for the docker-sogo docker image + +> [!IMPORTANT] +> This chart is still not ready for deployment. Please use the Docker container manually for now. + +## Usage + +[Helm](https://helm.sh) must be installed to use the charts. +Please refer to Helm's [documentation](https://helm.sh/docs/) to get started. + +Once Helm is set up properly, add the repository as follows: + +```console +helm repo add sogo https://sonroyaalmerol.github.io/docker-sogo +``` + +Running `helm search repo sogo` should now display the chart and it's versions + +To install the helm chart, use +```console +helm install sogo sogo/sogo --create-namespace --namespace sogo +``` + +## Values + You can find the `values.yaml` summary in [the charts directory](https://github.com/sonroyaalmerol/docker-sogo/blob/main/charts/palworld/values.yaml) \ No newline at end of file diff --git a/charts/sogo/templates/_helpers.tpl b/charts/sogo/templates/_helpers.tpl index 38709a3..cec08ff 100644 --- a/charts/sogo/templates/_helpers.tpl +++ b/charts/sogo/templates/_helpers.tpl @@ -1,63 +1,63 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "sogo.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "sogo.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "sogo.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create image name that is used in the deployment -*/}} -{{- define "sogo.image" -}} -{{- if .Values.image.tag -}} -{{- printf "%s:%s" .Values.image.repository .Values.image.tag -}} -{{- else -}} -{{- printf "%s:%s-%s" .Values.image.repository .Chart.AppVersion .Values.image.flavor -}} -{{- end -}} -{{- end -}} - - -{{- define "sogo.ingress.apiVersion" -}} -{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}} -{{- print "extensions/v1beta1" -}} -{{- else if semverCompare "<1.19-0" .Capabilities.KubeVersion.GitVersion -}} -{{- print "networking.k8s.io/v1beta1" -}} -{{- else -}} -{{- print "networking.k8s.io/v1" -}} -{{- end }} -{{- end -}} - - -{{/* -Create volume mounts for the sogo container. -*/}} -{{- define "sogo.volumeMounts" -}} -{{- if .Values.sogo.extraVolumeMounts }} -{{ toYaml .Values.sogo.extraVolumeMounts }} -{{- end }} -{{- end -}} +{{/* +Expand the name of the chart. +*/}} +{{- define "sogo.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "sogo.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "sogo.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create image name that is used in the deployment +*/}} +{{- define "sogo.image" -}} +{{- if .Values.image.tag -}} +{{- printf "%s:%s" .Values.image.repository .Values.image.tag -}} +{{- else -}} +{{- printf "%s:%s-%s" .Values.image.repository .Chart.AppVersion .Values.image.flavor -}} +{{- end -}} +{{- end -}} + + +{{- define "sogo.ingress.apiVersion" -}} +{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end }} +{{- end -}} + + +{{/* +Create volume mounts for the sogo container. +*/}} +{{- define "sogo.volumeMounts" -}} +{{- if .Values.sogo.extraVolumeMounts }} +{{ toYaml .Values.sogo.extraVolumeMounts }} +{{- end }} +{{- end -}} diff --git a/charts/sogo/templates/config.yaml b/charts/sogo/templates/config.yaml index 067ba55..6abf06b 100644 --- a/charts/sogo/templates/config.yaml +++ b/charts/sogo/templates/config.yaml @@ -1,14 +1,14 @@ -{{- if .Values.sogo.configs -}} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "sogo.fullname" . }}-config - labels: - app.kubernetes.io/name: {{ include "sogo.name" . }} - helm.sh/chart: {{ include "sogo.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -data: - configs: | -{{ .Values.sogo.configs | toYaml | indent 4 }} -{{- end }} \ No newline at end of file +{{- if .Values.sogo.configs -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "sogo.fullname" . }}-config + labels: + app.kubernetes.io/name: {{ include "sogo.name" . }} + helm.sh/chart: {{ include "sogo.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +data: + configs: | +{{ .Values.sogo.configs | toYaml | indent 4 }} +{{- end }} diff --git a/charts/sogo/templates/db-secret.yaml b/charts/sogo/templates/db-secret.yaml deleted file mode 100644 index 880158f..0000000 --- a/charts/sogo/templates/db-secret.yaml +++ /dev/null @@ -1,26 +0,0 @@ -{{- if or .Values.mariadb.enabled .Values.externalDatabase.enabled .Values.postgresql.enabled }} -{{- if not .Values.externalDatabase.existingSecret.enabled }} ---- -apiVersion: v1 -kind: Secret -metadata: - name: {{ .Release.Name }}-db - labels: - app.kubernetes.io/name: {{ include "sogo.name" . }} - helm.sh/chart: {{ include "sogo.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -type: Opaque -data: - {{- if .Values.mariadb.enabled }} - db-username: {{ .Values.mariadb.auth.username | b64enc | quote }} - db-password: {{ .Values.mariadb.auth.password | b64enc | quote }} - {{- else if .Values.postgresql.enabled }} - db-username: {{ .Values.postgresql.global.postgresql.auth.username | b64enc | quote }} - db-password: {{ .Values.postgresql.global.postgresql.auth.password | b64enc | quote }} - {{- else }} - db-username: {{ .Values.externalDatabase.user | b64enc | quote }} - db-password: {{ .Values.externalDatabase.password | b64enc | quote }} - {{- end }} -{{- end }} -{{- end }} \ No newline at end of file diff --git a/charts/sogo/templates/deployment.yaml b/charts/sogo/templates/deployment.yaml index 3875337..d0cad4f 100644 --- a/charts/sogo/templates/deployment.yaml +++ b/charts/sogo/templates/deployment.yaml @@ -1,187 +1,187 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "sogo.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "sogo.name" . }} - helm.sh/chart: {{ include "sogo.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: app - {{- with .Values.deploymentLabels }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- with .Values.deploymentAnnotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - replicas: {{ .Values.replicaCount }} - strategy: - {{- toYaml .Values.sogo.strategy | nindent 4 }} - selector: - matchLabels: - app.kubernetes.io/name: {{ include "sogo.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/component: app - template: - metadata: - labels: - app.kubernetes.io/name: {{ include "sogo.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/component: app - {{- if .Values.memcached.enabled }} - {{ template "sogo.memcached.fullname" . }}-client: "true" - {{- end }} - {{- with .Values.podLabels }} - {{- toYaml . | nindent 8 }} - {{- end }} - annotations: - sogo-config-hash: {{ print (toJson .Values.sogo.configs) | sha256sum }} - spec: - {{- with .Values.image.pullSecrets }} - imagePullSecrets: - {{- range . }} - - name: {{ . }} - {{- end}} - {{- end }} - containers: - - name: {{ .Chart.Name }} - image: {{ include "sogo.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- with .Values.lifecycle }} - lifecycle: - {{- with .postStartCommand }} - postStart: - exec: - command: - {{- toYaml . | nindent 18 }} - {{- end }} - {{- with .preStopCommand }} - preStop: - exec: - command: - {{- toYaml . | nindent 18 }} - {{- end }} - {{- end }} - ports: - - name: http - containerPort: {{ .Values.sogo.containerPort }} - protocol: TCP - {{- with .Values.livenessProbe }} - {{- if .enabled }} - livenessProbe: - httpGet: - path: /SOGo - port: {{ $.Values.sogo.containerPort }} - httpHeaders: - - name: Host - value: {{ $.Values.sogo.host | quote }} - initialDelaySeconds: {{ .initialDelaySeconds }} - periodSeconds: {{ .periodSeconds }} - timeoutSeconds: {{ .timeoutSeconds }} - successThreshold: {{ .successThreshold }} - failureThreshold: {{ .failureThreshold }} - {{- end }} - {{- end }} - {{- with .Values.readinessProbe }} - {{- if .enabled }} - readinessProbe: - httpGet: - path: /SOGo - port: {{ $.Values.sogo.containerPort }} - httpHeaders: - - name: Host - value: {{ $.Values.sogo.host | quote }} - initialDelaySeconds: {{ .initialDelaySeconds }} - periodSeconds: {{ .periodSeconds }} - timeoutSeconds: {{ .timeoutSeconds }} - successThreshold: {{ .successThreshold }} - failureThreshold: {{ .failureThreshold }} - {{- end }} - {{- end }} - {{- with .Values.startupProbe }} - {{- if .enabled }} - startupProbe: - httpGet: - path: /SOGo - port: {{ $.Values.sogo.containerPort }} - httpHeaders: - - name: Host - value: {{ $.Values.sogo.host | quote }} - initialDelaySeconds: {{ .initialDelaySeconds }} - periodSeconds: {{ .periodSeconds }} - timeoutSeconds: {{ .timeoutSeconds }} - successThreshold: {{ .successThreshold }} - failureThreshold: {{ .failureThreshold }} - {{- end }} - {{- end }} - resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.sogo.securityContext }} - securityContext: - {{- toYaml . | nindent 12 }} - {{- end }} - volumeMounts: - {{- include "sogo.volumeMounts" . | trim | nindent 12 }} - {{- if .Values.sogo.configs }} - - name: sogo-configs - mountPath: /etc/sogo/sogo.conf.d/99-helm.yaml - subPath: configs - readOnly: true - {{- end }} - {{- if .Values.sogo.secrets }} - - name: sogo-secrets - mountPath: /etc/sogo/sogo.conf.d/99-secrets.yaml - subPath: secrets - readOnly: true - {{- end }} - {{- with .Values.sogo.extraSidecarContainers }} - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- if or .Values.sogo.extraInitContainers }} - initContainers: - {{- with .Values.sogo.extraInitContainers }} - {{- toYaml . | nindent 8 }} - {{- end }} - {{- end }}{{/* end-if any initContainer */}} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} - volumes: - {{- if .Values.sogo.configs }} - - name: sogo-configs - configMap: - name: {{ template "sogo.fullname" . }}-config - {{- end }} - {{- if .Values.sogo.secrets }} - - name: sogo-secrets - secret: - secretName: {{ template "sogo.fullname" . }}-secret - {{- end }} - {{- with .Values.sogo.extraVolumes }} - {{- toYaml . | nindent 8 }} - {{- end }} - securityContext: - {{- with .Values.securityContext }} - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.sogo.podSecurityContext }} - {{- toYaml . | nindent 8 }} - {{- else }} - # Will mount configuration files as www-data (id: 33) for sogo - fsGroup: 33 - {{- end }}{{/* end-with podSecurityContext */}} - {{- if .Values.rbac.enabled }} - serviceAccountName: {{ .Values.rbac.serviceaccount.name }} - {{- end }} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "sogo.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "sogo.name" . }} + helm.sh/chart: {{ include "sogo.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: app + {{- with .Values.deploymentLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.deploymentAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + strategy: + {{- toYaml .Values.sogo.strategy | nindent 4 }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "sogo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: app + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "sogo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: app + {{- if .Values.memcached.enabled }} + {{ template "sogo.memcached.fullname" . }}-client: "true" + {{- end }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + sogo-config-hash: {{ print (toJson .Values.sogo.configs) | sha256sum }} + spec: + {{- with .Values.image.pullSecrets }} + imagePullSecrets: + {{- range . }} + - name: {{ . }} + {{- end}} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: {{ include "sogo.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- with .Values.lifecycle }} + lifecycle: + {{- with .postStartCommand }} + postStart: + exec: + command: + {{- toYaml . | nindent 18 }} + {{- end }} + {{- with .preStopCommand }} + preStop: + exec: + command: + {{- toYaml . | nindent 18 }} + {{- end }} + {{- end }} + ports: + - name: http + containerPort: {{ .Values.sogo.containerPort }} + protocol: TCP + {{- with .Values.livenessProbe }} + {{- if .enabled }} + livenessProbe: + httpGet: + path: /SOGo + port: {{ $.Values.sogo.containerPort }} + httpHeaders: + - name: Host + value: {{ $.Values.sogo.host | quote }} + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} + {{- end }} + {{- end }} + {{- with .Values.readinessProbe }} + {{- if .enabled }} + readinessProbe: + httpGet: + path: /SOGo + port: {{ $.Values.sogo.containerPort }} + httpHeaders: + - name: Host + value: {{ $.Values.sogo.host | quote }} + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} + {{- end }} + {{- end }} + {{- with .Values.startupProbe }} + {{- if .enabled }} + startupProbe: + httpGet: + path: /SOGo + port: {{ $.Values.sogo.containerPort }} + httpHeaders: + - name: Host + value: {{ $.Values.sogo.host | quote }} + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} + {{- end }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.sogo.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + {{- include "sogo.volumeMounts" . | trim | nindent 12 }} + {{- if .Values.sogo.configs }} + - name: sogo-configs + mountPath: /etc/sogo/sogo.conf.d/99-helm.yaml + subPath: configs + readOnly: true + {{- end }} + {{- if .Values.sogo.secrets }} + - name: sogo-secrets + mountPath: /etc/sogo/sogo.conf.d/99-secrets.yaml + subPath: secrets + readOnly: true + {{- end }} + {{- with .Values.sogo.extraSidecarContainers }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if or .Values.sogo.extraInitContainers }} + initContainers: + {{- with .Values.sogo.extraInitContainers }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- end }}{{/* end-if any initContainer */}} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + {{- if .Values.sogo.configs }} + - name: sogo-configs + configMap: + name: {{ template "sogo.fullname" . }}-config + {{- end }} + {{- if .Values.sogo.secrets }} + - name: sogo-secrets + secret: + secretName: {{ template "sogo.fullname" . }}-secret + {{- end }} + {{- with .Values.sogo.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- with .Values.securityContext }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.sogo.podSecurityContext }} + {{- toYaml . | nindent 8 }} + {{- else }} + # Will mount configuration files as www-data (id: 33) for sogo + fsGroup: 33 + {{- end }}{{/* end-with podSecurityContext */}} + {{- if .Values.rbac.enabled }} + serviceAccountName: {{ .Values.rbac.serviceaccount.name }} + {{- end }} diff --git a/charts/sogo/templates/hpa.yaml b/charts/sogo/templates/hpa.yaml index 8a4a410..7717d47 100644 --- a/charts/sogo/templates/hpa.yaml +++ b/charts/sogo/templates/hpa.yaml @@ -1,23 +1,23 @@ -{{- if .Values.hpa.enabled }} ---- -apiVersion: autoscaling/v1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ template "sogo.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "sogo.name" . }} - helm.sh/chart: {{ include "sogo.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: app -spec: - scaleTargetRef: - kind: Deployment - apiVersion: apps/v1 - name: {{ template "sogo.fullname" . }} - {{- with .Values.hpa }} - minReplicas: {{ .minPods }} - maxReplicas: {{ .maxPods }} - targetCPUUtilizationPercentage: {{ .cputhreshold }} - {{- end }}{{/* end-with .hpa */}} -{{- end }} +{{- if .Values.hpa.enabled }} +--- +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ template "sogo.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "sogo.name" . }} + helm.sh/chart: {{ include "sogo.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: app +spec: + scaleTargetRef: + kind: Deployment + apiVersion: apps/v1 + name: {{ template "sogo.fullname" . }} + {{- with .Values.hpa }} + minReplicas: {{ .minPods }} + maxReplicas: {{ .maxPods }} + targetCPUUtilizationPercentage: {{ .cputhreshold }} + {{- end }}{{/* end-with .hpa */}} +{{- end }} diff --git a/charts/sogo/templates/ingress.yaml b/charts/sogo/templates/ingress.yaml index 23cef31..aea4eae 100644 --- a/charts/sogo/templates/ingress.yaml +++ b/charts/sogo/templates/ingress.yaml @@ -1,46 +1,46 @@ -{{- if .Values.ingress.enabled }} ---- -apiVersion: {{ include "sogo.ingress.apiVersion" . }} -kind: Ingress -metadata: - name: {{ template "sogo.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "sogo.name" . }} - helm.sh/chart: {{ include "sogo.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: app - {{- with .Values.ingress.labels }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- with .Values.ingress.className }} - ingressClassName: {{ . }} - {{- end }} - rules: - - host: {{ .Values.sogo.host }} - http: - paths: - - path: {{ .Values.ingress.path }} - {{- if (eq (include "sogo.ingress.apiVersion" $) "networking.k8s.io/v1") }} - pathType: {{ .Values.ingress.pathType }} - {{- end }} - backend: - {{- if (eq (include "sogo.ingress.apiVersion" $) "networking.k8s.io/v1") }} - service: - name: {{ template "sogo.fullname" . }} - port: - number: {{ .Values.service.port }} - {{- else }} - serviceName: {{ template "sogo.fullname" . }} - servicePort: {{ .Values.service.port }} - {{- end }} - {{- with .Values.ingress.tls }} - tls: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} +{{- if .Values.ingress.enabled }} +--- +apiVersion: {{ include "sogo.ingress.apiVersion" . }} +kind: Ingress +metadata: + name: {{ template "sogo.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "sogo.name" . }} + helm.sh/chart: {{ include "sogo.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: app + {{- with .Values.ingress.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- with .Values.ingress.className }} + ingressClassName: {{ . }} + {{- end }} + rules: + - host: {{ .Values.sogo.host }} + http: + paths: + - path: {{ .Values.ingress.path }} + {{- if (eq (include "sogo.ingress.apiVersion" $) "networking.k8s.io/v1") }} + pathType: {{ .Values.ingress.pathType }} + {{- end }} + backend: + {{- if (eq (include "sogo.ingress.apiVersion" $) "networking.k8s.io/v1") }} + service: + name: {{ template "sogo.fullname" . }} + port: + number: {{ .Values.service.port }} + {{- else }} + serviceName: {{ template "sogo.fullname" . }} + servicePort: {{ .Values.service.port }} + {{- end }} + {{- with .Values.ingress.tls }} + tls: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/sogo/templates/rbac.yaml b/charts/sogo/templates/rbac.yaml index 7fdb9f6..8ebbab9 100644 --- a/charts/sogo/templates/rbac.yaml +++ b/charts/sogo/templates/rbac.yaml @@ -1,31 +1,31 @@ -{{- if .Values.rbac.enabled }} ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: {{ template "sogo.fullname" . }}-privileged - namespace: {{ .Release.Namespace }} -rules: - - apiGroups: - - extensions - resourceNames: - - privileged - resources: - - podsecuritypolicies - verbs: - - use ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: {{ template "sogo.fullname" . }}-privileged - namespace: {{ .Release.Namespace }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: {{ template "sogo.fullname" . }}-privileged -subjects: - - kind: ServiceAccount - name: {{ .Values.rbac.serviceaccount.name }} - namespace: {{ .Release.Namespace }} -{{- end }} +{{- if .Values.rbac.enabled }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ template "sogo.fullname" . }}-privileged + namespace: {{ .Release.Namespace }} +rules: + - apiGroups: + - extensions + resourceNames: + - privileged + resources: + - podsecuritypolicies + verbs: + - use +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ template "sogo.fullname" . }}-privileged + namespace: {{ .Release.Namespace }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ template "sogo.fullname" . }}-privileged +subjects: + - kind: ServiceAccount + name: {{ .Values.rbac.serviceaccount.name }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/sogo/templates/secrets.yaml b/charts/sogo/templates/secrets.yaml index ac927eb..4780929 100644 --- a/charts/sogo/templates/secrets.yaml +++ b/charts/sogo/templates/secrets.yaml @@ -1,14 +1,14 @@ -{{- if .Values.sogo.secrets -}} -apiVersion: v1 -kind: Secret -metadata: - name: {{ template "sogo.fullname" . }}-secret - labels: - app.kubernetes.io/name: {{ include "sogo.name" . }} - helm.sh/chart: {{ include "sogo.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -type: Opaque -data: - secrets: {{ .Values.sogo.secrets | toYaml | b64enc }} -{{- end }} +{{- if .Values.sogo.secrets -}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "sogo.fullname" . }}-secret + labels: + app.kubernetes.io/name: {{ include "sogo.name" . }} + helm.sh/chart: {{ include "sogo.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +type: Opaque +data: + secrets: {{ .Values.sogo.secrets | toYaml | b64enc }} +{{- end }} diff --git a/charts/sogo/templates/service.yaml b/charts/sogo/templates/service.yaml index 0838931..d25c72d 100644 --- a/charts/sogo/templates/service.yaml +++ b/charts/sogo/templates/service.yaml @@ -1,37 +1,37 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ template "sogo.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "sogo.name" . }} - helm.sh/chart: {{ include "sogo.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: app -spec: - type: {{ .Values.service.type }} - {{- if (eq .Values.service.type "LoadBalancer") }} - {{- with .Values.service.loadBalancerIP }} - loadBalancerIP: {{ . }} - {{- end }} - {{- end }} - {{- with .Values.service.ipFamilies }} - ipFamilies: - {{- toYaml . | nindent 4 }} - {{- end }} - {{- with .Values.service.ipFamilyPolicy }} - ipFamilyPolicy: {{ . }} - {{- end }} - ports: - - port: {{ .Values.service.port }} - targetPort: {{ .Values.sogo.containerPort }} - protocol: TCP - name: http - {{- if (eq .Values.service.type "NodePort") }} - nodePort: {{ .Values.service.nodePort | default "" }} - {{- end }} - selector: - app.kubernetes.io/name: {{ include "sogo.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/component: app +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ template "sogo.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "sogo.name" . }} + helm.sh/chart: {{ include "sogo.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: app +spec: + type: {{ .Values.service.type }} + {{- if (eq .Values.service.type "LoadBalancer") }} + {{- with .Values.service.loadBalancerIP }} + loadBalancerIP: {{ . }} + {{- end }} + {{- end }} + {{- with .Values.service.ipFamilies }} + ipFamilies: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.service.ipFamilyPolicy }} + ipFamilyPolicy: {{ . }} + {{- end }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.sogo.containerPort }} + protocol: TCP + name: http + {{- if (eq .Values.service.type "NodePort") }} + nodePort: {{ .Values.service.nodePort | default "" }} + {{- end }} + selector: + app.kubernetes.io/name: {{ include "sogo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: app diff --git a/charts/sogo/templates/serviceaccount.yaml b/charts/sogo/templates/serviceaccount.yaml index eb084a1..84989dc 100644 --- a/charts/sogo/templates/serviceaccount.yaml +++ b/charts/sogo/templates/serviceaccount.yaml @@ -1,11 +1,11 @@ -{{- if and .Values.rbac.enabled .Values.rbac.serviceaccount.create }} ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ .Values.rbac.serviceaccount.name }} - {{- with .Values.rbac.serviceaccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} +{{- if and .Values.rbac.enabled .Values.rbac.serviceaccount.create }} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.rbac.serviceaccount.name }} + {{- with .Values.rbac.serviceaccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/ct.yaml b/ct.yaml index cc9787b..caaa834 100644 --- a/ct.yaml +++ b/ct.yaml @@ -1,6 +1,6 @@ -# See https://github.com/helm/chart-testing#configuration -remote: origin -target-branch: main -chart-dirs: - - charts +# See https://github.com/helm/chart-testing#configuration +remote: origin +target-branch: main +chart-dirs: + - charts validate-maintainers: false \ No newline at end of file