Skip to content

Conversation

@kvaps
Copy link
Member

@kvaps kvaps commented Dec 19, 2025

This change is extracted from

and reworked to work standalone

Signed-off-by: Andrei Kvapil kvapss@gmail.com

What this PR does

Release note

[cozystack] Update go modules

Summary by CodeRabbit

  • Chores

    • Updated Go toolchain to 1.25.0 and upgraded core Kubernetes libraries, OpenTelemetry, Prometheus, gRPC/protobuf and many indirect dependencies. Bumped builder base images to golang:1.25-alpine across multiple components.
  • Refactor

    • Removed legacy component versioning/emulation and simplified server startup and configuration paths.
  • Tests

    • Removed tests related to the legacy versioning/emulation behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 19, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 19, 2025

Walkthrough

Go toolchain bumped to 1.25.0 with broad dependency upgrades. KEP-4330 component-versioning/emulation and its test removed from server startup. Multiple Dockerfile builder images updated from golang:1.24-alpine to golang:1.25-alpine.

Changes

Cohort / File(s) Summary
Toolchain & dependencies
go.mod
Go toolchain set to 1.25.0; many direct and indirect upgrades across Kubernetes modules, controller-runtime, FluxCD, Prometheus, OpenTelemetry, golang.org/x/*, grpc/protobuf, and updated replace directives.
Server startup versioning removal
pkg/cmd/server/start.go
Removed KEP-4330-related imports and registry-driven component-version/feature-gate wiring; eliminated CozyVersionToKubeVersion; preserved CRD registration and OpenAPI setup with simplified initialization of feature gate/effective version.
Tests
pkg/cmd/server/start_test.go
Removed TestCozyEmulationVersionToKubeEmulationVersion; added note that KEP-4330 tests are not applicable for Kubernetes v0.34.1.
Dockerfile builder image bumps
Dockerfiles
packages/system/cozystack-api/images/cozystack-api/Dockerfile, packages/system/cozystack-controller/images/cozystack-controller/Dockerfile, packages/system/kubeovn-plunger/images/kubeovn-plunger/Dockerfile, packages/system/lineage-controller-webhook/images/lineage-controller-webhook/Dockerfile, packages/system/backup-controller/images/backup-controller/Dockerfile, packages/core/platform/images/cozystack-assets/Dockerfile, packages/core/installer/images/cozystack/Dockerfile
Updated builder stage base image from golang:1.24-alpine to golang:1.25-alpine; build steps and runtime stages unchanged.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Update go modules' directly matches the main change in the changeset, which involves updating go.mod with Kubernetes, FluxCD, and various Go module dependencies, plus updating builder base images in Dockerfiles.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kvaps, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a comprehensive update of the project's Go module dependencies and the Go language version itself. The primary goal is to ensure the codebase remains current with the latest versions of its underlying libraries, particularly Kubernetes components. This update includes a significant bump in Kubernetes API versions, which necessitated the removal of certain component versioning logic that is no longer supported in the newer Kubernetes ecosystem.

Highlights

  • Go Version Update: The Go language version has been upgraded from 1.23.0 to 1.25.0, bringing the project up to date with the latest language features and performance improvements.
  • Kubernetes Dependency Upgrade: Core Kubernetes dependencies, including k8s.io/api, k8s.io/apimachinery, k8s.io/client-go, and k8s.io/controller-runtime, have been updated from v0.31.2 to v0.34.1, aligning with a more recent Kubernetes API version.
  • General Module Dependency Updates: Numerous other Go module dependencies, such as github.com/fluxcd/helm-controller/api, github.com/onsi/ginkgo/v2, github.com/prometheus/client_golang, and github.com/spf13/cobra, have been updated to their latest stable versions.
  • KEP-4330 Component Versioning Removal: Code related to KEP-4330 component versioning functionality has been removed from the server startup logic and its associated tests, as this feature is noted to be unavailable in Kubernetes v0.34.1.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates Go modules, most notably upgrading the Go version from 1.23.0 to 1.25.0 and Kubernetes dependencies from v0.31.2 to v0.34.1. The changes in pkg/cmd/server/start.go and pkg/cmd/server/start_test.go correctly remove functionality related to KEP-4330 component versioning, which is no longer available in the updated Kubernetes libraries. The code modifications are a direct and necessary consequence of the dependency updates. The changes are consistent, and the added comments explaining the removal of versioning code are helpful. Overall, this is a clean and well-executed dependency upgrade.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/cmd/server/start.go (1)

137-156: Use a cancellable context and structured logging.

Two concerns with the retry mechanism:

  1. Line 138: Using context.Background() ignores cancellation signals. If the server receives a shutdown signal during startup, this loop will continue retrying for up to 30 minutes. Consider passing a context through Complete() or using a context with timeout.

  2. Line 149: Using fmt.Printf is inconsistent with Kubernetes patterns. Based on learnings, controller-runtime patterns should use structured logging via klog.

🔎 Proposed fix
-func (o *CozyServerOptions) Complete() error {
+func (o *CozyServerOptions) Complete(ctx context.Context) error {
 	scheme := runtime.NewScheme()
 	if err := v1alpha1.AddToScheme(scheme); err != nil {
 		return fmt.Errorf("failed to register types: %w", err)
 	}
 ...
 	for {
-		err := o.Client.List(context.Background(), crdList)
+		err := o.Client.List(ctx, crdList)
 		if err == nil {
 			break
 		}

 		// Check if we've exceeded the maximum retry duration
 		if time.Since(startTime) >= maxRetryDuration {
 			return fmt.Errorf("failed to list CozystackResourceDefinitions after %v: %w", maxRetryDuration, err)
 		}

+		// Check for context cancellation
+		select {
+		case <-ctx.Done():
+			return fmt.Errorf("context cancelled while listing CozystackResourceDefinitions: %w", ctx.Err())
+		default:
+		}
+
 		// Log the error and wait before retrying
-		fmt.Printf("Failed to list CozystackResourceDefinitions (retrying in %v): %v\n", delay, err)
+		klog.Infof("Failed to list CozystackResourceDefinitions (retrying in %v): %v", delay, err)
 		time.Sleep(delay)
🧹 Nitpick comments (2)
pkg/cmd/server/start_test.go (1)

17-20: Consider removing the empty test file or adding placeholder tests.

This file now contains only a comment explaining the removal of KEP-4330 tests. An empty test file with no test functions is unusual and may cause confusion. Consider either:

  1. Removing the file entirely and tracking the note in the PR/commit message
  2. Adding basic test stubs for the remaining functionality in start.go (e.g., Complete(), Validate(), Config())
pkg/cmd/server/start.go (1)

166-166: TODO: Implement shortnames.

There's a TODO to implement shortnames for resources. The current implementation uses an empty slice.

Would you like me to help implement shortnames support or open an issue to track this task?

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe7bdcf and 19cda65.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (3)
  • go.mod (1 hunks)
  • pkg/cmd/server/start.go (2 hunks)
  • pkg/cmd/server/start_test.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Use Controller-runtime patterns and kubebuilder style for Go code

Files:

  • pkg/cmd/server/start.go
  • pkg/cmd/server/start_test.go
{go.mod,go.sum}

📄 CodeRabbit inference engine (AGENTS.md)

Do not manually modify go.mod and go.sum files; use go get command instead

Files:

  • go.mod
🧠 Learnings (1)
📚 Learning: 2025-11-27T11:21:45.808Z
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-27T11:21:45.808Z
Learning: Applies to **/*.go : Use Controller-runtime patterns and kubebuilder style for Go code

