Split API into a standalone Go module - #2882
aryangorwade wants to merge 8 commits into
Conversation
470d8a1 to
0acdb89
Compare
| github.com/Masterminds/sprig/v3 v3.3.0 | ||
| github.com/NVIDIA/go-nvlib v0.12.0 | ||
| github.com/NVIDIA/k8s-kata-manager v0.2.3 | ||
| github.com/NVIDIA/gpu-operator/api v0.2603.3 |
There was a problem hiding this comment.
Should this be changed to a psuedo-verison v0.0.0-00010101000000-000000000000 that is not updated in any version-bump PRs? If changes were made to /api after say release 26.03.3, but those changes are not part of any current release; this could incorrectly point to a stale older API version.
A problem is that this would result in a built image's embedded binary reporting a psuedo-version and failing CVE scans. That is what currently happens with the gpu-operator and most of our Go products anyways
There was a problem hiding this comment.
A problem is that this would result in a built image's embedded binary reporting a psuedo-version and failing CVE scans.
I'm not sure setting a version for github.com/NVIDIA/gpu-operator/api has any effect on the version embedded for the gpu-operator binary. I think a pseudo-version will be embedded for the main binary regardless of what version a dependency is declared as.
There was a problem hiding this comment.
Makes sense. #428 would only apply to the main binary which is the gpu operator.
📝 WalkthroughWalkthroughThe repository now contains a separate Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to A release PR can bypass API-tag collision validation by using a different title, risking an invalid release. The lint suppression can also hide new deprecated API usage. Resolve these checks before merge. ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Note
Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.
🟡 Other comments (1)
.golangci.yml-30-30 (1)
30-30: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winLimit the SA1019 exclusion to the known compatibility sites.
This rule has no path restriction. Both lint commands scan root and API packages with this configuration, so any matching
.ConfigMapNameor.Namediagnostic outside the compatibility sites will be silently excluded. Restore a path restriction or narrow the exclusion to the affected legacy types so CI reports reintroduced deprecated uses.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: QUIET
Plan: Enterprise
Run ID: c6cb07c3-751f-40f4-a465-f56bb1f4e5ad
⛔ Files ignored due to path filters (23)
api/go.sumis excluded by!**/*.sumvendor/github.com/NVIDIA/gpu-operator/api/image/image.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/nvidia/v1/clusterpolicy_types.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/nvidia/v1/groupversion_info.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/nvidia/v1/zz_generated.deepcopy.gois excluded by!vendor/**,!**/zz_generated.*.govendor/github.com/NVIDIA/gpu-operator/api/nvidia/v1alpha1/gpucluster_types.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/nvidia/v1alpha1/groupversion_info.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/nvidia/v1alpha1/nvidiadriver_types.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/nvidia/v1alpha1/zz_generated.deepcopy.gois excluded by!vendor/**,!**/zz_generated.*.govendor/github.com/NVIDIA/gpu-operator/api/versioned/clientset.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/versioned/scheme/doc.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/versioned/scheme/register.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/versioned/typed/nvidia/v1/clusterpolicy.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/versioned/typed/nvidia/v1/doc.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/versioned/typed/nvidia/v1/generated_expansion.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/versioned/typed/nvidia/v1/nvidia_client.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/versioned/typed/nvidia/v1alpha1/doc.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/versioned/typed/nvidia/v1alpha1/generated_expansion.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/versioned/typed/nvidia/v1alpha1/gpucluster.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/versioned/typed/nvidia/v1alpha1/nvidia_client.gois excluded by!vendor/**vendor/github.com/NVIDIA/gpu-operator/api/versioned/typed/nvidia/v1alpha1/nvidiadriver.gois excluded by!vendor/**vendor/k8s.io/client-go/discovery/fake/discovery.gois excluded by!vendor/**vendor/modules.txtis excluded by!vendor/**
📒 Files selected for processing (36)
.common-ci.yml.github/dependabot.yml.github/workflows/api-post-tag-validation.yaml.github/workflows/api-release-checks.yaml.golangci.yml.nvidia-ci.ymlMakefileapi/go.modapi/image/image.goapi/image/imagepath_validation_test.goapi/nvidia/v1alpha1/nvidiadriver_types.gocontrollers/clusterpolicy_controller.gocontrollers/clusterpolicy_controller_test.gocontrollers/nodelabeling_controller.gocontrollers/nodelabeling_controller_test.gocontrollers/object_controls_test.gocontrollers/upgrade_controller.gocontrollers/upgrade_controller_test.godocker/Dockerfile.develgo.modhack/validate-api-version-unpublished.shhack/validate-published-api-module.shhack/validate-shared-dependencies.shinternal/consts/consts.gointernal/nvidiadriver/nvidiadriver.gointernal/nvidiadriver/nvidiadriver_errors_test.gointernal/nvidiadriver/nvidiadriver_test.gointernal/state/configurable_state.gointernal/state/dra_driver.gointernal/state/driver.gointernal/state/driver_manifest_test.gointernal/state/driver_test.gointernal/state/nodepool.gointernal/state/nodepool_test.gointernal/validator/validator_test.gotools/generate-third-party-notices.sh
💤 Files with no reviewable changes (1)
- internal/consts/consts.go
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.
| contains(github.event.pull_request.title, 'operator') && | ||
| contains(github.event.pull_request.title, 'version') && | ||
| contains(github.event.pull_request.title, 'bump') |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,120p' .github/workflows/api-release-checks.yaml
rg -n --glob '!vendor/**' 'validate-api-version-unpublished|API Release Checks|operator.*version.*bump|OPERATOR_VERSION|api/v' .github Makefile hack versions.mk . 2>/dev/null | head -240Repository: NVIDIA/gpu-operator
Length of output: 10771
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- validator ---'
sed -n '1,220p' hack/validate-api-version-unpublished.sh
printf '%s\n' '--- make/version definitions ---'
sed -n '220,265p' Makefile
sed -n '1,180p' versions.mk
printf '%s\n' '--- release/version references ---'
rg -n -i --glob '!vendor/**' --glob '!third_party/**' '(version bump|bump.*version|release.*version|operator.*version|api.*tag|unpublished|pull request.*title|title.*operator)' .github README.md CONTRIBUTING.md AGENTS.md PROJECT Makefile hack versions.mk 2>/dev/null | head -300
printf '%s\n' '--- release workflow/template filenames ---'
git ls-files '.github' | rg -i '(release|pull|pr|version|api)'Repository: NVIDIA/gpu-operator
Length of output: 15870
🤖 get_repo_knowledge executed:
get_repo_knowledge NVIDIA/gpu-operator /tmp/coderabbit-repo-knowledge/nvidia-gpu-operator-eed98df4/conventions
Length of output: 4401
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- pull request template ---'
sed -n '1,220p' .github/PULL_REQUEST_TEMPLATE.md
printf '%s\n' '--- contributing release guidance ---'
sed -n '45,75p' CONTRIBUTING.md
printf '%s\n' '--- API post-tag validation workflow ---'
sed -n '1,110p' .github/workflows/api-post-tag-validation.yaml
printf '%s\n' '--- release workflow triggers and version inputs ---'
sed -n '1,75p' .github/workflows/release.yaml
sed -n '1,55p' .github/workflows/release-rc-assets.yamlRepository: NVIDIA/gpu-operator
Length of output: 8575
Run the API-tag check for version changes.
If a PR changes the API module version but its title does not contain all three required substrings, GitHub skips api-version-unpublished. The validator then does not check whether api/<version> already exists, so a title such as Release v25.3.0 can bypass this release check. The PR template does not require the current title format.
Gate the job on changed API version metadata, or use a required release signal that cannot be omitted by changing the title.
Relocate shared image path logic and NVIDIADriver constants so api/ no longer imports root internal packages ahead of becoming a standalone Go module. Signed-off-by: Aryan Gorwade <agorwade@nvidia.com>
Give API consumers a Go-compatible versioned module while keeping root development builds pinned to the local API source. Signed-off-by: Aryan Gorwade <agorwade@nvidia.com>
Signed-off-by: Aryan Gorwade <agorwade@nvidia.com>
Fail CI when direct dependencies shared by the root and API modules use different versions. Signed-off-by: Aryan Gorwade <agorwade@nvidia.com>
Verify operator and API tags share a commit and that released binaries record the independently downloadable API module version. Signed-off-by: Aryan Gorwade <agorwade@nvidia.com>
Have Dependabot update shared root and API dependencies together while preserving grouped Kubernetes upgrades. Signed-off-by: Aryan Gorwade <agorwade@nvidia.com>
Run the unpublished-tag check for pull requests whose titles identify an operator version bump. Signed-off-by: Aryan Gorwade <agorwade@nvidia.com>
Skip internal pipelines for API-only tags and prevent them from reaching Nspect or NGC publishing jobs. Signed-off-by: Aryan Gorwade <agorwade@nvidia.com>
0acdb89 to
dc78578
Compare
Description
This is a PR splitting
/apiinto a standalone module, as described in this design doc, this would serve to fix GPU Operator versioning issues (Go supportsv0.x.yandv1.x.y).This architectural split involves:
api/into/apito avoid circular importsgo.modandgo.sum; rootgo.modreferences this module nowCI checks introduced:
Changes to CI pipeline:
.nvidia-ci.yamland.common-ci.yamlto ensure that tagging a release commit with operator and api tags does not cause a separate release process to trigger for theapitag in addition to the operator tagDependabot changes:
dependabot.yamlusinggroup-by: dependency-nameand across-directorypattern to update each shared dependency between both modules in one PR (one PR per dependency; for both modules). Note that groups such ask8s.io/*can be created, resulting in one cross-directory PR for all deps underk8s.io/*.Checklist
make lint)make validate-generated-assets)make validate-modules)Testing
Tested building & deploying the operator on a cluster with some test workloads. Tested Makefile commands.