Skip to content

Commit

Permalink
Clean up ClusterRoleBindings (istio#732)
Browse files Browse the repository at this point in the history
* Clean up ClusterRoleBindings

* Fix linter

* Check file exists


Former-commit-id: 64198ed
  • Loading branch information
andraxylia authored Sep 11, 2017
1 parent 3563b67 commit eee03a2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/e2e/framework/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ func (k *KubeInfo) Setup() error {
func (k *KubeInfo) Teardown() error {
glog.Info("Cleaning up kubeInfo")
var err error

if *rbacfile != "" {

testRbacYaml := filepath.Join(k.TmpDir, "yaml", filepath.Base(*rbacfile))
if _, err = os.Stat(testRbacYaml); os.IsNotExist(err) {
glog.Errorf("%s File does not exist", testRbacYaml)
} else if err = util.KubeDelete(k.Namespace, testRbacYaml); err != nil {
glog.Errorf("Rbac deletion failed, please remove stale ClusterRoleBindings")
}
}

if k.namespaceCreated {
if err = util.DeleteNamespace(k.Namespace); err != nil {
glog.Errorf("Failed to delete namespace %s", k.Namespace)
Expand Down

0 comments on commit eee03a2

Please sign in to comment.