Skip to content

ability to deal with server side defaults/initializers #812

@surajkota

Description

@surajkota

Is your feature request related to a problem?

Ability to specify fields initialized by service post create. Following are the patterns observed:

  1. Generated fields. Example:
    1. roleARN field in ScalableTarget resource is generated by service. See Handle server-side defaults applicationautoscaling-controller#12 (comment) (service - Applicationautoscaling)
    2. staticHyperparameter field in Hyperparameter tuning resource. Slice has some extra fields returned from the service which should be ignored for comparison. See customSetDefaults in HPJob (service - SageMaker)
  2. Default value for fields
    1. Boolean fields returned as False.
      • Scalable target struct in ScalableTarget resource - SuspendedState.<*> (all fields) returned as False by default. See setDefaults in autoscaling (service - Applicationautoscaling)
    2. String fields return default values. e.g. Model resource - PrimaryContainer.Mode retuned as SingleMode by default (service - SageMaker)

Describe the solution you'd like
1.a, 2.a, 2.b - if DesiredResource.Spec.field = nil set these values from latestResource
1.b - a hook to write custom algorithm for comparison and remove service generated fields, ignore setting values from latestResource to desired

Note: In 2.a,

  • whole desired.spec.SuspendedState == nil and service still returns false values for all fields in the structs (DynamicScalingInSuspended, DynamicScalingInSuspended, ScheduledScalingSuspended)
  • desired.spec.SuspendedState != nil but desired.spec.SuspendedState.DynamicScalingInSuspended == nil and service still returns False for desired.spec.SuspendedState.DynamicScalingInSuspended

Describe alternatives you've considered
1.b - a hook to write custom logic to insert only server generated <key, value> pairs into the slice only if diff is False
1.b - a hook to write custom algorithm for comparison and insert service generated fields, set values from latestResource into desired only for comparison

Metadata

Metadata

Assignees

Labels

kind/enhancementCategorizes issue or PR as related to existing feature enhancements.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions