Skip to content

Commit

Permalink
fix: nil deref in usage of incomplete experiment config policies (#10068
Browse files Browse the repository at this point in the history
)

Fix a call to cfg.Resources().Priority() on an experiment config without
schemas.WithDefaults. I didn't call with defaults because the config is
intentionally incomplete (we need to know what the user set, without
any defaulting).
  • Loading branch information
stoksc authored Oct 16, 2024
1 parent 6c46a46 commit a14525f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions master/internal/configpolicy/task_config_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ func findAllowedPriority(scope *int, workloadType string) (limit int, exists boo
if err != nil {
return 0, false, fmt.Errorf("unable to unmarshal task config policies: %w", err)
}
if configs.Resources().Priority() != nil {
adminPriority := *configs.Resources().Priority()
if configs.RawResources != nil && configs.RawResources.RawPriority != nil {
adminPriority := *configs.RawResources.RawPriority
return adminPriority, false,
fmt.Errorf("priority set by invariant config: %w", errPriorityImmutable)
}
Expand Down

0 comments on commit a14525f

Please sign in to comment.