test/main.go: remove last bits of kubectl command usage
Some of the replacements for the kubectl command usage are a bit
cumbersome and not very clean, but it works for now. It should be
simplified more in the future (especially for things like group
and apiversion, which can be inferred from the yaml files)
@@ -124,8 +124,23 @@ func main() {
log.Fatal(err)
}
- kubectlWrapper("delete", namespace, "deploy/cr.yaml")
- kubectlWrapper("delete", namespace, "deploy/operator.yaml")
+ err = memcachedClient.Delete().
+ Namespace(namespace).
+ Resource("memcacheds").
+ Name("example-memcached").
+ Body([]byte("{\"propagationPolicy\":\"Foreground\"}")).
+ Do().
+ Error()
+ if err != nil {
+ fmt.Println("Failed to delete example-memcached CR")
+ log.Fatal(err)
+ }
+ err = kubeclient.AppsV1().Deployments(namespace).
+ Delete("memcached-operator", nil)
+ if err != nil {
+ fmt.Println("Failed to delete memcached-operator deployment")
+ log.Fatal(err)
+ }
}
func getCRClient(config *rest.Config, group, version string) *rest.RESTClient {
