Skip to content

Commit

Permalink
fix: remove wrong logic
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
1 parent deaba8e commit 1f0088d
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions pkg/runner/operations/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,26 @@ func Delete(ctx context.Context, expected unstructured.Unstructured, c client.Cl
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) {
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) {
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 1f0088d

Please sign in to comment.