Applied to files:

  • pkg/cmd/server/start.go
🔇 Additional comments (4)
pkg/cmd/server/start.go (2)

83-85: LGTM - KEP-4330 removal is appropriate.

The simplified PersistentPreRunE returning nil is appropriate given the removal of component versioning logic that's unavailable in Kubernetes v0.34.1.


158-183: LGTM - Resource config population is correct.

The mapping from CozystackResourceDefinition to config.Resource is clean and straightforward.

go.mod (2)

19-29: Kubernetes dependencies are properly aligned with controller-runtime v0.22.2.

Controller-runtime v0.22 is tested with Kubernetes v0.34, and v0.22.2 includes a bump to k8s.io/* v0.34.1. All Kubernetes-related dependencies (k8s.io/api, k8s.io/apimachinery, k8s.io/apiserver, k8s.io/client-go, k8s.io/component-base) at v0.34.1 are consistent with the controller-runtime version pinned here.


128-129: Replace directive for k8s.io/apimachinery must use proper Go tooling.

This replace directive should be managed using go get rather than manual go.mod edits. Verify the fork can be removed by testing the upstream Kubernetes issue fix, and ensure any manual go.mod edits are replaced with proper Go commands going forward.

⛔ Skipped due to learnings
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-27T11:21:45.808Z
Learning: Applies to {go.mod,go.sum} : Do not manually modify `go.mod` and `go.sum` files; use `go get` command instead

module github.com/cozystack/cozystack

go 1.23.0
go 1.25.0
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix the Go version format in the go.mod directive — use go 1.25 instead of go 1.25.0.

The go directive should specify only the major and minor version, not the patch version. Update line 5 from go 1.25.0 to go 1.25. Patch versions are not allowed in the go directive and will cause parsing errors.

🤖 Prompt for AI Agents
In go.mod around line 5: the go directive currently uses a patch version ("go
1.25.0") which is invalid; update that line to use only major and minor version
("go 1.25") so the directive parses correctly and conforms to Go module
requirements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
pkg/cmd/server/start.go (1)

83-85: Consider removing the no-op PersistentPreRunE hook.

The PersistentPreRunE hook now returns nil immediately and serves no purpose. Consider removing it entirely to simplify the command setup, unless you're planning to add functionality here in the near future.

🔎 Proposed refactor to remove the no-op hook
 	cmd := &cobra.Command{
 		Short: "Launch an Cozystack API server",
 		Long:  "Launch an Cozystack API server",
-		PersistentPreRunE: func(*cobra.Command, []string) error {
-			return nil
-		},
 		RunE: func(c *cobra.Command, args []string) error {
 			if err := o.Complete(); err != nil {
 				return err
 			}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19cda65 and fe92995.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (7)
  • go.mod (1 hunks)
  • packages/system/cozystack-api/images/cozystack-api/Dockerfile (1 hunks)
  • packages/system/cozystack-controller/images/cozystack-controller/Dockerfile (1 hunks)
  • packages/system/kubeovn-plunger/images/kubeovn-plunger/Dockerfile (1 hunks)
  • packages/system/lineage-controller-webhook/images/lineage-controller-webhook/Dockerfile (1 hunks)
  • pkg/cmd/server/start.go (2 hunks)
  • pkg/cmd/server/start_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • go.mod
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Use Controller-runtime patterns and kubebuilder style for Go code

Files:

  • pkg/cmd/server/start.go
  • pkg/cmd/server/start_test.go
🧠 Learnings (1)
📚 Learning: 2025-11-27T11:21:45.808Z
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-27T11:21:45.808Z
Learning: Applies to **/*.go : Use Controller-runtime patterns and kubebuilder style for Go code

