mirror of
https://github.com/dsx-ai-factory/nvke.git
synced 2026-12-07 04:35:58 +08:00
pull-request/2437
6
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3e8ca2590f |
refactor: rename the Go identifiers, packages and fixture paths that carried the old product name (#1453)
After the repository rename and the module-path change (#1449) the tree still carried the old name where it is ours alone: Go identifiers, two internal package names, import aliases, fixture and test-data directories, the e2e deploy overlays and a few deploy and hack scripts. None of these is a wire protocol, a persisted name or a user-typed value, so they change now, before the repository goes public, without a migration. Identifiers change as tokens, through a go/scanner pass, and in comments only on word boundaries, so every string value stays: NamespaceNVKESystem is still "nke-system" and the env and json struct tags keep their keys. Generated files are untouched and regenerate identically. The packages controller/internal/nkerbac and controller/test/e2e/internal/nke move with their import paths; the e2e deploy overlays, the nke-deploy.yaml files, deploy/nke-deploy.sh, deploy/lib/nke-deploy-items.py and the two hack scripts move with every reference; the twelve management-engine test-data directories move with the test prefixes that select them. Kept on purpose: the NKECluster types and their schema tests (the CRD kind), the UpdateNKERBAC rpc names and their tests (from the proto), the SubjectNKE release subject, agent/pkg/nkeauth and its record magic, and every nkectl name, which moves with the binary. Closes #1452 Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
7b1c662d56 |
test(oidc): add an in-process HTTPS issuer (#1414)
Signed-off-by: Steven Zhang <stevenzhang@nvidia.com> |
||
|
|
2a7c3fb2cc |
docs(api): generate the REST API Reference from openapi.yaml (#1172)
* chore(api): lint openapi.yaml and mark the internal surface for Fern Fern builds the REST API Reference tab of the documentation site from controller/api/openapi.yaml, and the docs team is about to move the prose of the "NKE REST API Reference" into that file. This is the tooling that has to be in place first. Lint gate. `make -C controller/api lint` now also runs `lint-spec`, which lints openapi.yaml with vacuum against openapi-lint.yaml. vacuum is a Spectral-compatible linter written in Go, so `go run` pins it the way generate.go pins gofumpt, with no install step; the version lives in make/tool-versions.mk with the other tools. Errors fail the gate: every example matches its schema, no component is unused, operationIds are unique. Warnings measure the prose the spec still lacks (16 operations and 40 properties without a description, 31 schemas, no tags) and fail nothing yet; each is raised to error once the prose port lands, so that coverage cannot regress afterwards. Rules the API breaks on purpose (camelCase paths and properties, a DELETE with a body, extensions beside `$ref`) are off, with the reason beside each. The one error it found is fixed here: the `nodePools` example on CreateClusterRequest named a `namePrefix` field that does not exist and had neither `name` nor `nodeNamePrefix`, both required. Internal surface. The `infra` provider, `teleportEnabled`, the legacy `controlPlane` node-pool flag, the `/osProfiles` and `/configProfiles` endpoints, and the schemas only they reach now carry `x-fern-ignore: true`. Fern leaves them out of the published reference; Swagger UI at /api/docs/ and the generated Go are unchanged. `x-fern-audiences` was the first choice and does not fit: `fern ir --audience public` returns an empty API unless every element is tagged, so a new endpoint would vanish from the customer docs by default. The ignore marker is opt-out, and the IR confirms it removes exactly the listed items. The two "exactly one of `nico` or `infra`" sentences move from the schema descriptions onto the `infra` properties, so the published reference, which does not show `infra`, no longer refers to it. Only comments change in the generated Go. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * fix(api): keep `infra` out of the text the customer reference shows The previous commit moved the "exactly one of `nico` or `infra`" sentences onto the `infra` properties and said the published reference no longer refers to `infra`. That was wrong on two counts, found by rendering the spec with Redoc and dumping Fern's intermediate representation. A description written beside a `$ref` is read by Fern and ignored by Redoc, Swagger UI and oapi-codegen, which show the referenced schema's description instead. So is `x-go-type-skip-optional-pointer` beside a `$ref`: the generated field was a pointer all along. And six schema descriptions that Fern does show still named `infra`: the control-plane create and update configs, the node pool update request, and the three NICo provider schemas. Those six no longer mention the other provider. The exclusivity rule now lives on the Infra* schemas, which the published reference omits and Swagger UI shows. The four `nico` and `infra` properties touched before wrap their `$ref` in `allOf`, so every reader applies the description, and drop the pointer extension that was never in effect; the generated Go changes only in comments. no-$ref-siblings moves from off to warn, with an accurate note, so the docs port can work the remaining 28 down. Verified: Fern IR has 0 docs strings mentioning `infra`; Redoc shows the new `nico` text and none of the old sentences; make -C controller/api lint passes with 0 errors. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * docs(api): port the REST API Reference prose into openapi.yaml The docs team wrote "NKE REST API Reference (Alpha) - Customer Edition" by hand. This moves its language into the spec, so the reference is generated from the file the code is generated from. The text is taken as written; claims the code contradicts are corrected in the commits that follow, each with its evidence, so the review can see both. What moved: the info block (title, version, and the conventions: base URL, authentication, errors, asynchronous operations, PATCH merge semantics, lists, unauthenticated endpoints); tags carrying the concept text (infrastructure provider, Kubernetes versions, networking, control plane, OS releases); a summary, a description and the documented 400 and 409 rules for each of the 22 operations; request examples for the five writes and response examples for the error cases the PDF shows; path and query parameter text; and a description for every schema and property. Structure is unchanged: no required list, enum, pattern or bound moved, no schema was renamed, and the health endpoints stay out of `paths`. They are described in the info block instead, because the generated router would mount them under /api. Every property whose `$ref` had sibling keys now wraps the `$ref` in `allOf`: Redoc, Swagger UI and oapi-codegen ignore the siblings and Fern reads them, so this is the only form all four render. The `x-order` and `x-go-type-skip-optional-pointer` keys beside those `$ref`s are dropped, since neither ever applied there. The generated Go changes only in comments; struct fields keep their order. vacuum reports no warnings left. Its coverage rules are raised to errors in a later commit. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * docs(api): configProfile is required, the PDF left it out The PDF never mentions `nico.configProfile`, and its create examples omit it. The server requires it: a NICo node pool without one is rejected ("nico.configProfile is required when creating a nico node pool", controller/internal/server/node_pools.go:298), and so is a control plane ("controlPlaneConfig.nico.configProfile is required for a nico cluster control plane", cluster_control_plane_config.go:206 and :239). Every example in the PDF would have failed with 400. The field is now described as required on the node pool and control-plane create schemas, the two create operations list it among their 400 causes, and the three request examples carry it. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * docs(api): describe OS profiles as the controller resolves them today The PDF describes `osProfile` as the name of a release in an Operator curated catalog of MachineImage, ClusterRelease and NodePoolRelease entries, managed with nkectl. Those kinds exist as CRDs in management-engine/ (#1085, 2026-09-29), but nothing consumes them yet: management-engine/README.md says lifecycle reconciliation and the public API are not implemented, and the controller still reads OS profiles from its profiles directory (controller/internal/server/os_profiles.go:35), supplied by the Operator as described in controller/profiles/README.md. The reference now says what the API does today: `osProfile` and `configProfile` name profiles the Operator supplies to the management plane, and changing `osProfile` rolls the affected nodes. The catalog text returns when the controller resolves names against it. Example names follow the example bundle in controller/profiles/example. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * docs(api): use the server's real error messages in the examples Three error examples in the PDF are paraphrases. The server says: "cluster update rejected: <op> in progress since <time>" (controller/internal/server/clusters.go:67), "Cannot create node pool when parent cluster is deleting" (node_pools.go:173), and for a control-plane delete that would breach the minimum, the sentence in controller/internal/nodes/control_plane_delete_request.go:57. ClusterConditions also listed `upgrading` as required, a property the schema does not define. The PDF's required list (provisioning, provisioned, deleting) is the correct one. Nothing in the generated Go refers to it, so only the spec changes. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * chore(api): make the OpenAPI prose coverage rules errors With the REST API Reference prose in the spec, vacuum reports nothing. The coverage rules that were warnings so the gate could land first now fail the gate: every operation, parameter, schema and property has a description, and no description sits beside a bare `$ref`. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * docs(api): quote the node-name pattern so renderers do not eat the angle brackets Redoc rendered "Node names are <cluster>-<prefix>-<NNNN>" as "Node names are --": markdown treats the angle brackets as HTML tags. Backticks keep them. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * docs: make fern check pass and pin the Fern CLI `fern check` could not run: fern/docs.yml named a `components` directory that does not exist in the repository, so the checker failed to initialize. With that line gone it ran, and reported three broken links, all pointing at repository directories the documentation site cannot serve. They now point at the directories on GitHub. fern/fern.config.json pinned the CLI to `latest`; it now pins the version CI runs, which make/tool-versions.mk carries as FERN_VERSION. Related: Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> #330. * ci(api): render the REST API Reference with Redocly and check the docs site `make -C controller/api docs` renders openapi.yaml into one self-contained HTML page with Redocly. It bundles first, because `build-docs` applies no decorators, and redocly.yaml's `remove-x-internal` decorator is pointed at `x-fern-ignore`, so the page drops the same surface the Fern site drops. The output lands in controller/.local/, which git ignores. Node is required; npx fetches the pinned CLI. The new `API docs` workflow is advisory: it builds that page on every pull request that touches the spec or the docs and uploads it as the `api-reference` artifact, runs `fern check`, and on main publishes the Fern site when FERN_TOKEN is set. The secret is not configured yet, so that step is skipped and says so. Publishing needs a secret, which the workflow design guide keeps out of the required gate; that is why this is not a merge-gate member. Both CLIs are pinned in make/tool-versions.mk. The runner's preinstalled Node is used rather than a new pinned setup action. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * fix(api): keep request-schema $ref properties bare Wrapping a request property's `$ref` in `allOf` changed the 400 body. kin-openapi reports a failure inside an `allOf` as a raw schema error, "Error at \"/controlPlaneConfig\": Doesn't match schema \"not\"" followed by a dump of the schema, instead of the one-line "request body has an error: ..." message, and the middleware passes it through whole. TestOpenAPIValidator_CreateRequiresExactlyOneProvider caught it: the control-plane cases no longer carried the request-body prefix the test uses to tell a schema rejection from a handler rejection. The fifteen `$ref` properties in request schemas are bare again, with their prose on the referenced schemas, which every renderer shows. The response schemas keep the `allOf` form; nothing validates responses. The sibling rule is an error, with the five deliberate `x-fern-ignore` siblings on the `infra` properties listed in openapi-lint-ignore.yaml. The generated Go changes only in comments. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * build(api): regenerate with the Go toolchain api/go.mod declares generate-check failed on the pull request while passing locally and on the Linux box. The embedded copy of openapi.yaml in server.gen.go is gzip-compressed, and compress/flate output differs between Go releases: the workspace asks for Go 1.27.1, so a developer regenerating in the workspace produces one blob, while generate-check.yml installs the 1.26.5 that controller/api/go.mod declares and produces another. `make -C controller generate-api` now runs the generator with GOWORK=off, since the api module is self-contained, and GOTOOLCHAIN pinned to the version api/go.mod declares, so every developer regenerates the bytes the gate expects. server.gen.go is regenerated that way here; only the embedded blob changes. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * docs: render the tag descriptions in the Fern API tab controller/api/openapi.yaml now carries the concept text on its tags. `tag-description-pages: true` makes Fern render each tag description as the intro of its section in the REST API Reference, so that text ships with the reference instead of only in Swagger UI. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * ci(api): publish a Fern preview of the site for pull requests The `API docs` workflow now publishes a Fern preview, API Reference tab included, on every pull request and manual run that has FERN_TOKEN, and writes the preview URL to the job summary and as a notice. A stable id, pr-<number>, makes a later push overwrite the same preview, and a cleanup job deletes it when the pull request closes. FERN_TOKEN is an organization secret, but GitHub withholds secrets from `pull_request` runs of fork pull requests, so those runs say why no preview was published instead. Push the branch to this repository and dispatch the workflow to preview a fork pull request. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * docs(api): give Fern an absolute server and order the reference sections The spec's only server was the relative `/api`, which is right for the embedded Swagger UI and the request validator but left Fern rendering request examples against `https:/https://api/...`. A second server with the placeholder host the PDF uses, `https://nke.acme.example/api`, now carries the examples; the relative one stays first, so Swagger UI's default and the validator's routing are unchanged, and is marked `x-fern-ignore`, so Fern and the Redocly page show only the absolute one. The validator still accepts requests on any host through the relative server; the server tests cover it. In docs/index.yml the API tab is flattened, so the path no longer repeats `rest-api-reference`, and the sections are laid out in reading order, Clusters first, instead of in order of first appearance, which put the one-endpoint Catalog section at the top. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * docs: do not repeat rest-api-reference in the API tab's URL The tab slug and the api item's slug were both derived from the same title, so every reference page lived under /nke/rest-api-reference/rest-api-reference/. skip-slug on the tab keeps one segment. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * docs: skip the api item's slug, not the tab's skip-slug on the tab left the path unchanged on the preview; the duplicated segment comes from the api item, so skip that one. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> --------- Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> |
||
|
|
6b494863dc |
build: remove committed Go workspace vendoring (#1055)
- Resolve public dependencies through Go modules across builds and CI - Remove vendor-only checks and the remote test bundle - Refresh third-party notices and contributor documentation Signed-off-by: Vivin Wilson <vwilson@nvidia.com> |
||
|
|
647011beca |
build: align local gate with CI (#314)
Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> |
||
|
|
2cd5f78e5e |
ci(lint): collapse seven near-identical jobs into one matrix (#301)
lint.yml ran seven jobs that differed in five values: the directory, GOWORK, the go-version file, the cache key and the timeout. Six already ran `make lint`. The file goes from 276 lines to 130. The parallelism is unchanged. GitHub schedules one runner per matrix entry, so the wall clock is the same and controller keeps its 25-minute budget while the rest keep 15. The seventh job existed only because controller/api had no Makefile, so it open-coded a golangci-lint install pinned by hand in YAML. That module now has a Makefile like every other, using the shared make/golangci.mk, so all seven run the same command and the pin lives in one place. It also gains a `test` target and a `help`, which it never had. Its Makefile records why it sets GOLANGCI_LINT_GOWORK empty: the module has no .golangci.yml, so golangci-lint walks up to controller/.golangci.yml and inherits modules-download-mode: vendor. With the workspace off, -mod=vendor resolves against the root vendor/ tree while treating this module as a lone main module, and the job failed listing fourteen of its own direct requirements as inconsistent vendoring. That reasoning was a comment in the workflow; it now sits next to the setting it explains. Every entry now keys its cache on **/go.sum. Two jobs previously keyed on their own go.sum alone, with no reason recorded, so they would restore a stale cache after a cross-module dependency bump -- the failure the **/go.sum comment in go-build.yml was written to prevent. The agent job was named plain `golangci-lint`, which said nothing about which module it covered; it is now `golangci-lint (agent)`. No individual lint job is a required status check -- only `gate` is -- so renaming a member is safe. Still not linted, and out of scope here: controller/test/e2e carries a 202-line .golangci.yml that nothing runs and reports real findings today, and controller/hack/capd-reboot-controller has no config at all. Both are in WORK_MODULES and both compile in CI. Adding them means fixing their findings first. Verified: all seven modules lint clean locally, and actionlint is clean. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> |