Skip to content

Support proxy-url from host cluster kubeconfig in SetControlplaneConfig for Karmada operator #7769

Description

@qiuming520

What would you like to be added:
When deploying Karmada instance via karmada.operator.karmada.io/v1alpha1 CR with host cluster kubeconfig that contains proxy-url, make karmada-operator automatically parse and inject the proxy-url field into control plane config when building host cluster connection in SetControlplaneConfig logic, so that operator can properly connect target Karmada control plane and complete the installation of karmada-apiserver and other control plane components successfully.

Locations:

// store rest config to RunData.
config, err := clientcmd.RESTConfigFromKubeConfig(configBytes)
if err != nil {
return err
}
data.SetControlplaneConfig(config)
klog.V(2).InfoS("[UploadAdminKubeconfig] Successfully created secret of karmada apiserver kubeconfig", "karmada", klog.KObj(data))
return nil
}

Why is this needed:
Currently, if the kubeconfig of host cluster configured in Karmada CR uses proxy-url to access cluster apiserver, karmada-operator will ignore the proxy-url field during constructing host cluster connection in SetControlplaneConfig phase. Without supplementing proxy-url into client config, operator cannot establish normal connection to target Karmada control plane, resulting in failure to install karmada-apiserver and other core control plane components, which blocks the whole Karmada instance deployment flow for environments that rely on proxy to access Kubernetes clusters.

Locations:

func runSystemNamespace(r workflow.RunData) error {
data, ok := r.(InitData)
if !ok {
return errors.New("systemName task invoked with an invalid data struct")
}
err := apiclient.CreateNamespace(data.KarmadaClient(), &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: constants.KarmadaSystemNamespace,
},
})
if err != nil {
return fmt.Errorf("failed to create namespace %s, err: %w", constants.KarmadaSystemNamespace, err)
}
klog.V(2).InfoS("[systemName] Successfully created karmada system namespace", "namespace", constants.KarmadaSystemNamespace, "karmada", klog.KObj(data))
return nil
}

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.

Type

No type

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions