Skip to content

[deps] Update Go version, Golang CI, Cluster API, Kubernetes, and related dependencies#742

Merged
komer3 merged 8 commits intomainfrom
update-deps
May 2, 2025
Merged

[deps] Update Go version, Golang CI, Cluster API, Kubernetes, and related dependencies#742
komer3 merged 8 commits intomainfrom
update-deps

Conversation

@komer3
Copy link
Contributor

@komer3 komer3 commented May 2, 2025

What this PR does / why we need it:

This PR updates several core dependencies and development tools to their newer versions:

  • Go: Upgraded from 1.23 to 1.24 (go.mod, Dockerfile, devbox.json). Includes the Go 1.24.1 toolchain.
  • Cluster API: Upgraded from v1.9.6 to v1.10.1 (go.mod).
    • Addresses the necessary import path change from sigs.k8s.io/cluster-api/exp/addons/api/v1beta1 to sigs.k8s.io/cluster-api/api/addons/v1beta1.
  • Kubernetes: Upgraded API/client libraries from v0.32.3 to v0.33.0 (go.mod).
    • Includes related CRD schema updates (e.g., added maxLength, minLength, enum constraints) in config/crd/bases/.
  • golangci-lint: Upgraded to v2 (.golangci.yml, Makefile).
    • Updated configuration (.golangci.yml) to schema version "2", and adjusted enabled linters.
    • Implemented necessary code fixes across the codebase to comply with the new linting rules. This primarily involved:
      • Updating context.Background() usage to t.Context() within test files.
      • Refactoring client usage to consistently use the clients package.
      • Adjusting import paths and field references where necessary.
  • Indirect Dependencies: Numerous indirect dependencies listed in go.mod were updated as a result of the primary dependency bumps.

The goal of these updates is to stay current with upstream releases, benefiting from the latest features, security patches, and bug fixes provided by Go, Kubernetes, Cluster API, and golangci-lint. Corresponding changes were made to configuration, build files, CRDs, and source code to ensure compatibility and adherence to updated standards.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

dependabot bot and others added 5 commits March 5, 2025 17:34
Bumps golang from 1.23 to 1.24.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps the kubernetes group with 4 updates: [k8s.io/api](https://github.com/kubernetes/api), [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery), [k8s.io/client-go](https://github.com/kubernetes/client-go) and [sigs.k8s.io/cluster-api](https://github.com/kubernetes-sigs/cluster-api).


Updates `k8s.io/api` from 0.32.3 to 0.33.0
- [Commits](kubernetes/api@v0.32.3...v0.33.0)

Updates `k8s.io/apimachinery` from 0.32.3 to 0.33.0
- [Commits](kubernetes/apimachinery@v0.32.3...v0.33.0)

Updates `k8s.io/client-go` from 0.32.3 to 0.33.0
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](kubernetes/client-go@v0.32.3...v0.33.0)