Applied to files:

  • pkg/cmd/server/start.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (5)
packages/system/lineage-controller-webhook/images/lineage-controller-webhook/Dockerfile (1)

1-1: LGTM! Consistent with the Go 1.25 upgrade.

The builder image update aligns with the coordinated Go upgrade across all components. Verification comments from the cozystack-api Dockerfile apply here as well.

packages/system/cozystack-controller/images/cozystack-controller/Dockerfile (1)

1-1: LGTM! Consistent with the Go 1.25 upgrade.

The builder image update maintains consistency with the broader Go toolchain upgrade across the project.

packages/system/kubeovn-plunger/images/kubeovn-plunger/Dockerfile (1)

1-1: LGTM! Consistent with the Go 1.25 upgrade.

The builder image update completes the consistent Go 1.25 upgrade across all system component Dockerfiles.

packages/system/cozystack-api/images/cozystack-api/Dockerfile (1)

1-1: Go 1.25 image is available and compatible; consider GOMAXPROCS behavior for containers.

The golang:1.25-alpine image is available and stable. Go 1.25 maintains backward compatibility, and almost all Go programs should continue to compile and run as before. If this code runs in containerized environments (Kubernetes/Docker), note that Go 1.25 now considers cgroup CPU bandwidth limits when setting GOMAXPROCS by default on Linux, which generally corresponds to container "CPU limit" options.

pkg/cmd/server/start_test.go (1)

19-20: Test removal is well-documented.

