@@ -18,15 +18,13 @@ package util
1818
1919import (
2020 "fmt"
21- "strings"
2221
2322 corev1 "k8s.io/api/core/v1"
2423 clientset "k8s.io/client-go/kubernetes"
2524 "k8s.io/klog/v2"
2625 "k8s.io/perf-tests/clusterloader2/pkg/framework/client"
2726)
2827
29- const keyMasterNodeLabel = "node-role.kubernetes.io/master"
3028const keyControlPlaneNodeLabel = "node-role.kubernetes.io/control-plane"
3129
3230// Based on the following docs:
@@ -153,7 +151,7 @@ func GetMasterName(c clientset.Interface) (string, error) {
153151 return "" , err
154152 }
155153 for i := range nodeList {
156- if LegacyIsMasterNode ( & nodeList [ i ]) || IsControlPlaneNode (& nodeList [i ]) {
154+ if IsControlPlaneNode (& nodeList [i ]) {
157155 return nodeList [i ].Name , nil
158156 }
159157 }
@@ -168,7 +166,7 @@ func GetMasterIPs(c clientset.Interface, addressType corev1.NodeAddressType) ([]
168166 }
169167 var ips []string
170168 for i := range nodeList {
171- if LegacyIsMasterNode ( & nodeList [ i ]) || IsControlPlaneNode (& nodeList [i ]) {
169+ if IsControlPlaneNode (& nodeList [i ]) {
172170 for _ , address := range nodeList [i ].Status .Addresses {
173171 if address .Type == addressType && address .Address != "" {
174172 ips = append (ips , address .Address )
@@ -183,33 +181,6 @@ func GetMasterIPs(c clientset.Interface, addressType corev1.NodeAddressType) ([]
183181 return ips , nil
184182}
185183
186- // LegacyIsMasterNode returns true if given node is a registered master according
187- // to the logic historically used for this function. This code path is deprecated
188- // and the node disruption exclusion label should be used in the future.
189- // This code will not be allowed to update to use the node-role label, since
190- // node-roles may not be used for feature enablement.
191- // DEPRECATED: this will be removed in Kubernetes 1.19
192- func LegacyIsMasterNode (node * corev1.Node ) bool {
193- for key := range node .GetLabels () {
194- if key == keyMasterNodeLabel {
195- return true
196- }
197- }
198-
199- // We are trying to capture "master(-...)?$" regexp.
200- // However, using regexp.MatchString() results even in more than 35%
201- // of all space allocations in ControllerManager spent in this function.
202- // That's why we are trying to be a bit smarter.
203- nodeName := node .GetName ()
204- if strings .HasSuffix (nodeName , "master" ) {
205- return true
206- }
207- if len (nodeName ) >= 10 {
208- return strings .HasSuffix (nodeName [:len (nodeName )- 3 ], "master-" )
209- }
210- return false
211- }
212-
213184func IsControlPlaneNode (node * corev1.Node ) bool {
214185 for key := range node .GetLabels () {
215186 if key == keyControlPlaneNodeLabel {
0 commit comments