Skip to content

Commit 15bf54b

Browse files
camilamacedo86kerstendependabot[bot]k8s-ci-robotfferrann
authored
📖 Update the docs with release v4.6.0 (#4822)
* chore: simplify test variable declarations for CLI tests Replaced redundant multi-line `var` blocks with single-line declarations in `version_test.go` and `completion_test.go`. This reduces visual noise and aligns with idiomatic Go style for concise test setup. * chore: improve readability of test case for alternative delimiters Reformatted the inline struct definition in `scaffold_test.go` to a multi-line layout. * chore: add gofumpt to golangci-lint configuration Enabled the `gofumpt` linter in `.golangci.yml` to enforce stricter formatting rules and ensure consistency with gofumpt standards across the codebase. * 📖 bump sigs.k8s.io/kubebuilder/v4 Bumps [sigs.k8s.io/kubebuilder/v4](https://github.com/kubernetes-sigs/kubebuilder) from 4.5.1 to 4.5.2. - [Release notes](https://github.com/kubernetes-sigs/kubebuilder/releases) - [Changelog](https://github.com/kubernetes-sigs/kubebuilder/blob/master/RELEASE.md) - [Commits](v4.5.1...v4.5.2) --- updated-dependencies: - dependency-name: sigs.k8s.io/kubebuilder/v4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * chore: unify import alias for network-policy Replaces import alias `network_policy` with `networkpolicy` to follow Go naming conventions. * chore: normalize error messages and wrap errors using %w - Use %w consistently in fmt.Errorf for proper error wrapping - Normalize error message casing for consistency - Adjust tests to reflect updated error strings * chore: normalize error messages and wrap errors using %w - Use %w consistently in fmt.Errorf for proper error wrapping * chore: normalize error messages and wrap errors using %w - Use %w consistently in fmt.Errorf for proper error wrapping * 🌱 (chore): wrap errors with `%w` and normalize formatting in `kustomize/v2` Replaced uses of `%v` with `%w` in `fmt.Errorf` to support proper error wrapping. Standardized formatting style, e.g. quoting strings with `%q` where appropriate. * 🌱 (chore): wrap file and I/O errors with `%w` in `pkg` - Replaced legacy `%v` error wrapping with `%w` in `fmt.Errorf(...)` calls - Applied `%q` for path-related variables to improve clarity - Affected areas include `helm/v1alpha`, `external/helpers`, and `model/resource` * 🌱 (chore): wrap conversion errors with `%w` in `crd_version_conversion.md` design doc - Updated `fmt.Errorf` to use `%w` for proper error wrapping in code snippets - Improves consistency and error traceability in example code * 🌱 (chore): wrap test command execution errors with `%w` in test utils - Use `%w` in `fmt.Errorf` for proper error wrapping - Quote string with `%q` for clarity - Applied consistently across all testdata and tutorial utility files * 🌱 (chore): remove unnecessary blank lines across plugin configuration and options - Removed stray empty lines in `grafana`, `golang`, and CLI plugin logic - Keeps code formatting consistent and clean * 🌱 (chore): wrap error with `%w` in `test_context.go` for improved diagnostics - Updated error formatting to use `%w` in `fmt.Errorf` for proper error chaining - Affects command execution error reporting in test context * Update getting-started.md Fix incorrect samples location * fix: avoid shadowing of 'config' and 'resource' in golang/v4 plugins Renamed variables and function parameters in pkg/plugins/golang/v4 to avoid shadowing imported packages: 'config' → 'cfg', and 'resource' → 'res'. This includes updates to the webhook, scaffolds (api, edit, init, webhook), and internal validation logic. These changes improve code readability and prevent potential issues when using package-level identifiers within the same scope. * 🌱 (chore): fix improper usage of `errors.As` in scaffold tests This fixes a misuse of `errors.As` where a non-pointer was passed as the second argument. Go requires the second argument to be a pointer to an interface or a type implementing the `error` interface. The test helper now correctly uses `&errType` to ensure proper error assertion and avoid false negatives or runtime issues. * util: clarify usage context of ReplaceRegexInFile Update the comment to note that the function is currently unused in the Kubebuilder codebase, but used by other projects and may be used internally in the future. * fix: avoid shadowing of 'config', 'store', and 'resource' in cli/alpha/generate Renamed variables and function parameters in pkg/cli/alpha/internal/generate.go to avoid shadowing imported packages: 'config' → 'cfg', 'store' → 's', 'resource' → 'res' and 'resource' → 'resourceData'. This improves code readability and prevents potential issues when calling package-level functions. * chore: enable shadow checks via import-shadowing linter Now that all variable shadowing issues have been resolved in previous commits, the `shadow` linter in govet is enabled and `import-shadowing` rule from revive is activated, to ensure consistent detection of future shadowing problems. * 🌱 (chore): enable `whitespace` linter in golangci-lint config Adds `whitespace` to the list of active linters in `.golangci.yml` to enforce consistent formatting and improve code cleanliness. * 🌱 (chore): enable `asciicheck` and `bidichk` for improved code safety and clarity - Added `asciicheck` to detect non-ASCII characters in identifiers and strings. Helps prevent hidden bugs and improves readability across systems. - Added `bidichk` to catch Unicode bidirectional control characters. Protects against visual code obfuscation and potential security vulnerabilities. These linters help enforce safer and more maintainable Go code, especially in kubebuilders collaborative environment with many contributors. * 🐛 enable `import-shadowing` linter in .golangci.yml files This PR adds the `import-shadowing` linter to all `.golangci.yml` configuration files across test projects and templates. The `import-shadowing` linter detects cases where a package import shadows an existing variable, which can lead to subtle bugs. * 🌱 (chore): isolate mutable test data in CLI spec to avoid Ginkgo pollution * 🌱 (chore): move mutable test declarations into BeforeEach to ensure clean test state * 🌱 (chore): move mutable test declarations into BeforeEach to ensure clean test state * 🌱 (chore): move mutable test declarations into BeforeEach to ensure clean test state * 🌱 (chore): move mutable test declarations into BeforeEach to ensure clean test state * 🌱 (chore): align stage test suite with Ginkgo conventions and cleanup * 🌱 (chore): isolate mutable resource test state with BeforeEach * 🌱 (chore): refactor shared setup logic in plugins into BeforeEach to isolate test state * 🌱 (chore): refactor shared setup logic in plugin into BeforeEach to isolate test state * fix: use limited scoped error in generated main.go * Updated migration pages and added index for better navigation removed prerequisite and verfication steps changed the header removed toc * Updated 404 page updated error page updated book.toml Delete docs/book/src/404.md * 🌱 fix (ci): fix lint issue: shadow: declaration of pluginCfg shadows declaration (#4725) fix (ci): fix lint issue: shadow: declaration of pluginCfg shadows declaration Fix plugin config test by resetting struct to avoid value reuse Avoids test contamination caused by shared PluginConfig variable by explicitly resetting it before decoding in each test case. Also resolves shadowing linter errors reported by golangci-lint. * 🌱 (chore): enable ginkgolinter forbid-focus-container 🌱 enable ginkgolinter forbid-focus-container This PR adds the following configuration to `.golangci.yml`: ```yaml linters-settings: ginkgolinter: forbid-focus-container: true ``` Enabling forbid-focus-container protects the code in the repository against accident commiting of debug code. A contributeor may use ginkgo's focus container (e.g. `FIt`, `FContext` etc. or by adding the `Focus` decorator), in order to locally debug a specific test. Merging a ginkgo's focus container will prevent running of all the other tests in CI. Signed-off-by: Nahshon Unna-Tsameret <[email protected]> * 🌱 (chore): enable ginkgolinter forbid-spec-pollution to enforce isolated test specs * fix: Use dynamic controller-runtime version in doc generator Replace hardcoded controller-runtime version in hack/docs/internal/cronjob-tutorial/generate_cronjob.go with a reference to the ControllerRuntimeVersion constant from the scaffolding package. This prevents the docs generation from breaking when the controller-runtime version is updated in the scaffolding logic, ensuring that `make generate-docs` remains stable across version bumps. Update hack/docs/internal/cronjob-tutorial/generate_cronjob.go Co-authored-by: Saan <[email protected]> Update hack/docs/internal/cronjob-tutorial/generate_cronjob.go Co-authored-by: Kersten Burkhardt <[email protected]> * 🌱 (chore): replace errors.As() with MatchError() in error assertions This update improves Gomega assertions by replacing `errors.As()` with `MatchError()` where the test intends to match specific error types rather than extract them. This change simplifies the assertions and improves readability, aligning with idiomatic Gomega style. * 📖 Fixed grammatical errors in designs doc (#4716) Fixed grammatical error in designs doc few more typos * 🌱 Add kubernetesVendorVersion for binary builds with LD_FLAGS This commit adds a kubernetesVendorVersion flag to Makefile. Rely on ldflags to set kubernetesVendorVersion, similarly to the other variables in cmd/version.go. Use a single variable to define K8S_VERSION for both ldflags and the goreleaser configuration. * update golang version to v1.2.4.0 Signed-off-by: dongjiang <[email protected]> fix golangci lint Signed-off-by: dongjiang <[email protected]> revent golangcl-lint Signed-off-by: dongjiang <[email protected]> add go install mode Signed-off-by: dongjiang <[email protected]> * 🌱 (chore): replace `%v` with `%w` in deploy-image v1alpha1 plugin errors - Ensured proper error wrapping using `fmt.Errorf(..., %w, ...)` throughout `scaffolds/api.go` - Used %q for filenames and paths for better formatting * 🌱 Fix golangci-lint wrong configurations (#4726) Fix golangci-lint configurations The current file is wrong with duplicated key: the `linters-settings.ginkgolinter` key, appears twice. This PR merges the duplicated keys into one. Signed-off-by: Nahshon Unna-Tsameret <[email protected]> * 🌱 (chore): replace empty slice literals with idiomatic var decls for []metav1.Condition, []templates.CustomMetricItem and []external.Flag * 🌱 (chore): improve error wrapping for generate command execution * 🌱 (chore): wrap errors using `%w` and improve formatting in golang plugin Replaced usage of `%v` with `%w` in `fmt.Errorf` calls to enable proper error chaining across: - `pkg/plugins/golang/repository.go` - `go_version.go` - `v4/scaffolds/api.go` Also improved formatting by quoting dynamic values with `%q` and removed redundant error wrapping logic. * 🌱 (chore): consistently wrap and enrich error messages across helm plugin * 🌱 (chore): improve error context and wrapping in utility and test helpers * 🌱 (chore): use `errors.As` and wrap exec errors in repository.go Refactored error handling in `repository.go`: - Replaced type assertion with `errors.As` for `*exec.ExitError` - Ensured command stderr is preserved in the wrapped `fmt.Errorf` output - Set up for better error introspection and debugging * 🌱 (chore): add detailed error wrapping across Golang plugin commands * 🌱 (chore): improve error context in common kustomize plugin scaffolds * 🌱 (chore): add error context to golang scaffolder execution steps * 🌱 (chore): improve error wrapping for external plugin discovery and config loading * 🌱 (chore): wrap config parsing and validation errors with contextual messages * 🌱 (chore): wrap plugin and util error returns for better context * 🌱 (chore): check and return error from os.WriteFile when writing litout.json * 🌱 (chore): use pointer receiver for Validate and rename shadowed var * 🌱 (chore): wrap deploy-image plugin errors with contextual messages * 🌱 (chore): remove unnecessary string() and []byte conversions * 🌱 (refactor): add contextual error wrapping for external plugin helpers * 🌱 (chore): wrap plugin and util error returns for better context * 🌱 (chore): handle flag parsing errors in sample external plugin This improves the robustness of the external plugin examples in the docs by adding proper error handling when parsing flags with `pflag`. If parsing fails, the plugin sets `pluginResponse.Error = true` and includes a clear error message in `ErrorMsgs`, preventing silent failures and making debugging easier for plugin authors following the tutorial. * 🌱 Bump github.com/onsi/gomega from 1.36.3 to 1.37.0 Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.36.3 to 1.37.0. - [Release notes](https://github.com/onsi/gomega/releases) - [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md) - [Commits](onsi/gomega@v1.36.3...v1.37.0) --- updated-dependencies: - dependency-name: github.com/onsi/gomega dependency-version: 1.37.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * 🌱 (chore): clean up and unify error messages in golang/v4 plugin - Lowercased error messages for consistency - Removed redundant punctuation from error strings - Improved clarity of multi-line `fmt.Errorf` usage * 🌱 (chore): consistently wrap and enrich error messages across test utils It standardizes error handling and improves traceability. * Update versions_compatibility_supportability.md Fix link pointing to the wrong page * ✨ (API, CLI, go/v4) Add cliVersion field to the PROJECT file configuration to store the CLI binary version used to scaffold projects. (#4621) Add cliVersion field to PROJECT file This commit adds a new field to the PROJECT file: cliVersion. Additionally, it updates the documentation in the Project Configuration Reference to include the new cliVersion field. It also updates the PROJECT file scaffolded in the docs and in testdata. * 🌱 use `env:` to set variable. Otherwise quoting issues. If the title contains quotes, the currrent GitHub Action will fail to run. * 🌱 (chore): handle flag parsing errors in simple external plugin tutorial API scaffolder * refactor(e2e-setup): update Kind cluster naming for e2e tests change default Kind cluster names to be project-specific for e2e tests Previously, the default Kind cluster name was "kind", which could lead to conflicts when running multiple e2e tests concurrently across different projects. This change updates the Kind cluster name to be project-specific, reducing potential conflicts and improving the isolation of e2e test environments. * update golangci-lint v2 Signed-off-by: dongjiang <[email protected]> revert by codereview and make generate Signed-off-by: dongjiang <[email protected]> * 🌱 Bump github.com/onsi/ginkgo/v2 from 2.23.3 to 2.23.4 Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.23.3 to 2.23.4. - [Release notes](https://github.com/onsi/ginkgo/releases) - [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md) - [Commits](onsi/ginkgo@v2.23.3...v2.23.4) --- updated-dependencies: - dependency-name: github.com/onsi/ginkgo/v2 dependency-version: 2.23.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Upgrade controller-tools from v0.17.2 to v0.17.3 * 🌱 Bump golang.org/x/text from 0.23.0 to 0.24.0 Bumps [golang.org/x/text](https://github.com/golang/text) from 0.23.0 to 0.24.0. - [Release notes](https://github.com/golang/text/releases) - [Commits](golang/text@v0.23.0...v0.24.0) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-version: 0.24.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * 🌱 (chore): wrap and contextualize errors across Grafana plugin * fix staticcheck lint issues - ST1008 and ST1008 * 🌱 Bump golang.org/x/tools from 0.31.0 to 0.32.0 Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.31.0 to 0.32.0. - [Release notes](https://github.com/golang/tools/releases) - [Commits](golang/tools@v0.31.0...v0.32.0) --- updated-dependencies: - dependency-name: golang.org/x/tools dependency-version: 0.32.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * fix(makefile): correct GNU sed detection method change sed detection from checking OS to checking for GNU version to ensure compatibility across different environments * (Follow up of : #4752 - Upgrade GolangCI) - fix: address staticcheck linter issues (ST1005, QF1008) in scaffolds and tutorials Co-Author: dongjiang <[email protected]> * fix bug Signed-off-by: dongjiang <[email protected]> update by codereview Signed-off-by: dongjiang <[email protected]> * 🌱 (chore): Enable wrapcheck linter (#4721) 🌱 (chore): enable wrapcheck via golangci-lint * Add control-plane labels to metrics service and ServiceMonitor templates * Removing goinstall mode * (testdata): Upgrade version used in the samples under testdata * 🐛 Remove redundant/noisy godebug default= lines from go.mod. (#4787) Remove redundant/noisy godebug default= lines from go.mod. * Removing calico - using default CNI from Kind * 🌱 Bump golang.org/x/text from 0.24.0 to 0.25.0 Bumps [golang.org/x/text](https://github.com/golang/text) from 0.24.0 to 0.25.0. - [Release notes](https://github.com/golang/text/releases) - [Commits](golang/text@v0.24.0...v0.25.0) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-version: 0.25.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * 🌱 Bump golang.org/x/tools from 0.32.0 to 0.33.0 Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.32.0 to 0.33.0. - [Release notes](https://github.com/golang/tools/releases) - [Commits](golang/tools@v0.32.0...v0.33.0) --- updated-dependencies: - dependency-name: golang.org/x/tools dependency-version: 0.33.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * ✨ update golangci-lint to v2.1.0 and lint-action to v8 * bump controller-tools to v0.18.0 Signed-off-by: Adem Baccara <[email protected]> * append project name to conversion webhook service name * Fix: correct make command for updating RBAC to 'make manifests' * docs: fix heading formatting for 'ownerRef and cascading events' * ⚠️ Upgrade controller-runtime (v0.20.4 to v0.21.0) and k8s version ( 1.32 => 1.33 ) (#4813) Upgrade controller-runtime (v0.20.4 to v0.21.0) and k8s version ( 1.32 => 1.33 ) * 🌱 Bump joelanford/go-apidiff from 0.8.2 to 0.8.3 Bumps [joelanford/go-apidiff](https://github.com/joelanford/go-apidiff) from 0.8.2 to 0.8.3. - [Release notes](https://github.com/joelanford/go-apidiff/releases) - [Commits](joelanford/go-apidiff@v0.8.2...v0.8.3) --- updated-dependencies: - dependency-name: joelanford/go-apidiff dependency-version: 0.8.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * fix: revert registry added to docker images by mistake * (rbac) fix: improve role comment clarity by replacing {{ .ProjectName }} with rendered project name * 🐛 refactor: inline getKubebuilderVersion into cli.WithCliVersion setup (#4821) refactor: inline getKubebuilderVersion into cli.WithCliVersion setup --------- Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Nahshon Unna-Tsameret <[email protected]> Signed-off-by: dongjiang <[email protected]> Signed-off-by: Adem Baccara <[email protected]> Co-authored-by: Kersten Burkhardt <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kubernetes Prow Robot <[email protected]> Co-authored-by: fferrann <[email protected]> Co-authored-by: koba1t <[email protected]> Co-authored-by: Kuzuri247 <[email protected]> Co-authored-by: Nahshon Unna-Tsameret <[email protected]> Co-authored-by: Pranchal Shah <[email protected]> Co-authored-by: Kersten Burkhardt <[email protected]> Co-authored-by: RAHUL SINGH <[email protected]> Co-authored-by: vitorfloriano <[email protected]> Co-authored-by: dongjiang <[email protected]> Co-authored-by: Nahshon Unna Tsameret <[email protected]> Co-authored-by: Lucas Possani <[email protected]> Co-authored-by: Thomas Guettler <[email protected]> Co-authored-by: sarthaksarthak9 <[email protected]> Co-authored-by: Laurent Demailly <[email protected]> Co-authored-by: ira-pandey1 <[email protected]> Co-authored-by: Ansh Garhewal <[email protected]> Co-authored-by: Adem Baccara <[email protected]> Co-authored-by: Fabian Hirscher <[email protected]> Co-authored-by: Vaishnav88sk <[email protected]>
1 parent 7c70705 commit 15bf54b

File tree

315 files changed

+3024
-2261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

315 files changed

+3024
-2261
lines changed

.github/workflows/apidiff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
with:
2525
go-version-file: go.mod
2626
- name: Execute go-apidiff
27-
uses: joelanford/[email protected].2
27+
uses: joelanford/[email protected].3
2828
with:
2929
compare-imports: true
3030
print-compatible: true

.github/workflows/lint-sample.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ jobs:
3636
working-directory: ${{ matrix.folder }}
3737
run: make lint-config
3838
- name: Run linter
39-
uses: golangci/golangci-lint-action@v6
39+
uses: golangci/golangci-lint-action@v8
4040
with:
41-
version: v1.63.4
41+
version: v2.1.0
4242
working-directory: ${{ matrix.folder }}
4343
args: --config .golangci.yml ./...
4444
- name: Run linter via makefile target

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424
- name: Check linter configuration
2525
run: make lint-config
2626
- name: Run linter
27-
uses: golangci/golangci-lint-action@v6
27+
uses: golangci/golangci-lint-action@v8
2828
with:
29-
version: v1.63.4
29+
version: v2.1.0
3030

3131
yamllint:
3232
runs-on: ubuntu-latest

.github/workflows/verify.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ jobs:
1313
uses: actions/checkout@v4
1414

1515
- name: Validate PR Title Format
16+
env:
17+
TITLE: ${{ github.event.pull_request.title }}
1618
run: |
17-
TITLE="${{ github.event.pull_request.title }}"
18-
1919
if [[ -z "$TITLE" ]]; then
2020
echo "Error: PR title cannot be empty."
2121
exit 1
2222
fi
23-
23+
2424
if ! [[ "$TITLE" =~ ^($'\u26A0'|$'\u2728'|$'\U0001F41B'|$'\U0001F4D6'|$'\U0001F680'|$'\U0001F331') ]]; then
2525
echo "Error: Invalid PR title format."
2626
echo "Your PR title must start with one of the following indicators:"
@@ -32,5 +32,5 @@ jobs:
3232
echo "- Infra/Tests/Other: 🌱 (U+1F331)"
3333
exit 1
3434
fi
35-
35+
3636
echo "PR title is valid: '$TITLE'"

.golangci.yml

Lines changed: 81 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,101 @@
1+
version: "2"
12
run:
2-
timeout: 5m
33
allow-parallel-runners: true
4-
5-
issues:
6-
# don't skip warning about doc comments
7-
# don't exclude the default set of lint
8-
exclude-use-default: false
9-
# restore some of the defaults
10-
# (fill in the rest as needed)
11-
exclude-rules:
12-
- linters: [gosec]
13-
path: "test/e2e/*"
14-
- path: "hack/docs/*"
15-
linters:
16-
- lll
17-
- gosec
18-
19-
linters-settings:
20-
govet:
21-
enable-all: true
22-
disable:
23-
- fieldalignment
24-
- shadow
25-
nolintlint:
26-
allow-unused: false
27-
revive:
28-
rules:
29-
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
30-
- name: blank-imports
31-
- name: context-as-argument
32-
- name: context-keys-type
33-
- name: dot-imports
34-
arguments:
35-
# dot import should be ONLY allowed for ginkgo testing packages
36-
- allowedPackages:
37-
- "github.com/onsi/ginkgo/v2"
38-
- "github.com/onsi/gomega"
39-
- name: error-return
40-
- name: error-strings
41-
- name: error-naming
42-
- name: exported
43-
- name: if-return
44-
- name: increment-decrement
45-
- name: var-naming
46-
- name: var-declaration
47-
- name: package-comments
48-
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
49-
- name: range
50-
- name: receiver-naming
51-
- name: time-naming
52-
- name: unexported-return
53-
- name: indent-error-flow
54-
- name: errorf
55-
- name: empty-block
56-
- name: superfluous-else
57-
- name: unused-parameter
58-
- name: unreachable-code
59-
- name: redefines-builtin-id
60-
#
61-
# Rules in addition to the recommended configuration above.
62-
#
63-
- name: bool-literal-in-expr
64-
- name: constant-logical-expr
65-
- name: comment-spacings
66-
674
linters:
68-
disable-all: true
5+
default: none
696
enable:
7+
- asciicheck
8+
- bidichk
9+
- copyloopvar
7010
- dupl
7111
- errcheck
72-
- copyloopvar
7312
- ginkgolinter
7413
- goconst
7514
- gocyclo
76-
- gofmt
77-
- goimports
78-
- gosimple
7915
- govet
8016
- ineffassign
8117
- lll
8218
- misspell
83-
- nolintlint
8419
- nakedret
20+
- nolintlint
8521
- prealloc
8622
- revive
8723
- staticcheck
88-
- typecheck
8924
- unconvert
9025
- unparam
9126
- unused
92-
27+
- wrapcheck
28+
- whitespace
29+
settings:
30+
ginkgolinter:
31+
forbid-focus-container: true
32+
forbid-spec-pollution: true
33+
govet:
34+
disable:
35+
- fieldalignment
36+
enable-all: true
37+
nolintlint:
38+
allow-unused: false
39+
revive:
40+
rules:
41+
- name: blank-imports
42+
- name: context-as-argument
43+
- name: context-keys-type
44+
- name: dot-imports
45+
arguments:
46+
- allowedPackages:
47+
- github.com/onsi/ginkgo/v2
48+
- github.com/onsi/gomega
49+
- name: error-return
50+
- name: error-strings
51+
- name: error-naming
52+
- name: exported
53+
- name: if-return
54+
- name: import-shadowing
55+
- name: increment-decrement
56+
- name: var-naming
57+
- name: var-declaration
58+
- name: package-comments
59+
disabled: true
60+
- name: range
61+
- name: receiver-naming
62+
- name: time-naming
63+
- name: unexported-return
64+
- name: indent-error-flow
65+
- name: errorf
66+
- name: empty-block
67+
- name: superfluous-else
68+
- name: unused-parameter
69+
- name: unreachable-code
70+
- name: redefines-builtin-id
71+
- name: bool-literal-in-expr
72+
- name: constant-logical-expr
73+
- name: comment-spacings
74+
exclusions:
75+
generated: lax
76+
rules:
77+
- linters:
78+
- gosec
79+
path: test/e2e/*
80+
- linters:
81+
- gosec
82+
- lll
83+
path: hack/docs/*
84+
- linters:
85+
- revive
86+
text: 'should have comment or be unexported'
87+
paths:
88+
- third_party$
89+
- builtin$
90+
- examples$
91+
formatters:
92+
enable:
93+
- gofmt
94+
- gofumpt
95+
- goimports
96+
exclusions:
97+
generated: lax
98+
paths:
99+
- third_party$
100+
- builtin$
101+
- examples$

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,8 @@ To manually setup run:
8080
```shell
8181
# To generate an Kubebuilder local binary with your changes
8282
make install
83-
# To create the cluster and configure a CNI which supports NetworkPolicy
83+
# To create the cluster
8484
kind create cluster --config ./test/e2e/kind-config.yaml
85-
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
8685
```
8786

8887
Now, you can for example, run in debug mode the `test/e2e/v4/e2e_suite_test.go`:

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ help: ## Display this help
4545

4646
##@ Build
4747

48+
K8S_VERSION ?= $(shell go list -m -modfile=./testdata/project-v4/go.mod -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d.%d", $$3, $$4}')
49+
4850
LD_FLAGS=-ldflags " \
4951
-X sigs.k8s.io/kubebuilder/v4/cmd.kubeBuilderVersion=$(shell git describe --tags --dirty --broken) \
52+
-X sigs.k8s.io/kubebuilder/v4/cmd.kubernetesVendorVersion=$(K8S_VERSION) \
5053
-X sigs.k8s.io/kubebuilder/v4/cmd.goos=$(shell go env GOOS) \
5154
-X sigs.k8s.io/kubebuilder/v4/cmd.goarch=$(shell go env GOARCH) \
5255
-X sigs.k8s.io/kubebuilder/v4/cmd.gitCommit=$(shell git rev-parse HEAD) \
@@ -72,7 +75,7 @@ generate: generate-testdata generate-docs update-k8s-version ## Update/generate
7275
remove-spaces:
7376
@echo "Removing trailing spaces"
7477
@bash -c ' \
75-
if [[ "$$(uname)" == "Linux" ]]; then \
78+
if sed --version 2>&1 | grep -q "GNU"; then \
7679
find . -type f -name "*.md" -exec sed -i "s/[[:space:]]*$$//" {} + || true; \
7780
else \
7881
find . -type f -name "*.md" -exec sed -i "" "s/[[:space:]]*$$//" {} + || true; \
@@ -124,8 +127,7 @@ yamllint:
124127
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
125128
golangci-lint:
126129
@[ -f $(GOLANGCI_LINT) ] || { \
127-
set -e ;\
128-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.63.4 ;\
130+
GOBIN=$(shell pwd)/bin go install github.com/golangci/golangci-lint/v2/cmd/[email protected] ;\
129131
}
130132

131133
.PHONY: apidiff
@@ -201,7 +203,6 @@ install-helm: ## Install the latest version of Helm locally
201203
helm-lint: install-helm ## Lint the Helm chart in testdata
202204
helm lint testdata/project-v4-with-plugins/dist/chart
203205

204-
K8S_VERSION ?= $(shell go list -m -modfile=./testdata/project-v4/go.mod -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d.%d", $$3, $$4}')
205206
.PHONY: update-k8s-version
206207
update-k8s-version: ## Update Kubernetes API version in version.go and .goreleaser.yml
207208
@if [ -z "$(K8S_VERSION)" ]; then echo "Error: K8S_VERSION is empty"; exit 1; fi

build/.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ builds:
4646
- darwin_amd64
4747
- darwin_arm64
4848
env:
49-
- KUBERNETES_VERSION=1.32.1
49+
- KUBERNETES_VERSION=1.33.0
5050
- CGO_ENABLED=0
5151

5252
# Only binaries of the form "kubebuilder_${goos}_${goarch}" will be released.

cmd/cmd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func Run() {
5555
c, err := cli.New(
5656
cli.WithCommandName("kubebuilder"),
5757
cli.WithVersion(versionString()),
58+
cli.WithCliVersion(getKubebuilderVersion()),
5859
cli.WithPlugins(
5960
golangv4.Plugin{},
6061
gov4Bundle,

cmd/version.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const unknown = "unknown"
2727
// information in the release process
2828
var (
2929
kubeBuilderVersion = unknown
30-
kubernetesVendorVersion = "1.32.1"
30+
kubernetesVendorVersion = "1.33.0"
3131
goos = unknown
3232
goarch = unknown
3333
gitCommit = "$Format:%H$" // sha1 from git, output of $(git rev-parse HEAD)
@@ -45,7 +45,7 @@ type version struct {
4545
GoArch string `json:"goArch"`
4646
}
4747

48-
// versionString returns the CLI version
48+
// versionString returns the Full CLI version
4949
func versionString() string {
5050
if kubeBuilderVersion == unknown {
5151
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "" {
@@ -62,3 +62,13 @@ func versionString() string {
6262
goarch,
6363
})
6464
}
65+
66+
// getKubebuilderVersion returns only the CLI version string
67+
func getKubebuilderVersion() string {
68+
if kubeBuilderVersion == unknown {
69+
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "" {
70+
kubeBuilderVersion = info.Main.Version
71+
}
72+
}
73+
return kubeBuilderVersion
74+
}

designs/crd_version_conversion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ func (ch *conversionHandler) convertObject(src, dst runtime.Object) error {
158158

159159
err = src.(conversion.Convertible).ConvertTo(hub)
160160
if err != nil {
161-
return fmt.Errorf("%T failed to convert to hub version %T : %v", src, hub, err)
161+
return fmt.Errorf("%T failed to convert to hub version %T : %w", src, hub, err)
162162
}
163163

164164
err = dst.(conversion.Convertible).ConvertFrom(hub)
165165
if err != nil {
166-
return fmt.Errorf("%T failed to convert from hub version %T : %v", dst, hub, err)
166+
return fmt.Errorf("%T failed to convert from hub version %T : %w", dst, hub, err)
167167
}
168168
return nil
169169
}

0 commit comments

Comments
 (0)