Files
nvke/controller/api/Makefile
Davanum SrinivasandClaude Fable 5.1 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>
2026-10-10 16:31:31 -04:00

68 lines
2.6 KiB
Makefile

# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# This module is the generated oapi-codegen client, server and models. It is
# regenerated by `make -C controller generate-api`, so there is no fmt target:
# formatting belongs to the generator.
#
# It had no Makefile at all, which made it the one module lint.yml could not
# invoke through `make lint`, so that job open-coded a golangci-lint install.
GO ?= go
GOBIN ?= $(shell $(GO) env GOBIN)
ifeq (,$(GOBIN))
GOBIN = $(shell $(GO) env GOPATH)/bin
endif
# This module inherits controller/.golangci.yml. Keep workspace mode on so
# lint sees the same public dependency graph as the other module builds.
GOLANGCI_LINT_GOWORK :=
include ../../make/golangci.mk
include ../../make/coverage.mk
# VACUUM_VERSION, pinned with the other repository-wide tool versions.
include ../../make/tool-versions.mk
GO_TEST_FLAGS ?=
.PHONY: help lint lint-spec test docs
##@ Help
help: ## Show the available targets.
@awk 'BEGIN { FS = ":.*## " } \
/^##@ / { printf "\n%s\n", substr($$0, 5) } \
/^[a-z][a-z0-9-]*:.*## / { printf " %-22s %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
@echo
##@ Build and test
lint: lint-spec ## Run golangci-lint and the OpenAPI lint over this module. (run by the merge gate)
@$(GOLANGCI_LINT_RUN) run --timeout 10m
# vacuum is a Go program, so `go run` pins it the way generate.go pins gofumpt,
# and nothing has to be installed. The rules, and why each is on or off, are in
# openapi-lint.yaml.
API_DOCS_OUT ?= ../.local/api-reference.html
##@ Documentation
# Two steps, because `build-docs` applies no decorators: `bundle` drops the
# surface marked `x-fern-ignore` (see redocly.yaml) and resolves references,
# then `build-docs` renders the bundle into one self-contained page. Needs
# Node; npx fetches the pinned CLI.
docs: ## Render openapi.yaml into one HTML page with Redocly, minus the x-fern-ignore surface. (needs Node)
@mkdir -p $(dir $(API_DOCS_OUT))
npx -y @redocly/cli@$(REDOCLY_VERSION) bundle nvke --config redocly.yaml -o $(API_DOCS_OUT).bundle.yaml
npx -y @redocly/cli@$(REDOCLY_VERSION) build-docs $(API_DOCS_OUT).bundle.yaml -o $(API_DOCS_OUT)
@rm -f $(API_DOCS_OUT).bundle.yaml
@echo "Rendered $(API_DOCS_OUT)"
lint-spec: ## Lint openapi.yaml against openapi-lint.yaml.
$(GO) run github.com/daveshanley/vacuum@$(VACUUM_VERSION) lint --ruleset openapi-lint.yaml --ignore-file openapi-lint-ignore.yaml --details --no-banner --no-style --no-clip --min-score 0 openapi.yaml
test: ## Run this module's tests.
@$(COVERAGE_MKDIR)
$(GO) test $(GO_TEST_FLAGS) $(GO_COVER_FLAGS) ./...