Skip to content

Commit

Permalink
Merge branch 'master' into liesenfeldn/eval-query-before-running
Browse files Browse the repository at this point in the history
  • Loading branch information
liesenfeldn authored Dec 17, 2024
2 parents eb543fd + 0eec0d8 commit 32caf96
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ require (
golang.org/x/oauth2 v0.24.0
google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53
google.golang.org/grpc v1.69.0
google.golang.org/protobuf v1.35.2
google.golang.org/protobuf v1.36.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.29.3
k8s.io/apiextensions-apiserver v0.29.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1146,8 +1146,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
Expand Down
23 changes: 18 additions & 5 deletions rollout/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,30 @@ func (c *Controller) syncHandler(ctx context.Context, key string) error {
}()

resolveErr := c.refResolver.Resolve(r)
// We could maybe lose setting the error condition from the below if resolveErr != nil {}, and just log the error to clean up the logic
roCtx, err := c.newRolloutContext(r)
if roCtx == nil {
logCtx.Error("newRolloutContext returned nil")
return err
}
if err != nil {
if _, ok := err.(*field.Error); ok {
// We want to frequently requeue rollouts with InvalidSpec errors, because the error
// condition might be timing related (e.g. the Rollout was applied before the Service).
c.enqueueRolloutAfter(roCtx.rollout, 20*time.Second)
return nil // do not requeue from error because we already re-queued above
}
logCtx.Errorf("newRolloutContext err %v", err)
return err
}
// We should probably delete this if block and just log the error to clean up the logic, a bigger change would be to add a new
// field to the status maybe (reconcileErrMsg) and store the errors there from the processNextWorkItem function in controller/controller.go
if resolveErr != nil {
roCtx.createInvalidRolloutCondition(resolveErr, r)
return resolveErr
err := roCtx.createInvalidRolloutCondition(resolveErr, r)
if err != nil {
return fmt.Errorf("failed to create invalid rollout condition during resolving the rollout: %w", err)
}
return fmt.Errorf("failed to resolve rollout: %w", resolveErr)
}

// In order to work with HPA, the rollout.Spec.Replica field cannot be nil. As a result, the controller will update
Expand Down Expand Up @@ -539,9 +555,6 @@ func (c *Controller) newRolloutContext(rollout *v1alpha1.Rollout) (*rolloutConte
err = roCtx.getRolloutValidationErrors()
if err != nil {
if vErr, ok := err.(*field.Error); ok {
// We want to frequently requeue rollouts with InvalidSpec errors, because the error
// condition might be timing related (e.g. the Rollout was applied before the Service).
c.enqueueRolloutAfter(roCtx.rollout, 20*time.Second)
err := roCtx.createInvalidRolloutCondition(vErr, roCtx.rollout)
if err != nil {
return nil, err
Expand Down

0 comments on commit 32caf96

Please sign in to comment.