mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
Merge pull request #9845 from liggitt/kubernetes_service_uid
Apply BeforeCreate logic to kubernetes service
This commit is contained in:
commit
3e7799d9a8
@ -24,6 +24,7 @@ import (
|
|||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/endpoints"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/endpoints"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/rest"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/endpoint"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/endpoint"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/namespace"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/namespace"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/service"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/service"
|
||||||
@ -157,8 +158,14 @@ func (c *Controller) CreateMasterServiceIfNeeded(serviceName string, serviceIP n
|
|||||||
Selector: nil,
|
Selector: nil,
|
||||||
ClusterIP: serviceIP.String(),
|
ClusterIP: serviceIP.String(),
|
||||||
SessionAffinity: api.ServiceAffinityNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
|
Type: api.ServiceTypeClusterIP,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := rest.BeforeCreate(rest.Services, ctx, svc); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
_, err := c.ServiceRegistry.CreateService(ctx, svc)
|
_, err := c.ServiceRegistry.CreateService(ctx, svc)
|
||||||
if err != nil && errors.IsAlreadyExists(err) {
|
if err != nil && errors.IsAlreadyExists(err) {
|
||||||
err = nil
|
err = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user