Fix: Update dependencies and resolve compatibility issues#783
Conversation
d41104d to
4a845df
Compare
- 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>
7408279 to
e014816
Compare
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. |
|
Thanks for the contribution, @scodeman! 🙌 I noticed that this PR downgrades the That said, to stay aligned with the main KubeVela and related dependencies, we actually want to move forward to Also, just a heads-up: upgrading from |
…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>
fdb672f to
cc4111b
Compare
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:
The following errors were encountered:
1. Missing/Deprecated Package Errors
This error occurred in 11 test files that were importing the deprecated
envtest/printerpackage 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
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:
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:
Changes Made
1. Dependency Updates
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.3k8s.io/client-go v0.25.3sigs.k8s.io/controller-runtime v0.12.3When 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:
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.0The newer k8s versions require OpenTelemetry packages that conflict with what kubevela-core-api expects.
sigs.k8s.io/controller-runtime/pkg/envtest/printer: module found (v0.22.4), but does not contain packageThis 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:
sigs.k8s.io/controller-runtime/pkg/envtest/printerfrom all test filesUpdated test functions:
RunSpecsWithDefaultAndCustomReporters(t, "Suite Name", []Reporter{printer.NewlineReporter{}})RunSpecs(t, "Suite Name")Files modified:
test/e2e-test/terraform-test/terraform_test.golegacy/workloads/podspecworkload/controllers/suite_test.golegacy/traits/sidecartrait/controllers/suite_test.golegacy/traits/poddisruptionbudgettrait/controllers/suite_test.golegacy/traits/autoscalertrait/controllers/suite_test.golegacy/traits/cronhpatrait/controllers/suite_test.golegacy/traits/metricstrait/controllers/suite_test.golegacy/traits/routetrait/controllers/suite_test.golegacy/traits/metrichpatrait/controllers/suite_test.golegacy/traits/simplerollouttrait/controllers/suite_test.golegacy/traits/hpatrait/test/suite_test.goTesting
✅ Build verification:
./hack/build.shcompletes 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 tidycommand shows warnings aboutenvtest/printerpackage from external dependencies (kubevela-core-api@v1.7.7). This is expected and harmless because:Commits
Summary by cubic
Aligns dependencies with kubevela master, pins
kustomizeto resolvegnosticbuild 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
k8s.io/apimachineryandk8s.io/client-gotov0.31.10,sigs.k8s.io/controller-runtimetov0.19.7.helm.sh/helm/v3tov3.14.4.sigs.k8s.io/kustomize/apiandsigs.k8s.io/kustomize/kyamlto kubevela-aligned revisions to fixgnostictype mismatches.docker/cli,docker/docker,docker-credential-helpers,sigs.k8s.io/apiserver-network-proxy/konnectivity-clienttov0.0.36,sigs.k8s.io/apiserver-runtime,cloud.google.com/go,github.com/oam-dev/stern).v1.28.0,grpc-gateway/v2,oras-go v1.2.5, etc.).1.23.8; bumpGO_VERSIONin.github/workflows.Migration
sigs.k8s.io/controller-runtime/pkg/envtest/printerand switch fromRunSpecsWithDefaultAndCustomReporterstoRunSpecsacross 11 suites.go mod tidymay still showenvtest/printerwarnings fromkubevela-core-apitest deps; harmless.Written for commit cc4111b. Summary will update on new commits.