The explanatory comment clearly states why the KEP-4330 component versioning tests were removed. This is consistent with the removal of the corresponding functionality from start.go.

Comment on lines +104 to +105
// Note: KEP-4330 component versioning functionality (k8s.io/apiserver/pkg/util/version)
// is not available in Kubernetes v0.34.1. The component versioning code has been removed.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Correct the Kubernetes version number in the comment.

The comment references "Kubernetes v0.34.1," which does not exist. The correct version is Kubernetes v1.34.1. Additionally, note that KEP-4330 component versioning functionality (k8s.io/apiserver/pkg/util/version) was introduced in Kubernetes v1.34 as an alpha feature.

	// Note: KEP-4330 component versioning functionality (k8s.io/apiserver/pkg/util/version)
	// is not available in Kubernetes v1.34.1. The component versioning code has been removed.
🤖 Prompt for AI Agents
In pkg/cmd/server/start.go around lines 104 to 105, the comment incorrectly
references "Kubernetes v0.34.1"; update the comment to the correct version
"Kubernetes v1.34.1" and mention that KEP-4330 component versioning
(k8s.io/apiserver/pkg/util/version) was introduced as an alpha feature in
Kubernetes v1.34, e.g. change the text to reference v1.34.1 and note the alpha
introduction.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
pkg/cmd/server/start.go (1)

104-105: Correct the Kubernetes version number in the comment.

The comment references "Kubernetes v0.34.1," which should be "v1.34.1". This issue was already flagged in a previous review.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe92995 and 1e2ed2c.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • go.mod (1 hunks)
  • packages/system/backup-controller/images/backup-controller/Dockerfile (1 hunks)
  • packages/system/cozystack-api/images/cozystack-api/Dockerfile (1 hunks)
  • packages/system/cozystack-controller/images/cozystack-controller/Dockerfile (1 hunks)
  • packages/system/kubeovn-plunger/images/kubeovn-plunger/Dockerfile (1 hunks)
  • packages/system/lineage-controller-webhook/images/lineage-controller-webhook/Dockerfile (1 hunks)
  • pkg/cmd/server/start.go (2 hunks)
  • pkg/cmd/server/start_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/system/kubeovn-plunger/images/kubeovn-plunger/Dockerfile
  • packages/system/cozystack-api/images/cozystack-api/Dockerfile
  • packages/system/lineage-controller-webhook/images/lineage-controller-webhook/Dockerfile
  • packages/system/cozystack-controller/images/cozystack-controller/Dockerfile
  • go.mod
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Use Controller-runtime patterns and kubebuilder style for Go code

Files:

  • pkg/cmd/server/start.go
  • pkg/cmd/server/start_test.go
