-
Notifications
You must be signed in to change notification settings - Fork 440
Error when using json.RawMessage - string vs object #637
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
Comments
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
Adding
|
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This patch updates the VMClass.Spec.ConfigSpec to be json.RawMessage, which is similar to runtime.RawExtension, but has no opinion about being a runtime.Object. Per kubernetes-sigs/controller-tools#637, it was necessary to decorate the field with the following kubebuilder annotations to force the wire protocol to be an object: // +kubebuilder:validation:Schemaless // +kubebuilder:validation:Type=object // +kubebuilder:pruning:PreserveUnknownFields
This patch updates the VMClass.Spec.ConfigSpec to be json.RawMessage, which is similar to runtime.RawExtension, but has no opinion about being a runtime.Object. Per kubernetes-sigs/controller-tools#637, it was necessary to decorate the field with the following kubebuilder annotations to force the wire protocol to be an object: // +kubebuilder:validation:Schemaless // +kubebuilder:validation:Type=object // +kubebuilder:pruning:PreserveUnknownFields
This patch updates the VMClass.Spec.ConfigSpec to be json.RawMessage, which is similar to runtime.RawExtension, but has no opinion about being a runtime.Object. Per kubernetes-sigs/controller-tools#637, it was necessary to decorate the field with the following kubebuilder annotations to force the wire protocol to be an object: // +kubebuilder:validation:Schemaless // +kubebuilder:validation:Type=object // +kubebuilder:pruning:PreserveUnknownFields
how to solve this? is the k8s version and controller version conflict? |
Overview
Continuing from bug report #533 which was likely fixed and then resurfaced.
Using controller-gen
v0.6.2
you get an error when usingjson.RawMessage
to represent unstructured fields.(As a note, I would rather be able to use the
map[string]interface{}
type, which would make this bug a non-issue for me, see #636 😉 )Repro 1 - RawMessage has string type by default
Expected:
Actual:
Repro 2 - Explicit
validation:Type=object
causes errorExpected:
Actual (error):
Versions
controller-gen
v0.6.2
k8s.io/apimachinery
v0.22.2
k8s.io/client-go
v0.22.2
sigs.k8s.io/controller-runtime
v0.10.2
The text was updated successfully, but these errors were encountered: