client interface change after scope change.
This commit is contained in:
parent
ea6215fcf7
commit
aa24ea2457
|
@ -28,7 +28,6 @@ const (
|
|||
// ControllerName is the controller name that will be used when reporting events.
|
||||
ControllerName = "execution-controller"
|
||||
finalizer = "karmada.io/execution-controller"
|
||||
memberClusterNS = "karmada-cluster"
|
||||
)
|
||||
|
||||
// Controller is to sync PropagationWork.
|
||||
|
@ -127,7 +126,7 @@ func (c *Controller) deletePropagationWork(propagationWork *propagationstrategy.
|
|||
}
|
||||
|
||||
// TODO(RainbowMango): retrieve member cluster from the local cache instead of a real request to API server.
|
||||
memberCluster, err := c.KarmadaClient.MemberclusterV1alpha1().MemberClusters(memberClusterNS).Get(context.TODO(), executionSpace, v1.GetOptions{})
|
||||
memberCluster, err := c.KarmadaClient.MemberclusterV1alpha1().MemberClusters().Get(context.TODO(), executionSpace, v1.GetOptions{})
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to get status of the given member cluster %s", executionSpace)
|
||||
return err
|
||||
|
@ -169,7 +168,7 @@ func (c *Controller) dispatchPropagationWork(propagationWork *propagationstrateg
|
|||
}
|
||||
|
||||
// TODO(RainbowMango): retrieve member cluster from the local cache instead of a real request to API server.
|
||||
memberCluster, err := c.KarmadaClient.MemberclusterV1alpha1().MemberClusters(memberClusterNS).Get(context.TODO(), executionSpace, v1.GetOptions{})
|
||||
memberCluster, err := c.KarmadaClient.MemberclusterV1alpha1().MemberClusters().Get(context.TODO(), executionSpace, v1.GetOptions{})
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to get status of the given member cluster %s", executionSpace)
|
||||
return err
|
||||
|
|
|
@ -40,7 +40,7 @@ type Controller struct {
|
|||
// The Controller will requeue the Request to be processed again if an error is non-nil or
|
||||
// Result.Requeue is true, otherwise upon completion it will remove the work from the queue.
|
||||
func (c *Controller) Reconcile(req controllerruntime.Request) (controllerruntime.Result, error) {
|
||||
klog.V(4).Infof("Reconciling memberCluster %s", req.NamespacedName.String())
|
||||
klog.V(4).Infof("Reconciling memberCluster %s", req.NamespacedName.Name)
|
||||
|
||||
memberCluster := &v1alpha1.MemberCluster{}
|
||||
if err := c.Client.Get(context.TODO(), req.NamespacedName, memberCluster); err != nil {
|
||||
|
|
|
@ -229,7 +229,6 @@ func Run(cmdOut io.Writer, karmadaConfig KarmadaConfig, opts CommandJoinOption)
|
|||
}
|
||||
|
||||
memberClusterObj := &memberclusterapi.MemberCluster{}
|
||||
memberClusterObj.Namespace = opts.ClusterNamespace
|
||||
memberClusterObj.Name = opts.MemberClusterName
|
||||
memberClusterObj.Spec.APIEndpoint = memberClusterConfig.Host
|
||||
memberClusterObj.Spec.SecretRef = &memberclusterapi.LocalSecretReference{
|
||||
|
@ -380,7 +379,7 @@ func createMemberClusterObject(controlPlaneClient *karmadaclientset.Clientset, m
|
|||
|
||||
// IsMemberClusterExist tells if a member cluster (namespace/name) already joined to control plane.
|
||||
func IsMemberClusterExist(controlPlaneClient karmadaclientset.Interface, namespace string, name string) (bool, error) {
|
||||
_, err := controlPlaneClient.MemberclusterV1alpha1().MemberClusters(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
||||
_, err := controlPlaneClient.MemberclusterV1alpha1().MemberClusters().Get(context.TODO(), name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
if apierrors.IsNotFound(err) {
|
||||
return false, nil
|
||||
|
@ -395,7 +394,7 @@ func IsMemberClusterExist(controlPlaneClient karmadaclientset.Interface, namespa
|
|||
|
||||
// CreateMemberCluster creates a new member cluster object in control plane.
|
||||
func CreateMemberCluster(controlPlaneClient karmadaclientset.Interface, cluster *memberclusterapi.MemberCluster) error {
|
||||
_, err := controlPlaneClient.MemberclusterV1alpha1().MemberClusters(cluster.Namespace).Create(context.TODO(), cluster, metav1.CreateOptions{})
|
||||
_, err := controlPlaneClient.MemberclusterV1alpha1().MemberClusters().Create(context.TODO(), cluster, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
klog.Warningf("failed to create member cluster. member cluster: %s/%s, error: %v", cluster.Namespace, cluster.Name, err)
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue