diff --git a/charts/sn-platform/ci/enable-zookeeper-backup.yaml b/.ci/ct.yaml similarity index 83% rename from charts/sn-platform/ci/enable-zookeeper-backup.yaml rename to .ci/ct.yaml index e33d50dd..6290483a 100644 --- a/charts/sn-platform/ci/enable-zookeeper-backup.yaml +++ b/.ci/ct.yaml @@ -1,4 +1,3 @@ - # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file @@ -18,7 +17,12 @@ # under the License. # -zookeeper: - customTools: - backup: - enable: true \ No newline at end of file +chart-dirs: + - charts +charts: + - charts/pulsar-operator + - charts/sn-platform + +debug: true +helm-extra-args: --timeout 1200 +validate-maintainers: false diff --git a/.github/workflows/chart_test.yml b/.github/workflows/chart_test.yml new file mode 100644 index 00000000..40b15dd5 --- /dev/null +++ b/.github/workflows/chart_test.yml @@ -0,0 +1,649 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +name: Chart Test +on: + pull_request: + branches: + - '*' + paths: + - 'charts/sn-platform' + - 'charts/sn-platform-slim' + - 'charts/pulsar-operator' + - '.github/workflows/**' + - '.ci/ct.yaml' + +jobs: + basic-tests: + runs-on: ubuntu-latest + outputs: + changed: ${{ steps.list-changed.outputs.changed }} + chart_name: ${{ steps.list-changed.outputs.chart_name }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.12.1 + + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.4.0 + + - name: Run chart-testing (list-changed) + id: list-changed + run: | + chart_name=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }} --config .ci/ct.yaml | grep -v '>>>' || echo '') + if [[ -n "$chart_name" ]]; then + echo "changed=true" >> $GITHUB_OUTPUT + echo "chart_name=$chart_name" >> $GITHUB_OUTPUT + else + echo "changed=false" >> $GITHUB_OUTPUT + echo "chart_name=$chart_name" >> $GITHUB_OUTPUT + fi + + - name: Run chart-testing (lint) + if: steps.list-changed.outputs.changed == 'true' + run: ct lint --target-branch ${{ github.event.repository.default_branch }} --config .ci/ct.yaml + + - name: Run template test + if: steps.list-changed.outputs.changed == 'true' + run: | + for i in v1.20.0 v1.21.0 v1.22.0 v1.23.0 v1.24.0 v1.25.0 v1.26.0 v1.27.0 + do + helm template test ${{ steps.list-changed.outputs.chart_name }} --kube-version $i> $i.yaml + yamllint $i.yaml --config-file lintconf.yaml + done + + - name: Run unittest + if: steps.list-changed.outputs.changed == 'true' + run: | + helm plugin install https://github.com/quintush/helm-unittest + helm unittest ${{ steps.list-changed.outputs.chart_name }} + + install-on-v1-20: + runs-on: ubuntu-latest + needs: basic-tests + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: clean disk + run: | + df -h + sudo swapoff -a + sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc "$AGENT_TOOLSDIRECTORY" + sudo apt clean + docker rmi $(docker images -q) -f + df -h + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.12.1 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.4.0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Create kind cluster + run: | + ./hack/kind-cluster-build.sh --nodeNum 3 --k8sVersion v1.20.15 + docker pull "$SN_IMAGE" + kind load docker-image --name pulsar-dev --nodes pulsar-dev-worker "$SN_IMAGE" + + env: + KIND_VERSION: 0.20.0 + SN_IMAGE: streamnative/sn-platform:2.10.4.3 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + + # Install the pulsar operator before testing the sn-platform + - name: Install the pulsar operator + if: ${{ needs.basic-tests.outputs.changed == 'true' && needs.basic-tests.outputs.chart_name != 'charts/pulsar-operator' }} + run: | + helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com + helm -n sn-system install sn charts/pulsar-operator --create-namespace + kubectl -n sn-system get deploy + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-pulsar-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-zookeeper-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-bookkeeper-controller-manager + helm -n sn-system upgrade --install vault-operator banzaicloud-stable/vault-operator + kubectl -nsn-system wait --for condition=available --timeout=360s deployment/vault-operator + df -h + + - name: Run chart-testing (install) + run: ct install --debug --config ct.yaml --print-config --charts ${{ needs.basic-tests.outputs.chart_name }} + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + if: failure() + + install-on-v1-21: + runs-on: ubuntu-latest + needs: basic-tests + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: clean disk + run: | + df -h + sudo swapoff -a + sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc "$AGENT_TOOLSDIRECTORY" + sudo apt clean + docker rmi $(docker images -q) -f + df -h + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.12.1 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.4.0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Create kind cluster + run: | + ./hack/kind-cluster-build.sh --nodeNum 3 --k8sVersion v1.21.14 + docker pull "$SN_IMAGE" + kind load docker-image --name pulsar-dev --nodes pulsar-dev-worker "$SN_IMAGE" + + env: + KIND_VERSION: 0.20.0 + SN_IMAGE: streamnative/sn-platform:2.10.4.3 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + + # Install the pulsar operator before testing the sn-platform + - name: Install the pulsar operator + if: ${{ needs.basic-tests.outputs.changed == 'true' && needs.basic-tests.outputs.chart_name != 'charts/pulsar-operator' }} + run: | + helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com + helm -n sn-system install sn charts/pulsar-operator --create-namespace + kubectl -n sn-system get deploy + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-pulsar-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-zookeeper-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-bookkeeper-controller-manager + helm -n sn-system upgrade --install vault-operator banzaicloud-stable/vault-operator + kubectl -nsn-system wait --for condition=available --timeout=360s deployment/vault-operator + df -h + + - name: Run chart-testing (install) + run: ct install --debug --config ct.yaml --print-config --charts ${{ needs.basic-tests.outputs.chart_name }} + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + if: failure() + + install-on-v1-22: + runs-on: ubuntu-latest + needs: basic-tests + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: clean disk + run: | + df -h + sudo swapoff -a + sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc "$AGENT_TOOLSDIRECTORY" + sudo apt clean + docker rmi $(docker images -q) -f + df -h + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.12.1 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.4.0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Create kind cluster + run: | + ./hack/kind-cluster-build.sh --nodeNum 3 --k8sVersion v1.22.17 + docker pull "$SN_IMAGE" + kind load docker-image --name pulsar-dev --nodes pulsar-dev-worker "$SN_IMAGE" + + env: + KIND_VERSION: 0.20.0 + SN_IMAGE: streamnative/sn-platform:2.10.4.3 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + + # Install the pulsar operator before testing the sn-platform + - name: Install the pulsar operator + if: ${{ needs.basic-tests.outputs.changed == 'true' && needs.basic-tests.outputs.chart_name != 'charts/pulsar-operator' }} + run: | + helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com + helm -n sn-system install sn charts/pulsar-operator --create-namespace + kubectl -n sn-system get deploy + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-pulsar-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-zookeeper-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-bookkeeper-controller-manager + helm -n sn-system upgrade --install vault-operator banzaicloud-stable/vault-operator + kubectl -nsn-system wait --for condition=available --timeout=360s deployment/vault-operator + df -h + + - name: Run chart-testing (install) + run: ct install --debug --config ct.yaml --print-config --charts ${{ needs.basic-tests.outputs.chart_name }} + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + if: failure() + + install-on-v1-23: + runs-on: ubuntu-latest + needs: basic-tests + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: clean disk + run: | + df -h + sudo swapoff -a + sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc "$AGENT_TOOLSDIRECTORY" + sudo apt clean + docker rmi $(docker images -q) -f + df -h + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.12.1 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.4.0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Create kind cluster + run: | + ./hack/kind-cluster-build.sh --nodeNum 3 --k8sVersion v1.23.17 + docker pull "$SN_IMAGE" + kind load docker-image --name pulsar-dev --nodes pulsar-dev-worker "$SN_IMAGE" + + env: + KIND_VERSION: 0.20.0 + SN_IMAGE: streamnative/sn-platform:2.10.4.3 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + + # Install the pulsar operator before testing the sn-platform + - name: Install the pulsar operator + if: ${{ needs.basic-tests.outputs.changed == 'true' && needs.basic-tests.outputs.chart_name != 'charts/pulsar-operator' }} + run: | + helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com + helm -n sn-system install sn charts/pulsar-operator --create-namespace + kubectl -n sn-system get deploy + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-pulsar-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-zookeeper-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-bookkeeper-controller-manager + helm -n sn-system upgrade --install vault-operator banzaicloud-stable/vault-operator + kubectl -nsn-system wait --for condition=available --timeout=360s deployment/vault-operator + df -h + + - name: Run chart-testing (install) + run: ct install --debug --config ct.yaml --print-config --charts ${{ needs.basic-tests.outputs.chart_name }} + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + if: failure() + + install-on-v1-24: + runs-on: ubuntu-latest + needs: basic-tests + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: clean disk + run: | + df -h + sudo swapoff -a + sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc "$AGENT_TOOLSDIRECTORY" + sudo apt clean + docker rmi $(docker images -q) -f + df -h + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.12.1 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.4.0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Create kind cluster + run: | + ./hack/kind-cluster-build.sh --nodeNum 3 --k8sVersion v1.24.15 + docker pull "$SN_IMAGE" + kind load docker-image --name pulsar-dev --nodes pulsar-dev-worker "$SN_IMAGE" + + env: + KIND_VERSION: 0.20.0 + SN_IMAGE: streamnative/sn-platform:2.10.4.3 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + + # Install the pulsar operator before testing the sn-platform + - name: Install the pulsar operator + if: ${{ needs.basic-tests.outputs.changed == 'true' && needs.basic-tests.outputs.chart_name != 'charts/pulsar-operator' }} + run: | + helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com + helm -n sn-system install sn charts/pulsar-operator --create-namespace + kubectl -n sn-system get deploy + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-pulsar-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-zookeeper-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-bookkeeper-controller-manager + helm -n sn-system upgrade --install vault-operator banzaicloud-stable/vault-operator + kubectl -nsn-system wait --for condition=available --timeout=360s deployment/vault-operator + df -h + + - name: Run chart-testing (install) + run: ct install --debug --config ct.yaml --print-config --charts ${{ needs.basic-tests.outputs.chart_name }} + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + if: failure() + + + install-on-v1-25: + runs-on: ubuntu-latest + needs: basic-tests + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: clean disk + run: | + df -h + sudo swapoff -a + sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc "$AGENT_TOOLSDIRECTORY" + sudo apt clean + docker rmi $(docker images -q) -f + df -h + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.12.1 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.4.0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Create kind cluster + run: | + ./hack/kind-cluster-build.sh --nodeNum 3 --k8sVersion v1.25.11 + docker pull "$SN_IMAGE" + kind load docker-image --name pulsar-dev --nodes pulsar-dev-worker "$SN_IMAGE" + + env: + KIND_VERSION: 0.20.0 + SN_IMAGE: streamnative/sn-platform:2.10.4.3 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + + # Install the pulsar operator before testing the sn-platform + - name: Install the pulsar operator + if: ${{ needs.basic-tests.outputs.changed == 'true' && needs.basic-tests.outputs.chart_name != 'charts/pulsar-operator' }} + run: | + helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com + helm -n sn-system install sn charts/pulsar-operator --create-namespace + kubectl -n sn-system get deploy + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-pulsar-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-zookeeper-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-bookkeeper-controller-manager + helm -n sn-system upgrade --install vault-operator banzaicloud-stable/vault-operator + kubectl -nsn-system wait --for condition=available --timeout=360s deployment/vault-operator + df -h + + - name: Run chart-testing (install) + run: ct install --debug --config ct.yaml --print-config --charts ${{ needs.basic-tests.outputs.chart_name }} + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + if: failure() + + + install-on-v1-26: + runs-on: ubuntu-latest + needs: basic-tests + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: clean disk + run: | + df -h + sudo swapoff -a + sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc "$AGENT_TOOLSDIRECTORY" + sudo apt clean + docker rmi $(docker images -q) -f + df -h + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.12.1 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.4.0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Create kind cluster + run: | + ./hack/kind-cluster-build.sh --nodeNum 3 --k8sVersion v1.26.6 + docker pull "$SN_IMAGE" + kind load docker-image --name pulsar-dev --nodes pulsar-dev-worker "$SN_IMAGE" + + env: + KIND_VERSION: 0.20.0 + SN_IMAGE: streamnative/sn-platform:2.10.4.3 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + + # Install the pulsar operator before testing the sn-platform + - name: Install the pulsar operator + if: ${{ needs.basic-tests.outputs.changed == 'true' && needs.basic-tests.outputs.chart_name != 'charts/pulsar-operator' }} + run: | + helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com + helm -n sn-system install sn charts/pulsar-operator --create-namespace + kubectl -n sn-system get deploy + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-pulsar-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-zookeeper-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-bookkeeper-controller-manager + helm -n sn-system upgrade --install vault-operator banzaicloud-stable/vault-operator + kubectl -nsn-system wait --for condition=available --timeout=360s deployment/vault-operator + df -h + + - name: Run chart-testing (install) + run: ct install --debug --config ct.yaml --print-config --charts ${{ needs.basic-tests.outputs.chart_name }} + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + if: failure() + + + install-on-v1-27: + runs-on: ubuntu-latest + needs: basic-tests + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: clean disk + run: | + df -h + sudo swapoff -a + sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc "$AGENT_TOOLSDIRECTORY" + sudo apt clean + docker rmi $(docker images -q) -f + df -h + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.12.1 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.4.0 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Create kind cluster + run: | + ./hack/kind-cluster-build.sh --nodeNum 3 --k8sVersion v1.27.3 + docker pull "$SN_IMAGE" + kind load docker-image --name pulsar-dev --nodes pulsar-dev-worker "$SN_IMAGE" + + env: + KIND_VERSION: 0.20.0 + SN_IMAGE: streamnative/sn-platform:2.10.4.3 + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + + # Install the pulsar operator before testing the sn-platform + - name: Install the pulsar operator + if: ${{ needs.basic-tests.outputs.changed == 'true' && needs.basic-tests.outputs.chart_name != 'charts/pulsar-operator' }} + run: | + helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com + helm -n sn-system install sn charts/pulsar-operator --create-namespace + kubectl -n sn-system get deploy + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-pulsar-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-zookeeper-controller-manager + kubectl -n sn-system wait --for condition=available --timeout=360s deployment/sn-pulsar-operator-bookkeeper-controller-manager + helm -n sn-system upgrade --install vault-operator banzaicloud-stable/vault-operator + kubectl -nsn-system wait --for condition=available --timeout=360s deployment/vault-operator + df -h + + - name: Run chart-testing (install) + run: ct install --debug --config ct.yaml --print-config --charts ${{ needs.basic-tests.outputs.chart_name }} + if: ${{ needs.basic-tests.outputs.changed == 'true' }} + + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + if: failure() \ No newline at end of file diff --git a/charts/sn-platform/ci/disable-monitoring-values.yaml b/charts/sn-platform/ci/disable-monitoring-values.yaml index 1e2814eb..b5e8ed6b 100644 --- a/charts/sn-platform/ci/disable-monitoring-values.yaml +++ b/charts/sn-platform/ci/disable-monitoring-values.yaml @@ -17,6 +17,7 @@ # under the License. # +initialize: true # Based on the defult values, disable the monitoring components monitoring: prometheus: false diff --git a/charts/sn-platform/ci/enable-istio-values.yaml b/charts/sn-platform/ci/enable-istio-values.yaml deleted file mode 100644 index e65f43f9..00000000 --- a/charts/sn-platform/ci/enable-istio-values.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# Based on the defult values, enable the istio -istio: - enabled: true - # istio labels used to inject sidecars if it's not `sidecar.istio.io/inject: "true"` - labels: {} - gateway: - # gateway selector if it's not `istio: ingressgateway` - selector: {} - tls: - certSecretName: istio-cert diff --git a/charts/sn-platform/templates/_helpers.tpl b/charts/sn-platform/templates/_helpers.tpl index 566a9ba5..e741d927 100644 --- a/charts/sn-platform/templates/_helpers.tpl +++ b/charts/sn-platform/templates/_helpers.tpl @@ -243,36 +243,36 @@ Define function for get authenticaiton environment variable {{- if .Values.auth.vault.enabled }} - name: PULSAR_PREFIX_OIDCTokenAudienceID valueFrom: - secretKeyRef: - name: {{ template "pulsar.vault-secret-key-name" . }} - key: PULSAR_PREFIX_OIDCTokenAudienceID + secretKeyRef: + name: {{ template "pulsar.vault-secret-key-name" . }} + key: PULSAR_PREFIX_OIDCTokenAudienceID {{- if and (eq .Component "proxy") .Values.auth.superUsers.proxyRolesEnabled }} - name: brokerClientAuthenticationParameters valueFrom: - secretKeyRef: - name: {{ template "pulsar.vault-secret-key-name" . }} - key: PROXY_brokerClientAuthenticationParameters + secretKeyRef: + name: {{ template "pulsar.vault-secret-key-name" . }} + key: PROXY_brokerClientAuthenticationParameters {{- else }} - name: brokerClientAuthenticationParameters valueFrom: - secretKeyRef: - name: {{ template "pulsar.vault-secret-key-name" . }} - key: brokerClientAuthenticationParameters + secretKeyRef: + name: {{ template "pulsar.vault-secret-key-name" . }} + key: brokerClientAuthenticationParameters {{- end }} {{- end }} {{- if .Values.auth.authentication.jwt.enabled }} {{- if and (eq .Component "proxy") .Values.auth.superUsers.proxyRolesEnabled }} - name: brokerClientAuthenticationParameters valueFrom: - secretKeyRef: - name: {{ .Release.Name }}-token-proxy-admin - key: TOKEN + secretKeyRef: + name: {{ .Release.Name }}-token-proxy-admin + key: TOKEN {{- else }} - name: brokerClientAuthenticationParameters valueFrom: - secretKeyRef: - name: {{ .Release.Name }}-token-admin - key: TOKEN + secretKeyRef: + name: {{ .Release.Name }}-token-admin + key: TOKEN {{- end }} {{- if .Values.auth.authentication.jwt.usingSecretKey }} - name: tokenSecretKey diff --git a/charts/sn-platform/templates/alert-manager/alertmanager-deployment.yaml b/charts/sn-platform/templates/alert-manager/alertmanager-deployment.yaml index 18459ac0..322152d9 100644 --- a/charts/sn-platform/templates/alert-manager/alertmanager-deployment.yaml +++ b/charts/sn-platform/templates/alert-manager/alertmanager-deployment.yaml @@ -72,7 +72,7 @@ spec: - --volume-dir=/etc/config - --webhook-url=http://127.0.0.1:{{ .Values.alert_manager.port }}{{ template "pulsar.control_center_path.alertmanager" . }}/-/reload resources: -{{ toYaml .Values.configmapReload.alertmanager.resources | indent 12 }} +{{- toYaml .Values.configmapReload.alertmanager.resources | nindent 10 }} volumeMounts: - name: config-volume mountPath: /etc/config diff --git a/charts/sn-platform/templates/alert-manager/alertmanager-service.yaml b/charts/sn-platform/templates/alert-manager/alertmanager-service.yaml index e48f3275..82e38e3c 100644 --- a/charts/sn-platform/templates/alert-manager/alertmanager-service.yaml +++ b/charts/sn-platform/templates/alert-manager/alertmanager-service.yaml @@ -27,7 +27,7 @@ metadata: {{- include "pulsar.standardLabels" . | nindent 4 }} component: {{ .Values.alert_manager.component }} annotations: - {{ toYaml .Values.alert_manager.service.annotations | indent 4 }} + {{- toYaml .Values.alert_manager.service.annotations | nindent 4 }} spec: {{- with .Values.alert_manager.service.spec }} {{ toYaml . | indent 2 }} diff --git a/charts/sn-platform/templates/broker/broker-cluster.yaml b/charts/sn-platform/templates/broker/broker-cluster.yaml index e700fdb8..05779d76 100644 --- a/charts/sn-platform/templates/broker/broker-cluster.yaml +++ b/charts/sn-platform/templates/broker/broker-cluster.yaml @@ -130,9 +130,9 @@ spec: {{ toYaml . | indent 4 }} {{- end }} # not support envFrom currently - #envFrom: - #- secretRef: - # name: {{ template "pulsar.vault-secret-key-name" . }} + # envFrom: + # - secretRef: + # name: {{ template "pulsar.vault-secret-key-name" . }} {{- if .Values.broker.resources }} resources: {{ toYaml .Values.broker.resources | indent 6 }} @@ -350,7 +350,7 @@ spec: name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.customTools.restore.component }}" {{- end }} {{- if .Values.broker.resources }} - resources: {{- toYaml .Values.broker.resources | nindent 10 }} + resources: {{- toYaml .Values.broker.resources | nindent 6 }} {{- end }} {{- if or .Values.tls.broker.enabled .Values.broker.extraVolumeMounts .Values.broker.extraVolumeClaimTemplates }} apiObjects: diff --git a/charts/sn-platform/templates/detector/pulsar-detector-deployment.yaml b/charts/sn-platform/templates/detector/pulsar-detector-deployment.yaml index 37ae5c3c..a3bd681f 100644 --- a/charts/sn-platform/templates/detector/pulsar-detector-deployment.yaml +++ b/charts/sn-platform/templates/detector/pulsar-detector-deployment.yaml @@ -120,9 +120,9 @@ spec: {{- if and .Values.components.vault .Values.auth.vault.enabled }} - name: brokerClientAuthenticationParameters valueFrom: - secretKeyRef: - name: {{ template "pulsar.vault-secret-key-name" . }} - key: brokerClientAuthenticationParameters + secretKeyRef: + name: {{ template "pulsar.vault-secret-key-name" . }} + key: brokerClientAuthenticationParameters {{- end }} {{- if and .Values.auth.authentication.enabled .Values.auth.authentication.jwt.enabled }} - name: brokerClientAuthenticationParameters diff --git a/charts/sn-platform/templates/grafana/grafana-pvc.yaml b/charts/sn-platform/templates/grafana/grafana-pvc.yaml index d2765e5e..8e8d1da1 100644 --- a/charts/sn-platform/templates/grafana/grafana-pvc.yaml +++ b/charts/sn-platform/templates/grafana/grafana-pvc.yaml @@ -29,7 +29,8 @@ spec: resources: requests: storage: {{ .Values.grafana.volumes.data.size }} - accessModes: [ "ReadWriteOnce" ] + accessModes: + - "ReadWriteOnce" {{- if .Values.grafana.volumes.data.storageClass }} storageClassName: "{{ template "pulsar.grafana.volumes.pvc.name" . }}}" {{- else if .Values.grafana.volumes.data.storageClassName }} diff --git a/charts/sn-platform/templates/grafana/grafana-statefulset.yaml b/charts/sn-platform/templates/grafana/grafana-statefulset.yaml index 03e88337..2c40031f 100644 --- a/charts/sn-platform/templates/grafana/grafana-statefulset.yaml +++ b/charts/sn-platform/templates/grafana/grafana-statefulset.yaml @@ -155,7 +155,7 @@ spec: - metadata: name: "{{ template "pulsar.grafana.volumes.pvc.name" . }}" spec: - accessModes: [ "ReadWriteOnce" ] + accessModes: ["ReadWriteOnce"] resources: requests: storage: {{ .Values.grafana.volumes.data.size }} diff --git a/charts/sn-platform/templates/node-exporter/node-exporter.yaml b/charts/sn-platform/templates/node-exporter/node-exporter.yaml index ef1d02c4..017e1953 100644 --- a/charts/sn-platform/templates/node-exporter/node-exporter.yaml +++ b/charts/sn-platform/templates/node-exporter/node-exporter.yaml @@ -80,7 +80,7 @@ spec: volumeMounts: - name: proc mountPath: /host/proc - readOnly: true + readOnly: true - name: sys mountPath: /host/sys readOnly: true diff --git a/charts/sn-platform/templates/prometheus/prometheus-pvc.yaml b/charts/sn-platform/templates/prometheus/prometheus-pvc.yaml index 6d46fe74..eccf88fe 100644 --- a/charts/sn-platform/templates/prometheus/prometheus-pvc.yaml +++ b/charts/sn-platform/templates/prometheus/prometheus-pvc.yaml @@ -29,7 +29,8 @@ spec: resources: requests: storage: {{ .Values.prometheus.volumes.data.size }} - accessModes: [ "ReadWriteOnce" ] + accessModes: + - "ReadWriteOnce" {{- if .Values.prometheus.volumes.data.storageClass }} storageClassName: "{{ template "pulsar.prometheus.data.pvc.name" . }}" {{- else if .Values.prometheus.volumes.data.storageClassName }} diff --git a/charts/sn-platform/templates/streamnative-console/streamnative-console-pvc.yaml b/charts/sn-platform/templates/streamnative-console/streamnative-console-pvc.yaml index 747e1724..f2f96357 100644 --- a/charts/sn-platform/templates/streamnative-console/streamnative-console-pvc.yaml +++ b/charts/sn-platform/templates/streamnative-console/streamnative-console-pvc.yaml @@ -29,7 +29,8 @@ spec: resources: requests: storage: {{ .Values.streamnative_console.volumes.data.size }} - accessModes: [ "ReadWriteOnce" ] + accessModes: + - "ReadWriteOnce" {{- if .Values.streamnative_console.volumes.data.storageClass }} storageClassName: "{{ template "pulsar.streamnative_console.data.pvc.name" . }}" {{- else if .Values.streamnative_console.volumes.data.storageClassName }} diff --git a/charts/sn-platform/templates/vault/vault-statefulset.yaml b/charts/sn-platform/templates/vault/vault-statefulset.yaml index 8115c1c2..f1c21c00 100644 --- a/charts/sn-platform/templates/vault/vault-statefulset.yaml +++ b/charts/sn-platform/templates/vault/vault-statefulset.yaml @@ -88,7 +88,7 @@ spec: - metadata: name: "{{ template "pulsar.fullname" . }}-{{ .Values.vault.component }}-{{ .Values.vault.volume.name }}" spec: - accessModes: [ "ReadWriteOnce" ] + accessModes: ["ReadWriteOnce"] resources: requests: storage: {{ .Values.vault.volume.size }} diff --git a/ct.yaml b/ct.yaml index 5e132d76..eeef1265 100644 --- a/ct.yaml +++ b/ct.yaml @@ -23,9 +23,8 @@ charts: - charts/local-storage-provisioner - charts/image-puller - charts/pulsar-operator - - charts/function-mesh-operator - charts/sn-platform - charts/pulsar debug: true -helm-extra-args: --timeout 1200 +helm-extra-args: --timeout 1200s validate-maintainers: false diff --git a/lintconf.yaml b/lintconf.yaml new file mode 100644 index 00000000..56ccf1cb --- /dev/null +++ b/lintconf.yaml @@ -0,0 +1,60 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--- +rules: + braces: + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + brackets: + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + colons: + max-spaces-before: 0 + max-spaces-after: 1 + commas: + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: + require-starting-space: true + min-spaces-from-content: 2 + document-end: disable + document-start: disable # No --- to start a file + empty-lines: + max: 2 + max-start: 0 + max-end: 0 + hyphens: + max-spaces-after: 1 + indentation: + spaces: consistent + indent-sequences: whatever # - list indentation will handle both indentation and without + check-multi-line-strings: false + key-duplicates: enable + line-length: disable # Lines can be any length + new-line-at-end-of-file: enable + new-lines: + type: unix + trailing-spaces: disable + truthy: + level: warning