use core client with explicit version globally

This commit is contained in:
Kevin
2017-10-25 23:54:32 +08:00
parent d945927077
commit 4c8539cece
190 changed files with 921 additions and 921 deletions

View File

@@ -99,19 +99,19 @@ func NewBootstrapSigner(cl clientset.Interface, options BootstrapSignerOptions)
secretNamespace: options.TokenSecretNamespace,
syncQueue: workqueue.NewNamed("bootstrap_signer_queue"),
}
if cl.Core().RESTClient().GetRateLimiter() != nil {
metrics.RegisterMetricAndTrackRateLimiterUsage("bootstrap_signer", cl.Core().RESTClient().GetRateLimiter())
if cl.CoreV1().RESTClient().GetRateLimiter() != nil {
metrics.RegisterMetricAndTrackRateLimiterUsage("bootstrap_signer", cl.CoreV1().RESTClient().GetRateLimiter())
}
configMapSelector := fields.SelectorFromSet(map[string]string{api.ObjectNameField: options.ConfigMapName})
e.configMaps, e.configMapsController = cache.NewInformer(
&cache.ListWatch{
ListFunc: func(lo metav1.ListOptions) (runtime.Object, error) {
lo.FieldSelector = configMapSelector.String()
return e.client.Core().ConfigMaps(options.ConfigMapNamespace).List(lo)
return e.client.CoreV1().ConfigMaps(options.ConfigMapNamespace).List(lo)
},
WatchFunc: func(lo metav1.ListOptions) (watch.Interface, error) {
lo.FieldSelector = configMapSelector.String()
return e.client.Core().ConfigMaps(options.ConfigMapNamespace).Watch(lo)
return e.client.CoreV1().ConfigMaps(options.ConfigMapNamespace).Watch(lo)
},
},
&v1.ConfigMap{},
@@ -127,11 +127,11 @@ func NewBootstrapSigner(cl clientset.Interface, options BootstrapSignerOptions)
&cache.ListWatch{
ListFunc: func(lo metav1.ListOptions) (runtime.Object, error) {
lo.FieldSelector = secretSelector.String()
return e.client.Core().Secrets(e.secretNamespace).List(lo)
return e.client.CoreV1().Secrets(e.secretNamespace).List(lo)
},
WatchFunc: func(lo metav1.ListOptions) (watch.Interface, error) {
lo.FieldSelector = secretSelector.String()
return e.client.Core().Secrets(e.secretNamespace).Watch(lo)
return e.client.CoreV1().Secrets(e.secretNamespace).Watch(lo)
},
},
&v1.Secret{},
@@ -227,7 +227,7 @@ func (e *BootstrapSigner) signConfigMap() {
}
func (e *BootstrapSigner) updateConfigMap(cm *v1.ConfigMap) {
_, err := e.client.Core().ConfigMaps(cm.Namespace).Update(cm)
_, err := e.client.CoreV1().ConfigMaps(cm.Namespace).Update(cm)
if err != nil && !apierrors.IsConflict(err) && !apierrors.IsNotFound(err) {
glog.V(3).Infof("Error updating ConfigMap: %v", err)
}

View File

@@ -71,8 +71,8 @@ func NewTokenCleaner(cl clientset.Interface, options TokenCleanerOptions) *Token
client: cl,
tokenSecretNamespace: options.TokenSecretNamespace,
}
if cl.Core().RESTClient().GetRateLimiter() != nil {
metrics.RegisterMetricAndTrackRateLimiterUsage("token_cleaner", cl.Core().RESTClient().GetRateLimiter())
if cl.CoreV1().RESTClient().GetRateLimiter() != nil {
metrics.RegisterMetricAndTrackRateLimiterUsage("token_cleaner", cl.CoreV1().RESTClient().GetRateLimiter())
}
secretSelector := fields.SelectorFromSet(map[string]string{api.SecretTypeField: string(bootstrapapi.SecretTypeBootstrapToken)})
@@ -80,11 +80,11 @@ func NewTokenCleaner(cl clientset.Interface, options TokenCleanerOptions) *Token
&cache.ListWatch{
ListFunc: func(lo metav1.ListOptions) (runtime.Object, error) {
lo.FieldSelector = secretSelector.String()
return e.client.Core().Secrets(e.tokenSecretNamespace).List(lo)
return e.client.CoreV1().Secrets(e.tokenSecretNamespace).List(lo)
},
WatchFunc: func(lo metav1.ListOptions) (watch.Interface, error) {
lo.FieldSelector = secretSelector.String()
return e.client.Core().Secrets(e.tokenSecretNamespace).Watch(lo)
return e.client.CoreV1().Secrets(e.tokenSecretNamespace).Watch(lo)
},
},
&v1.Secret{},
@@ -118,7 +118,7 @@ func (tc *TokenCleaner) evalSecret(o interface{}) {
if len(secret.UID) > 0 {
options = &metav1.DeleteOptions{Preconditions: &metav1.Preconditions{UID: &secret.UID}}
}
err := tc.client.Core().Secrets(secret.Namespace).Delete(secret.Name, options)
err := tc.client.CoreV1().Secrets(secret.Namespace).Delete(secret.Name, options)
// NotFound isn't a real error (it's already been deleted)
// Conflict isn't a real error (the UID precondition failed)
if err != nil && !apierrors.IsConflict(err) && !apierrors.IsNotFound(err) {