Skip to content

feat: persist component scheduling results #6069

feat: persist component scheduling results

feat: persist component scheduling results #6069

# validate any chart changes under charts directory
name: Chart
env:
HELM_VERSION: v3.17.3
KUSTOMIZE_VERSION: 5.6.0
on:
push:
# Exclude branches created by Dependabot to avoid triggering current workflow
# for PRs initiated by Dependabot.
branches-ignore:
- 'dependabot/**'
pull_request:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test-on-kubernetes-matrix:
name: Test on Kubernetes
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
# Here support the latest three minor releases of Kubernetes, this can be considered to be roughly
# the same as the End of Life of the Kubernetes release: https://kubernetes.io/releases/
# Please remember to update the CI Schedule Workflow when we add a new version.
k8s: [ v1.34.0, v1.35.0, v1.36.1 ]
steps:
# Free up disk space on Ubuntu
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with:
# this might remove tools that are actually needed, if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: install Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- name: Set up Helm
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
with:
version: ${{ env.HELM_VERSION }}
- name: Set up Kustomize
uses: syntaqx/setup-kustomize@4331ea02eec887906c9adbf7f431ca3db09908fd # v1.0.3
with:
kustomize-version: ${{ env.KUSTOMIZE_VERSION }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Run chart-testing (template)
run: |
cat <<EOF > post-render.sh
#!/bin/sh
# save helm stdout to file, kustomize will read this
cat > all.yaml
kustomize build
EOF
chmod +x post-render.sh
cat <<EOF > kustomization.yaml
resources:
- all.yaml
EOF
helm template --set components={"search,descheduler,schedulerEstimator"} --dependency-update ./charts/karmada \
--post-renderer ./post-render.sh --debug > /dev/null
helm template --set components={"search,descheduler,schedulerEstimator"},certs.mode=custom --dependency-update \
./charts/karmada --post-renderer ./post-render.sh --debug > /dev/null
helm template --set components={"search,descheduler,schedulerEstimator"},installMode=component --dependency-update \
./charts/karmada --post-renderer ./post-render.sh --debug > /dev/null
helm template --set installMode=agent --dependency-update ./charts/karmada --post-renderer ./post-render.sh --debug > /dev/null
helm template --dependency-update ./charts/karmada-operator --post-renderer ./post-render.sh --debug > /dev/null
rm post-render.sh all.yaml kustomization.yaml
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: 3.9
check-latest: true
- name: Set up chart-testing
uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # v2.8.0
- name: Add dependency chart repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$( ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --debug --check-version-increment=false --target-branch ${{ github.event.repository.default_branch }}
- name: Run chart-testing (install)
run: |
export CLUSTER_VERSION=kindest/node:${{ matrix.k8s }}
hack/setup-dev-base.sh
export KUBECONFIG=~/.kube/karmada.config
ct install --target-branch ${{ github.event.repository.default_branch }} --charts charts/karmada --debug --helm-extra-set-args '--set components={search,metricsAdapter,descheduler},apiServer.hostNetwork=true' --helm-extra-args "--timeout 800s" --skip-clean-up
kubectl get pods -A
- name: Run karmada-operator chart installation test
run: |
export KUBECONFIG=~/.kube/karmada.config
# Install the karmada-operator chart. This validates that the chart installs
# successfully and that the CRD is also installed
helm install karmada-operator --dependency-update ./charts/karmada-operator --namespace karmada-operator-system --create-namespace --timeout 300s
# Verify the CRD was created (by default, the chart should install the CRD).
kubectl get crd karmadas.operator.karmada.io
# Uninstall the chart and verify the CRD survives.
# This is critical — deleting the CRD would
# cascade-delete all Karmada custom resources in the cluster.
helm uninstall karmada-operator --namespace karmada-operator-system
kubectl get crd karmadas.operator.karmada.io