mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Rename createEndpointService() to createOrGetEndpointService()
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
parent
c86828b74b
commit
745f12837f
@ -815,7 +815,7 @@ func (p *glusterfsVolumeProvisioner) CreateVolume(gid int) (r *v1.GlusterfsPersi
|
|||||||
epServiceName = p.provisionerConfig.customEpNamePrefix + "-" + string(p.options.PVC.UID)
|
epServiceName = p.provisionerConfig.customEpNamePrefix + "-" + string(p.options.PVC.UID)
|
||||||
}
|
}
|
||||||
epNamespace := p.options.PVC.Namespace
|
epNamespace := p.options.PVC.Namespace
|
||||||
endpoint, service, err := p.createEndpointService(epNamespace, epServiceName, p.options.PVC)
|
endpoint, service, err := p.createOrGetEndpointService(epNamespace, epServiceName, p.options.PVC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("failed to create endpoint/service %v/%v: %v", epNamespace, epServiceName, err)
|
klog.Errorf("failed to create endpoint/service %v/%v: %v", epNamespace, epServiceName, err)
|
||||||
return nil, 0, "", fmt.Errorf("failed to create endpoint/service %v/%v: %v", epNamespace, epServiceName, err)
|
return nil, 0, "", fmt.Errorf("failed to create endpoint/service %v/%v: %v", epNamespace, epServiceName, err)
|
||||||
@ -915,11 +915,11 @@ func (p *glusterfsVolumeProvisioner) CreateVolume(gid int) (r *v1.GlusterfsPersi
|
|||||||
}, sz, volID, nil
|
}, sz, volID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// createEndpointService() makes sure an endpoint and service
|
// createOrGetEndpointService() makes sure an endpoint and service
|
||||||
// exist for the given namespace, PVC name, endpoint name
|
// exist for the given namespace, PVC name, endpoint name
|
||||||
// I.e. the endpoint or service is only created
|
// I.e. the endpoint or service is only created
|
||||||
// if it does not exist yet.
|
// if it does not exist yet.
|
||||||
func (p *glusterfsVolumeProvisioner) createEndpointService(namespace string, epServiceName string, pvc *v1.PersistentVolumeClaim) (endpoint *v1.Endpoints, service *v1.Service, err error) {
|
func (p *glusterfsVolumeProvisioner) createOrGetEndpointService(namespace string, epServiceName string, pvc *v1.PersistentVolumeClaim) (endpoint *v1.Endpoints, service *v1.Service, err error) {
|
||||||
pvcNameOrID := ""
|
pvcNameOrID := ""
|
||||||
if len(pvc.Name) >= 63 {
|
if len(pvc.Name) >= 63 {
|
||||||
pvcNameOrID = string(pvc.UID)
|
pvcNameOrID = string(pvc.UID)
|
||||||
|
Loading…
Reference in New Issue
Block a user