Skip to content

Commit 8135f19

Browse files
committed
add short name for stagedkubernetesnetworkpolicy
1 parent 515521e commit 8135f19

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

apiserver/pkg/registry/projectcalico/rest/storage_calico.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (p RESTStorageProvider) NewV3Storage(
104104
},
105105
p.StorageType,
106106
authorizer,
107-
[]string{},
107+
[]string{"sknp"},
108108
)
109109

110110
stagedpolicyRESTOptions, err := restOptionsGetter.GetRESTOptions(calico.Resource("stagednetworkpolicies"), nil)
@@ -214,7 +214,7 @@ func (p RESTStorageProvider) NewV3Storage(
214214
},
215215
p.StorageType,
216216
authorizer,
217-
[]string{"sgnp", "csgnp", "calicostagedglobalnetworkpolicies"},
217+
[]string{"sgnp", "csgnp", "calicostagedglobalnetworkpolicies", "calicostagedglobalnetworkpolicy"},
218218
)
219219

220220
gNetworkSetRESTOptions, err := restOptionsGetter.GetRESTOptions(calico.Resource("globalnetworksets"), nil)

apiserver/pkg/registry/projectcalico/stagedkubernetesnetworkpolicy/storage.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
// rest implements a RESTStorage for API services against etcd
3131
type REST struct {
3232
*genericregistry.Store
33+
shortNames []string
3334
}
3435

3536
// EmptyObject returns an empty instance
@@ -89,5 +90,9 @@ func NewREST(scheme *runtime.Scheme, opts server.Options) (*REST, error) {
8990
DestroyFunc: dFunc,
9091
}
9192

92-
return &REST{store}, nil
93+
return &REST{store, opts.ShortNames}, nil
94+
}
95+
96+
func (r *REST) ShortNames() []string {
97+
return r.shortNames
9398
}

0 commit comments

Comments
 (0)