Skip to content

Commit

Permalink
fix: assign namespace when create service.
Browse files Browse the repository at this point in the history
Signed-off-by: Simoncqk <[email protected]>
  • Loading branch information
SimonCqk committed Mar 19, 2022
1 parent a645df5 commit db4e0bf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/job_controller/service_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ package job_controller
import (
"context"
"fmt"
"sync"

"github.com/golang/glog"
log "github.com/sirupsen/logrus"
"k8s.io/api/core/v1"
Expand All @@ -27,7 +29,6 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/tools/record"
"sigs.k8s.io/controller-runtime/pkg/client"
"sync"
)

const (
Expand Down Expand Up @@ -110,6 +111,8 @@ func (r ServiceControl) createServices(namespace string, service *v1.Service, ob
r.recorder.Eventf(object, v1.EventTypeWarning, FailedCreateServiceReason, "Error creating: %v", err)
return fmt.Errorf("unable to create services: %v", err)
}

serviceWithOwner.Namespace = namespace
err = r.client.Create(context.Background(), serviceWithOwner)
if err != nil {
r.recorder.Eventf(object, v1.EventTypeWarning, FailedCreateServiceReason, "Error creating: %v", err)
Expand Down

0 comments on commit db4e0bf

Please sign in to comment.