🧠 Learnings (1)
📚 Learning: 2025-11-27T11:21:45.808Z
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-27T11:21:45.808Z
Learning: Applies to **/*.go : Use Controller-runtime patterns and kubebuilder style for Go code

Applied to files:

  • pkg/cmd/server/start.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (2)
packages/system/backup-controller/images/backup-controller/Dockerfile (1)

1-1: Confirm image availability and consider using a pinned version.

The golang:1.25-alpine image is available on Docker Hub. However, using the generic 1.25-alpine tag will pull the latest 1.25.x patch (currently 1.25.5-alpine). For production builds, consider pinning to a specific patch version like golang:1.25.5-alpine to avoid unexpected updates.

Note that the Alpine variant is highly experimental and not officially supported by the Go project, and it uses musl libc instead of glibc, which can lead to unexpected behavior. Ensure the build and final application behavior are compatible before merging.

pkg/cmd/server/start.go (1)

84-84: LGTM!

Returning nil is appropriate given the removal of KEP-4330 component versioning logic from the startup flow.

Comment on lines +19 to +20
// Note: Tests for KEP-4330 component versioning functionality have been removed
// as the functionality is not available in Kubernetes v0.34.1.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Correct the Kubernetes version number in the comment.

The comment references "Kubernetes v0.34.1," which does not exist. The correct version is v1.34.1. KEP-4330 component versioning functionality was introduced in Kubernetes v1.34 as an alpha feature.

🔎 Proposed fix
-// Note: Tests for KEP-4330 component versioning functionality have been removed
-// as the functionality is not available in Kubernetes v0.34.1.
+// Note: Tests for KEP-4330 component versioning functionality have been removed
+// as the functionality is not available in Kubernetes v1.34.1.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Note: Tests for KEP-4330 component versioning functionality have been removed
// as the functionality is not available in Kubernetes v0.34.1.
// Note: Tests for KEP-4330 component versioning functionality have been removed
// as the functionality is not available in Kubernetes v1.34.1.
🤖 Prompt for AI Agents
In pkg/cmd/server/start_test.go around lines 19 to 20, the comment incorrectly
references "Kubernetes v0.34.1"; update the comment to use the correct version
"Kubernetes v1.34.1" (or "v1.34" if you prefer the minor-only form) so it
accurately reflects when KEP-4330 component versioning was introduced.

@kvaps kvaps force-pushed the update-go branch 2 times, most recently from 94a97f7 to 8392cc3 Compare December 22, 2025 09:09
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (3)
pkg/cmd/server/start_test.go (1)

19-20: Correct the Kubernetes version number in the comment.

The comment references "Kubernetes v0.34.1," which does not exist. The correct version is v1.34.1.

🔎 Proposed fix
 // Note: Tests for KEP-4330 component versioning functionality have been removed
-// as the functionality is not available in Kubernetes v0.34.1.
+// as the functionality is not available in Kubernetes v1.34.1.
pkg/cmd/server/start.go (1)

104-105: Correct the Kubernetes version number in the comment.

The comment references "Kubernetes v0.34.1," which does not exist. The correct version is v1.34.1. KEP-4330 component versioning functionality was introduced in Kubernetes v1.34 as an alpha feature.

🔎 Proposed fix
-// Note: KEP-4330 component versioning functionality (k8s.io/apiserver/pkg/util/version)
-// is not available in Kubernetes v0.34.1. The component versioning code has been removed.
+// Note: KEP-4330 component versioning functionality (k8s.io/apiserver/pkg/util/version)
+// is not available in Kubernetes v1.34.1. The component versioning code has been removed.
go.mod (1)

5-5: Fix the Go version format in the go.mod directive.

The go directive should specify only the major and minor version, not the patch version. Update from go 1.25.0 to go 1.25. Patch versions are not allowed in the go directive and will cause parsing errors.

🔎 Proposed fix
-go 1.25.0
+go 1.25

As per coding guidelines, use the go get command to manage go.mod rather than manual edits.

🧹 Nitpick comments (1)
packages/core/installer/images/cozystack/Dockerfile (1)

1-1: Update k8s-await-election-builder stage to golang:1.25-alpine for consistency.

The first builder stage uses golang:1.24-alpine, while the main builder stage at Line 16 uses golang:1.25-alpine. Since multiple other Dockerfiles in the repository have been updated to golang:1.25-alpine as part of this PR, consider updating this stage as well for consistency, unless there's a specific compatibility reason to keep it on 1.24.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 94a97f7 and 8392cc3.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (10)
  • go.mod
  • packages/core/installer/images/cozystack/Dockerfile
  • packages/core/platform/images/cozystack-assets/Dockerfile
  • packages/system/backup-controller/images/backup-controller/Dockerfile
  • packages/system/cozystack-api/images/cozystack-api/Dockerfile
  • packages/system/cozystack-controller/images/cozystack-controller/Dockerfile
  • packages/system/kubeovn-plunger/images/kubeovn-plunger/Dockerfile
  • packages/system/lineage-controller-webhook/images/lineage-controller-webhook/Dockerfile
  • pkg/cmd/server/start.go
  • pkg/cmd/server/start_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/system/cozystack-api/images/cozystack-api/Dockerfile
  • packages/core/platform/images/cozystack-assets/Dockerfile
  • packages/system/backup-controller/images/backup-controller/Dockerfile
  • packages/system/cozystack-controller/images/cozystack-controller/Dockerfile
🧰 Additional context used
📓 Path-based instructions (2)
{go.mod,go.sum}

📄 CodeRabbit inference engine (AGENTS.md)

Do not manually modify go.mod and go.sum files; use go get command instead

Files:

  • go.mod
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Use Controller-runtime patterns and kubebuilder style for Go code

Files:

  • pkg/cmd/server/start_test.go
  • pkg/cmd/server/start.go
🧠 Learnings (2)
📚 Learning: 2025-11-27T11:21:45.808Z
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-27T11:21:45.808Z
Learning: Applies to {go.mod,go.sum} : Do not manually modify `go.mod` and `go.sum` files; use `go get` command instead

Applied to files:

  • go.mod
📚 Learning: 2025-11-27T11:21:45.808Z
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-27T11:21:45.808Z
Learning: Applies to **/*.go : Use Controller-runtime patterns and kubebuilder style for Go code

