controller-tools icon indicating copy to clipboard operation
controller-tools copied to clipboard

sos, when i use deploymentSpec as api field, template.metadata.labels cannot be parsed, why?

Open gotosre opened this issue 2 years ago • 2 comments

def:

type GuestbookSpec struct {
	// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
	// Important: Run "make" to regenerate code after modifying this file

	// DeploymentSpec use the type in appsv1 directly
	// +optional
	DeploymentSpec appsv1.DeploymentSpec `json:"deploymentSpec"`

	// Number of desired pods. This is a pointer to distinguish between explicit
	// zero and not specified. Defaults to 1.
	// +optional
	Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
}

when apply a cr, error below: strict decoding error: unknown field "spec.deploymentSpec.template.metadata.labels"

-- now i need to add x-kubernetes-preserve-unknown-fields: true to crd to allow this behaviour, how to use +kubebuild to do so?

gotosre avatar Nov 03 '23 13:11 gotosre