Skip to content

Specify defaults using annotations, use validating functions exposed by apimachinery, etc.#89

Merged
unmarshall merged 3 commits into
ai-dynamo:mainfrom
renormalize:fix
Jun 17, 2025
Merged

Specify defaults using annotations, use validating functions exposed by apimachinery, etc.#89
unmarshall merged 3 commits into
ai-dynamo:mainfrom
renormalize:fix

Conversation

@renormalize

Copy link
Copy Markdown
Contributor

In general, I prefer specifying the defaults in the CRD itself, instead of a defaulting webhook defaulting these values. This PR attempts to fix a few places where this change was trivial.

  • Move +kubebuilder:default annotation to the field definition from the type definition.

    • Defaultling only occurs on fields, thus moved the defaulting annotation to the field definition.

    • Remove the explicit defaulting in the defaulting webhook.

  • Use +kubebuilder annotation to default the value of PodGangTemplateSpec.SchedulingPolicyConfig.

    • Default the value to BestEffort through the annotation, which will include the default value in the CRD for PodGangSet.

    • Remove the explicit defaulting in the defaulting webhook.

  • Use apivalidation.ValidateImmutableField() where applicable.

  • Change the type of PodGangTemplateSpec.Cliques to []PodCliqueTemplateSpec from []*PodCliqueTemplateSpec.

…he type definition.

* Defaultling only occurs on fields, thus moved the defaulting annotation
  to the field definition.

* Remove the explicit defaulting in the defaulting webhook.

Signed-off-by: Saketh Kalaga <51327242+renormalize@users.noreply.github.com>
….SchedulingPolicyConfig`.

* Default the value to `BestEffort` through the annotation, which will
  include the default value in the CRD for `PodGangSet`.

* Remove the explicit defaulting in the defaulting webhook.

Signed-off-by: Saketh Kalaga <51327242+renormalize@users.noreply.github.com>
Signed-off-by: Saketh Kalaga <51327242+renormalize@users.noreply.github.com>
@unmarshall unmarshall merged commit f02af1c into ai-dynamo:main Jun 17, 2025
1 check passed
@renormalize renormalize deleted the fix branch July 4, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants