Skip to content
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

[Backport release-1.26] Fix workerprofile data types on the generated CRD #3376

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

jnummelin
Copy link
Member

@jnummelin jnummelin commented Aug 14, 2023

Backport of #3372 to 1.26. See #3369.

Using json.RawMessage creates the data type in CRD as `string` which is obviously wrong. Although in the Golang side it work perfectly it results into case where a k0s config cannot be created in the API when dynamic config is enabled and the config has worker profiles:
```
level=info msg="E0810 18:28:49.753959      60 fieldmanager.go:152] \"[SHOULD NOT HAPPEN] failed to update managedFields\" err=\"failed to convert new object (kube-system/k0s; k0s.k0sproject.io/v1beta1, Kind=ClusterConfig) to smd typed: .spec.workerProfiles[0].values: expected string, got &value.valueUnstructured{Value:map[string]interface {}{}}\" versionKind=\"k0s.k0sproject.io/v1beta1, Kind=ClusterConfig\" namespace=\"kube-system\" name=\"k0s\"" component=kube-apiserver stream=stderr
```

Many projects (e.g. ArgoCD) using generic maps for data use runtime.RawExtension and so does the controller-gen maintainers seem to advise.
https://github.com/argoproj/argo-cd/blob/master/pkg/apis/application/v1alpha1/types.go#L325-L326

Added also a test in `configchange` smoke that actually verifies the workerprofiles are usable with dynamic config and can be used for workers.

Signed-off-by: Jussi Nummelin <[email protected]>
@jnummelin jnummelin requested a review from a team as a code owner August 14, 2023 08:09
@jnummelin jnummelin added the backport/release-1.25 PR that needs to be backported/cherrypicked to release-1.25 branch label Aug 14, 2023
@jnummelin jnummelin merged commit 1d24ed1 into k0sproject:release-1.26 Aug 14, 2023
67 checks passed
@k0s-bot
Copy link

k0s-bot commented Aug 14, 2023

Backport failed for release-1.25, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin release-1.25
git worktree add -d .worktree/backport-3376-to-release-1.25 origin/release-1.25
cd .worktree/backport-3376-to-release-1.25
git checkout -b backport-3376-to-release-1.25
ancref=$(git merge-base faeabcf338a443e15c05b9c1345fdc83ad71a34e d6ce15a9ba8b4b759bbc3be43d673924ddbf6392)
git cherry-pick -x $ancref..d6ce15a9ba8b4b759bbc3be43d673924ddbf6392

@jnummelin jnummelin deleted the rel-1.26/k0s-crd-fix branch August 14, 2023 09:22
@twz123 twz123 changed the title [Release 1.26] k0s crd fix [Backport release-1.26] Fix workerprofile data types on the generated CRD Aug 28, 2023
@twz123 twz123 added bug Something isn't working area/controlplane labels Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/controlplane backport/release-1.25 PR that needs to be backported/cherrypicked to release-1.25 branch bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants