Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/config/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion pkg/generate/code/late_initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down