Skip to content
Closed
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
8 changes: 7 additions & 1 deletion pkg/stub/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ func (h *Handler) syncIngressUpdate(ci *ingressv1alpha1.ClusterIngress) error {
err = sdk.Create(ds)
if err == nil {
logrus.Infof("created router daemonset %s/%s", ds.Namespace, ds.Name)
} else if !errors.IsAlreadyExists(err) {
} else if errors.IsAlreadyExists(err) {
err = sdk.Update(ds)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we know this is an update event and not resync event? (may be we want to update anyway during resync?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When @Miciah PR gets merged we will know when there's an update. I think this pattern is good for now.

if err != nil {
return fmt.Errorf("couldn't update router daemonset %s/%s", ds.Namespace, ds.Name)
}
logrus.Infof("updated router daemonset %s/%s", ds.Namespace, ds.Name)
} else {
return fmt.Errorf("failed to create daemonset %s/%s: %v", ds.Namespace, ds.Name, err)
}

Expand Down