MCPcopy Create free account
hub / github.com/cloudtty/cloudtty / CreateOrUpdateService

Function CreateOrUpdateService

pkg/utils/service.go:11–23  ·  view source on GitHub ↗
(c client.Client, service *corev1.Service)

Source from the content-addressed store, hash-verified

9)
10
11func CreateOrUpdateService(c client.Client, service *corev1.Service) error {
12 var newer corev1.Service
13 if err := c.Get(context.TODO(), client.ObjectKeyFromObject(service), &newer); err != nil {
14 if apierrors.IsNotFound(err) {
15 return c.Create(context.TODO(), service)
16 }
17
18 return err
19 }
20
21 service.ResourceVersion = newer.ResourceVersion
22 return c.Update(context.TODO(), service)
23}

Callers

nothing calls this directly

Calls 3

GetMethod · 0.65
CreateMethod · 0.65
UpdateMethod · 0.65

Tested by

no test coverage detected