Skip to content

Commit

Permalink
fix(cluster): import cluster verification failure
Browse files Browse the repository at this point in the history
  • Loading branch information
choujimmy committed May 13, 2020
1 parent 86219f4 commit e701629
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/platform/validation/clustercredential.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package validation

import (
"context"
"errors"
"time"

apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -69,7 +70,7 @@ func ValidateClusterCredential(ctx context.Context, credential *platform.Cluster
if credential.CACert != nil {
restConfig.CAData = credential.CACert
if err = utilvalidation.ValidateRESTConfig(ctx, restConfig); err != nil {
if !apierrors.IsUnauthorized(err) {
if status := apierrors.APIStatus(nil); !errors.As(err, &status) {
allErrs = append(allErrs, field.Invalid(field.NewPath("caCert"), "", err.Error()))
}
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/platform/provider/imported/validation/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package validation

import (
"context"
"errors"
"fmt"
"time"

Expand Down Expand Up @@ -113,7 +114,7 @@ func ValidatClusterCredentialRef(ctx context.Context, cluster *types.Cluster, fl
if credential.CACert != nil {
restConfig.CAData = credential.CACert
if err = utilvalidation.ValidateRESTConfig(ctx, restConfig); err != nil {
if !apierrors.IsUnauthorized(err) {
if status := apierrors.APIStatus(nil); !errors.As(err, &status) {
allErrs = append(allErrs, field.Invalid(field.NewPath("caCert"), "", err.Error()))
}
}
Expand Down

0 comments on commit e701629

Please sign in to comment.