我试图从操作员CR处获得RAW
个数据,我得到empty object个数据.(所有其他值均按预期工作)
The tricky part here that my struct is reference to another struct which have a property type rawdata
https://github.com/JennyMet/gardner_test
这里是简单的CR
https://github.com/JennyMet/gardner_test/blob/main/config/samples/mygroup_v1alpha1_rawtest.yaml#L11
这里我想读取数据并得到一个空对象,你知道吗?
https://github.com/JennyMet/gardner_test/blob/main/controllers/rawtest_controller.go#L70
这是我使用的类型的引用
I think its related to fields
x-kubernetes-preserve-unknown-fields: true
https://github.com/JennyMet/gardner_test/blob/main/api/v1alpha1/rawtest_types.go#L32,在发动机罩下使用
我的意思是,我试过了,但它不起作用,因为生的InfrastructureConfig
个在
type System struct {
Type system `json:"type,omitempty"`
// +kubebuilder:pruning:PreserveUnknownFields
Provider v1beta1.Provider `json:"provider,omitempty"`
}
但是原始数据低于Provider
,这不是我的 struct ,im just using it.
就像这样,看InfrastructureConfig
型...
type Provider struct {
Type string `json:"type" protobuf:"bytes,1,opt,name=type"`
ControlPlaneConfig *runtime.RawExtension `json:"controlPlaneConfig,omitempty" protobuf:"bytes,2,opt,name=controlPlaneConfig"`
InfrastructureConfig *runtime.RawExtension `json:"infrastructureConfig,omitempty" protobuf:"bytes,3,opt,name=infrastructureConfig"`
}