Skip to content

Commit

Permalink
removed app commit from component deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
xadhatter committed Nov 30, 2023
1 parent 4056069 commit 7db2230
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion components/operator/controller/component_mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ func (cm *ComponentManager) ReconcileApps(ctx context.Context, namespace string)
Name: compName,
Commit: comp.Commit,
App: appDep.Spec.App.Name,
AppCommit: appDep.Spec.App.Commit,
Image: image,
ImagePullPolicy: appDep.Spec.App.ImagePullSecretName,
},
Expand Down
6 changes: 5 additions & 1 deletion k8s/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ func (c *Client) Upsert(ctx context.Context, obj client.Object, dryRun bool) err
if dryRun {
opts = append(opts, client.DryRunAll)
}
err = c.Update(ctx, obj, opts...)
if err = c.Update(ctx, obj, opts...); IsConflict(err) {
// Perform single retry on conflict.
err = c.Update(ctx, obj, opts...)
}

}
// Restore TypeMeta.
obj.GetObjectKind().SetGroupVersionKind(orig.GetObjectKind().GroupVersionKind())
Expand Down
7 changes: 7 additions & 0 deletions k8s/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ func IsAlreadyExists(err error) bool {
return apierrors.IsAlreadyExists(err)
}

func IsConflict(err error) bool {
if err == nil {
return false
}
return apierrors.IsConflict(err)
}

func ToString(obj client.Object) string {
gvk := obj.GetObjectKind().GroupVersionKind()
grp := gvk.Group
Expand Down

0 comments on commit 7db2230

Please sign in to comment.