Commit cef8637
authored
Fix LabelSelector validation markers for map field (#1679)
* Fix LabelSelector validation markers for map field
Changed MinItems/MaxItems to
MinProperties/MaxProperties for the
MatchLabels field in LabelSelector, as it is a map type, not an array.
This resolves controller-gen CRD generation
errors.
Signed-off-by: Killian Golds <kgolds@redhat.com>
* Add CRD generation to make generate target
Add controller-gen crd to the generate target to validate kubebuilder markers during development and CI runs.
Previously, make generate only ran controller-gen object, which generates DeepCopy methods but does not validate CRD markers like MinItems, MaxItems, MinProperties, etc. This meant invalid markers could be merged without detection, only to cause failures in downstream projects that run full CRD generation.
By adding CRD generation to the generate target:
- Invalid kubebuilder markers are caught immediately during development
- CI will fail if markers are incorrect or CRDs are out of sync
- Prevents downstream projects from encountering CRD generation errors
- Aligns with the target's existing documentation which states it generates CustomResourceDefinition objects
This change would have caught the MinItems/MaxItems issue fixed in commit 40cecfd before it was merged.
Signed-off-by: Killian Golds <kgolds@redhat.com>
* Regenerate CRDs with updated validation markers
This regenerates the CRDs to include the MinProperties/MaxProperties
validation for the MatchLabels map field.
The generated CRD now includes:
- minProperties: 1
- maxProperties: 64
These properties correctly validate the map field, replacing the
incorrect MinItems/MaxItems markers that were causing controller-gen
failures.
Signed-off-by: Killian Golds <kgolds@redhat.com>
---------
Signed-off-by: Killian Golds <kgolds@redhat.com>1 parent db90544 commit cef8637
File tree
3 files changed
+5
-2
lines changed- api/v1
- config/crd/bases
3 files changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
141 | | - | |
| 140 | + | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| |||
0 commit comments