From 573f4f0a82741a8ed03313a29f74a7f424ae1367 Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Fri, 17 Mar 2023 10:59:46 +0100 Subject: [PATCH] task: move from kubeval to kubeconform (#73) In the process I also spotted that we're not actually linting/validating all our schemas, since we run helm template without any values, it's run without ingress and hpa enabled, so this PR also adds values files which causes all template files to be exercised. --- .../unleash-edge/unleash-edge-values.yaml | 7 ++ .github/kubeconform.sh | 27 +++++++ .github/kubeval.sh | 30 -------- .github/workflows/ci.yaml | 73 +++++++++++-------- .github/workflows/release.yaml | 13 ++-- charts/unleash-proxy/Chart.yaml | 2 +- .../ci/unleash-proxy-values.yaml | 10 +++ charts/unleash-proxy/features.json | 1 + charts/unleash-proxy/templates/configmap.yaml | 10 +++ .../unleash-proxy/templates/deployment.yaml | 46 +++++++++++- charts/unleash-proxy/templates/hpa.yaml | 11 ++- .../templates/tests/test-connection.yaml | 4 +- charts/unleash-proxy/values.yaml | 2 + charts/unleash/Chart.yaml | 2 +- charts/unleash/ci/unleash-values.yaml | 7 ++ charts/unleash/templates/hpa.yaml | 10 ++- charts/unleash/templates/vpa.yaml | 15 ---- charts/unleash/values.yaml | 4 +- results/.gitignore | 1 + 19 files changed, 181 insertions(+), 94 deletions(-) create mode 100644 .github/helmvalues/unleash-edge/unleash-edge-values.yaml create mode 100755 .github/kubeconform.sh delete mode 100755 .github/kubeval.sh create mode 100644 charts/unleash-proxy/ci/unleash-proxy-values.yaml create mode 100644 charts/unleash-proxy/features.json create mode 100644 charts/unleash-proxy/templates/configmap.yaml create mode 100644 charts/unleash/ci/unleash-values.yaml delete mode 100644 charts/unleash/templates/vpa.yaml create mode 100644 results/.gitignore diff --git a/.github/helmvalues/unleash-edge/unleash-edge-values.yaml b/.github/helmvalues/unleash-edge/unleash-edge-values.yaml new file mode 100644 index 0000000..8e1899d --- /dev/null +++ b/.github/helmvalues/unleash-edge/unleash-edge-values.yaml @@ -0,0 +1,7 @@ +autoscaling: + enabled: true + minReplicas: 1 + maxReplicas: 4 + +ingress: + enabled: true diff --git a/.github/kubeconform.sh b/.github/kubeconform.sh new file mode 100755 index 0000000..2848b12 --- /dev/null +++ b/.github/kubeconform.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# use kubeconform to validate helm generated kubernetes manifests +# + +set -o errexit +set -o pipefail + +echo "Running for K8S schema version: $KUBERNETES_VERSION with Kube conform: $KUBECONFORM_VERSION" +# install kubeconform +curl --silent --show-error --fail --location --output /tmp/kubeconform.tar.gz https://github.com/yannh/kubeconform/releases/download/"${KUBECONFORM_VERSION}"/kubeconform-linux-amd64.tar.gz +sudo tar -C /usr/local/bin -xf /tmp/kubeconform.tar.gz kubeconform + +mkdir -p results +echo "Adding bitnami repo so dependency building succeeds" +helm repo add bitnami https://charts.bitnami.com/bitnami +echo "Repo added" +CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/main -- charts | grep '[cC]hart.yaml' | sed -e 's#/[Cc]hart.yaml##g')" +for CHART_DIR in ${CHART_DIRS}; do + echo "helm dependency build..." + helm dependency build "${CHART_DIR}" + + echo "kubeconforming ${CHART_DIR##charts/} chart ..." + helm template "${CHART_DIR}" -f ./"${CHART_DIR}"/ci/"${CHART_DIR##charts/}"-values.yaml | kubeconform -kubernetes-version "${KUBERNETES_VERSION}" --output=tap > results/"${CHART_DIR##charts/}"-"${KUBERNETES_VERSION}"-result.tap +done + +exit 0 diff --git a/.github/kubeval.sh b/.github/kubeval.sh deleted file mode 100755 index 0de9152..0000000 --- a/.github/kubeval.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# use kubeval to validate helm generated kubernetes manifests -# - -set -o errexit -set -o pipefail - -CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/main -- charts | grep '[cC]hart.yaml' | sed -e 's#/[Cc]hart.yaml##g')" -HELM_VERSION="v3.10.0" -KUBEVAL_VERSION="v0.16.1" -SCHEMA_LOCATION="https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/" - -# install helm -curl --silent --show-error --fail --location --output get_helm.sh https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get -chmod 700 get_helm.sh -./get_helm.sh --version "${HELM_VERSION}" - -# install kubeval -curl --silent --show-error --fail --location --output /tmp/kubeval.tar.gz https://github.com/instrumenta/kubeval/releases/download/"${KUBEVAL_VERSION}"/kubeval-linux-amd64.tar.gz -sudo tar -C /usr/local/bin -xf /tmp/kubeval.tar.gz kubeval - -# validate charts -for CHART_DIR in ${CHART_DIRS};do - echo "helm dependency build..." - helm dependency build "${CHART_DIR}" - - echo "kubeval(idating) ${CHART_DIR##charts/} chart..." - helm template "${CHART_DIR}" | kubeval --strict --ignore-missing-schemas --kubernetes-version "${KUBERNETES_VERSION#v}" --schema-location "${SCHEMA_LOCATION}" -done diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 00c6662..2fc8551 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Codespell uses: codespell-project/actions-codespell@master with: @@ -22,26 +22,27 @@ jobs: check_hidden: true lint-chart: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Helm - uses: azure/setup-helm@v1 + uses: azure/setup-helm@v3 with: - version: v3.8.1 - - uses: actions/setup-python@v2 + version: v3.11.1 + - uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: 3.9 + check-latest: true - name: Set up chart-testing - uses: helm/chart-testing-action@v2.2.1 + uses: helm/chart-testing-action@v2.3.1 - name: Run chart-testing (lint) run: ct lint --config .github/ct.yaml super-linter: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v3 @@ -59,40 +60,51 @@ jobs: VALIDATE_JSCPD: false VALIDATE_KUBERNETES_KUBEVAL: false VALIDATE_YAML: false - - kubeval-chart: - runs-on: ubuntu-20.04 + kubeconform: + runs-on: ubuntu-latest needs: - codespell - - lint-chart - super-linter + - lint-chart strategy: matrix: k8s: - - v1.22.11 - - v1.23.8 - - v1.24.2 + - 1.23.17 + - 1.24.11 + - 1.25.7 + - 1.26.2 steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Fetch history - run: git fetch --prune --unshallow - - name: Run kubeval + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup helm + uses: azure/setup-helm@v3 + with: + version: 3.11.1 + - name: Run kubeconform tests + run: .github/kubeconform.sh env: KUBERNETES_VERSION: ${{ matrix.k8s }} - run: .github/kubeval.sh + KUBECONFORM_VERSION: v0.6.1 + - name: Create test summary + uses: test-summary/action@v2 + with: + paths: "./results/*.tap" + if: always() install-chart: name: install-chart runs-on: ubuntu-20.04 needs: - - kubeval-chart + - kubeconform strategy: matrix: k8s: - - v1.22.15 - - v1.23.12 - - v1.24.6 + - v1.23.13 + - v1.24.7 + - v1.25.3 + - v1.26.2 steps: - name: Checkout uses: actions/checkout@v3 @@ -101,12 +113,13 @@ jobs: - name: Set up Helm uses: azure/setup-helm@v1 with: - version: v3.8.1 + version: v3.11.1 - uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: 3.9 + check-latest: true - name: Set up chart-testing - uses: helm/chart-testing-action@v2.2.1 + uses: helm/chart-testing-action@v2.3.1 - name: Run chart-testing (list-changed) id: list-changed run: | @@ -115,7 +128,7 @@ jobs: echo "changed=true" >> "$GITHUB_OUTPUT" fi - name: Create kind cluster - uses: helm/kind-action@v1.3.0 + uses: helm/kind-action@v1.5.0 if: steps.list-changed.outputs.changed == 'true' with: config: .github/kind-config.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1f3f63a..63ee42e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,10 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 - - - name: Fetch history - run: git fetch --prune --unshallow + uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Configure Git run: | @@ -21,12 +20,12 @@ jobs: git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Install Helm - uses: azure/setup-helm@v1 + uses: azure/setup-helm@v3 with: - version: v3.5.2 + version: 3.11.1 - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.2.0 + uses: helm/chart-releaser-action@v1.5.0 with: charts_repo_url: https://docs.getunleash.io/helm-charts env: diff --git a/charts/unleash-proxy/Chart.yaml b/charts/unleash-proxy/Chart.yaml index 16e2117..63899d9 100644 --- a/charts/unleash-proxy/Chart.yaml +++ b/charts/unleash-proxy/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.2.2 +version: 0.3.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/unleash-proxy/ci/unleash-proxy-values.yaml b/charts/unleash-proxy/ci/unleash-proxy-values.yaml new file mode 100644 index 0000000..86140a6 --- /dev/null +++ b/charts/unleash-proxy/ci/unleash-proxy-values.yaml @@ -0,0 +1,10 @@ +ingress: + enabled: true + +autoscaling: + enabled: true + minReplicas: 1 + maxReplicas: 4 + +edge: + enable: true diff --git a/charts/unleash-proxy/features.json b/charts/unleash-proxy/features.json new file mode 100644 index 0000000..4bbfd14 --- /dev/null +++ b/charts/unleash-proxy/features.json @@ -0,0 +1 @@ +{"version":2,"features":[{"strategies":[{"name":"applicationHostname","constraints":[],"parameters":{"hostNames":""}},{"name":"userWithId","constraints":[],"parameters":{"userIds":""}}],"impressionData":false,"enabled":true,"name":"1234","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"userWithId","constraints":[],"parameters":{"userIds":"44113858,77331345,54502293,95104627,55505705,128535,72247905"}},{"name":"userWithId","constraints":[],"parameters":{"userIds":"48755422"}},{"name":"userWithId","constraints":[],"parameters":{"userIds":"128535"}}],"impressionData":false,"enabled":true,"name":"demoApp.step2","description":"Enable a feature for a specific userId","project":"demo-app","stale":false,"type":"permission","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"res","description":"","project":"default","stale":false,"type":"kill-switch","variants":[]},{"strategies":[{"name":"userWithId","constraints":[{"values":["then","this"],"inverted":false,"operator":"IN","contextName":"appName","caseInsensitive":false},{"values":["1234567"],"inverted":false,"operator":"IN","contextName":"companyId","caseInsensitive":false},{"values":["123","456"],"inverted":true,"operator":"IN","contextName":"userId","caseInsensitive":false},{"values":["4","5"],"inverted":true,"operator":"IN","contextName":"AccountId","caseInsensitive":false}],"parameters":{"userIds":""}},{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"demoApp.step3","rollout":"100","stickiness":"userId"}}],"impressionData":false,"enabled":true,"name":"demoApp.step3","description":"Gradual rollout of feature toggle","project":"demo-app","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"atf1","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"atf1","description":"haha","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"userWithId","constraints":[],"parameters":{"userIds":"95104627,128535"}},{"name":"userWithId","constraints":[],"parameters":{"userIds":"82895148,dfsfsd,vsdfvsdf,qsv,44113858"}}],"impressionData":true,"enabled":true,"name":"demoApp.step4","description":"Demonstration on how to use multiple variants","project":"demo-app","stale":false,"type":"experiment","variants":[{"name":"cyan","weight":10,"payload":{"type":"string","value":"cyan"},"overrides":[],"stickiness":"default","weightType":"variable"},{"name":"orange","weight":950,"payload":{"type":"string","value":"orange"},"overrides":[],"stickiness":"default","weightType":"fix"},{"name":"red","weight":30,"payload":{"type":"string","value":"red"},"overrides":[{"values":["82895148"],"contextName":"userId"}],"stickiness":"default","weightType":"fix"},{"name":"userId","weight":10,"payload":{"type":"string","value":"54388052"},"overrides":[],"stickiness":"default","weightType":"variable"}]},{"strategies":[{"name":"default","constraints":[],"parameters":{}},{"name":"default","constraints":[{"values":["1","2"],"inverted":true,"operator":"IN","contextName":"userId","caseInsensitive":false},{"values":["666","678","689"],"inverted":false,"operator":"IN","contextName":"pc","caseInsensitive":false},{"values":["1272"],"inverted":false,"operator":"IN","contextName":"country","caseInsensitive":false}],"parameters":{}},{"name":"flexibleRollout","constraints":[{"values":["then"],"inverted":false,"operator":"IN","contextName":"appName","caseInsensitive":false},{"values":["666","678","689"],"inverted":false,"operator":"IN","contextName":"pc","caseInsensitive":false},{"values":["1272"],"inverted":false,"operator":"IN","contextName":"country","caseInsensitive":false}],"parameters":{"groupId":"demoApp.step1","rollout":"100","stickiness":"default"}},{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"demoApp.step1","rollout":"50","stickiness":"default"}}],"impressionData":true,"enabled":true,"name":"demoApp.step1","description":"Enable for all users","project":"demo-app","stale":false,"type":"release","variants":[{"name":"Main","weight":500,"payload":{"type":"string","value":"hestarsomfestar"},"overrides":[],"stickiness":"default","weightType":"variable"},{"name":"Opa","weight":500,"payload":{"type":"string","value":"asAS"},"overrides":[],"stickiness":"default","weightType":"variable"}]},{"strategies":[{"name":"remoteAddress","constraints":[],"parameters":{"IPs":"192.168.0.1"}},{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"bbtoggles","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"bbtoggles","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"testttttttttttt","rollout":"50","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"testttttttttttt","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"default","constraints":[],"parameters":{}}],"impressionData":false,"enabled":false,"name":"HideLogo","description":"This option for hide logo","project":"default","stale":false,"type":"experiment","variants":[{"name":"test","weight":1000,"payload":{"type":"string","value":"asdf"},"overrides":[{"values":["this"],"contextName":"appName"},{"values":["then"],"contextName":"appName"}],"stickiness":"default","weightType":"variable"}]},{"strategies":[],"impressionData":false,"enabled":false,"name":"Test44","description":"","project":"default","stale":false,"type":"operational","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"fd","description":"","project":"default","stale":false,"type":"experiment","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"earphones","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":false,"name":"earphones","description":"","project":"test-project","stale":false,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"toggle2","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"length","rollout":"100","stickiness":"default"}}],"impressionData":true,"enabled":true,"name":"length","description":"길이","project":"KTest","stale":false,"type":"release","variants":[{"name":"variant","weight":1000,"payload":{"type":"string","value":"TEST!!"},"overrides":[{"values":["1","2","3"],"contextName":"companyId"},{"values":["4","5","6"],"contextName":"companyId"}],"stickiness":"default","weightType":"variable"}]},{"strategies":[{"name":"userWithId","constraints":[{"values":["then"],"inverted":false,"operator":"IN","contextName":"appName","caseInsensitive":false},{"values":["1","2","3"],"inverted":false,"operator":"IN","contextName":"companyId","caseInsensitive":false}],"parameters":{"userIds":""}}],"impressionData":false,"enabled":false,"name":"expTest","description":"","project":"KTest","stale":false,"type":"experiment","variants":[]},{"strategies":[{"name":"default","constraints":[{"values":["67686","6799","6554"],"inverted":false,"operator":"IN","contextName":"companyId","caseInsensitive":false}],"parameters":{}},{"name":"default","constraints":[{"values":["1272","1092"],"inverted":false,"operator":"IN","contextName":"country","caseInsensitive":false}],"parameters":{}},{"name":"userrole","constraints":[{"values":["1092"],"inverted":false,"operator":"IN","contextName":"country","caseInsensitive":false},{"values":["699","698","697"],"inverted":false,"operator":"IN","contextName":"pc","caseInsensitive":false},{"values":["DC","FARM"],"inverted":false,"operator":"IN","contextName":"role","caseInsensitive":false}],"parameters":{}},{"name":"userrole","constraints":[{"values":["1272"],"inverted":false,"operator":"IN","contextName":"country","caseInsensitive":false},{"values":["666","667","668"],"inverted":false,"operator":"IN","contextName":"pc","caseInsensitive":false},{"values":["FARM","DC","BRKR"],"inverted":false,"operator":"IN","contextName":"role","caseInsensitive":false}],"parameters":{}}],"impressionData":false,"enabled":false,"name":"price","description":"","project":"SALT","stale":false,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"feat123","description":"","project":"mh-project","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"cc","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"cc","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"1q","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"1q","description":"1","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"show-frontend","description":"","project":"smart-mash","stale":false,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"show-button","description":"","project":"smart-mash","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"toggle_bun","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"toggle_bun","description":"","project":"1","stale":false,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"fuga","description":"","project":"hoge","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"YZTesting","rollout":"50","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"YZTesting","description":"","project":"default","stale":false,"type":"experiment","variants":[{"name":"x1","weight":334,"payload":{"type":"string","value":"hello"},"overrides":[],"stickiness":"default","weightType":"variable"},{"name":"x2","weight":333,"payload":{"type":"string","value":"byebye"},"overrides":[],"stickiness":"default","weightType":"variable"},{"name":"x3","weight":333,"payload":{"type":"string","value":"bonjour"},"overrides":[],"stickiness":"default","weightType":"variable"}]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"cccc","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"cccc","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"feature_01","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"feature_01","description":"","project":"gl-jaje","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"default","constraints":[{"values":["india","belgium","france"],"inverted":false,"operator":"IN","contextName":"country","caseInsensitive":false}],"parameters":{}}],"impressionData":true,"enabled":false,"name":"transics1","description":"","project":"3","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"teste2","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"teste2","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"transics2","description":"Add toggle through CI/CD pipeline","project":"3","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"turnlight","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"turnlight","description":"turn on/off light","project":"projectAAA","stale":true,"type":"kill-switch","variants":[]},{"strategies":[],"impressionData":true,"enabled":false,"name":"horrendouswarning","description":"Test for warning","project":"konk-test","stale":false,"type":"experiment","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"T1","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":false,"name":"T1","description":"","project":"Test","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"snow","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"snow","description":"","project":"projectAAA","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"tenants","constraints":[],"parameters":{"ids":"45,34"}}],"impressionData":false,"enabled":true,"name":"new-login","description":"","project":"default","stale":false,"type":"experiment","variants":[]},{"strategies":[{"name":"default","constraints":[{"values":["hamish@foobs.com"],"inverted":true,"operator":"IN","contextName":"email","caseInsensitive":false}],"parameters":{}},{"name":"userWithId","constraints":[],"parameters":{"userIds":"123,345"}}],"impressionData":true,"enabled":true,"name":"loginAllowed","description":"","project":"default","stale":false,"type":"permission","variants":[]},{"strategies":[{"name":"default","constraints":[],"parameters":{}},{"name":"default","constraints":[],"parameters":{}}],"impressionData":true,"enabled":true,"name":"snowing","description":"Enable snowing feature","project":"demo-app","stale":false,"type":"release","variants":[{"name":"appName","weight":250,"overrides":[{"values":["ios-mpa"],"contextName":"appName"}],"stickiness":"default","weightType":"variable"},{"name":"test","weight":250,"payload":{"type":"json","value":"{\"asd\":\"asd\"}"},"overrides":[{"values":["v1"],"contextName":"appName"},{"values":["axon"],"contextName":"companyId"}],"stickiness":"default","weightType":"variable"},{"name":"teste","weight":250,"payload":{"type":"string","value":"true"},"overrides":[{"values":["teste"],"contextName":"country"}],"stickiness":"default","weightType":"variable"},{"name":"US","weight":0,"payload":{"type":"string","value":"us"},"overrides":[{"values":["south"],"contextName":"region"}],"stickiness":"default","weightType":"fix"},{"name":"xyz","weight":250,"payload":{"type":"string","value":"test"},"overrides":[{"values":["spot"],"contextName":"institutionId"}],"stickiness":"default","weightType":"variable"}]},{"strategies":[{"name":"default","constraints":[],"parameters":{}}],"impressionData":false,"enabled":false,"name":"CMTestToggle","description":"","project":"CMTest","stale":false,"type":"release","variants":[{"name":"Variant2","weight":1000,"payload":{"type":"json","value":"{\"hello\":\"world\"}"},"overrides":[],"stickiness":"default","weightType":"variable"}]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"TEst","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"TEst","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"transics3","description":"","project":"3","stale":true,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"pricefeature","description":"","project":"SALT-New","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"userWithId","constraints":[],"parameters":{"userIds":"hakon"}}],"impressionData":false,"enabled":false,"name":"isAdmin","description":"only available for user admin users","project":"hptest","stale":false,"type":"permission","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"is-appS","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"is-appS","description":"","project":"sms-reminder-test","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"default","constraints":[],"parameters":{}}],"impressionData":false,"enabled":true,"name":"testexperiment","description":"test-experiment","project":"default","stale":false,"type":"experiment","variants":[{"name":"clear","weight":500,"overrides":[],"stickiness":"default","weightType":"variable"},{"name":"dark","weight":500,"overrides":[],"stickiness":"default","weightType":"variable"}]},{"strategies":[],"impressionData":false,"enabled":false,"name":"aaaaaaaaaaaaaa","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"lalala1","rollout":"50","stickiness":"default"}}],"impressionData":false,"enabled":false,"name":"lalala1","description":"asdfsf","project":"lala","stale":true,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"feature_001","description":"","project":"MerchantTest","stale":false,"type":"experiment","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"feature_002","description":"","project":"MerchantTest","stale":false,"type":"permission","variants":[]},{"strategies":[{"name":"userWithId","constraints":[],"parameters":{"userIds":"12,3214,4124124"}}],"impressionData":false,"enabled":false,"name":"Tester","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"default","constraints":[{"value":"3.9.1","values":[],"inverted":false,"operator":"SEMVER_GT","contextName":"version","caseInsensitive":false}],"parameters":{}}],"impressionData":false,"enabled":true,"name":"TestVersion","description":"","project":"default","stale":false,"type":"release","variants":[{"name":"productcode","weight":1000,"payload":{"type":"string","value":"asdadasd"},"overrides":[{"values":["11111"],"contextName":"currentTime"},{"values":["22222"],"contextName":"currentTime"}],"stickiness":"default","weightType":"variable"}]},{"strategies":[],"impressionData":false,"enabled":false,"name":"test_wow2","description":"","project":"test.test","stale":false,"type":"release","variants":[{"name":"test","weight":1000,"payload":{"type":"string","value":"test"},"overrides":[],"stickiness":"default","weightType":"variable"}]},{"strategies":[],"impressionData":false,"enabled":false,"name":"dasdas","description":"dasdasdas","project":"testdasdas","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"HistoricSync","rollout":"50","stickiness":"default"}}],"impressionData":false,"enabled":false,"name":"HistoricSync","description":"","project":"projid","stale":false,"type":"experiment","variants":[]},{"strategies":[],"impressionData":true,"enabled":false,"name":"ytuyghgdfhfj","description":"","project":"default","stale":false,"type":"operational","variants":[]},{"strategies":[{"name":"default","constraints":[],"parameters":{}}],"impressionData":false,"enabled":false,"name":"Blah","description":"","project":"test","stale":false,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"testf","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"Tenants","constraints":[{"values":["tenant"],"inverted":false,"operator":"IN","contextName":"starter","caseInsensitive":false}],"parameters":{}}],"impressionData":true,"enabled":true,"name":"proto-test","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"userWithId","constraints":[{"values":["10869984482"],"inverted":false,"operator":"IN","contextName":"userId","caseInsensitive":false}],"parameters":{"userIds":""}},{"name":"default","constraints":[],"parameters":{}}],"impressionData":false,"enabled":false,"name":"PIX","description":"","project":"caio-test","stale":false,"type":"permission","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"TestTest123","rollout":"100","stickiness":"default"}}],"impressionData":true,"enabled":true,"name":"TestTest123","description":"","project":"test123","stale":false,"type":"experiment","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"disableDemo1","rollout":"100","stickiness":"default"}}],"impressionData":true,"enabled":true,"name":"disableDemo1","description":"disable Demo 1","project":"5555","stale":false,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"HistoricSyncInGarmin2","description":"","project":"projid","stale":false,"type":"permission","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"nextjs-poc","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"nextjs-poc","description":"","project":"default","stale":false,"type":"experiment","variants":[{"name":"A","weight":500,"payload":{"type":"string","value":"a"},"overrides":[],"stickiness":"default","weightType":"variable"},{"name":"B","weight":500,"payload":{"type":"string","value":"b"},"overrides":[],"stickiness":"default","weightType":"variable"}]},{"strategies":[{"name":"remoteAddress","constraints":[{"values":["666","678","689"],"inverted":false,"operator":"IN","contextName":"pc","caseInsensitive":false},{"values":["1272"],"inverted":false,"operator":"IN","contextName":"country","caseInsensitive":false}],"parameters":{"IPs":"19.23.33.44"}}],"impressionData":false,"enabled":false,"name":"test2023","description":"teste","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"ciatest","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"demo001","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"demo001","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[{"value":"20","values":[],"inverted":false,"operator":"NUM_GTE","contextName":"age","caseInsensitive":false}],"parameters":{"groupId":"ff-rollout","rollout":"50","stickiness":"default"}}],"impressionData":false,"enabled":false,"name":"ff-rollout","description":"","project":"roll","stale":false,"type":"release","variants":[]},{"strategies":[],"impressionData":false,"enabled":false,"name":"test-release-toggle-1","description":"","project":"testtest","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"test999999","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"test999999","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[],"impressionData":true,"enabled":false,"name":"permy","description":"","project":"default","stale":false,"type":"permission","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"test_wow","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":false,"name":"test_wow","description":"","project":"test.test","stale":false,"type":"operational","variants":[{"name":"test","weight":1000,"payload":{"type":"string","value":"wow"},"overrides":[{"values":["then"],"contextName":"appName"}],"stickiness":"default","weightType":"variable"}]},{"strategies":[],"impressionData":true,"enabled":false,"name":"go1toggle","description":"","project":"default","stale":false,"type":"release","variants":[{"name":"CTAButtonSend","weight":334,"payload":{"type":"string","value":"Submit"},"overrides":[],"stickiness":"default","weightType":"variable"},{"name":"CTAButtonShare","weight":333,"payload":{"type":"string","value":"Share"},"overrides":[],"stickiness":"default","weightType":"variable"},{"name":"CTAButtonSubmit","weight":333,"payload":{"type":"string","value":"Submit"},"overrides":[],"stickiness":"default","weightType":"variable"}]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"beamer","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":false,"name":"beamer","description":"","project":"creative-suite","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"flexibleRollout","constraints":[],"parameters":{"groupId":"disabled_Second","rollout":"100","stickiness":"default"}}],"impressionData":false,"enabled":true,"name":"disabled_Second","description":"test second option","project":"5555","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"default","constraints":[],"parameters":{}}],"impressionData":false,"enabled":true,"name":"DemoToggle2222","description":"","project":"default","stale":false,"type":"release","variants":[]},{"strategies":[{"name":"default","constraints":[{"values":["1234567"],"inverted":false,"operator":"IN","contextName":"companyId","caseInsensitive":false}],"parameters":{}}],"impressionData":false,"enabled":false,"name":"Addm","description":"asdadasda","project":"default","stale":false,"type":"experiment","variants":[{"name":"sdds","weight":1000,"payload":{"type":"string","value":"dsds"},"overrides":[],"stickiness":"default","weightType":"variable"}]}],"query":{"environment":"default","inlineSegmentConstraints":true}} \ No newline at end of file diff --git a/charts/unleash-proxy/templates/configmap.yaml b/charts/unleash-proxy/templates/configmap.yaml new file mode 100644 index 0000000..755e165 --- /dev/null +++ b/charts/unleash-proxy/templates/configmap.yaml @@ -0,0 +1,10 @@ +--- +{{- if .Values.edge.enable }} +kind: ConfigMap +apiVersion: v1 +metadata: + name: edge-features +data: + features.json: |- + {{ .Files.Get "features.json" | indent 4}} +{{- end}} diff --git a/charts/unleash-proxy/templates/deployment.yaml b/charts/unleash-proxy/templates/deployment.yaml index 83745b1..c1a171e 100644 --- a/charts/unleash-proxy/templates/deployment.yaml +++ b/charts/unleash-proxy/templates/deployment.yaml @@ -51,7 +51,11 @@ spec: value: "{{ join "," .Values.proxy.clientKeys }}" {{- end }} - name: UNLEASH_URL - value: "{{ .Values.proxy.serverHost }}" + {{- if .Values.edge.enable }} + value: "http://localhost:3063/api" + {{- else }} + value: {{ .Values.proxy.serverHost }}" + {{- end }} {{- if .Values.proxy.logLevel }} - name: LOG_LEVEL value: "{{ .Values.proxy.logLevel }}" @@ -93,6 +97,46 @@ spec: port: http resources: {{- toYaml .Values.resources | nindent 12 }} + {{- if .Values.edge.enable }} + - name: unleash-edge + args: + - "offline" + env: + - name: TOKENS + value: {{ .Values.proxy.apiToken }} + - name: BOOTSTRAP_FILE + value: /data/config/features.json + image: "unleashorg/unleash-edge:v0.5.1" + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 3063 + protocol: TCP + livenessProbe: + httpGet: + path: /internal-backstage/health + port: http + readinessProbe: + httpGet: + port: http + path: /internal-backstage/health + resources: + limits: + cpu: 50m + memory: 32Mi + requests: + cpu: 20m + memory: 32Mi + volumeMounts: + - mountPath: "/data/config" + name: edge-features + {{- end }} + {{- if .Values.edge.enable }} + volumes: + - name: edge-features + configMap: + name: edge-features + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/unleash-proxy/templates/hpa.yaml b/charts/unleash-proxy/templates/hpa.yaml index 529f1a9..bc4470b 100644 --- a/charts/unleash-proxy/templates/hpa.yaml +++ b/charts/unleash-proxy/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 +apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: {{ include "unleash-proxy.fullname" . }} @@ -17,12 +17,17 @@ spec: - type: Resource resource: name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} {{- end }} {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - type: Resource resource: name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + container: application + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} {{- end }} {{- end }} diff --git a/charts/unleash-proxy/templates/tests/test-connection.yaml b/charts/unleash-proxy/templates/tests/test-connection.yaml index 852b999..9464e7d 100644 --- a/charts/unleash-proxy/templates/tests/test-connection.yaml +++ b/charts/unleash-proxy/templates/tests/test-connection.yaml @@ -11,5 +11,7 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "unleash-proxy.fullname" . }}:{{ .Values.service.port }}'] + args: ['-O -', + "--header='Authorization: {{ .Values.proxy.clientKeys | first }}'", + '{{ include "unleash-proxy.fullname" . }}:{{ .Values.service.port }}/proxy/health'] restartPolicy: Never diff --git a/charts/unleash-proxy/values.yaml b/charts/unleash-proxy/values.yaml index 537d8af..082de98 100644 --- a/charts/unleash-proxy/values.yaml +++ b/charts/unleash-proxy/values.yaml @@ -95,6 +95,8 @@ existingSecrets: # name: secretname # key: secretkey +edge: + enable: false proxy: serverHost: http://unleash:4242/api apiToken: "default:development.unleash-insecure-api-token" diff --git a/charts/unleash/Chart.yaml b/charts/unleash/Chart.yaml index 96c31de..bc7ece8 100644 --- a/charts/unleash/Chart.yaml +++ b/charts/unleash/Chart.yaml @@ -15,4 +15,4 @@ sources: - https://github.com/Unleash/unleash - https://github.com/Unleash/helm-charts type: application -version: 2.7.7 +version: 2.8.0 diff --git a/charts/unleash/ci/unleash-values.yaml b/charts/unleash/ci/unleash-values.yaml new file mode 100644 index 0000000..dc9298f --- /dev/null +++ b/charts/unleash/ci/unleash-values.yaml @@ -0,0 +1,7 @@ +ingress: + enabled: true + +autoscaling: + enabled: true + minReplicas: 1 + maxReplicas: 4 diff --git a/charts/unleash/templates/hpa.yaml b/charts/unleash/templates/hpa.yaml index b0796dc..1fcf82b 100644 --- a/charts/unleash/templates/hpa.yaml +++ b/charts/unleash/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 +apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: {{ include "unleash.fullname" . }} @@ -17,12 +17,16 @@ spec: - type: Resource resource: name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} {{- end }} {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - type: Resource resource: name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} {{- end }} {{- end }} diff --git a/charts/unleash/templates/vpa.yaml b/charts/unleash/templates/vpa.yaml deleted file mode 100644 index f694822..0000000 --- a/charts/unleash/templates/vpa.yaml +++ /dev/null @@ -1,15 +0,0 @@ -{{- if .Values.vpa.enabled }} -apiVersion: autoscaling.k8s.io/v1beta2 -kind: VerticalPodAutoscaler -metadata: - name: {{ include "unleash.fullname" . }} - labels: - {{- include "unleash.labels" . | nindent 4 }} -spec: - targetRef: - apiVersion: "apps/v1" - kind: Deployment - name: {{ include "unleash.fullname" . }} - updatePolicy: - updateMode: "Off" -{{- end }} diff --git a/charts/unleash/values.yaml b/charts/unleash/values.yaml index 057c5f0..1e6ddc2 100644 --- a/charts/unleash/values.yaml +++ b/charts/unleash/values.yaml @@ -245,5 +245,5 @@ autoscaling: enabled: false minReplicas: 0 maxReplicas: 0 - targetCPUUtilizationPercentage: 0 - targetMemoryUtilizationPercentage: 0 + targetCPUUtilizationPercentage: 70 + targetMemoryUtilizationPercentage: 70 diff --git a/results/.gitignore b/results/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/results/.gitignore @@ -0,0 +1 @@ +*