chore(module): migrate to go.work#2626
Open
danilrwx wants to merge 18 commits into
Open
Conversation
module-sdk v0.11.1 pulls controller-runtime v0.22.x, which requires the k8s 0.34 API stack and deckhouse/log v0.2.0. Bump the k8s.io replaces to v0.34.2 and kube-openapi to a structured-merge-diff/v6 compatible pseudo. Adapt tests to the renamed mock constructor (NewPatchableValuesCollectorMock -> NewOutputPatchableValuesCollectorMock) and to the functional log options API. Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Move virtualization-artifact and virtualization-dra to deckhouse/log v0.2.0 and its functional options API (WithLevel/WithOutput). Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Add a Go workspace over the modules sharing the k8s 0.34 / kubevirt v48 stack. Conflicting third-party pins (k8s.io/*, golang.org/x/oauth2, k8s.io/kube-openapi) are unified via go.work replace so every member builds against a single dependency set. Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
controller-runtime v0.22 adds Apply to client.Client/Writer; regenerate the moq client mock so it satisfies the interface. Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Add images/hooks, images/virt-launcher/vlctl and images/dvcr-artifact to the workspace. Their older k8s.io/*, openshift and controller-runtime pins are unified via go.work replace (k8s 0.34.2, controller-runtime v0.22.5, kubevirt v48). Drop images/cdi-cloner/cloner-startup, removed from the repo by #2394. Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Trim redundant/dead replace directives and unify shared versions so the
go.work workspace needs a minimal set of overrides:
- vlctl: drop ~20 dead k8s.io/* subpackage replaces (not in the require
graph, inherited from the kubevirt template) and bump k8s core to 0.34.2
- pvc-artifact: fix a malformed k8s.io/dynamic-resource-allocation replace
(missing module domain), bump golang.org/x/crypto to v0.52.0
- unify k8s.io/kube-openapi to the structured-merge-diff/v6 compatible
pseudo-version across kube-api-rewriter, e2e, kubevirt-rules, shatal
- unify github.com/openshift/{api,client-go} between vlctl and pvc
- virtualization-artifact: bump golang.org/x/oauth2 to v0.34.0
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Replace dvcr-artifact with pvc-artifact in the workspace (both provide module kubevirt.io/containerized-data-importer; only one can be a workspace member). After aligning module deps, the go.work replace set shrinks from 30 to 9: k8s core (6) at v0.34.2, kubevirt v50, controller-runtime v0.22.5 and k8s.io/kubelet v0.34.2. Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
pvc-artifact pinned k8s.io/code-generator to v0.30.2 via a replace but does not require it. In the workspace this leaked into api code generation, resolving code-generator to a version mismatched with the tool binary and breaking 'task generate'. Drop the dead replace so the workspace uses a single code-generator (v0.34.2). Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
The workspace hid incomplete per-module go.sum entries (covered by go.work.sum), but werf builds each image in isolation without go.work. Run go mod tidy for virtualization-dra (missing deckhouse/log v0.2.0 sum) and kube-api-rewriter so their go.sum are self-contained. Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
module-sdk v0.11.1 (hooks) requires controller-runtime v0.22.5, whose client.Client API is incompatible with the v0.21 used by the rest of the workspace. Align the whole artifact cluster on the newer stack so builds are consistent both in isolation (werf) and in the workspace: - virtualization-artifact: controller-runtime v0.22.5, regenerate client mock (client.Client gained Apply) - e2e, shatal, kube-api-rewriter: bump k8s.io/* to v0.34.2, controller-runtime v0.22.5 and kube-openapi to the smd/v6 pseudo Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
module-sdk v0.11.1 removed pkg.ReconcileFunc. The EE-only tls-certificates-audit hook used it; switch to pkg.HookFunc[*pkg.HookInput] (same func(ctx, input) error signature). Only surfaced under -tags EE, which werf builds use. Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
…/slices staticcheck (SA1019) flags k8s.io/utils/strings/slices as deprecated in favor of the standard library slices package. Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
controller-runtime v0.22 clears TypeMeta on objects returned by the typed client, so the owner reference built for the population snapshot had an empty APIVersion/Kind. Set the PVC GVK explicitly before constructing the reference. Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
…me v0.21 module-sdk v0.11.1 pulls controller-runtime v0.22, whose fake client runs objects through structured-merge-diff on create/update/patch. That panics on KubeVirt's uint64 VolumeStatus.Size (unsupported by SMD) in many artifact unit tests. Use module-sdk v0.10.13 (same public API, requires controller-runtime v0.20) and unify the workspace on controller-runtime v0.21, which the artifact cluster already used. Revert the artifact cluster (artifact, e2e, shatal, kube-api-rewriter) to their native stacks and restore the original client mock. Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Contributor
|
Workflow has started. The target step completed with status: failure. |
The rootCA Secret template inlined the raw PEM cert/key into the data field, which requires base64; the multi-line PEM broke chart rendering. Encode with b64enc, matching the other tls secret templates. Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Contributor
|
Workflow has started. The target step completed with status: failure. |
The rootCA cert in values is raw PEM; running b64dec on it produced an 'illegal base64 data' string as the ca-bundle, so virt-api could not load the CA (TLS handshake failures, pods flapping). Use the PEM as-is. Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
CASecret.Crt/Key are []byte, so setting the struct into values
re-encoded them to base64 (Go's []byte JSON convention). The TLS
certificate hooks then read an unparsable CA from values
("parse certificate: block not found"), treated it as outdated and
regenerated the CA on every reconcile — an endless module redeploy loop
that left virt-api unable to load the CA. Set the crt/key as plain PEM
strings instead.
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Contributor
|
Workflow has started. The target step completed with status: failure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Adds a
go.workworkspace at the repository root covering the Go modules that share the current Kubernetes 0.34 / KubeVirt v50 stack (api,virtualization-artifact,hooks,virtualization-dra,pvc-artifact,vm-route-forge,kube-api-rewriter,kubevirt-rules,vlctl,cli, e2e and tooling modules). With the workspace, cross-module changes (e.g. editingapi/and immediately using it from the controller) build without hand-editingreplacedirectives.Conflicting third-party pins across the member modules are unified in
go.workvia a minimal set ofreplaceoverrides (k8s core → v0.34.2, controller-runtime → v0.22.5, kube-openapi, kubevirt.io/api → v50, k8s.io/kubelet). The set was trimmed by removing dead/inheritedreplacedirectives from membergo.modfiles (notably ~20 unusedk8s.io/*pins invlctland a malformeddynamic-resource-allocationreplace inpvc-artifact).To make the members share one dependency set, a few modules were aligned to newer versions:
deckhouse/logbumped to v0.2.0 (functional options API) in artifact, dra and hooks;module-sdkbumped to v0.11.1 in hooks, which pulls controller-runtime v0.22.5; the artifact cluster (artifact, e2e, shatal, kube-api-rewriter) was moved onto the same controller-runtime / k8s 0.34 stack accordingly, and one removed SDK symbol (pkg.ReconcileFunc) was replaced.The workspace files are not copied into any werf image build context, so isolated image builds keep using each module's own
go.mod; every member was verified to build both in isolation (GOWORK=off, including-tags EE) and inside the workspace.Why do we need it, and what problem does it solve?
The repository has many independent Go modules with cross-
replacelinks. Without a workspace, working on a change that spans several of them (for example the sharedapimodule and its consumers) requires manually pointingreplacedirectives at local paths and reverting them before commit. Thego.workfile makes the whole set resolve locally out of the box, which simplifies day-to-day development and IDE/gopls setup. This is a developer-facing change; it does not affect the module's runtime behaviour.What is the expected result?
go build ./...works from any member module with the workspace active.go.work.Checklist
Changelog entries