console icon indicating copy to clipboard operation
console copied to clipboard

Unable to set default values for operand resource requirements

Open kovayur opened this issue 2 years ago • 4 comments

Hi OpenShift Console team,

We would like to fill in the default values for resource requirements in the CRD.

Here's the example of the schema definition:

type OperandSpec struct {
	//+operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:resourceRequirements"},order=100
	//+kubebuilder:default={limits: {cpu: "500m", memory: "1Gi"}, requests: {cpu: "100m", memory: "256Mi"}}
	Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
}

When the custom resource is created with kubectl, the default values are populated successfully. However, when I try to create the same operand using the openshift console, the default values are not shown in the UI. This can be confusing to the user.

After some debugging, it seems that the root cause is related to the issue in the rjsf library (rjsf-team/react-jsonschema-form#2593).
When OpenAPI3 schema contains default additionalResources, they are not properly displayed and submitted in the form.

OpenShift version: 4.10.3 Kubernetes version: v1.23.3+e419edf Channel: stable-4.10

kovayur avatar Apr 12 '22 07:04 kovayur

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot avatar Jul 11 '22 13:07 openshift-bot

/cc @TheRealJon /kind bug

spadgett avatar Jul 25 '22 18:07 spadgett

/remove-lifecycle stale

spadgett avatar Jul 25 '22 18:07 spadgett

I haven't tried an example of providing default values for a ResourceRequirement field yet, but this is something that would be helpful for me as well.

gmarks-ntap avatar Oct 06 '22 15:10 gmarks-ntap