Skip to content

Commit

Permalink
Update vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Sep 12, 2020
1 parent fe76f26 commit 1819ce2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/rancher/fleet/pkg/apis v0.0.0
github.com/rancher/gitjob v0.1.0
github.com/rancher/lasso v0.0.0-20200820172840-0e4cc0ef5cb0
github.com/rancher/wrangler v0.6.2-0.20200829053106-7e1dd4260224
github.com/rancher/wrangler v0.6.2-0.20200912225020-2e02d61f54bc
github.com/rancher/wrangler-cli v0.0.0-20200815040857-81c48cf8ab43
github.com/sirupsen/logrus v1.6.0
github.com/spf13/cobra v1.0.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,8 @@ github.com/rancher/wrangler v0.6.2-0.20200828043115-6943c5e1c9c7 h1:HXP9Rg3ijtwV
github.com/rancher/wrangler v0.6.2-0.20200828043115-6943c5e1c9c7/go.mod h1:I7qe4DZNMOLKVa9ax7DJdBZ0XtKOppLF/dalhPX3vaE=
github.com/rancher/wrangler v0.6.2-0.20200829053106-7e1dd4260224 h1:NWYSyS1YiWJOB84xq0FcGDY8xQQwrfKoip2BjMSlu1g=
github.com/rancher/wrangler v0.6.2-0.20200829053106-7e1dd4260224/go.mod h1:I7qe4DZNMOLKVa9ax7DJdBZ0XtKOppLF/dalhPX3vaE=
github.com/rancher/wrangler v0.6.2-0.20200912225020-2e02d61f54bc h1:Td32Jny0tPOQFLxxZHxgfk9mlEYJopwB47EizTQuGjU=
github.com/rancher/wrangler v0.6.2-0.20200912225020-2e02d61f54bc/go.mod h1:I7qe4DZNMOLKVa9ax7DJdBZ0XtKOppLF/dalhPX3vaE=
github.com/rancher/wrangler-cli v0.0.0-20200815040857-81c48cf8ab43 h1:+Bc9QnL9GuZiYxc3Mvm4n6EEjgI5TFQLDGjpRhQbkVk=
github.com/rancher/wrangler-cli v0.0.0-20200815040857-81c48cf8ab43/go.mod h1:KxpGNhk/oVL6LCfyxESTD1sb8eXRlUxtkbNm06+7dZU=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
Expand Down
29 changes: 28 additions & 1 deletion modules/agent/pkg/controllers/bundledeployment/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,20 @@ func (h *handler) Trigger(key string, bd *fleet.BundleDeployment) (*fleet.Bundle
return bd, nil
}

func shouldRedeploy(bd *fleet.BundleDeployment) bool {
if bd.Spec.Options.ForceSyncBefore == nil {
return false
}
if bd.Status.ForceSync == nil {
return true
}
if bd.Spec.Options.ForceSyncBefore.Time.After(time.Now().Add(-15 * time.Minute)) {
return false
}

return bd.Status.ForceSync.Before(bd.Spec.Options.ForceSyncBefore)
}

func (h *handler) MonitorBundle(bd *fleet.BundleDeployment, status fleet.BundleDeploymentStatus) (fleet.BundleDeploymentStatus, error) {
if bd.Spec.DeploymentID != status.AppliedDeploymentID {
return status, nil
Expand All @@ -120,7 +134,20 @@ func (h *handler) MonitorBundle(bd *fleet.BundleDeployment, status fleet.BundleD
status.Ready = deploymentStatus.Ready
status.NonModified = deploymentStatus.NonModified

condition.Cond(fleet.BundleDeploymentConditionReady).SetError(&status, "", readyError(status))
readyError := readyError(status)
condition.Cond(fleet.BundleDeploymentConditionReady).SetError(&status, "", readyError)
if len(status.ModifiedStatus) > 0 {
h.bdController.EnqueueAfter(bd.Namespace, bd.Name, 5*time.Minute)
if shouldRedeploy(bd) {
logrus.Infof("Redeploying %s", bd.Name)
status.AppliedDeploymentID = ""
}
}

status.ForceSync = bd.Spec.Options.ForceSyncBefore
if readyError != nil {
logrus.Errorf("bundle %s: %v", bd.Name, readyError)
}
return status, nil
}

Expand Down

0 comments on commit 1819ce2

Please sign in to comment.