cockroachdb / cockroach-operator

k8s operator for CRDB
Apache License 2.0
284 stars 95 forks source link

[resources] Cannot set resources for initContainers #954

Open nttvgonzafe opened 1 year ago

nttvgonzafe commented 1 year ago

Currently the spec doesn't allow setting the resources field on initContainers. On clusters that enforce setting resources for all containers, this blocks databases created by the operator from starting.

Related code is at https://github.com/cockroachdb/cockroach-operator/blob/c7ea8c17f2cce43506d50108449b9169323b44fe/pkg/resource/statefulset.go#L253

nttvgonzafe commented 1 year ago

A possible workaround is to add a LimitRange with the default resources. Anyway, this initContainerResources can be a good thing to have.

pseudomuto commented 1 year ago

Hey @nttvgonzafe, thanks for opening this issue! Ideally, how would you envision this working? Would it be exposing a top-level field on the cluster CRD for example?

nttvgonzafe commented 1 year ago

Hey! I think so, exposing a initResources at the same level as resources in the CRD with the same schema should be intuitive. Edit: initResources or initContainerResources whichever seems more idiomatic.