Skip to content

Commit

Permalink
enable mcs to support headless-svc
Browse files Browse the repository at this point in the history
  • Loading branch information
WenchuanZhao committed Apr 7, 2023
1 parent b7a4fb0 commit c98ec5f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/controllers/mcs/service_import_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (c *ServiceImportController) Reconcile(ctx context.Context, req controllerr
return controllerruntime.Result{Requeue: true}, err
}

if !svcImport.DeletionTimestamp.IsZero() || svcImport.Spec.Type != mcsv1alpha1.ClusterSetIP {
if !svcImport.DeletionTimestamp.IsZero() {
return controllerruntime.Result{}, nil
}

Expand Down Expand Up @@ -93,6 +93,10 @@ func (c *ServiceImportController) deriveServiceFromServiceImport(svcImport *mcsv
},
}

if svcImport.Spec.Type == mcsv1alpha1.Headless {
newDerivedService.Spec.ClusterIP = corev1.ClusterIPNone
}

oldDerivedService := &corev1.Service{}
err := c.Client.Get(context.TODO(), types.NamespacedName{
Name: names.GenerateDerivedServiceName(svcImport.Name),
Expand Down

0 comments on commit c98ec5f

Please sign in to comment.