Skip to content

Commit

Permalink
Refetch set before update to stabilize integration test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 committed Mar 26, 2024
1 parent d5761f6 commit 363cf39
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions controllers/deployment/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,20 +168,26 @@ func (c *controller) createFirewallSet(r *controllers.Ctx[*v2.FirewallDeployment
}

func (c *controller) syncFirewallSet(r *controllers.Ctx[*v2.FirewallDeployment], set *v2.FirewallSet) error {
set.Spec.Replicas = r.Target.Spec.Replicas
set.Spec.Template = r.Target.Spec.Template
refetched := &v2.FirewallSet{}
err := c.c.GetSeedClient().Get(r.Ctx, client.ObjectKeyFromObject(set), refetched)
if err != nil {
return fmt.Errorf("unable to update/sync firewall set: %w", err)
}

refetched.Spec.Replicas = r.Target.Spec.Replicas
refetched.Spec.Template = r.Target.Spec.Template

err := c.c.GetSeedClient().Update(r.Ctx, set)
err = c.c.GetSeedClient().Update(r.Ctx, refetched)
if err != nil {
return fmt.Errorf("unable to update/sync firewall set: %w", err)
}

r.Log.Info("updated firewall set", "set-name", set.Name)
r.Log.Info("updated firewall set", "set-name", refetched.Name)

cond := v2.NewCondition(v2.FirewallDeplomentProgressing, v2.ConditionTrue, "FirewallSetUpdated", fmt.Sprintf("Updated firewall set %q.", set.Name))
cond := v2.NewCondition(v2.FirewallDeplomentProgressing, v2.ConditionTrue, "FirewallSetUpdated", fmt.Sprintf("Updated firewall set %q.", refetched.Name))
r.Target.Status.Conditions.Set(cond)

c.recorder.Eventf(set, "Normal", "Update", "updated firewallset %s", set.Name)
c.recorder.Eventf(refetched, "Normal", "Update", "updated firewallset %s", refetched.Name)

return nil
}
Expand Down

0 comments on commit 363cf39

Please sign in to comment.