-
Notifications
You must be signed in to change notification settings - Fork 136
Update go modules #1736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update go modules #1736
Conversation
WalkthroughGo 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 Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
Summary of ChangesHello @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
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this 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.
There was a problem hiding this 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:
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 throughComplete()or using a context with timeout.Line 149: Using
fmt.Printfis inconsistent with Kubernetes patterns. Based on learnings, controller-runtime patterns should use structured logging viaklog.🔎 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:
- Removing the file entirely and tracking the note in the PR/commit message
- 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
⛔ Files ignored due to path filters (1)
go.sumis 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.gopkg/cmd/server/start_test.go
{go.mod,go.sum}
📄 CodeRabbit inference engine (AGENTS.md)
Do not manually modify
go.modandgo.sumfiles; usego getcommand 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
PersistentPreRunEreturningnilis 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
CozystackResourceDefinitiontoconfig.Resourceis 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 getrather 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this 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
PersistentPreRunEhook now returnsnilimmediately 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
⛔ Files ignored due to path filters (1)
go.sumis 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.gopkg/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-alpineimage 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.
| // 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this 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
⛔ Files ignored due to path filters (1)
go.sumis 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.gopkg/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-alpinetag will pull the latest 1.25.x patch (currently 1.25.5-alpine). For production builds, consider pinning to a specific patch version likegolang:1.25.5-alpineto 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
nilis appropriate given the removal of KEP-4330 component versioning logic from the startup flow.
| // Note: Tests for KEP-4330 component versioning functionality have been removed | ||
| // as the functionality is not available in Kubernetes v0.34.1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| // 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.
94a97f7 to
8392cc3
Compare
There was a problem hiding this 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
godirective should specify only the major and minor version, not the patch version. Update fromgo 1.25.0togo 1.25. Patch versions are not allowed in the go directive and will cause parsing errors.🔎 Proposed fix
-go 1.25.0 +go 1.25As per coding guidelines, use the
go getcommand 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 usesgolang: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
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (10)
go.modpackages/core/installer/images/cozystack/Dockerfilepackages/core/platform/images/cozystack-assets/Dockerfilepackages/system/backup-controller/images/backup-controller/Dockerfilepackages/system/cozystack-api/images/cozystack-api/Dockerfilepackages/system/cozystack-controller/images/cozystack-controller/Dockerfilepackages/system/kubeovn-plunger/images/kubeovn-plunger/Dockerfilepackages/system/lineage-controller-webhook/images/lineage-controller-webhook/Dockerfilepkg/cmd/server/start.gopkg/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.modandgo.sumfiles; usego getcommand 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.gopkg/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-alpineis 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-alpinealigns with the PR's Go toolchain upgrade.pkg/cmd/server/start.go (1)
83-85: LGTM!The simplified
PersistentPreRunEcorrectly returnsnilafter 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 getto manage Kubernetes dependency upgrades as per project guidelines.
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
There was a problem hiding this 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
godirective 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
apiVersionuses 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 OpenAPIInfo.Versionfields.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (10)
go.modpackages/core/installer/images/cozystack/Dockerfilepackages/core/platform/images/cozystack-assets/Dockerfilepackages/system/backup-controller/images/backup-controller/Dockerfilepackages/system/cozystack-api/images/cozystack-api/Dockerfilepackages/system/cozystack-controller/images/cozystack-controller/Dockerfilepackages/system/kubeovn-plunger/images/kubeovn-plunger/Dockerfilepackages/system/lineage-controller-webhook/images/lineage-controller-webhook/Dockerfilepkg/cmd/server/start.gopkg/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.modandgo.sumfiles; usego getcommand 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-alpinetogolang:1.25-alpineis consistent with the Go toolchain upgrade to 1.25 ingo.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-alpineis consistent with the Go toolchain upgrade. Note that thek8s-await-election-builderstage (line 1) intentionally remains ongolang:1.24-alpineas 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-alpinealigns with the broader Go toolchain upgrade in this PR.go.mod (1)
1-129: Verify that dependency updates were applied usinggo getcommands.Per the coding guidelines,
go.modandgo.sumfiles should not be manually modified; use thego getcommand instead. Please confirm that these dependency updates were applied usinggo getor 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
basecompatibilityis consistent with the removal of KEP-4330 component versioning functionality described in the AI summary.
| // 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, "", "") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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 -100Repository: 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 -20Repository: 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 -20Repository: 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 -50Repository: 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.
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 -->
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 -->
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 -->
This change is extracted from
and reworked to work standalone
Signed-off-by: Andrei Kvapil kvapss@gmail.com
What this PR does
Release note
Summary by CodeRabbit
Chores
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.