Applied to files:

  • pkg/cmd/server/start.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (4)
packages/system/lineage-controller-webhook/images/lineage-controller-webhook/Dockerfile (1)

1-1: LGTM!

The builder base image update to golang:1.25-alpine is consistent with the Go toolchain upgrade objective of this PR.

packages/system/kubeovn-plunger/images/kubeovn-plunger/Dockerfile (1)

1-1: LGTM!

The builder base image update to golang:1.25-alpine aligns with the PR's Go toolchain upgrade.

pkg/cmd/server/start.go (1)

83-85: LGTM!

The simplified PersistentPreRunE correctly returns nil after the removal of KEP-4330 component versioning setup logic.

go.mod (1)

7-30: Verify Kubernetes v1.34.1 dependency compatibility and update go.mod using go get.

Kubernetes 1.34 does not introduce any removals or critical API deprecations, making these dependency updates relatively stable. However, verify that the updated k8s.io packages (v0.34.1) are compatible with your codebase changes. Note: do not manually modify go.mod; use go get to manage Kubernetes dependency upgrades as per project guidelines.

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
go.mod (1)

5-5: Fix the Go version format in the go.mod directive.

The go directive should use only major and minor version (go 1.25), not include the patch version (go 1.25.0). The patch version in the go directive causes parsing errors.

Based on past review comments.

pkg/cmd/server/start.go (1)

104-105: Correct the Kubernetes version number in the comment.

The comment references "Kubernetes v0.34.1" but the correct version format is "Kubernetes v1.34.1". Kubernetes versions use the format v1.x.y, not v0.x.y.

Based on past review comments.

🧹 Nitpick comments (1)
pkg/cmd/server/start.go (1)

219-227: Consider whether the apiVersion format aligns with OpenAPI versioning conventions.

The computed apiVersion uses the format "0.1-{hash}" which doesn't follow semantic versioning (e.g., 0.1.0). While this format may be intentional to indicate API stability tied to configuration hash, consider whether standard semantic versioning would be more appropriate for OpenAPI Info.Version fields.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8392cc3 and e213b06.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (10)
  • go.mod
  • packages/core/installer/images/cozystack/Dockerfile
  • packages/core/platform/images/cozystack-assets/Dockerfile
  • packages/system/backup-controller/images/backup-controller/Dockerfile
  • packages/system/cozystack-api/images/cozystack-api/Dockerfile
  • packages/system/cozystack-controller/images/cozystack-controller/Dockerfile
  • packages/system/kubeovn-plunger/images/kubeovn-plunger/Dockerfile
  • packages/system/lineage-controller-webhook/images/lineage-controller-webhook/Dockerfile
  • pkg/cmd/server/start.go
  • pkg/cmd/server/start_test.go
✅ Files skipped from review due to trivial changes (1)
  • packages/system/lineage-controller-webhook/images/lineage-controller-webhook/Dockerfile
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/system/kubeovn-plunger/images/kubeovn-plunger/Dockerfile
  • packages/system/backup-controller/images/backup-controller/Dockerfile
  • packages/system/cozystack-api/images/cozystack-api/Dockerfile
  • pkg/cmd/server/start_test.go
🧰 Additional context used
📓 Path-based instructions (2)
{go.mod,go.sum}

📄 CodeRabbit inference engine (AGENTS.md)

Do not manually modify go.mod and go.sum files; use go get command instead

Files:

  • go.mod
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Use Controller-runtime patterns and kubebuilder style for Go code

Files:

  • pkg/cmd/server/start.go
🧠 Learnings (2)
📚 Learning: 2025-11-27T11:21:45.808Z
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-27T11:21:45.808Z
Learning: Applies to {go.mod,go.sum} : Do not manually modify `go.mod` and `go.sum` files; use `go get` command instead

Applied to files:

  • go.mod
