Remove anonymous check from managedClusterCreatingController sync (#299)

Signed-off-by: aii-nozomu-oki <h-nozomu.oki@inside.ai>
This commit is contained in:
Ohki Nozomu
2023-02-14 22:40:55 +09:00
committed by GitHub
parent 28255f6a9d
commit cc7a5cdd96

View File

@@ -3,7 +3,6 @@ package managedcluster
import (
"context"
"fmt"
"strings"
"time"
clientset "open-cluster-management.io/api/client/cluster/clientset/versioned"
@@ -17,9 +16,6 @@ import (
"k8s.io/klog/v2"
)
// well-known anonymous user
const anonymous = "system:anonymous"
var (
// CreatingControllerSyncInterval is exposed so that integration tests can crank up the controller sync speed.
CreatingControllerSyncInterval = 60 * time.Minute
@@ -54,7 +50,8 @@ func NewManagedClusterCreatingController(
func (c *managedClusterCreatingController) sync(ctx context.Context, syncCtx factory.SyncContext) error {
existingCluster, err := c.hubClusterClient.ClusterV1().ManagedClusters().Get(ctx, c.clusterName, metav1.GetOptions{})
if err != nil && skipUnauthorizedError(err) == nil && strings.Contains(err.Error(), anonymous) {
// ManagedCluster is only allowed created during bootstrap. After bootstrap secret expired, an unauthorized error will be got, output log at the debug level
if err != nil && skipUnauthorizedError(err) == nil {
klog.V(4).Infof("unable to get the managed cluster %q from hub: %v", c.clusterName, err)
return nil
}