Fix: Update dependencies and resolve compatibility issues #783
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Updates Go dependencies and migrates tests to Ginkgo v2 to resolve build and compatibility issues. Builds and addon sync programs compile and run cleanly.
Dependencies
Test Migration
Written for commit e014816. Summary will update automatically on new commits.