diff --git a/.github/workflows/build-helm-release.yaml b/.github/workflows/build-helm-release.yaml new file mode 100644 index 0000000..b3a8ce0 --- /dev/null +++ b/.github/workflows/build-helm-release.yaml @@ -0,0 +1,190 @@ +name: Helm Release + +on: + workflow_dispatch: + push: + branches: + - main + tags: + - "v*" + paths: + - charts/ascend-device-plugin/Chart.yaml + +env: + HELM_VERSION: "v3.20.0" + CHART_PATH: charts/ascend-device-plugin + CHART_NAME: ascend-device-plugin + +permissions: + contents: read + +concurrency: + group: helm-release + cancel-in-progress: false + +jobs: + detect-chart-version: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + outputs: + version_changed: ${{ steps.compare.outputs.version_changed }} + previous_version: ${{ steps.compare.outputs.previous_version }} + current_version: ${{ steps.compare.outputs.current_version }} + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Compare chart version + id: compare + shell: bash + run: | + set -euo pipefail + + before_sha="${{ github.event.before }}" + if [[ -z "${before_sha}" || "${before_sha}" == "0000000000000000000000000000000000000000" ]]; then + echo "github.event.before is not available for this push" >&2 + exit 1 + fi + + current_version="$(awk '$1 == "version:" { print $2; exit }' "${{ env.CHART_PATH }}/Chart.yaml")" + if [[ -z "${current_version}" ]]; then + echo "failed to resolve current chart version from ${{ env.CHART_PATH }}/Chart.yaml" >&2 + exit 1 + fi + + if git cat-file -e "${before_sha}:${{ env.CHART_PATH }}/Chart.yaml" 2>/dev/null; then + previous_version="$(git show "${before_sha}:${{ env.CHART_PATH }}/Chart.yaml" | awk '$1 == "version:" { print $2; exit }')" + else + previous_version="" + fi + + if [[ -z "${previous_version}" || "${previous_version}" != "${current_version}" ]]; then + version_changed=true + else + version_changed=false + fi + + { + echo "previous_version=${previous_version}" + echo "current_version=${current_version}" + echo "version_changed=${version_changed}" + } >>"$GITHUB_OUTPUT" + + helm-release: + needs: + - detect-chart-version + if: >- + always() && + (github.event_name == 'workflow_dispatch' || + startsWith(github.ref, 'refs/tags/') || + needs.detect-chart-version.outputs.version_changed == 'true') + permissions: + contents: write + packages: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v5.0.0 + with: + version: ${{ env.HELM_VERSION }} + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: go.mod + + - name: Set up helm-docs + uses: gabe565/setup-helm-docs-action@v1 + with: + version: v1.14.2 + + - name: Verify Helm chart before release writes + run: | + make verify-helm-chart + make verify-helm-release-path + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Ensure gh-pages branch exists + shell: bash + run: | + set -euo pipefail + + if git ls-remote --exit-code --heads origin gh-pages >/dev/null 2>&1; then + echo "origin/gh-pages already exists" + exit 0 + fi + + workdir="$(mktemp -d)" + git worktree add --detach "${workdir}" HEAD + + pushd "${workdir}" + git switch --orphan gh-pages + git rm -rf . >/dev/null 2>&1 || true + touch .nojekyll + git add .nojekyll + git commit -m "chore: initialize gh-pages branch" + git push origin gh-pages + popd + + git worktree remove --force "${workdir}" + git fetch origin gh-pages + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.6.0 + with: + charts_dir: charts + skip_existing: true + env: + CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish Helm chart to GHCR + shell: bash + env: + GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + + namespace="${GITHUB_REPOSITORY_OWNER,,}" + chart_version="$(awk '$1 == "version:" { print $2; exit }' "${{ env.CHART_PATH }}/Chart.yaml")" + + if [[ -z "${chart_version}" ]]; then + echo "failed to resolve chart version for ${{ env.CHART_NAME }}" >&2 + exit 1 + fi + + echo "${GHCR_TOKEN}" | helm registry login ghcr.io --username "${GITHUB_ACTOR}" --password-stdin + chart_ref="oci://ghcr.io/${namespace}/charts/${{ env.CHART_NAME }}" + lookup_error="$(mktemp)" + + if helm show chart "${chart_ref}" --version "${chart_version}" >/dev/null 2>"${lookup_error}"; then + echo "${chart_ref}:${chart_version} already exists; skipping GHCR push" + exit 0 + fi + + if ! grep -Eqi 'not found|manifest unknown' "${lookup_error}"; then + echo "failed to query ${chart_ref}:${chart_version}" >&2 + cat "${lookup_error}" >&2 + exit 1 + fi + + mkdir -p .cr-release-packages + helm package "${{ env.CHART_PATH }}" --destination .cr-release-packages + package_path=".cr-release-packages/${{ env.CHART_NAME }}-${chart_version}.tgz" + + if [[ ! -f "${package_path}" ]]; then + echo "failed to package chart for ${{ env.CHART_NAME }}" >&2 + exit 1 + fi + + helm push "${package_path}" "oci://ghcr.io/${namespace}/charts" diff --git a/.github/workflows/helm-lint.yaml b/.github/workflows/helm-lint.yaml new file mode 100644 index 0000000..2f93f99 --- /dev/null +++ b/.github/workflows/helm-lint.yaml @@ -0,0 +1,89 @@ +name: Helm Lint + +on: + pull_request: + branches: + - main + +env: + HELM_VERSION: "v3.20.0" + +permissions: + contents: read + pull-requests: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + outputs: + helm: ${{ steps.filter.outputs.helm }} + steps: + - name: Detect Helm changes + uses: dorny/paths-filter@v4 + id: filter + with: + filters: | + helm: + - 'charts/ascend-device-plugin/**' + - 'Makefile' + - '.github/workflows/helm-lint.yaml' + - '.github/workflows/build-helm-release.yaml' + + lint-test: + runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.helm == 'true' + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Set up Helm + uses: azure/setup-helm@v5.0.0 + with: + version: ${{ env.HELM_VERSION }} + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: go.mod + + - name: Set up helm-docs + uses: gabe565/setup-helm-docs-action@v1 + with: + version: v1.14.2 + + - name: Run Helm chart verification + run: | + make verify-helm-chart + make verify-helm-release-path + + helm-lint-required: + runs-on: ubuntu-latest + needs: + - changes + - lint-test + if: always() + steps: + - name: Check Helm workflow result + shell: bash + run: | + if [[ "${{ needs.changes.result }}" != "success" ]]; then + echo "Helm change detection did not complete successfully: ${{ needs.changes.result }}" + exit 1 + fi + + if [[ "${{ needs.changes.outputs.helm }}" != "true" ]]; then + echo "No Helm-relevant changes." + exit 0 + fi + + if [[ "${{ needs.lint-test.result }}" != "success" ]]; then + echo "Helm verification did not complete successfully: ${{ needs.lint-test.result }}" + exit 1 + fi diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6144afb --- /dev/null +++ b/.gitignore @@ -0,0 +1,75 @@ +### Linux template +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Go template +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work +go.work.sum + +# env file +.env + +### macOS template +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + + +### Custom +.idea/ +.vscode/ +.worktree/ diff --git a/Makefile b/Makefile index 1bb2037..c7c7bbf 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,47 @@ lint: ascend-device-plugin: $(GO) build $(BUILDARGS) -o ./ascend-device-plugin ./cmd/main.go +.PHONY: update-chart-docs +update-chart-docs: + cd charts/ascend-device-plugin && helm-docs --skip-version-footer + cd charts/ascend-device-plugin && $(GO) run github.com/losisin/helm-values-schema-json@v1.9.2 -input values.yaml -output values.schema.json + +.PHONY: verify-helm-chart +verify-helm-chart: + $(MAKE) update-chart-docs + git diff --exit-code -- charts/ascend-device-plugin/README.md charts/ascend-device-plugin/values.schema.json + @set -eu; \ + manifest="$$(mktemp)"; \ + trap 'rm -f "$$manifest"' EXIT; \ + helm lint --strict charts/ascend-device-plugin; \ + helm template ascend-device-plugin charts/ascend-device-plugin >"$$manifest"; \ + awk '/^[[:space:]]+args:$$/ { in_args = 1; next } in_args && /^[[:space:]]*$$/ { next } in_args && /^[[:space:]]+- / { value = $$0; sub(/^[[:space:]]+- /, "", value); args[++count] = value; next } in_args { in_args = 0 } END { exit !(args[1] == "--config_file" && args[2] == "/device-config.yaml" && args[3] == "--node_config_file" && args[4] == "/node-config.yaml" && args[5] == "--v=4") }' "$$manifest"; \ + if helm lint --strict charts/ascend-device-plugin --set image=null >/dev/null 2>&1; then echo 'null image value was accepted' >&2; exit 1; fi; \ + if helm lint --strict charts/ascend-device-plugin --set daemonSet=null >/dev/null 2>&1; then echo 'null daemonSet value was accepted' >&2; exit 1; fi; \ + if helm lint --strict charts/ascend-device-plugin --set image.repository= >/dev/null 2>&1; then echo 'empty image repository was accepted' >&2; exit 1; fi; \ + if helm lint --strict charts/ascend-device-plugin --set image.pullPolicy=Sometimes >/dev/null 2>&1; then echo 'invalid image pull policy was accepted' >&2; exit 1; fi; \ + if helm lint --strict charts/ascend-device-plugin --set image.unexpected=value >/dev/null 2>&1; then echo 'unknown image value was accepted' >&2; exit 1; fi; \ + if helm template ascend-device-plugin charts/ascend-device-plugin --kube-version 1.19.16 >/dev/null 2>&1; then echo 'unsupported Kubernetes version was accepted' >&2; exit 1; fi + +.PHONY: verify-helm-release-path +verify-helm-release-path: + @set -eu; \ + packages="$$(mktemp -d)"; \ + trap 'rm -rf "$$packages"' EXIT; \ + chart_version="$$(awk '$$1 == "version:" { print $$2; exit }' charts/ascend-device-plugin/Chart.yaml)"; \ + if [ -z "$$chart_version" ]; then echo 'failed to resolve chart version' >&2; exit 1; fi; \ + helm package charts/ascend-device-plugin --destination "$$packages" >/dev/null; \ + package_path="$$packages/ascend-device-plugin-$$chart_version.tgz"; \ + test -f "$$package_path"; \ + helm show chart "$$package_path" >/dev/null; \ + grep -Fq 'uses: helm/chart-releaser-action@v1.6.0' .github/workflows/build-helm-release.yaml; \ + grep -Fq 'charts_dir: charts' .github/workflows/build-helm-release.yaml; \ + if grep -Eq '^[[:space:]]*skip_packaging:[[:space:]]*true' .github/workflows/build-helm-release.yaml; then echo 'chart-releaser skip_packaging must remain disabled' >&2; exit 1; fi; \ + show_line="$$(grep -n 'helm show chart' .github/workflows/build-helm-release.yaml | cut -d: -f1)"; \ + package_line="$$(grep -n 'helm package "$${{ env.CHART_PATH }}" --destination .cr-release-packages' .github/workflows/build-helm-release.yaml | cut -d: -f1)"; \ + if [ -z "$$show_line" ] || [ -z "$$package_line" ] || [ "$$show_line" -ge "$$package_line" ]; then echo 'GHCR existence check must precede packaging' >&2; exit 1; fi + clean: rm -rf ./ascend-device-plugin -.PHONY: all tidy test lint clean \ No newline at end of file +.PHONY: all tidy test lint clean update-chart-docs verify-helm-chart verify-helm-release-path diff --git a/charts/ascend-device-plugin/Chart.yaml b/charts/ascend-device-plugin/Chart.yaml index ec1fe64..3676309 100644 --- a/charts/ascend-device-plugin/Chart.yaml +++ b/charts/ascend-device-plugin/Chart.yaml @@ -4,3 +4,4 @@ description: HAMi Ascend device plugin type: application version: 0.1.0 appVersion: v1.4.0 +kubeVersion: ">=1.20.0-0" diff --git a/charts/ascend-device-plugin/README.md b/charts/ascend-device-plugin/README.md index 82c9b29..20978c0 100644 --- a/charts/ascend-device-plugin/README.md +++ b/charts/ascend-device-plugin/README.md @@ -1,4 +1,8 @@ -# Ascend Device Plugin Helm Chart +# ascend-device-plugin + +![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.4.0](https://img.shields.io/badge/AppVersion-v1.4.0-informational?style=flat-square) + +HAMi Ascend device plugin This chart deploys the standalone HAMi Ascend device plugin manifests: @@ -19,8 +23,7 @@ Install the chart: ```bash helm install ascend-device-plugin ./charts/ascend-device-plugin \ - --namespace kube-system \ - --set image.tag=v1.4.0 + --namespace kube-system ``` If the HAMi chart already manages the Ascend device plugin DaemonSet, related ConfigMaps, RBAC, or RuntimeClass, do not deploy this standalone chart at the same time. @@ -32,7 +35,6 @@ If another chart, such as the HAMi chart, already owns the shared `hami-schedule ```bash helm install ascend-device-plugin ./charts/ascend-device-plugin \ --namespace kube-system \ - --set image.tag=v1.4.0 \ --set config.create=false \ --set config.existingDeviceConfigMapName=hami-scheduler-device ``` @@ -46,14 +48,9 @@ Enable the global `vnpus.hamiVnpuCore` switch in the generated device config: ```bash helm install ascend-device-plugin ./charts/ascend-device-plugin \ --namespace kube-system \ - --set image.tag=v1.4.0 \ --set hamiVnpuCore.enabled=true ``` -## Monitoring - -In `hami-vnpu-core` (soft slicing) mode, the device plugin exposes Prometheus-format metrics on `:9395/metrics` (container port `monitorport`). Wiring this up to your own Prometheus (Service, ServiceMonitor/PodMonitor, alerting/recording rules, etc.) is outside the scope of this chart — point your monitoring stack at that port however it expects. - ## Node Configuration Override `nodeConfig` to enable or customize `hami-vnpu-core` per node: @@ -65,3 +62,37 @@ nodeConfig: |- hami-vnpu-core: true vDeviceCount: 8 ``` + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| config.create | bool | `true` | Create the device configuration ConfigMap. | +| config.deviceConfigMapName | string | `"hami-scheduler-device"` | Name of the chart-managed device configuration ConfigMap. | +| config.existingDeviceConfigMapName | string | `""` | Existing device configuration ConfigMap to mount instead of the chart-managed ConfigMap. | +| daemonSet.args[0] | string | `"--config_file"` | | +| daemonSet.args[1] | string | `"/device-config.yaml"` | | +| daemonSet.args[2] | string | `"--node_config_file"` | | +| daemonSet.args[3] | string | `"/node-config.yaml"` | | +| daemonSet.args[4] | string | `"--v=4"` | | +| daemonSet.name | string | `"hami-ascend-device-plugin"` | Device plugin DaemonSet name. | +| fullnameOverride | string | `""` | Override the fully qualified resource name. | +| hamiVnpuCore.enabled | bool | `false` | Enable hami-vnpu-core in the generated global device configuration. | +| image.pullPolicy | string | `"IfNotPresent"` | Kubernetes image pull policy. | +| image.repository | string | `"projecthami/ascend-device-plugin"` | Container image repository. | +| image.tag | string | `""` | Container image tag. Defaults to the chart `appVersion` when empty. | +| nameOverride | string | `""` | Override the chart name used in resource names. | +| nodeConfig | string | `"nodes: []"` | Per-node hami-vnpu-core configuration written to the node ConfigMap. | +| nodeConfigMap.create | bool | `true` | Create the per-node configuration ConfigMap. | +| nodeConfigMap.name | string | `"hami-device-node-config"` | Per-node configuration ConfigMap name. | +| nodeSelector.ascend | string | `"on"` | Node label value used to schedule the device plugin. | +| rbac.name | string | `"hami-ascend"` | Name shared by the chart-managed RBAC resources. | +| resources.limits.cpu | string | `"500m"` | | +| resources.limits.memory | string | `"500Mi"` | | +| resources.requests.cpu | string | `"500m"` | | +| resources.requests.memory | string | `"500Mi"` | | +| runtimeClass.create | bool | `true` | Create the Ascend RuntimeClass. | +| runtimeClass.handler | string | `"ascend"` | Container runtime handler used by the RuntimeClass. | +| runtimeClass.name | string | `"ascend"` | RuntimeClass resource name. | +| serviceAccount.create | bool | `true` | Create a ServiceAccount for the device plugin. | +| serviceAccount.name | string | `"hami-ascend"` | ServiceAccount name. Defaults to the chart fullname when empty and creation is enabled. | diff --git a/charts/ascend-device-plugin/README.md.gotmpl b/charts/ascend-device-plugin/README.md.gotmpl new file mode 100644 index 0000000..1cf9dae --- /dev/null +++ b/charts/ascend-device-plugin/README.md.gotmpl @@ -0,0 +1,66 @@ +{{ template "chart.header" . }} + +{{ template "chart.versionBadge" . }} {{ template "chart.typeBadge" . }} {{ template "chart.appVersionBadge" . }} + +{{ template "chart.description" . }} + +This chart deploys the standalone HAMi Ascend device plugin manifests: + +- RuntimeClass +- ConfigMaps +- RBAC and ServiceAccount +- Device plugin DaemonSet + +## Install + +Label Ascend nodes before installing: + +```bash +kubectl label node ascend=on --overwrite +``` + +Install the chart: + +```bash +helm install ascend-device-plugin ./charts/ascend-device-plugin \ + --namespace kube-system +``` + +If the HAMi chart already manages the Ascend device plugin DaemonSet, related ConfigMaps, RBAC, or RuntimeClass, do not deploy this standalone chart at the same time. + +## Existing Device Configuration + +If another chart, such as the HAMi chart, already owns the shared `hami-scheduler-device` ConfigMap, reuse it instead of creating another one: + +```bash +helm install ascend-device-plugin ./charts/ascend-device-plugin \ + --namespace kube-system \ + --set config.create=false \ + --set config.existingDeviceConfigMapName=hami-scheduler-device +``` + +With this mode, the chart mounts the existing device config and still manages `hami-device-node-config` by default. + +## hami-vnpu-core + +Enable the global `vnpus.hamiVnpuCore` switch in the generated device config: + +```bash +helm install ascend-device-plugin ./charts/ascend-device-plugin \ + --namespace kube-system \ + --set hamiVnpuCore.enabled=true +``` + +## Node Configuration + +Override `nodeConfig` to enable or customize `hami-vnpu-core` per node: + +```yaml +nodeConfig: |- + nodes: + - name: "ascend-node-1" + hami-vnpu-core: true + vDeviceCount: 8 +``` + +{{ template "chart.valuesSection" . }} diff --git a/charts/ascend-device-plugin/values.schema.json b/charts/ascend-device-plugin/values.schema.json new file mode 100644 index 0000000..2d706cc --- /dev/null +++ b/charts/ascend-device-plugin/values.schema.json @@ -0,0 +1,212 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "required": [ + "image", + "daemonSet", + "rbac", + "runtimeClass", + "serviceAccount", + "nodeSelector", + "resources", + "config", + "nodeConfigMap", + "hamiVnpuCore", + "deviceConfig", + "nodeConfig" + ], + "properties": { + "config": { + "type": "object", + "required": [ + "create", + "existingDeviceConfigMapName", + "deviceConfigMapName" + ], + "properties": { + "create": { + "type": "boolean" + }, + "deviceConfigMapName": { + "type": "string" + }, + "existingDeviceConfigMapName": { + "type": "string" + } + }, + "additionalProperties": false + }, + "daemonSet": { + "type": "object", + "required": [ + "name", + "args" + ], + "properties": { + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false + }, + "deviceConfig": { + "type": "string" + }, + "fullnameOverride": { + "type": "string" + }, + "hamiVnpuCore": { + "type": "object", + "required": [ + "enabled" + ], + "properties": { + "enabled": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "image": { + "type": "object", + "required": [ + "repository", + "pullPolicy" + ], + "properties": { + "pullPolicy": { + "type": "string", + "enum": [ + "Always", + "IfNotPresent", + "Never" + ] + }, + "repository": { + "type": "string", + "minLength": 1 + }, + "tag": { + "type": "string" + } + }, + "additionalProperties": false + }, + "nameOverride": { + "type": "string" + }, + "nodeConfig": { + "type": "string" + }, + "nodeConfigMap": { + "type": "object", + "required": [ + "create", + "name" + ], + "properties": { + "create": { + "type": "boolean" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false + }, + "nodeSelector": { + "type": "object", + "properties": { + "ascend": { + "type": "string" + } + } + }, + "rbac": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resources": { + "type": "object", + "required": [ + "requests", + "limits" + ], + "properties": { + "limits": { + "type": "object", + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + } + }, + "requests": { + "type": "object", + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + "runtimeClass": { + "type": "object", + "required": [ + "create", + "name", + "handler" + ], + "properties": { + "create": { + "type": "boolean" + }, + "handler": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false + }, + "serviceAccount": { + "type": "object", + "required": [ + "create", + "name" + ], + "properties": { + "create": { + "type": "boolean" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + } +} diff --git a/charts/ascend-device-plugin/values.yaml b/charts/ascend-device-plugin/values.yaml index 68b973a..21642e3 100644 --- a/charts/ascend-device-plugin/values.yaml +++ b/charts/ascend-device-plugin/values.yaml @@ -1,54 +1,85 @@ -image: - repository: projecthami/ascend-device-plugin +image: # @schema required:true;additionalProperties:false + # image.repository -- Container image repository. + repository: projecthami/ascend-device-plugin # @schema required:true;minLength:1 + + # image.tag -- Container image tag. Defaults to the chart `appVersion` when empty. tag: "" - pullPolicy: IfNotPresent + # image.pullPolicy -- Kubernetes image pull policy. + pullPolicy: IfNotPresent # @schema required:true;enum:[Always, IfNotPresent, Never] + +# nameOverride -- Override the chart name used in resource names. nameOverride: "" + +# fullnameOverride -- Override the fully qualified resource name. fullnameOverride: "" -daemonSet: - name: hami-ascend-device-plugin - args: +daemonSet: # @schema required:true;additionalProperties:false + # daemonSet.name -- Device plugin DaemonSet name. + name: hami-ascend-device-plugin # @schema required:true + args: # @schema required:true - --config_file - /device-config.yaml + - --node_config_file + - /node-config.yaml - --v=4 -rbac: - name: hami-ascend +rbac: # @schema required:true;additionalProperties:false + # rbac.name -- Name shared by the chart-managed RBAC resources. + name: hami-ascend # @schema required:true + +runtimeClass: # @schema required:true;additionalProperties:false + # runtimeClass.create -- Create the Ascend RuntimeClass. + create: true # @schema required:true + + # runtimeClass.name -- RuntimeClass resource name. + name: ascend # @schema required:true -runtimeClass: - create: true - name: ascend - handler: ascend + # runtimeClass.handler -- Container runtime handler used by the RuntimeClass. + handler: ascend # @schema required:true -serviceAccount: - create: true - name: hami-ascend +serviceAccount: # @schema required:true;additionalProperties:false + # serviceAccount.create -- Create a ServiceAccount for the device plugin. + create: true # @schema required:true -nodeSelector: + # serviceAccount.name -- ServiceAccount name. Defaults to the chart fullname when empty and creation is enabled. + name: hami-ascend # @schema required:true + +nodeSelector: # @schema required:true + # nodeSelector.ascend -- Node label value used to schedule the device plugin. ascend: "on" -resources: - requests: +resources: # @schema required:true;additionalProperties:false + requests: # @schema required:true memory: 500Mi cpu: 500m - limits: + limits: # @schema required:true memory: 500Mi cpu: 500m -config: - create: true - existingDeviceConfigMapName: "" - deviceConfigMapName: hami-scheduler-device +config: # @schema required:true;additionalProperties:false + # config.create -- Create the device configuration ConfigMap. + create: true # @schema required:true + + # config.existingDeviceConfigMapName -- Existing device configuration ConfigMap to mount instead of the chart-managed ConfigMap. + existingDeviceConfigMapName: "" # @schema required:true + + # config.deviceConfigMapName -- Name of the chart-managed device configuration ConfigMap. + deviceConfigMapName: hami-scheduler-device # @schema required:true + +nodeConfigMap: # @schema required:true;additionalProperties:false + # nodeConfigMap.create -- Create the per-node configuration ConfigMap. + create: true # @schema required:true -nodeConfigMap: - create: true - name: hami-device-node-config + # nodeConfigMap.name -- Per-node configuration ConfigMap name. + name: hami-device-node-config # @schema required:true -hamiVnpuCore: - enabled: false +hamiVnpuCore: # @schema required:true;additionalProperties:false + # hamiVnpuCore.enabled -- Enable hami-vnpu-core in the generated global device configuration. + enabled: false # @schema required:true -deviceConfig: |- +# @ignored +deviceConfig: |- # @schema required:true vnpus: hamiVnpuCore: {{ .Values.hamiVnpuCore.enabled }} configs: @@ -176,5 +207,6 @@ deviceConfig: |- aiCore: 20 aiCPU: 7 -nodeConfig: |- +# nodeConfig -- Per-node hami-vnpu-core configuration written to the node ConfigMap. +nodeConfig: |- # @schema required:true nodes: [] diff --git a/docs/volcano.md b/docs/volcano.md index 73a2892..ced6d06 100644 --- a/docs/volcano.md +++ b/docs/volcano.md @@ -6,7 +6,7 @@ This guide covers deploying `ascend-device-plugin` for use with the [Volcano](ht ## Prerequisites -- **Kubernetes**: ≥ 1.16 +- **Kubernetes**: ≥ 1.20 - **Volcano**: ≥ 1.14 (≥ 1.16 required for `hami-core` soft slicing) - [ascend-docker-runtime](https://gitcode.com/Ascend/mind-cluster/tree/master/component/ascend-docker-runtime) - **Ascend Driver Version**: ≥ 25.5 diff --git a/docs/volcano_cn.md b/docs/volcano_cn.md index 31c991d..8f601c8 100644 --- a/docs/volcano_cn.md +++ b/docs/volcano_cn.md @@ -6,7 +6,7 @@ ## 环境要求 -- **Kubernetes**:≥ 1.16 +- **Kubernetes**:≥ 1.20 - **Volcano**:≥ 1.14(`hami-core` 软切分需要 ≥ 1.16) - [ascend-docker-runtime](https://gitcode.com/Ascend/mind-cluster/tree/master/component/ascend-docker-runtime) - Ascend 驱动版本:≥ 25.5 @@ -165,4 +165,3 @@ curl -s $POD_IP:9395/metrics | grep hami_ | `hami_vgpu_memory_used_bytes` | `namespace`, `pod`, `container`, `vdevice_index`, `device_uuid` | 每容器 vNPU 已用显存(字节) | | `hami_vgpu_memory_limit_bytes` | `namespace`, `pod`, `container`, `vdevice_index`, `device_uuid` | 每容器 vNPU 显存上限(字节) | | `hami_container_device_utilization_ratio` | `namespace`, `pod`, `container`, `vdevice_index`, `device_uuid` | 容器所在设备的 AICore 利用率(0–100) | -