@@ -24,7 +24,6 @@ import (
24
24
25
25
"github.com/pkg/errors"
26
26
27
- "k8s.io/api/core/v1"
28
27
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29
28
"k8s.io/apimachinery/pkg/util/wait"
30
29
"k8s.io/client-go/tools/clientcmd"
@@ -74,16 +73,11 @@ func RetrieveValidatedConfigInfo(cfg *kubeadmapi.JoinConfiguration) (*clientcmda
74
73
klog .V (1 ).Infof ("[discovery] Created cluster-info discovery client, requesting info from %q\n " , insecureBootstrapConfig .Clusters [clusterName ].Server )
75
74
76
75
// Make an initial insecure connection to get the cluster-info ConfigMap
77
- var insecureClusterInfo * v1.ConfigMap
78
- wait .PollImmediateInfinite (constants .DiscoveryRetryInterval , func () (bool , error ) {
79
- var err error
80
- insecureClusterInfo , err = insecureClient .CoreV1 ().ConfigMaps (metav1 .NamespacePublic ).Get (bootstrapapi .ConfigMapClusterInfo , metav1.GetOptions {})
81
- if err != nil {
82
- klog .V (1 ).Infof ("[discovery] Failed to request cluster info, will try again: [%s]\n " , err )
83
- return false , nil
84
- }
85
- return true , nil
86
- })
76
+ insecureClusterInfo , err := insecureClient .CoreV1 ().ConfigMaps (metav1 .NamespacePublic ).Get (bootstrapapi .ConfigMapClusterInfo , metav1.GetOptions {})
77
+ if err != nil {
78
+ klog .V (1 ).Infof ("[discovery] Failed to request cluster info: [%s]\n " , err )
79
+ return nil , err
80
+ }
87
81
88
82
// Validate the MAC on the kubeconfig from the ConfigMap and load it
89
83
insecureKubeconfigString , ok := insecureClusterInfo .Data [bootstrapapi .KubeConfigKey ]
@@ -138,16 +132,11 @@ func RetrieveValidatedConfigInfo(cfg *kubeadmapi.JoinConfiguration) (*clientcmda
138
132
}
139
133
140
134
klog .V (1 ).Infof ("[discovery] Requesting info from %q again to validate TLS against the pinned public key\n " , insecureBootstrapConfig .Clusters [clusterName ].Server )
141
- var secureClusterInfo * v1.ConfigMap
142
- wait .PollImmediateInfinite (constants .DiscoveryRetryInterval , func () (bool , error ) {
143
- var err error
144
- secureClusterInfo , err = secureClient .CoreV1 ().ConfigMaps (metav1 .NamespacePublic ).Get (bootstrapapi .ConfigMapClusterInfo , metav1.GetOptions {})
145
- if err != nil {
146
- klog .V (1 ).Infof ("[discovery] Failed to request cluster info, will try again: [%s]\n " , err )
147
- return false , nil
148
- }
149
- return true , nil
150
- })
135
+ secureClusterInfo , err := secureClient .CoreV1 ().ConfigMaps (metav1 .NamespacePublic ).Get (bootstrapapi .ConfigMapClusterInfo , metav1.GetOptions {})
136
+ if err != nil {
137
+ klog .V (1 ).Infof ("[discovery] Failed to request cluster info: [%s]\n " , err )
138
+ return nil , err
139
+ }
151
140
152
141
// Pull the kubeconfig from the securely-obtained ConfigMap and validate that it's the same as what we found the first time
153
142
secureKubeconfigBytes := []byte (secureClusterInfo .Data [bootstrapapi .KubeConfigKey ])
0 commit comments