Skip to content

Fix: Update dependencies and resolve compatibility issues#783

Open
scodeman wants to merge 4 commits into
kubevela:masterfrom
scodeman:fix_dependencies
Open

Fix: Update dependencies and resolve compatibility issues#783
scodeman wants to merge 4 commits into
kubevela:masterfrom
scodeman:fix_dependencies

Conversation

@scodeman

@scodeman scodeman commented Dec 16, 2025

Copy link
Copy Markdown

Summary

This PR resolves Go module dependency issues and updates the project to be compatible with Ginkgo v2 test framework.

Issues Encountered

When running the initial commands:

go mod tidy
(cd addons && go run ../hack/addons/syn_addon_package.go ./ https://kubevela.github.io/catalog/official)
(cd experimental/addons && go run ../../hack/addons/syn_addon_package.go ./https://kubevela.github.io/catalog/experimental)

The following errors were encountered:

1. Missing/Deprecated Package Errors

sigs.k8s.io/controller-runtime/pkg/envtest/printer: module sigs.k8s.io/controller-runtime@latest 
found (v0.17.6), but does not contain package sigs.k8s.io/controller-runtime/pkg/envtest/printer

This error occurred in 11 test files that were importing the deprecated envtest/printer package and using the old Ginkgo v1 API. The package was removed in newer versions of controller-runtime as part of the Ginkgo v2 migration.

2. Konnectivity Client Package Errors

sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client/metrics: 
module does not contain package

sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/common/metrics: 
module does not contain package

These packages were moved/restructured in newer versions of the konnectivity-client, requiring proper version constraints via replace directives.

3. Build Compilation Errors (After Initial Fixes)

After attempting initial fixes, additional compatibility issues arose:

# sigs.k8s.io/kustomize/kyaml/openapi
cannot use doc (variable of type *"github.com/google/gnostic-models/openapiv2".Document) 
as *"github.com/google/gnostic/openapiv2".Document value in argument to swagger.FromGnostic

This required adding replace directives for gnostic packages and pinning kustomize versions to resolve the type mismatch between gnostic and gnostic-models packages.

Resolution

All these issues have been systematically resolved through:

  1. Removing deprecated test imports from all 11 test files
  2. Updating to Ginkgo v2 API (RunSpecs instead of RunSpecsWithDefaultAndCustomReporters)
  3. Adding comprehensive replace directives in go.mod for version constraints
  4. Pinning all affected packages to compatible versions

Changes Made

1. Dependency Updates

  • controller-runtime: Updated to v0.14.6 for stability and compatibility
  • k8s.io packages: Pinned to v0.26.3 (api, apimachinery, client-go, apiextensions-apiserver, apiserver, cli-runtime, component-base)
  • kube-openapi: Pinned to v0.0.0-20230202010329-39b3636cbaa3
  • konnectivity-client: Added replace directive for v0.0.37
  • OpenTelemetry packages: Added version constraints for compatibility (v1.10.0)
  • gnostic packages: Added replace directives to resolve version conflicts
  • kustomize packages: Pinned api to v0.12.1 and kyaml to v0.13.9

External Dependency Constraints (kubevela-core-api v1.7.7)
The project depends on kubevela-core-api v1.7.7, which requires:
k8s.io/apimachinery v0.25.3
k8s.io/client-go v0.25.3
sigs.k8s.io/controller-runtime v0.12.3
When we try to use v0.29.2 for k8s packages and v0.17.6 for controller-runtime, this create version conflicts because kubevela-core-api is pulling in older versions.

Compatibility Issues with Dependencies
When using the newer versions, the following errors occur:

  • OpenTelemetry Package Issues:
    go.opentelemetry.io/otel/semconv/v1.17.0: module found (v1.39.0, replaced by v1.10.0), but does not contain package go.opentelemetry.io/otel/semconv/v1.17.0
    The newer k8s versions require OpenTelemetry packages that conflict with what kubevela-core-api expects.
  • The same envtest/printer Issue:
    sigs.k8s.io/controller-runtime/pkg/envtest/printer: module found (v0.22.4), but does not contain package
    This still occurs because kubevela-core-api's test dependencies reference the old package.

The solution is to use a compatible middle ground where we chose v0.26.3 for k8s packages and v0.14.6 for controller-runtime because:
✅ They're newer than what kubevela-core-api requires (v0.25.3 and v0.12.3)
✅ They're compatible with each other and the dependency chain
✅ They work with the replace directives for konnectivity-client and other packages
✅ The build succeeds without conflicts

2. Test Code Migration (Ginkgo v2 Compatibility)

Updated 11 test files to be compatible with Ginkgo v2:

Removed deprecated imports:

  • Removed sigs.k8s.io/controller-runtime/pkg/envtest/printer from all test files

Updated test functions:

  • Changed from RunSpecsWithDefaultAndCustomReporters(t, "Suite Name", []Reporter{printer.NewlineReporter{}})
  • To RunSpecs(t, "Suite Name")

Files modified:

  • test/e2e-test/terraform-test/terraform_test.go
  • legacy/workloads/podspecworkload/controllers/suite_test.go
  • legacy/traits/sidecartrait/controllers/suite_test.go
  • legacy/traits/poddisruptionbudgettrait/controllers/suite_test.go
  • legacy/traits/autoscalertrait/controllers/suite_test.go
  • legacy/traits/cronhpatrait/controllers/suite_test.go
  • legacy/traits/metricstrait/controllers/suite_test.go
  • legacy/traits/routetrait/controllers/suite_test.go
  • legacy/traits/metrichpatrait/controllers/suite_test.go
  • legacy/traits/simplerollouttrait/controllers/suite_test.go
  • legacy/traits/hpatrait/test/suite_test.go

Testing

Build verification: ./hack/build.sh completes successfully
Addon sync (official): Successfully compiles and runs
Addon sync (experimental): Successfully compiles and runs
Test compilation: All test files compile correctly

Known Limitations

The go mod tidy command shows warnings about envtest/printer package from external dependencies (kubevela-core-api@v1.7.7). This is expected and harmless because:

  • These are test dependencies of external packages, not our code
  • We've fixed all our own test files
  • Build and runtime functionality is unaffected
  • We cannot control test dependencies of external packages

Commits

  • fix: update dependencies and resolve Ginkgo v2 compatibility
  • fix: add gnostic and kustomize version constraints for build compatibility

Summary by cubic

Aligns dependencies with kubevela master, pins kustomize to resolve gnostic build conflicts, and removes deprecated test imports so builds and addon syncs run cleanly. CI now uses Go 1.23.8 to match go.mod.

  • Dependencies

    • Upgrade k8s.io/apimachinery and k8s.io/client-go to v0.31.10, sigs.k8s.io/controller-runtime to v0.19.7.
    • Bump helm.sh/helm/v3 to v3.14.4.
    • Pin sigs.k8s.io/kustomize/api and sigs.k8s.io/kustomize/kyaml to kubevela-aligned revisions to fix gnostic type mismatches.
    • Add replace directives mirroring kubevela (e.g., docker/cli, docker/docker, docker-credential-helpers, sigs.k8s.io/apiserver-network-proxy/konnectivity-client to v0.0.36, sigs.k8s.io/apiserver-runtime, cloud.google.com/go, github.com/oam-dev/stern).
    • Update indirects (OpenTelemetry v1.28.0, grpc-gateway/v2, oras-go v1.2.5, etc.).
    • Require Go 1.23.8; bump GO_VERSION in .github/workflows.
  • Migration

    • Drop sigs.k8s.io/controller-runtime/pkg/envtest/printer and switch from RunSpecsWithDefaultAndCustomReporters to RunSpecs across 11 suites.
    • Note: go mod tidy may still show envtest/printer warnings from kubevela-core-api test deps; harmless.

Written for commit cc4111b. Summary will update on new commits.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 13 files

- Update controller-runtime to v0.14.6 for compatibility
- Pin k8s.io packages to v0.26.3
- Add replace directives for konnectivity-client (v0.0.37)
- Add OpenTelemetry version constraints for compatibility
- Remove deprecated envtest/printer imports from all test files
- Migrate from RunSpecsWithDefaultAndCustomReporters to RunSpecs

This resolves dependency conflicts and ensures compatibility with
Ginkgo v2 test framework.

Signed-off-by: S Code Man <30977678+scodeman@users.noreply.github.com>
…ility

- Add replace directives for gnostic packages to resolve version conflicts
- Pin kustomize/api to v0.12.1 and kustomize/kyaml to v0.13.9
- Ensures main code and addon sync programs compile successfully

Signed-off-by: S Code Man <30977678+scodeman@users.noreply.github.com>
…rect

- Restore fatih/color, kubevela-core-api, terraform-controller, pkg/errors as direct deps
- Restore k8s.io/apimachinery, k8s.io/client-go, controller-runtime as direct deps
- These are used by test files and should be explicit dependencies

Signed-off-by: S Code Man <30977678+scodeman@users.noreply.github.com>
@scodeman

Copy link
Copy Markdown
Author

@FogDong @anoop2811 @barnettZQG @dhiguero @jguionnet @wangyikewxgm @wonderflow

@scodeman

Copy link
Copy Markdown
Author

@FogDong @anoop2811 @barnettZQG @dhiguero @jguionnet @wangyikewxgm @wonderflow

What is required to get the review performed ?

@anoop2811

Copy link
Copy Markdown
Contributor

@FogDong @anoop2811 @barnettZQG @dhiguero @jguionnet @wangyikewxgm @wonderflow

What is required to get the review performed ?

Hey @scodeman , sorry for the delay as we are working through some big changes in the kubevela repo. Will take a look at this soon and merge if all ok. Thank you once again for your contributions and apologize for the delay.

@roguepikachu

Copy link
Copy Markdown
Collaborator

Thanks for the contribution, @scodeman! 🙌

I noticed that this PR downgrades the k8s.io/* packages (e.g., apimachinery, client-go) to v0.26.3, while we’re currently on v0.29.2. We should at least revert that downgrade.

That said, to stay aligned with the main KubeVela and related dependencies, we actually want to move forward to v0.31.10. Could you update the go.mod accordingly?

Also, just a heads-up: upgrading from v0.29.2 (and especially from v0.26.3) to v0.31.10 is a significant jump. This might introduce compatibility issues for some addons depending on their Kubernetes version support, so we’ll need thorough testing to make sure everything remains stable.

Comment thread go.mod Outdated

@roguepikachu roguepikachu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The test file changes lgtm

scodeman pushed a commit to scodeman/kubevela_catalog that referenced this pull request May 10, 2026
…rade

Resolves go.mod / go.sum conflicts in favor of this branch's
upgrade-to-kubevela-main approach, replacing PR kubevela#783's v0.26.3 downgrade
per roguepikachu's review feedback. The Ginkgo v2 test migration on
fix_dependencies is identical to ours, so those files merge cleanly.

https://claude.ai/code/session_01CnAoaapjc6wbwaPFFvcBdJ
…ading

Signed-off-by: florent.madiot.e <florent.madiot.e@thalesdigital.io>
@scodeman scodeman force-pushed the fix_dependencies branch from fdb672f to cc4111b Compare May 11, 2026 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants