зеркало из https://github.com/Azure/ARO-RP.git
Merge pull request #2346 from s-amann/refactor/clean-up-naming
clean up naming in liveconfig
This commit is contained in:
Коммит
d8e4f8edb0
|
@ -13,19 +13,19 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
HIVEENVVARIABLE = "HIVEKUBECONFIGPATH"
|
||||
HIVE_ENV_VARIABLE = "HIVEKUBECONFIGPATH"
|
||||
)
|
||||
|
||||
func (d *dev) HiveRestConfig(ctx context.Context, index int) (*rest.Config, error) {
|
||||
// Indexes above 0 have _index appended to them
|
||||
envVar := HIVEENVVARIABLE
|
||||
envVar := HIVE_ENV_VARIABLE
|
||||
if index != 0 {
|
||||
envVar = fmt.Sprintf("%s_%d", HIVEENVVARIABLE, index)
|
||||
envVar = fmt.Sprintf("%s_%d", HIVE_ENV_VARIABLE, index)
|
||||
}
|
||||
|
||||
kubeConfigPath := os.Getenv(envVar)
|
||||
if kubeConfigPath == "" {
|
||||
return nil, fmt.Errorf("missing %s env variable", HIVEENVVARIABLE)
|
||||
return nil, fmt.Errorf("missing %s env variable", HIVE_ENV_VARIABLE)
|
||||
}
|
||||
|
||||
restConfig, err := clientcmd.BuildConfigFromFlags("", kubeConfigPath)
|
||||
|
|
|
@ -52,7 +52,7 @@ func (p *prod) HiveRestConfig(ctx context.Context, index int) (*rest.Config, err
|
|||
rpResourceGroup := fmt.Sprintf("rp-%s", p.location)
|
||||
rpResourceName := fmt.Sprintf("aro-aks-cluster-%03d", index)
|
||||
|
||||
res, err := p.managedClusters.ListClusterUserCredentials(ctx, rpResourceGroup, rpResourceName, "")
|
||||
res, err := p.managedClustersClient.ListClusterUserCredentials(ctx, rpResourceGroup, rpResourceName, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -23,18 +23,18 @@ func NewDev() Manager {
|
|||
}
|
||||
|
||||
type prod struct {
|
||||
location string
|
||||
managedClusters containerservice.ManagedClustersClient
|
||||
location string
|
||||
managedClustersClient containerservice.ManagedClustersClient
|
||||
|
||||
hiveCredentialsMutex *sync.RWMutex
|
||||
cachedCredentials map[int]*rest.Config
|
||||
}
|
||||
|
||||
func NewProd(location string, managedClusters containerservice.ManagedClustersClient) Manager {
|
||||
func NewProd(location string, managedClustersClient containerservice.ManagedClustersClient) Manager {
|
||||
return &prod{
|
||||
location: location,
|
||||
managedClusters: managedClusters,
|
||||
cachedCredentials: make(map[int]*rest.Config),
|
||||
hiveCredentialsMutex: &sync.RWMutex{},
|
||||
location: location,
|
||||
managedClustersClient: managedClustersClient,
|
||||
cachedCredentials: make(map[int]*rest.Config),
|
||||
hiveCredentialsMutex: &sync.RWMutex{},
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче