Skip to content

Commit 4142631

Browse files
author
qliang
committed
remove GetRESTConfigFromSecret
1 parent 1a49986 commit 4142631

File tree

2 files changed

+0
-25
lines changed

2 files changed

+0
-25
lines changed

controllers/clustercache/cluster_accessor.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -437,19 +437,6 @@ func (ca *clusterAccessor) KubeConfigUpdated(ctx context.Context) (bool, error)
437437
return kubeconfigSecret.ResourceVersion != ca.lockedState.kubeconfigResourceVersion, nil
438438
}
439439

440-
func (ca *clusterAccessor) GetRESTConfigFromSecret(ctx context.Context) (*rest.Config, error) {
441-
ca.rLock(ctx)
442-
defer ca.rUnlock(ctx)
443-
444-
log := ctrl.LoggerFrom(ctx)
445-
log.V(6).Info("Creating REST config")
446-
restConfig, err := createRESTConfig(ctx, ca.config.Client, ca.config.SecretClient, ca.cluster)
447-
if err != nil {
448-
return nil, err
449-
}
450-
return restConfig, nil
451-
}
452-
453440
func (ca *clusterAccessor) GetClientCertificatePrivateKey(ctx context.Context) *rsa.PrivateKey {
454441
ca.rLock(ctx)
455442
defer ca.rUnlock(ctx)

controllers/clustercache/cluster_cache.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ type ClusterCache interface {
137137
// If there is no connection to the workload cluster ErrClusterNotConnected will be returned.
138138
GetRESTConfig(ctx context.Context, cluster client.ObjectKey) (*rest.Config, error)
139139

140-
// GetRESTConfigFromSecret returns a REST config for the given cluster.
141-
// It reads the REST config from kubeconfig secret directly.
142-
GetRESTConfigFromSecret(ctx context.Context, cluster client.ObjectKey) (*rest.Config, error)
143-
144140
// GetClientCertificatePrivateKey returns a private key that is generated once for a cluster
145141
// and can then be used to generate client certificates. This is e.g. used in KCP to generate a client
146142
// cert to communicate with etcd.
@@ -388,14 +384,6 @@ func (cc *clusterCache) GetRESTConfig(ctx context.Context, cluster client.Object
388384
return accessor.GetRESTConfig(ctx)
389385
}
390386

391-
func (cc *clusterCache) GetRESTConfigFromSecret(ctx context.Context, cluster client.ObjectKey) (*rest.Config, error) {
392-
accessor := cc.getClusterAccessor(cluster)
393-
if accessor == nil {
394-
return nil, errors.Wrapf(ErrClusterNotConnected, "error getting REST config")
395-
}
396-
return accessor.GetRESTConfigFromSecret(ctx)
397-
}
398-
399387
func (cc *clusterCache) GetClientCertificatePrivateKey(ctx context.Context, cluster client.ObjectKey) (*rsa.PrivateKey, error) {
400388
accessor := cc.getClusterAccessor(cluster)
401389
if accessor == nil {

0 commit comments

Comments
 (0)