Updates `sigs.k8s.io/cluster-api` from 1.9.6 to 1.10.0
- [Release notes](https://github.com/kubernetes-sigs/cluster-api/releases)
- [Commits](kubernetes-sigs/cluster-api@v1.9.6...v1.10.0)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-version: 0.33.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: kubernetes
- dependency-name: k8s.io/apimachinery
  dependency-version: 0.33.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: kubernetes
- dependency-name: k8s.io/client-go
  dependency-version: 0.33.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: kubernetes
- dependency-name: sigs.k8s.io/cluster-api
  dependency-version: 1.10.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: kubernetes
...

Signed-off-by: dependabot[bot] <support@github.com>
- Updated Go version from 1.23.0 to 1.24.0 in go.mod and devbox files.
- Removed kubernetes-controller-tools dependency from devbox.json and devbox.lock. Devbox was using older version causing issues. We can just use the binary we download using makefile target
- Updated references to cluster-api addons API from experimental to stable in multiple files.

This commit ensures compatibility with the latest Go version and cleans up unused dependencies, improving overall project maintainability.
@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label May 2, 2025
@codecov
Copy link

codecov bot commented May 2, 2025

Codecov Report

Attention: Patch coverage is 72.61905% with 23 lines in your changes missing coverage. Please review.

Project coverage is 62.97%. Comparing base (010d414) to head (5233b80).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/webhook/v1alpha2/webhook_helpers.go 45.45% 6 Missing ⚠️
...webhook/v1alpha2/linodeobjectstoragekey_webhook.go 60.00% 2 Missing and 2 partials ⚠️
internal/controller/linodemachine_controller.go 0.00% 2 Missing and 1 partial ⚠️
...al/controller/linodeobjectstoragekey_controller.go 62.50% 2 Missing and 1 partial ⚠️
internal/controller/linodefirewall_controller.go 33.33% 2 Missing ⚠️
...rnal/controller/linodeplacementgroup_controller.go 33.33% 2 Missing ⚠️
internal/controller/linodevpc_controller.go 33.33% 2 Missing ⚠️
...nal/controller/linodemachine_controller_helpers.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #742      +/-   ##
==========================================
- Coverage   65.22%   62.97%   -2.26%     
==========================================
  Files          69       69              
  Lines        6597     6598       +1     
==========================================
- Hits         4303     4155     -148     
- Misses       2041     2214     +173     
+ Partials      253      229      -24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Replaced instances of `context.Background()` with `t.Context()` in various test files to ensure proper context propagation during testing. This was an issue thrown by golangci.
- Updated `.golangci.yml` to version 2 and modified the configuration, including exclusions for generated files and specific paths.
- Changed the golangci-lint Docker image version in the Makefile to v2.1.5 for consistency with the updated configuration.

These changes enhance test reliability and maintainability while aligning with the latest linting standards.
@komer3 komer3 changed the title [deps] Update Go version, Cluster API, Kubernetes, and related dependencies [deps] Update Go version, Golang CI, Cluster API, Kubernetes, and related dependencies May 2, 2025
@komer3 komer3 requested a review from Copilot May 2, 2025 16:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates a number of dependencies and development tools, including upgrading Go to 1.24, Cluster API to v1.10.1, Kubernetes client libraries to v0.33.0, and golangci-lint to v2/v7. The changes include replacing usages of context.Background() with t.Context() in tests, updating dot-imports to explicit package imports, and modifying field accesses in secret generation for object storage keys to match the updated API.

Reviewed Changes

Copilot reviewed 61 out of 63 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cloud/scope/vpc_test.go Replaced context.Background() with t.Context() in VPC scope tests.
cloud/scope/vpc.go Updated explicit package references for client types.
cloud/scope/placement_group_test.go Replaced context.Background() with t.Context() in placement group tests.
cloud/scope/placement_group.go Updated explicit import and client type usage.
cloud/scope/object_storage_key_test.go Modified context usage to t.Context() in secret key tests.
cloud/scope/object_storage_key.go Adjusted secret generation fields to match new API structure.
cloud/scope/object_storage_bucket_test.go Replaced context.Background() with t.Context() in bucket scope tests.
cloud/scope/object_storage_bucket.go Updated explicit client references for bucket scope.
cloud/scope/machine_test.go Replaced context.Background() with t.Context() in machine scope tests.
cloud/scope/machine.go Updated explicit client references for machine scope.
cloud/scope/firewall_test.go Replaced context.Background() with t.Context() in firewall tests.
cloud/scope/firewall.go Updated explicit client references for firewall scope.
cloud/scope/common_test.go Replaced context.Background() with t.Context() in common tests.
cloud/scope/common.go Updated explicit client references for common functions.
cloud/scope/cluster_test.go Replaced context.Background() with t.Context() in cluster scope tests.
cloud/scope/cluster.go Updated explicit client references and DNS client creation.
.golangci.yml Updated configuration to schema version 2 and removed deprecated options.
.github/workflows/go-analyze.yml Updated golangci-lint action from v6 to v7.
Files not reviewed (2)
  • Dockerfile: Language not supported
  • Makefile: Language not supported

// Set an owner reference on a Secret if it will exist in the same namespace as the Key resource.
// Kubernetes does not allow cross-namespace ownership so modifications to a Secret in another namespace won't trigger reconciliation.
if s.Key.Spec.GeneratedSecret.Namespace == s.Key.Namespace {
if s.Key.Spec.Namespace == s.Key.Namespace {
Copy link

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition 'if s.Key.Spec.Namespace == s.Key.Namespace' always evaluates to true. Likely, it should compare the secret's namespace with the key object's namespace (for example, 'if s.Key.Spec.Namespace == s.Key.GetNamespace()') to correctly set the owner reference.

Suggested change
if s.Key.Spec.Namespace == s.Key.Namespace {
if s.Key.Spec.Namespace == s.Key.GetNamespace() {

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@rosskirkpat rosskirkpat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one small request, otherwise LGTM!

- Changed the golangci-lint Docker image version in the Makefile to utilize the GOLANGCI_LINT_VERSION variable, ensuring easier updates and consistency across the project.
- Added GOLANGCI_LINT_VERSION variable with a default value of v2.1.5 for better maintainability.
@komer3 komer3 merged commit 467f06f into main May 2, 2025
13 of 14 checks passed
@komer3 komer3 deleted the update-deps branch May 2, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants