diff --git a/pkg/config/field.go b/pkg/config/field.go index c7dda412..1a3555d5 100644 --- a/pkg/config/field.go +++ b/pkg/config/field.go @@ -318,6 +318,17 @@ type LateInitializeConfig struct { // MaxBackoffSeconds provide the maximum allowed backoff when retrying late initialization after an // unsuccessful attempt. MaxBackoffSeconds int `json:"max_backoff_seconds"` + // SkipIncompleteCheck skips the LateInitialization incomplete check for resources. + // NOTE: (michaelhtm) This skip is best used on resource fields we're sure will be set before being synced + // eg. A resource is marked as synced before the field is lateInitialized, we wouldn't want to wait until + // the next drift detection for the field to be set + SkipIncompleteCheck *SkipIncompleteLateInitializeCheckConfig `json:"skip_incomplete_check,omitempty"` +} + +// SkipIncompleteLateInitializeCheckConfig is a config that defines the scenarios in which +// we would want to skip lateInitialization. +// TODO: (michaelhtm) Populate this struct with conditions...? +type SkipIncompleteLateInitializeCheckConfig struct { } // ReferencesConfig contains the instructions for how to add the referenced resource diff --git a/pkg/generate/code/late_initialize.go b/pkg/generate/code/late_initialize.go index 0853348d..9c3f2c5b 100644 --- a/pkg/generate/code/late_initialize.go +++ b/pkg/generate/code/late_initialize.go @@ -276,7 +276,10 @@ func IncompleteLateInitialization( indent := strings.Repeat("\t", indentLevel) var lateInitFieldNames []string lateInitConfigs := cfg.GetLateInitConfigs(r.Names.Original) - for fieldName := range lateInitConfigs { + for fieldName, lateInitConfig := range lateInitConfigs { + if lateInitConfig.SkipIncompleteCheck != nil { + continue + } lateInitFieldNames = append(lateInitFieldNames, fieldName) } if len(lateInitFieldNames) == 0 {