Fix 'namespace karmada-cluster not found' when cluster is being registered with 'pull' mode

Signed-off-by: wuzhongjian <wuzhongjian_yewu@cmss.chinamobile.com>
This commit is contained in:
wuzhongjian 2022-08-05 13:52:37 +08:00
parent 371ecba406
commit 161c16de24
2 changed files with 5 additions and 5 deletions

View File

@ -160,11 +160,6 @@ func JoinCluster(controlPlaneRestConfig, clusterConfig *rest.Config, opts Comman
klog.V(1).Infof("joining cluster config. endpoint: %s", clusterConfig.Host)
// ensure namespace where the cluster object be stored exists in control plane.
if _, err = util.EnsureNamespaceExist(controlPlaneKubeClient, opts.ClusterNamespace, opts.DryRun); err != nil {
return err
}
registerOption := util.ClusterRegisterOption{
ClusterNamespace: opts.ClusterNamespace,
ClusterName: opts.ClusterName,

View File

@ -98,6 +98,11 @@ func ObtainCredentialsFromMemberCluster(clusterKubeClient kubeclient.Interface,
// RegisterClusterInControllerPlane represents register cluster in controller plane
func RegisterClusterInControllerPlane(opts ClusterRegisterOption, controlPlaneKubeClient kubeclient.Interface, generateClusterInControllerPlane generateClusterInControllerPlaneFunc) error {
// ensure namespace where the cluster object be stored exists in control plane.
if _, err := EnsureNamespaceExist(controlPlaneKubeClient, opts.ClusterNamespace, opts.DryRun); err != nil {
return err
}
impersonatorSecret := &corev1.Secret{}
secret := &corev1.Secret{}
var err error