Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
  • Loading branch information
eddycharly committed Oct 24, 2023
2 parents 5ea28d0 + fa47816 commit 35e959b
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions pkg/runner/operations/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,27 @@ func Delete(ctx context.Context, logger logging.Logger, expected ctrlclient.Obje
return _err
}
for i := range candidates {
if candidates[i].GetName() != "kube-root-ca.crt" {
err := c.Delete(ctx, &candidates[i])
if err != nil && !errors.IsNotFound(err) {
return err
}
err := c.Delete(ctx, &candidates[i])
if err != nil && !errors.IsNotFound(err) {
return err
}
}
gvk := expected.GetObjectKind().GroupVersionKind()
for i := range candidates {
if candidates[i].GetName() != "kube-root-ca.crt" {
if err := wait.PollUntilContextCancel(ctx, interval, true, func(ctx context.Context) (bool, error) {
attempts++
var actual unstructured.Unstructured
actual.SetGroupVersionKind(gvk)
err := c.Get(ctx, client.ObjectKey(&candidates[i]), &actual)
if err != nil {
if errors.IsNotFound(err) {
return true, nil
}
return false, err
if err := wait.PollUntilContextCancel(ctx, interval, true, func(ctx context.Context) (bool, error) {
attempts++
var actual unstructured.Unstructured
actual.SetGroupVersionKind(gvk)
err := c.Get(ctx, client.ObjectKey(&candidates[i]), &actual)
if err != nil {
if errors.IsNotFound(err) {
return true, nil
}
return false, nil
}); err != nil {
return err
return false, err
}
return false, nil
}); err != nil {
return err
}
}
return nil
Expand Down

0 comments on commit 35e959b

Please sign in to comment.