Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update firewalls in maintenance reconciliation #43

Merged
merged 17 commits into from
May 29, 2024
14 changes: 6 additions & 8 deletions controllers/deployment/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,13 @@ func sizeHasChanged(newS *v2.FirewallSpec, oldS *v2.FirewallSpec) bool {
}

func osImageHasChanged(ctx context.Context, m metalgo.Client, newS *v2.FirewallSpec, oldS *v2.FirewallSpec) (bool, error) {
if newS.Image != oldS.Image {
image, err := m.Image().FindLatestImage(image.NewFindLatestImageParams().WithID(newS.Image).WithContext(ctx), nil)
if err != nil {
return false, fmt.Errorf("latest firewall image not found:%s %w", newS.Image, err)
}
image, err := m.Image().FindLatestImage(image.NewFindLatestImageParams().WithID(newS.Image).WithContext(ctx), nil)
Gerrit91 marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return false, fmt.Errorf("latest firewall image not found:%s %w", newS.Image, err)
}

if image.Payload != nil && image.Payload.ID != nil && *image.Payload.ID != oldS.Image {
return true, nil
}
if image.Payload != nil && image.Payload.ID != nil && *image.Payload.ID != oldS.Image {
return true, nil
}

return false, nil
Expand Down
Loading