gardener icon indicating copy to clipboard operation
gardener copied to clipboard

`ManagedSeedSpec`'s field `Gardenlet` shouldn't be a pointer

Open Kostov6 opened this issue 1 year ago • 5 comments

How to categorize this issue?

/area quality /kind enhancement

What would you like to be added:

https://github.com/gardener/gardener/blob/78565916bef348d472d635e0e1b2449ed6b335d9/pkg/apis/seedmanagement/types_managedseed.go#L55 There is no reason for resource fields to be pointers outside of the case when we want to convey that they are optional

https://github.com/gardener/gardener/blob/78565916bef348d472d635e0e1b2449ed6b335d9/pkg/apis/seedmanagement/validation/managedseed.go#L97-L99

And from the code above we see that it can not be nil and therefore it is not an optional field

Kostov6 avatar Aug 16 '24 14:08 Kostov6

Most likely a leftover from https://github.com/gardener/gardener/issues/6898. Before https://github.com/gardener/gardener/issues/6898 in the ManagedSeed resource one of .spec.seedTemplate and .spec.gardenlet was required. That's why both of the fields were optional. But after we removed support for .spec.seedTemplate I think we can now make spec.gardenlet required. @timuthy @rfranzke to confirm.

ialidzhikov avatar Aug 16 '24 14:08 ialidzhikov

Yes, probably @ialidzhikov is right. Before doing this, please check if .spec.gardenlet gets defaulted somewhere by gardener-apiserver (either via static defaulting in pkg/apis or via admission plugins in plugins/pkg). If not, we can make it required.

rfranzke avatar Aug 19 '24 11:08 rfranzke

/good-first-issue

Kostov6 avatar Aug 22 '24 09:08 Kostov6

@Kostov6: This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to this:

/good-first-issue

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-sigs/prow repository.

gardener-prow[bot] avatar Aug 22 '24 09:08 gardener-prow[bot]

/assign Kostov6

Kostov6 avatar Aug 22 '24 09:08 Kostov6

/assign @RadaBDimitrova

Kostov6 avatar Oct 10 '24 14:10 Kostov6