@@ -759,20 +759,6 @@ func RunCmdRouter(f *clientcmd.Factory, cmd *cobra.Command, out, errout io.Write
759
759
Name : "system:router" ,
760
760
},
761
761
},
762
- & authapi.ClusterRoleBinding {
763
- ObjectMeta : metav1.ObjectMeta {Name : generateAuthRoleBindingName (cfg .Name )},
764
- Subjects : []kapi.ObjectReference {
765
- {
766
- Kind : "ServiceAccount" ,
767
- Name : cfg .ServiceAccount ,
768
- Namespace : namespace ,
769
- },
770
- },
771
- RoleRef : kapi.ObjectReference {
772
- Kind : "ClusterRole" ,
773
- Name : "system:auth-delegator" ,
774
- },
775
- },
776
762
)
777
763
778
764
objects = append (objects , & appsapi.DeploymentConfig {
@@ -847,7 +833,7 @@ func RunCmdRouter(f *clientcmd.Factory, cmd *cobra.Command, out, errout io.Write
847
833
848
834
levelPrefixFilter := func (e error ) string {
849
835
// Avoid failing when service accounts or role bindings already exist.
850
- if ignoreError (e , cfg .ServiceAccount , generateRoleBindingName (cfg .Name ), generateAuthRoleBindingName ( cfg . Name ) ) {
836
+ if ignoreError (e , cfg .ServiceAccount , generateRoleBindingName (cfg .Name )) {
851
837
return "warning"
852
838
}
853
839
return "error"
@@ -864,9 +850,9 @@ func RunCmdRouter(f *clientcmd.Factory, cmd *cobra.Command, out, errout io.Write
864
850
}
865
851
866
852
// ignoreError will return true if the error is an already exists status error and
867
- // 1. it is for a cluster role binding matching in roleBindingNames , or
868
- // 2. it is for a service account named saName
869
- func ignoreError (e error , saName string , roleBindingNames ... string ) bool {
853
+ // 1. it is for a cluster role binding named roleBindingName , or
854
+ // 2. it is for a service account name saName
855
+ func ignoreError (e error , saName string , roleBindingName string ) bool {
870
856
if ! errors .IsAlreadyExists (e ) {
871
857
return false
872
858
}
@@ -878,17 +864,9 @@ func ignoreError(e error, saName string, roleBindingNames ...string) bool {
878
864
if details == nil {
879
865
return false
880
866
}
881
- if details .Kind == "serviceaccounts" {
882
- return details .Name == saName
883
- }
884
- if details .Kind == "clusterrolebinding" /*pre-3.7*/ || details .Kind == "clusterrolebindings" /*3.7+*/ {
885
- for _ , name := range roleBindingNames {
886
- if details .Name == name {
887
- return true
888
- }
889
- }
890
- }
891
- return false
867
+ return (details .Kind == "serviceaccounts" && details .Name == saName ) ||
868
+ (details .Kind == "clusterrolebinding" /*pre-3.7*/ && details .Name == roleBindingName ) ||
869
+ (details .Kind == "clusterrolebindings" /*3.7+*/ && details .Name == roleBindingName )
892
870
}
893
871
894
872
// generateRoleBindingName generates a name for the rolebinding object if it is
@@ -897,10 +875,6 @@ func generateRoleBindingName(name string) string {
897
875
return fmt .Sprintf ("router-%s-role" , name )
898
876
}
899
877
900
- func generateAuthRoleBindingName (name string ) string {
901
- return fmt .Sprintf ("router-%s-auth-role" , name )
902
- }
903
-
904
878
// generateStatsPassword creates a random password.
905
879
func generateStatsPassword () string {
906
880
rand := rand .New (rand .NewSource (time .Now ().UTC ().UnixNano ()))
0 commit comments