From 5e7e35ca45ba3112d1ebd4da9acd08d601ec4f45 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Tue, 17 Nov 2020 15:18:10 -0800 Subject: [PATCH] Svc REST: Add stub begin* hooks These will be used in the next set of commits to de-0layer service REST. --- pkg/registry/core/service/storage/storage.go | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/pkg/registry/core/service/storage/storage.go b/pkg/registry/core/service/storage/storage.go index 2ec4bd64389..ed8e5be0f35 100644 --- a/pkg/registry/core/service/storage/storage.go +++ b/pkg/registry/core/service/storage/storage.go @@ -89,6 +89,8 @@ func NewGenericREST(optsGetter generic.RESTOptionsGetter, serviceCIDR net.IPNet, } genericStore := &GenericREST{store, primaryIPFamily, secondaryFamily} store.Decorator = genericStore.defaultOnRead + store.BeginCreate = genericStore.beginCreate + store.BeginUpdate = genericStore.beginUpdate return genericStore, &StatusREST{store: &statusStore}, nil } @@ -240,3 +242,37 @@ func (r *GenericREST) defaultOnReadService(service *api.Service) { } } } + +func (r *GenericREST) beginCreate(ctx context.Context, obj runtime.Object, options *metav1.CreateOptions) (genericregistry.FinishFunc, error) { + svc := obj.(*api.Service) + + // FIXME: remove this when implementing + _ = svc + + // Our cleanup callback + finish := func(_ context.Context, success bool) { + if success { + } else { + } + } + + return finish, nil +} + +func (r *GenericREST) beginUpdate(ctx context.Context, obj, oldObj runtime.Object, options *metav1.UpdateOptions) (genericregistry.FinishFunc, error) { + newSvc := obj.(*api.Service) + oldSvc := oldObj.(*api.Service) + + // FIXME: remove these when implementing + _ = oldSvc + _ = newSvc + + // Our cleanup callback + finish := func(_ context.Context, success bool) { + if success { + } else { + } + } + + return finish, nil +}