зеркало из https://github.com/Azure/ARO-RP.git
Renames SP checker fields
This commit is contained in:
Родитель
2268445408
Коммит
6c066e5902
|
@ -22,8 +22,8 @@ type servicePrincipalChecker interface {
|
||||||
type checker struct {
|
type checker struct {
|
||||||
log *logrus.Entry
|
log *logrus.Entry
|
||||||
|
|
||||||
credentialsGetter func(ctx context.Context) (*clusterauthorizer.Credentials, error)
|
credentials func(ctx context.Context) (*clusterauthorizer.Credentials, error)
|
||||||
spValidatorConstructor func(azEnv *azureclient.AROEnvironment) (dynamic.ServicePrincipalValidator, error)
|
newSPValidator func(azEnv *azureclient.AROEnvironment) (dynamic.ServicePrincipalValidator, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newServicePrincipalChecker(log *logrus.Entry, kubernetescli kubernetes.Interface) servicePrincipalChecker {
|
func newServicePrincipalChecker(log *logrus.Entry, kubernetescli kubernetes.Interface) servicePrincipalChecker {
|
||||||
|
@ -32,10 +32,10 @@ func newServicePrincipalChecker(log *logrus.Entry, kubernetescli kubernetes.Inte
|
||||||
return &checker{
|
return &checker{
|
||||||
log: log,
|
log: log,
|
||||||
|
|
||||||
credentialsGetter: func(ctx context.Context) (*clusterauthorizer.Credentials, error) {
|
credentials: func(ctx context.Context) (*clusterauthorizer.Credentials, error) {
|
||||||
return clusterauthorizer.AzCredentials(ctx, kubernetescli)
|
return clusterauthorizer.AzCredentials(ctx, kubernetescli)
|
||||||
},
|
},
|
||||||
spValidatorConstructor: func(azEnv *azureclient.AROEnvironment) (dynamic.ServicePrincipalValidator, error) {
|
newSPValidator: func(azEnv *azureclient.AROEnvironment) (dynamic.ServicePrincipalValidator, error) {
|
||||||
return dynamic.NewServicePrincipalValidator(log, azEnv, dynamic.AuthorizerClusterServicePrincipal, tokenClient)
|
return dynamic.NewServicePrincipalValidator(log, azEnv, dynamic.AuthorizerClusterServicePrincipal, tokenClient)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -47,12 +47,12 @@ func (r *checker) Check(ctx context.Context, AZEnvironment string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
azCred, err := r.credentialsGetter(ctx)
|
azCred, err := r.credentials(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
spDynamic, err := r.spValidatorConstructor(&azEnv)
|
spDynamic, err := r.newSPValidator(&azEnv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,13 +74,13 @@ func TestCheck(t *testing.T) {
|
||||||
|
|
||||||
sp := &checker{
|
sp := &checker{
|
||||||
log: log,
|
log: log,
|
||||||
credentialsGetter: func(ctx context.Context) (*clusterauthorizer.Credentials, error) {
|
credentials: func(ctx context.Context) (*clusterauthorizer.Credentials, error) {
|
||||||
if tt.credentialsExist {
|
if tt.credentialsExist {
|
||||||
return mockCredentials, nil
|
return mockCredentials, nil
|
||||||
}
|
}
|
||||||
return nil, errors.New("fake credentials get error")
|
return nil, errors.New("fake credentials get error")
|
||||||
},
|
},
|
||||||
spValidatorConstructor: func(azEnv *azureclient.AROEnvironment) (dynamic.ServicePrincipalValidator, error) {
|
newSPValidator: func(azEnv *azureclient.AROEnvironment) (dynamic.ServicePrincipalValidator, error) {
|
||||||
if validatorMock != nil {
|
if validatorMock != nil {
|
||||||
return validatorMock, nil
|
return validatorMock, nil
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче