mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Merge pull request #1221 from fmuyassarov/crs-cleanup
e2e: delete CRs only if found
This commit is contained in:
commit
50caa92232
1 changed files with 12 additions and 8 deletions
|
@ -150,19 +150,23 @@ func cleanupCRs(ctx context.Context, cli *nfdclient.Clientset, namespace string)
|
||||||
nfrs, err := cli.NfdV1alpha1().NodeFeatureRules().List(ctx, metav1.ListOptions{})
|
nfrs, err := cli.NfdV1alpha1().NodeFeatureRules().List(ctx, metav1.ListOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
By("Deleting NodeFeatureRule objects from the cluster")
|
if len(nfrs.Items) != 0 {
|
||||||
for _, nfr := range nfrs.Items {
|
By("Deleting NodeFeatureRule objects from the cluster")
|
||||||
err = cli.NfdV1alpha1().NodeFeatureRules().Delete(ctx, nfr.Name, metav1.DeleteOptions{})
|
for _, nfr := range nfrs.Items {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
err = cli.NfdV1alpha1().NodeFeatureRules().Delete(ctx, nfr.Name, metav1.DeleteOptions{})
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nfs, err := cli.NfdV1alpha1().NodeFeatures(namespace).List(ctx, metav1.ListOptions{})
|
nfs, err := cli.NfdV1alpha1().NodeFeatures(namespace).List(ctx, metav1.ListOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
By("Deleting NodeFeature objects from namespace " + namespace)
|
if len(nfs.Items) != 0 {
|
||||||
for _, nf := range nfs.Items {
|
By("Deleting NodeFeature objects from namespace " + namespace)
|
||||||
err = cli.NfdV1alpha1().NodeFeatures(namespace).Delete(ctx, nf.Name, metav1.DeleteOptions{})
|
for _, nf := range nfs.Items {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
err = cli.NfdV1alpha1().NodeFeatures(namespace).Delete(ctx, nf.Name, metav1.DeleteOptions{})
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue