@@ -361,37 +361,39 @@ func DeleteTiller(kubectlClient *kubernetes.Clientset, tillerConfig *v1.TillerCo
361361 err := kubectlClient .ExtensionsV1beta1 ().Deployments (tillerNamespace ).Delete (TillerDeploymentName , & metav1.DeleteOptions {
362362 PropagationPolicy : & propagationPolicy ,
363363 })
364- if err != nil {
364+ if err != nil && strings . HasSuffix ( err . Error (), "not found" ) == false {
365365 errs = append (errs , err )
366366 }
367367
368368 err = kubectlClient .CoreV1 ().Services (tillerNamespace ).Delete (TillerDeploymentName , & metav1.DeleteOptions {PropagationPolicy : & propagationPolicy })
369- if err != nil {
369+ if err != nil && strings . HasSuffix ( err . Error (), "not found" ) == false {
370370 errs = append (errs , err )
371371 }
372372
373373 err = kubectlClient .CoreV1 ().ServiceAccounts (tillerNamespace ).Delete (tillerServiceAccountName , & metav1.DeleteOptions {PropagationPolicy : & propagationPolicy })
374- if err != nil {
374+ if err != nil && strings . HasSuffix ( err . Error (), "not found" ) == false {
375375 errs = append (errs , err )
376376 }
377377
378378 roleNamespace := append (* tillerConfig .AppNamespaces , & tillerNamespace )
379379 for _ , appNamespace := range roleNamespace {
380- roleName := tillerRoleName
381-
382- if * appNamespace == tillerNamespace {
383- roleName = tillerRoleManagerName
380+ err = kubectlClient .RbacV1beta1 ().Roles (* appNamespace ).Delete (tillerRoleName , & metav1.DeleteOptions {PropagationPolicy : & propagationPolicy })
381+ if err != nil && strings .HasSuffix (err .Error (), "not found" ) == false {
382+ errs = append (errs , err )
384383 }
385384
386- log .Infof ("Delete %s RoleName %s" , * appNamespace , roleName )
385+ err = kubectlClient .RbacV1beta1 ().RoleBindings (* appNamespace ).Delete (tillerRoleName + "-binding" , & metav1.DeleteOptions {PropagationPolicy : & propagationPolicy })
386+ if err != nil && strings .HasSuffix (err .Error (), "not found" ) == false {
387+ errs = append (errs , err )
388+ }
387389
388- err = kubectlClient .RbacV1beta1 ().Roles (* appNamespace ).Delete (roleName , & metav1.DeleteOptions {PropagationPolicy : & propagationPolicy })
389- if err != nil {
390+ err = kubectlClient .RbacV1beta1 ().Roles (* appNamespace ).Delete (tillerRoleManagerName , & metav1.DeleteOptions {PropagationPolicy : & propagationPolicy })
391+ if err != nil && strings . HasSuffix ( err . Error (), "not found" ) == false {
390392 errs = append (errs , err )
391393 }
392394
393- err = kubectlClient .RbacV1beta1 ().RoleBindings (* appNamespace ).Delete (roleName + "-binding" , & metav1.DeleteOptions {PropagationPolicy : & propagationPolicy })
394- if err != nil {
395+ err = kubectlClient .RbacV1beta1 ().RoleBindings (* appNamespace ).Delete (tillerRoleManagerName + "-binding" , & metav1.DeleteOptions {PropagationPolicy : & propagationPolicy })
396+ if err != nil && strings . HasSuffix ( err . Error (), "not found" ) == false {
395397 errs = append (errs , err )
396398 }
397399 }
0 commit comments