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
🐛 Fix SIGSERV when RawSpec is nil (due to anonymous struct) #892
base: master
Are you sure you want to change the base?
Conversation
Welcome @rkettelerij! |
Hi @rkettelerij. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rkettelerij The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
if ctx.info.RawSpec.Type != structType { | ||
if ctx.info.RawSpec != nil && ctx.info.RawSpec.Type != structType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we add a test case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I've managed to break the complex set of structs down to the following test case. controller-get crd paths="<path/to/testcase/below>/..." output:stdout
currently fails on this one. With the fix it doesn't fail. It's due to the use of an anonymous struct.
// +groupName=test
package config
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type ExampleSpec struct {
Service Service `json:"service"`
}
type Example struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ExampleSpec `json:"spec,omitempty"`
}
type Service struct {
// +optional
Foobar struct {
// placeholder
} `yaml:"foobar" json:"foobar"`
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkettelerij please update pkg/crd/testdata/cronjob_types.go with an anonymous struct to test this
/ok-to-test
Under some circumstances
RawSpec
can be nil. I've encountred this when generating a CRD of a complex set of structs. Currently thestructToSchema
func fails hard on this (SIGSERV). This PR fixes the latter.