📚 Learning: 2025-11-27T11:21:45.808Z
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-27T11:21:45.808Z
Learning: Applies to **/*.go : Use Controller-runtime patterns and kubebuilder style for Go code

Applied to files:

  • pkg/cmd/server/start.go
🧬 Code graph analysis (1)
pkg/cmd/server/start.go (2)
pkg/config/config.go (1)
  • ResourceConfig (20-22)
pkg/apiserver/apiserver.go (1)
  • Scheme (53-53)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (5)
packages/core/platform/images/cozystack-assets/Dockerfile (1)

1-1: LGTM! Base image upgrade aligns with Go 1.25 toolchain.

The builder image bump from golang:1.24-alpine to golang:1.25-alpine is consistent with the Go toolchain upgrade to 1.25 in go.mod.

packages/core/installer/images/cozystack/Dockerfile (1)

16-16: LGTM! Main builder stage upgraded to Go 1.25.

The builder stage image bump to golang:1.25-alpine is consistent with the Go toolchain upgrade. Note that the k8s-await-election-builder stage (line 1) intentionally remains on golang:1.24-alpine as it builds a pinned external dependency.

packages/system/cozystack-controller/images/cozystack-controller/Dockerfile (1)

1-1: LGTM! Builder image upgraded to Go 1.25.

The base image bump to golang:1.25-alpine aligns with the broader Go toolchain upgrade in this PR.

go.mod (1)

1-129: Verify that dependency updates were applied using go get commands.

Per the coding guidelines, go.mod and go.sum files should not be manually modified; use the go get command instead. Please confirm that these dependency updates were applied using go get or similar Go tooling commands rather than manual edits.

Based on coding guidelines.

pkg/cmd/server/start.go (1)

42-43: LGTM! Import changes align with KEP-4330 removal.

The replacement of component versioning imports with basecompatibility is consistent with the removal of KEP-4330 component versioning functionality described in the AI summary.

Comment on lines +247 to +255
// Set FeatureGate and EffectiveVersion - required for Complete() in Kubernetes v0.34.1
// Following the pattern from sample-apiserver, but creating EffectiveVersion directly
// without ComponentGlobalsRegistry
serverConfig.FeatureGate = utilfeature.DefaultMutableFeatureGate
// Create EffectiveVersion directly using compatibility package
// This is needed even without ComponentGlobalsRegistry
if baseversion.DefaultKubeBinaryVersion != "" {
serverConfig.EffectiveVersion = basecompatibility.NewEffectiveVersionFromString(baseversion.DefaultKubeBinaryVersion, "", "")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for usages of EffectiveVersion and DefaultKubeBinaryVersion

echo "=== EffectiveVersion usages ==="
rg -n -C3 'EffectiveVersion' --type=go -g '!vendor/' -g '!go.mod' -g '!go.sum' | head -100

echo -e "\n=== DefaultKubeBinaryVersion usages ==="
rg -n -C3 'DefaultKubeBinaryVersion' --type=go -g '!vendor/' -g '!go.mod' -g '!go.sum' | head -100

Repository: cozystack/cozystack

Length of output: 1921


🏁 Script executed:

#!/bin/bash
# Search for broader patterns of EffectiveVersion access and DefaultKubeBinaryVersion initialization

echo "=== Search for serverConfig.EffectiveVersion access ==="
rg -n 'serverConfig\.EffectiveVersion' --type=go -g '!vendor/' | head -50

echo -e "\n=== Search for EffectiveVersion nil checks ==="
rg -n 'EffectiveVersion\s*==\s*nil|EffectiveVersion\s*!=\s*nil' --type=go -g '!vendor/' | head -50

echo -e "\n=== Search where DefaultKubeBinaryVersion is assigned ==="
rg -n 'DefaultKubeBinaryVersion\s*=' --type=go -g '!vendor/' | head -50

echo -e "\n=== Check baseversion package for DefaultKubeBinaryVersion definition ==="
find . -name '*.go' -type f -exec grep -l 'DefaultKubeBinaryVersion' {} \; | head -20

Repository: cozystack/cozystack

Length of output: 482


🏁 Script executed:

#!/bin/bash
# Check imports in start.go
echo "=== Imports in start.go ==="
head -100 ./pkg/cmd/server/start.go | grep -A50 '^import'

echo -e "\n=== Search for baseversion package ==="
find . -path '*/baseversion/*.go' -type f | head -10

echo -e "\n=== Look for DefaultKubeBinaryVersion definition ==="
rg -n 'DefaultKubeBinaryVersion' --type=go -B2 -A2 -g '!vendor/'

Repository: cozystack/cozystack

Length of output: 2282


🏁 Script executed:

#!/bin/bash
# Check what happens after EffectiveVersion is set
echo "=== Code around and after EffectiveVersion initialization ==="
sed -n '245,280p' ./pkg/cmd/server/start.go

echo -e "\n=== Search for Complete() method calls and serverConfig usage ==="
rg -n '\.Complete\(\)' ./pkg/cmd/server/start.go -A5 -B5

echo -e "\n=== Check if there are any comments about required fields in Complete() ==="
rg -n 'required|must|need' ./pkg/cmd/server/start.go -i | head -20

Repository: cozystack/cozystack

Length of output: 2445


🏁 Script executed:

#!/bin/bash
# Check if there's a go.mod to understand Kubernetes version being used
echo "=== Check go.mod for k8s.io/component-base version ==="
grep -A2 'k8s.io/component-base' ./go.mod | head -5

echo -e "\n=== Search for any initialization or build-related code ==="
rg -n 'ldflags|buildInfo|version' ./pkg/cmd/server/start.go -i | head -20

echo -e "\n=== Check if there are any defaults or initialization in config setup ==="
rg -n 'NewRecommendedOptions|Config\(\)' ./pkg/cmd/server/start.go -B3 -A10 | head -50

Repository: cozystack/cozystack

Length of output: 3096


Verify that nil EffectiveVersion is handled safely or provide a fallback when DefaultKubeBinaryVersion is empty.

The code only sets serverConfig.EffectiveVersion when baseversion.DefaultKubeBinaryVersion is non-empty (lines 253-254). However, the comment on line 247 explicitly states that EffectiveVersion is "required for Complete()" in Kubernetes v0.34.1. If DefaultKubeBinaryVersion is empty (possible when built without ldflags), EffectiveVersion remains nil, and the subsequent Complete() call on line 275 may fail or behave unexpectedly. Either provide a fallback/default value or add error handling to ensure the required field is never nil.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 24, 2025
@kvaps kvaps merged commit ab6c6ba into main Dec 24, 2025
42 of 43 checks passed
@kvaps kvaps deleted the update-go branch December 24, 2025 13:10
kvaps added a commit that referenced this pull request Jan 8, 2026
This change is extracted from
- #1641

and reworked to work standalone

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[cozystack] Update go modules
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **Chores**
* Updated Go toolchain to 1.25.0 and upgraded core Kubernetes libraries,
OpenTelemetry, Prometheus, gRPC/protobuf and many indirect dependencies.
Bumped builder base images to golang:1.25-alpine across multiple
components.

* **Refactor**
* Removed legacy component versioning/emulation and simplified server
startup and configuration paths.

* **Tests**
  * Removed tests related to the legacy versioning/emulation behavior.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
kvaps added a commit that referenced this pull request Jan 8, 2026
This change is extracted from
- #1641

and reworked to work standalone

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[cozystack] Update go modules
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **Chores**
* Updated Go toolchain to 1.25.0 and upgraded core Kubernetes libraries,
OpenTelemetry, Prometheus, gRPC/protobuf and many indirect dependencies.
Bumped builder base images to golang:1.25-alpine across multiple
components.

* **Refactor**
* Removed legacy component versioning/emulation and simplified server
startup and configuration paths.

* **Tests**
  * Removed tests related to the legacy versioning/emulation behavior.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
kvaps added a commit that referenced this pull request Jan 9, 2026
This change is extracted from
- #1641

and reworked to work standalone

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[cozystack] Update go modules
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **Chores**
* Updated Go toolchain to 1.25.0 and upgraded core Kubernetes libraries,
OpenTelemetry, Prometheus, gRPC/protobuf and many indirect dependencies.
Bumped builder base images to golang:1.25-alpine across multiple
components.

* **Refactor**
* Removed legacy component versioning/emulation and simplified server
startup and configuration paths.

* **Tests**
  * Removed tests related to the legacy versioning/emulation behavior.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants