Merge pull request #109303 from wojtek-t/clean_storage_shutdown
Cleanup rest storage resources on shutdown
This commit is contained in:
commit
cc2807c521
@ -159,7 +159,7 @@ func Run(completeOptions completedServerRunOptions, stopCh <-chan struct{}) erro
|
|||||||
|
|
||||||
klog.InfoS("Golang settings", "GOGC", os.Getenv("GOGC"), "GOMAXPROCS", os.Getenv("GOMAXPROCS"), "GOTRACEBACK", os.Getenv("GOTRACEBACK"))
|
klog.InfoS("Golang settings", "GOGC", os.Getenv("GOGC"), "GOMAXPROCS", os.Getenv("GOMAXPROCS"), "GOTRACEBACK", os.Getenv("GOTRACEBACK"))
|
||||||
|
|
||||||
server, err := CreateServerChain(completeOptions, stopCh)
|
server, err := CreateServerChain(completeOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ func Run(completeOptions completedServerRunOptions, stopCh <-chan struct{}) erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CreateServerChain creates the apiservers connected via delegation.
|
// CreateServerChain creates the apiservers connected via delegation.
|
||||||
func CreateServerChain(completedOptions completedServerRunOptions, stopCh <-chan struct{}) (*aggregatorapiserver.APIAggregator, error) {
|
func CreateServerChain(completedOptions completedServerRunOptions) (*aggregatorapiserver.APIAggregator, error) {
|
||||||
kubeAPIServerConfig, serviceResolver, pluginInitializer, err := CreateKubeAPIServerConfig(completedOptions)
|
kubeAPIServerConfig, serviceResolver, pluginInitializer, err := CreateKubeAPIServerConfig(completedOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -213,7 +213,7 @@ func StartTestServer(t Logger, instanceOptions *TestServerInstanceOptions, custo
|
|||||||
|
|
||||||
t.Logf("runtime-config=%v", completedOptions.APIEnablement.RuntimeConfig)
|
t.Logf("runtime-config=%v", completedOptions.APIEnablement.RuntimeConfig)
|
||||||
t.Logf("Starting kube-apiserver on port %d...", s.SecureServing.BindPort)
|
t.Logf("Starting kube-apiserver on port %d...", s.SecureServing.BindPort)
|
||||||
server, err := app.CreateServerChain(completedOptions, stopCh)
|
server, err := app.CreateServerChain(completedOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, fmt.Errorf("failed to create server chain: %v", err)
|
return result, fmt.Errorf("failed to create server chain: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &apiserverinternal.StorageVersion{}
|
return &apiserverinternal.StorageVersion{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -88,6 +88,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &apps.DaemonSet{}
|
return &apps.DaemonSet{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -140,6 +140,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &apps.Deployment{}
|
return &apps.Deployment{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
@ -185,6 +191,12 @@ func (r *RollbackREST) New() runtime.Object {
|
|||||||
return &apps.DeploymentRollback{}
|
return &apps.DeploymentRollback{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *RollbackREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
var _ = rest.NamedCreater(&RollbackREST{})
|
var _ = rest.NamedCreater(&RollbackREST{})
|
||||||
|
|
||||||
// Create runs rollback for deployment
|
// Create runs rollback for deployment
|
||||||
@ -283,6 +295,12 @@ func (r *ScaleREST) New() runtime.Object {
|
|||||||
return &autoscaling.Scale{}
|
return &autoscaling.Scale{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *ScaleREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves object from Scale storage.
|
// Get retrieves object from Scale storage.
|
||||||
func (r *ScaleREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *ScaleREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
obj, err := r.store.Get(ctx, name, options)
|
obj, err := r.store.Get(ctx, name, options)
|
||||||
|
@ -136,6 +136,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &apps.ReplicaSet{}
|
return &apps.ReplicaSet{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
@ -185,6 +191,12 @@ func (r *ScaleREST) New() runtime.Object {
|
|||||||
return &autoscaling.Scale{}
|
return &autoscaling.Scale{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *ScaleREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves object from Scale storage.
|
// Get retrieves object from Scale storage.
|
||||||
func (r *ScaleREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *ScaleREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
obj, err := r.store.Get(ctx, name, options)
|
obj, err := r.store.Get(ctx, name, options)
|
||||||
|
@ -124,6 +124,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &apps.StatefulSet{}
|
return &apps.StatefulSet{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
@ -179,6 +185,12 @@ func (r *ScaleREST) New() runtime.Object {
|
|||||||
return &autoscaling.Scale{}
|
return &autoscaling.Scale{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *ScaleREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves object from Scale storage.
|
// Get retrieves object from Scale storage.
|
||||||
func (r *ScaleREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *ScaleREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
obj, err := r.store.Get(ctx, name, options)
|
obj, err := r.store.Get(ctx, name, options)
|
||||||
|
@ -54,6 +54,12 @@ func (r *REST) New() runtime.Object {
|
|||||||
return &authentication.TokenReview{}
|
return &authentication.TokenReview{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *REST) Destroy() {
|
||||||
|
// Given no underlying store, we don't destroy anything
|
||||||
|
// here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
||||||
tokenReview, ok := obj.(*authentication.TokenReview)
|
tokenReview, ok := obj.(*authentication.TokenReview)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -47,6 +47,12 @@ func (r *REST) New() runtime.Object {
|
|||||||
return &authorizationapi.LocalSubjectAccessReview{}
|
return &authorizationapi.LocalSubjectAccessReview{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *REST) Destroy() {
|
||||||
|
// Given no underlying store, we don't destroy anything
|
||||||
|
// here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
||||||
localSubjectAccessReview, ok := obj.(*authorizationapi.LocalSubjectAccessReview)
|
localSubjectAccessReview, ok := obj.(*authorizationapi.LocalSubjectAccessReview)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -47,6 +47,12 @@ func (r *REST) New() runtime.Object {
|
|||||||
return &authorizationapi.SelfSubjectAccessReview{}
|
return &authorizationapi.SelfSubjectAccessReview{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *REST) Destroy() {
|
||||||
|
// Given no underlying store, we don't destroy anything
|
||||||
|
// here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
||||||
selfSAR, ok := obj.(*authorizationapi.SelfSubjectAccessReview)
|
selfSAR, ok := obj.(*authorizationapi.SelfSubjectAccessReview)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -49,6 +49,12 @@ func (r *REST) New() runtime.Object {
|
|||||||
return &authorizationapi.SelfSubjectRulesReview{}
|
return &authorizationapi.SelfSubjectRulesReview{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *REST) Destroy() {
|
||||||
|
// Given no underlying store, we don't destroy anything
|
||||||
|
// here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Create attempts to get self subject rules in specific namespace.
|
// Create attempts to get self subject rules in specific namespace.
|
||||||
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
||||||
selfSRR, ok := obj.(*authorizationapi.SelfSubjectRulesReview)
|
selfSRR, ok := obj.(*authorizationapi.SelfSubjectRulesReview)
|
||||||
|
@ -46,6 +46,12 @@ func (r *REST) New() runtime.Object {
|
|||||||
return &authorizationapi.SubjectAccessReview{}
|
return &authorizationapi.SubjectAccessReview{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *REST) Destroy() {
|
||||||
|
// Given no underlying store, we don't destroy anything
|
||||||
|
// here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
||||||
subjectAccessReview, ok := obj.(*authorizationapi.SubjectAccessReview)
|
subjectAccessReview, ok := obj.(*authorizationapi.SubjectAccessReview)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -88,6 +88,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &autoscaling.HorizontalPodAutoscaler{}
|
return &autoscaling.HorizontalPodAutoscaler{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -86,6 +86,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &batch.CronJob{}
|
return &batch.CronJob{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -129,6 +129,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &batch.Job{}
|
return &batch.Job{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -89,6 +89,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &certificates.CertificateSigningRequest{}
|
return &certificates.CertificateSigningRequest{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
@ -122,6 +128,12 @@ func (r *ApprovalREST) New() runtime.Object {
|
|||||||
return &certificates.CertificateSigningRequest{}
|
return &certificates.CertificateSigningRequest{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *ApprovalREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *ApprovalREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *ApprovalREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -58,6 +58,12 @@ func (rs *REST) New() runtime.Object {
|
|||||||
return &api.ComponentStatus{}
|
return &api.ComponentStatus{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *REST) Destroy() {
|
||||||
|
// Given no underlying store, we don't destroy anything
|
||||||
|
// here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
func (rs *REST) NewList() runtime.Object {
|
func (rs *REST) NewList() runtime.Object {
|
||||||
return &api.ComponentStatusList{}
|
return &api.ComponentStatusList{}
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,11 @@ func (r *REST) New() runtime.Object {
|
|||||||
return r.store.New()
|
return r.store.New()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *REST) Destroy() {
|
||||||
|
r.store.Destroy()
|
||||||
|
}
|
||||||
|
|
||||||
func (r *REST) NewList() runtime.Object {
|
func (r *REST) NewList() runtime.Object {
|
||||||
return r.store.NewList()
|
return r.store.NewList()
|
||||||
}
|
}
|
||||||
@ -300,6 +305,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return r.store.New()
|
return r.store.New()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
@ -325,6 +336,12 @@ func (r *FinalizeREST) New() runtime.Object {
|
|||||||
return r.store.New()
|
return r.store.New()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *FinalizeREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Update alters the status finalizers subset of an object.
|
// Update alters the status finalizers subset of an object.
|
||||||
func (r *FinalizeREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
|
func (r *FinalizeREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
|
||||||
// We are explicitly setting forceAllowCreate to false in the call to the underlying storage because
|
// We are explicitly setting forceAllowCreate to false in the call to the underlying storage because
|
||||||
|
@ -50,6 +50,12 @@ func (r *ProxyREST) New() runtime.Object {
|
|||||||
return &api.NodeProxyOptions{}
|
return &api.NodeProxyOptions{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *ProxyREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// ConnectMethods returns the list of HTTP methods that can be proxied
|
// ConnectMethods returns the list of HTTP methods that can be proxied
|
||||||
func (r *ProxyREST) ConnectMethods() []string {
|
func (r *ProxyREST) ConnectMethods() []string {
|
||||||
return proxyMethods
|
return proxyMethods
|
||||||
|
@ -66,6 +66,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &api.Node{}
|
return &api.Node{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -83,6 +83,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &api.PersistentVolume{}
|
return &api.PersistentVolume{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -127,6 +127,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &api.PersistentVolumeClaim{}
|
return &api.PersistentVolumeClaim{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -51,6 +51,12 @@ func (r *LogREST) New() runtime.Object {
|
|||||||
return &api.Pod{}
|
return &api.Pod{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *LogREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// ProducesMIMETypes returns a list of the MIME types the specified HTTP verb (GET, POST, DELETE,
|
// ProducesMIMETypes returns a list of the MIME types the specified HTTP verb (GET, POST, DELETE,
|
||||||
// PATCH) can respond with.
|
// PATCH) can respond with.
|
||||||
func (r *LogREST) ProducesMIMETypes(verb string) []string {
|
func (r *LogREST) ProducesMIMETypes(verb string) []string {
|
||||||
|
@ -49,6 +49,12 @@ func (r *ProxyREST) New() runtime.Object {
|
|||||||
return &api.PodProxyOptions{}
|
return &api.PodProxyOptions{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *ProxyREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// ConnectMethods returns the list of HTTP methods that can be proxied
|
// ConnectMethods returns the list of HTTP methods that can be proxied
|
||||||
func (r *ProxyREST) ConnectMethods() []string {
|
func (r *ProxyREST) ConnectMethods() []string {
|
||||||
return proxyMethods
|
return proxyMethods
|
||||||
@ -91,6 +97,12 @@ func (r *AttachREST) New() runtime.Object {
|
|||||||
return &api.PodAttachOptions{}
|
return &api.PodAttachOptions{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *AttachREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Connect returns a handler for the pod exec proxy
|
// Connect returns a handler for the pod exec proxy
|
||||||
func (r *AttachREST) Connect(ctx context.Context, name string, opts runtime.Object, responder rest.Responder) (http.Handler, error) {
|
func (r *AttachREST) Connect(ctx context.Context, name string, opts runtime.Object, responder rest.Responder) (http.Handler, error) {
|
||||||
attachOpts, ok := opts.(*api.PodAttachOptions)
|
attachOpts, ok := opts.(*api.PodAttachOptions)
|
||||||
@ -128,6 +140,12 @@ func (r *ExecREST) New() runtime.Object {
|
|||||||
return &api.PodExecOptions{}
|
return &api.PodExecOptions{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *ExecREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Connect returns a handler for the pod exec proxy
|
// Connect returns a handler for the pod exec proxy
|
||||||
func (r *ExecREST) Connect(ctx context.Context, name string, opts runtime.Object, responder rest.Responder) (http.Handler, error) {
|
func (r *ExecREST) Connect(ctx context.Context, name string, opts runtime.Object, responder rest.Responder) (http.Handler, error) {
|
||||||
execOpts, ok := opts.(*api.PodExecOptions)
|
execOpts, ok := opts.(*api.PodExecOptions)
|
||||||
@ -165,6 +183,12 @@ func (r *PortForwardREST) New() runtime.Object {
|
|||||||
return &api.PodPortForwardOptions{}
|
return &api.PodPortForwardOptions{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *PortForwardREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// NewConnectOptions returns the versioned object that represents the
|
// NewConnectOptions returns the versioned object that represents the
|
||||||
// portforward parameters
|
// portforward parameters
|
||||||
func (r *PortForwardREST) NewConnectOptions() (runtime.Object, bool, string) {
|
func (r *PortForwardREST) NewConnectOptions() (runtime.Object, bool, string) {
|
||||||
|
@ -95,6 +95,12 @@ func (r *EvictionREST) New() runtime.Object {
|
|||||||
return &policy.Eviction{}
|
return &policy.Eviction{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *EvictionREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Propagate dry-run takes the dry-run option from the request and pushes it into the eviction object.
|
// Propagate dry-run takes the dry-run option from the request and pushes it into the eviction object.
|
||||||
// It returns an error if they have non-matching dry-run options.
|
// It returns an error if they have non-matching dry-run options.
|
||||||
func propagateDryRun(eviction *policy.Eviction, options *metav1.CreateOptions) (*metav1.DeleteOptions, error) {
|
func propagateDryRun(eviction *policy.Eviction, options *metav1.CreateOptions) (*metav1.DeleteOptions, error) {
|
||||||
|
@ -689,3 +689,6 @@ func (ms *mockStore) NewList() runtime.Object {
|
|||||||
func (ms *mockStore) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (ms *mockStore) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ms *mockStore) Destroy() {
|
||||||
|
}
|
||||||
|
@ -157,6 +157,12 @@ func (r *BindingREST) New() runtime.Object {
|
|||||||
return &api.Binding{}
|
return &api.Binding{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *BindingREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
var _ = rest.NamedCreater(&BindingREST{})
|
var _ = rest.NamedCreater(&BindingREST{})
|
||||||
|
|
||||||
// Create ensures a pod is bound to a specific host.
|
// Create ensures a pod is bound to a specific host.
|
||||||
@ -263,6 +269,12 @@ func (r *LegacyBindingREST) New() runtime.Object {
|
|||||||
return r.bindingRest.New()
|
return r.bindingRest.New()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *LegacyBindingREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Create ensures a pod is bound to a specific host.
|
// Create ensures a pod is bound to a specific host.
|
||||||
func (r *LegacyBindingREST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (out runtime.Object, err error) {
|
func (r *LegacyBindingREST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (out runtime.Object, err error) {
|
||||||
metadata, err := meta.Accessor(obj)
|
metadata, err := meta.Accessor(obj)
|
||||||
@ -282,6 +294,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &api.Pod{}
|
return &api.Pod{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
@ -324,6 +342,12 @@ func (r *EphemeralContainersREST) New() runtime.Object {
|
|||||||
return &api.Pod{}
|
return &api.Pod{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *EphemeralContainersREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Update alters the EphemeralContainers field in PodSpec
|
// Update alters the EphemeralContainers field in PodSpec
|
||||||
func (r *EphemeralContainersREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
|
func (r *EphemeralContainersREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
|
||||||
if !utilfeature.DefaultFeatureGate.Enabled(features.EphemeralContainers) {
|
if !utilfeature.DefaultFeatureGate.Enabled(features.EphemeralContainers) {
|
||||||
|
@ -131,6 +131,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &api.ReplicationController{}
|
return &api.ReplicationController{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
@ -174,6 +180,12 @@ func (r *ScaleREST) New() runtime.Object {
|
|||||||
return &autoscaling.Scale{}
|
return &autoscaling.Scale{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *ScaleREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
func (r *ScaleREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *ScaleREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
obj, err := r.store.Get(ctx, name, options)
|
obj, err := r.store.Get(ctx, name, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -82,6 +82,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &api.ResourceQuota{}
|
return &api.ResourceQuota{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -46,6 +46,12 @@ func (r *ProxyREST) New() runtime.Object {
|
|||||||
return &api.ServiceProxyOptions{}
|
return &api.ServiceProxyOptions{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *ProxyREST) Destroy() {
|
||||||
|
// Given no underlying store, we don't destroy anything
|
||||||
|
// here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// ConnectMethods returns the list of HTTP methods that can be proxied
|
// ConnectMethods returns the list of HTTP methods that can be proxied
|
||||||
func (r *ProxyREST) ConnectMethods() []string {
|
func (r *ProxyREST) ConnectMethods() []string {
|
||||||
return proxyMethods
|
return proxyMethods
|
||||||
|
@ -166,6 +166,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &api.Service{}
|
return &api.Service{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -43,6 +43,12 @@ func (r *TokenREST) New() runtime.Object {
|
|||||||
return &authenticationapi.TokenRequest{}
|
return &authenticationapi.TokenRequest{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *TokenREST) Destroy() {
|
||||||
|
// Given no underlying store, we don't destroy anything
|
||||||
|
// here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
type TokenREST struct {
|
type TokenREST struct {
|
||||||
svcaccts getter
|
svcaccts getter
|
||||||
pods getter
|
pods getter
|
||||||
|
@ -81,6 +81,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &flowcontrol.FlowSchema{}
|
return &flowcontrol.FlowSchema{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -81,6 +81,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &flowcontrol.PriorityLevelConfiguration{}
|
return &flowcontrol.PriorityLevelConfiguration{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -80,6 +80,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &networking.Ingress{}
|
return &networking.Ingress{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -82,6 +82,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &networkingapi.NetworkPolicy{}
|
return &networkingapi.NetworkPolicy{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -77,6 +77,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &policyapi.PodDisruptionBudget{}
|
return &policyapi.PodDisruptionBudget{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -46,6 +46,11 @@ func NewStorage(s rest.StandardStorage, authorizer authorizer.Authorizer, ruleRe
|
|||||||
return &Storage{s, authorizer, ruleResolver}
|
return &Storage{s, authorizer, ruleResolver}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *Storage) Destroy() {
|
||||||
|
r.StandardStorage.Destroy()
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Storage) NamespaceScoped() bool {
|
func (r *Storage) NamespaceScoped() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,11 @@ func NewStorage(s rest.StandardStorage, authorizer authorizer.Authorizer, ruleRe
|
|||||||
return &Storage{s, authorizer, ruleResolver}
|
return &Storage{s, authorizer, ruleResolver}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *Storage) Destroy() {
|
||||||
|
r.StandardStorage.Destroy()
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Storage) NamespaceScoped() bool {
|
func (r *Storage) NamespaceScoped() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,11 @@ func NewStorage(s rest.StandardStorage, authorizer authorizer.Authorizer, ruleRe
|
|||||||
return &Storage{s, authorizer, ruleResolver}
|
return &Storage{s, authorizer, ruleResolver}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *Storage) Destroy() {
|
||||||
|
r.StandardStorage.Destroy()
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Storage) NamespaceScoped() bool {
|
func (r *Storage) NamespaceScoped() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,11 @@ func NewStorage(s rest.StandardStorage, authorizer authorizer.Authorizer, ruleRe
|
|||||||
return &Storage{s, authorizer, ruleResolver}
|
return &Storage{s, authorizer, ruleResolver}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *Storage) Destroy() {
|
||||||
|
r.StandardStorage.Destroy()
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Storage) NamespaceScoped() bool {
|
func (r *Storage) NamespaceScoped() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &storageapi.VolumeAttachment{}
|
return &storageapi.VolumeAttachment{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -195,6 +195,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &apiextensions.CustomResourceDefinition{}
|
return &apiextensions.CustomResourceDefinition{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -462,6 +462,9 @@ func (storage *SimpleRESTStorage) NewList() runtime.Object {
|
|||||||
return &genericapitesting.SimpleList{}
|
return &genericapitesting.SimpleList{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (storage *SimpleRESTStorage) Destroy() {
|
||||||
|
}
|
||||||
|
|
||||||
func (storage *SimpleRESTStorage) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
func (storage *SimpleRESTStorage) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
||||||
storage.checkContext(ctx)
|
storage.checkContext(ctx)
|
||||||
storage.created = obj.(*genericapitesting.Simple)
|
storage.created = obj.(*genericapitesting.Simple)
|
||||||
@ -547,6 +550,9 @@ func (s *ConnecterRESTStorage) New() runtime.Object {
|
|||||||
return &genericapitesting.Simple{}
|
return &genericapitesting.Simple{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *ConnecterRESTStorage) Destroy() {
|
||||||
|
}
|
||||||
|
|
||||||
func (s *ConnecterRESTStorage) Connect(ctx context.Context, id string, options runtime.Object, responder rest.Responder) (http.Handler, error) {
|
func (s *ConnecterRESTStorage) Connect(ctx context.Context, id string, options runtime.Object, responder rest.Responder) (http.Handler, error) {
|
||||||
s.receivedConnectOptions = options
|
s.receivedConnectOptions = options
|
||||||
s.receivedID = id
|
s.receivedID = id
|
||||||
@ -668,6 +674,9 @@ func (storage *SimpleTypedStorage) New() runtime.Object {
|
|||||||
return storage.baseType
|
return storage.baseType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (storage *SimpleTypedStorage) Destroy() {
|
||||||
|
}
|
||||||
|
|
||||||
func (storage *SimpleTypedStorage) Get(ctx context.Context, id string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (storage *SimpleTypedStorage) Get(ctx context.Context, id string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
storage.checkContext(ctx)
|
storage.checkContext(ctx)
|
||||||
return storage.item.DeepCopyObject(), storage.errors["get"]
|
return storage.item.DeepCopyObject(), storage.errors["get"]
|
||||||
@ -810,6 +819,9 @@ func (UnimplementedRESTStorage) New() runtime.Object {
|
|||||||
return &genericapitesting.Simple{}
|
return &genericapitesting.Simple{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (UnimplementedRESTStorage) Destroy() {
|
||||||
|
}
|
||||||
|
|
||||||
// TestUnimplementedRESTStorage ensures that if a rest.Storage does not implement a given
|
// TestUnimplementedRESTStorage ensures that if a rest.Storage does not implement a given
|
||||||
// method, that it is literally not registered with the server. In the past,
|
// method, that it is literally not registered with the server. In the past,
|
||||||
// we registered everything, and returned method not supported if it didn't support
|
// we registered everything, and returned method not supported if it didn't support
|
||||||
@ -4322,6 +4334,9 @@ func (storage *SimpleXGSubresourceRESTStorage) New() runtime.Object {
|
|||||||
return &genericapitesting.SimpleXGSubresource{}
|
return &genericapitesting.SimpleXGSubresource{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (storage *SimpleXGSubresourceRESTStorage) Destroy() {
|
||||||
|
}
|
||||||
|
|
||||||
func (storage *SimpleXGSubresourceRESTStorage) Get(ctx context.Context, id string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (storage *SimpleXGSubresourceRESTStorage) Get(ctx context.Context, id string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return storage.item.DeepCopyObject(), nil
|
return storage.item.DeepCopyObject(), nil
|
||||||
}
|
}
|
||||||
|
@ -70,9 +70,12 @@ func StorageWithCacher() generic.StorageDecorator {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, func() {}, err
|
return nil, func() {}, err
|
||||||
}
|
}
|
||||||
|
var once sync.Once
|
||||||
destroyFunc := func() {
|
destroyFunc := func() {
|
||||||
cacher.Stop()
|
once.Do(func() {
|
||||||
d()
|
cacher.Stop()
|
||||||
|
d()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : Remove RegisterStorageCleanup below when PR
|
// TODO : Remove RegisterStorageCleanup below when PR
|
||||||
|
@ -217,7 +217,10 @@ type Store struct {
|
|||||||
// If the StorageVersioner is nil, apiserver will leave the
|
// If the StorageVersioner is nil, apiserver will leave the
|
||||||
// storageVersionHash as empty in the discovery document.
|
// storageVersionHash as empty in the discovery document.
|
||||||
StorageVersioner runtime.GroupVersioner
|
StorageVersioner runtime.GroupVersioner
|
||||||
// Called to cleanup clients used by the underlying Storage; optional.
|
|
||||||
|
// DestroyFunc cleans up clients used by the underlying Storage; optional.
|
||||||
|
// If set, DestroyFunc has to be implemented in thread-safe way and
|
||||||
|
// be prepared for being called more than once.
|
||||||
DestroyFunc func()
|
DestroyFunc func()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,6 +282,13 @@ func (e *Store) New() runtime.Object {
|
|||||||
return e.NewFunc()
|
return e.NewFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up its resources on shutdown.
|
||||||
|
func (e *Store) Destroy() {
|
||||||
|
if e.DestroyFunc != nil {
|
||||||
|
e.DestroyFunc()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NewList implements rest.Lister.
|
// NewList implements rest.Lister.
|
||||||
func (e *Store) NewList() runtime.Object {
|
func (e *Store) NewList() runtime.Object {
|
||||||
return e.NewListFunc()
|
return e.NewListFunc()
|
||||||
@ -1433,11 +1443,14 @@ func (e *Store) CompleteWithOptions(options *generic.StoreOptions) error {
|
|||||||
if opts.CountMetricPollPeriod > 0 {
|
if opts.CountMetricPollPeriod > 0 {
|
||||||
stopFunc := e.startObservingCount(opts.CountMetricPollPeriod, opts.StorageObjectCountTracker)
|
stopFunc := e.startObservingCount(opts.CountMetricPollPeriod, opts.StorageObjectCountTracker)
|
||||||
previousDestroy := e.DestroyFunc
|
previousDestroy := e.DestroyFunc
|
||||||
|
var once sync.Once
|
||||||
e.DestroyFunc = func() {
|
e.DestroyFunc = func() {
|
||||||
stopFunc()
|
once.Do(func() {
|
||||||
if previousDestroy != nil {
|
stopFunc()
|
||||||
previousDestroy()
|
if previousDestroy != nil {
|
||||||
}
|
previousDestroy()
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,11 @@ type Storage interface {
|
|||||||
// New returns an empty object that can be used with Create and Update after request data has been put into it.
|
// New returns an empty object that can be used with Create and Update after request data has been put into it.
|
||||||
// This object must be a pointer type for use with Codec.DecodeInto([]byte, runtime.Object)
|
// This object must be a pointer type for use with Codec.DecodeInto([]byte, runtime.Object)
|
||||||
New() runtime.Object
|
New() runtime.Object
|
||||||
|
|
||||||
|
// Destroy cleans up its resources on shutdown.
|
||||||
|
// Destroy has to be implemented in thread-safe way and be prepared
|
||||||
|
// for being called more than once.
|
||||||
|
Destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scoper indicates what scope the resource is at. It must be specified.
|
// Scoper indicates what scope the resource is at. It must be specified.
|
||||||
@ -278,6 +283,11 @@ type StandardStorage interface {
|
|||||||
GracefulDeleter
|
GracefulDeleter
|
||||||
CollectionDeleter
|
CollectionDeleter
|
||||||
Watcher
|
Watcher
|
||||||
|
|
||||||
|
// Destroy cleans up its resources on shutdown.
|
||||||
|
// Destroy has to be implemented in thread-safe way and be prepared
|
||||||
|
// for being called more than once.
|
||||||
|
Destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirector know how to return a remote resource's location.
|
// Redirector know how to return a remote resource's location.
|
||||||
|
@ -110,6 +110,9 @@ func (r removedInStorage) New() runtime.Object {
|
|||||||
return removedInObj{major: r.major, minor: r.minor}
|
return removedInObj{major: r.major, minor: r.minor}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r removedInStorage) Destroy() {
|
||||||
|
}
|
||||||
|
|
||||||
type neverRemovedObj struct {
|
type neverRemovedObj struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +89,14 @@ type APIGroupInfo struct {
|
|||||||
StaticOpenAPISpec *spec.Swagger
|
StaticOpenAPISpec *spec.Swagger
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *APIGroupInfo) destroyStorage() {
|
||||||
|
for _, stores := range a.VersionedResourcesStorageMap {
|
||||||
|
for _, store := range stores {
|
||||||
|
store.Destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// GenericAPIServer contains state for a Kubernetes cluster api server.
|
// GenericAPIServer contains state for a Kubernetes cluster api server.
|
||||||
type GenericAPIServer struct {
|
type GenericAPIServer struct {
|
||||||
// discoveryAddresses is used to build cluster IPs for discovery.
|
// discoveryAddresses is used to build cluster IPs for discovery.
|
||||||
@ -222,6 +230,9 @@ type GenericAPIServer struct {
|
|||||||
// lifecycleSignals provides access to the various signals that happen during the life cycle of the apiserver.
|
// lifecycleSignals provides access to the various signals that happen during the life cycle of the apiserver.
|
||||||
lifecycleSignals lifecycleSignals
|
lifecycleSignals lifecycleSignals
|
||||||
|
|
||||||
|
// destroyFns contains a list of functions that should be called on shutdown to clean up resources.
|
||||||
|
destroyFns []func()
|
||||||
|
|
||||||
// muxAndDiscoveryCompleteSignals holds signals that indicate all known HTTP paths have been registered.
|
// muxAndDiscoveryCompleteSignals holds signals that indicate all known HTTP paths have been registered.
|
||||||
// it exists primarily to avoid returning a 404 response when a resource actually exists but we haven't installed the path to a handler.
|
// it exists primarily to avoid returning a 404 response when a resource actually exists but we haven't installed the path to a handler.
|
||||||
// it is exposed for easier composition of the individual servers.
|
// it is exposed for easier composition of the individual servers.
|
||||||
@ -264,6 +275,11 @@ type DelegationTarget interface {
|
|||||||
|
|
||||||
// MuxAndDiscoveryCompleteSignals exposes registered signals that indicate if all known HTTP paths have been installed.
|
// MuxAndDiscoveryCompleteSignals exposes registered signals that indicate if all known HTTP paths have been installed.
|
||||||
MuxAndDiscoveryCompleteSignals() map[string]<-chan struct{}
|
MuxAndDiscoveryCompleteSignals() map[string]<-chan struct{}
|
||||||
|
|
||||||
|
// Destroy cleans up its resources on shutdown.
|
||||||
|
// Destroy has to be implemented in thread-safe way and be prepared
|
||||||
|
// for being called more than once.
|
||||||
|
Destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GenericAPIServer) UnprotectedHandler() http.Handler {
|
func (s *GenericAPIServer) UnprotectedHandler() http.Handler {
|
||||||
@ -301,6 +317,18 @@ func (s *GenericAPIServer) MuxAndDiscoveryCompleteSignals() map[string]<-chan st
|
|||||||
return s.muxAndDiscoveryCompleteSignals
|
return s.muxAndDiscoveryCompleteSignals
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up all its and its delegation target resources on shutdown.
|
||||||
|
// It starts with destroying its own resources and later proceeds with
|
||||||
|
// its delegation target.
|
||||||
|
func (s *GenericAPIServer) Destroy() {
|
||||||
|
for _, destroyFn := range s.destroyFns {
|
||||||
|
destroyFn()
|
||||||
|
}
|
||||||
|
if s.delegationTarget != nil {
|
||||||
|
s.delegationTarget.Destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type emptyDelegate struct {
|
type emptyDelegate struct {
|
||||||
// handler is called at the end of the delegation chain
|
// handler is called at the end of the delegation chain
|
||||||
// when a request has been made against an unregistered HTTP path the individual servers will simply pass it through until it reaches the handler.
|
// when a request has been made against an unregistered HTTP path the individual servers will simply pass it through until it reaches the handler.
|
||||||
@ -340,6 +368,8 @@ func (s emptyDelegate) PrepareRun() preparedGenericAPIServer {
|
|||||||
func (s emptyDelegate) MuxAndDiscoveryCompleteSignals() map[string]<-chan struct{} {
|
func (s emptyDelegate) MuxAndDiscoveryCompleteSignals() map[string]<-chan struct{} {
|
||||||
return map[string]<-chan struct{}{}
|
return map[string]<-chan struct{}{}
|
||||||
}
|
}
|
||||||
|
func (s emptyDelegate) Destroy() {
|
||||||
|
}
|
||||||
|
|
||||||
// preparedGenericAPIServer is a private wrapper that enforces a call of PrepareRun() before Run can be invoked.
|
// preparedGenericAPIServer is a private wrapper that enforces a call of PrepareRun() before Run can be invoked.
|
||||||
type preparedGenericAPIServer struct {
|
type preparedGenericAPIServer struct {
|
||||||
@ -395,6 +425,9 @@ func (s preparedGenericAPIServer) Run(stopCh <-chan struct{}) error {
|
|||||||
delayedStopCh := s.lifecycleSignals.AfterShutdownDelayDuration
|
delayedStopCh := s.lifecycleSignals.AfterShutdownDelayDuration
|
||||||
shutdownInitiatedCh := s.lifecycleSignals.ShutdownInitiated
|
shutdownInitiatedCh := s.lifecycleSignals.ShutdownInitiated
|
||||||
|
|
||||||
|
// Clean up resources on shutdown.
|
||||||
|
defer s.Destroy()
|
||||||
|
|
||||||
// spawn a new goroutine for closing the MuxAndDiscoveryComplete signal
|
// spawn a new goroutine for closing the MuxAndDiscoveryComplete signal
|
||||||
// registration happens during construction of the generic api server
|
// registration happens during construction of the generic api server
|
||||||
// the last server in the chain aggregates signals from the previous instances
|
// the last server in the chain aggregates signals from the previous instances
|
||||||
@ -584,6 +617,8 @@ func (s *GenericAPIServer) installAPIResources(apiPrefix string, apiGroupInfo *A
|
|||||||
resourceInfos = append(resourceInfos, r...)
|
resourceInfos = append(resourceInfos, r...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.destroyFns = append(s.destroyFns, apiGroupInfo.destroyStorage)
|
||||||
|
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.StorageVersionAPI) &&
|
if utilfeature.DefaultFeatureGate.Enabled(features.StorageVersionAPI) &&
|
||||||
utilfeature.DefaultFeatureGate.Enabled(features.APIServerIdentity) {
|
utilfeature.DefaultFeatureGate.Enabled(features.APIServerIdentity) {
|
||||||
// API installation happens before we start listening on the handlers,
|
// API installation happens before we start listening on the handlers,
|
||||||
@ -595,6 +630,9 @@ func (s *GenericAPIServer) installAPIResources(apiPrefix string, apiGroupInfo *A
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InstallLegacyAPIGroup exposes the given legacy api group in the API.
|
||||||
|
// The <apiGroupInfo> passed into this function shouldn't be used elsewhere as the
|
||||||
|
// underlying storage will be destroyed on this servers shutdown.
|
||||||
func (s *GenericAPIServer) InstallLegacyAPIGroup(apiPrefix string, apiGroupInfo *APIGroupInfo) error {
|
func (s *GenericAPIServer) InstallLegacyAPIGroup(apiPrefix string, apiGroupInfo *APIGroupInfo) error {
|
||||||
if !s.legacyAPIGroupPrefixes.Has(apiPrefix) {
|
if !s.legacyAPIGroupPrefixes.Has(apiPrefix) {
|
||||||
return fmt.Errorf("%q is not in the allowed legacy API prefixes: %v", apiPrefix, s.legacyAPIGroupPrefixes.List())
|
return fmt.Errorf("%q is not in the allowed legacy API prefixes: %v", apiPrefix, s.legacyAPIGroupPrefixes.List())
|
||||||
@ -616,7 +654,9 @@ func (s *GenericAPIServer) InstallLegacyAPIGroup(apiPrefix string, apiGroupInfo
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exposes given api groups in the API.
|
// InstallAPIGroups exposes given api groups in the API.
|
||||||
|
// The <apiGroupInfos> passed into this function shouldn't be used elsewhere as the
|
||||||
|
// underlying storage will be destroyed on this servers shutdown.
|
||||||
func (s *GenericAPIServer) InstallAPIGroups(apiGroupInfos ...*APIGroupInfo) error {
|
func (s *GenericAPIServer) InstallAPIGroups(apiGroupInfos ...*APIGroupInfo) error {
|
||||||
for _, apiGroupInfo := range apiGroupInfos {
|
for _, apiGroupInfo := range apiGroupInfos {
|
||||||
// Do not register empty group or empty version. Doing so claims /apis/ for the wrong entity to be returned.
|
// Do not register empty group or empty version. Doing so claims /apis/ for the wrong entity to be returned.
|
||||||
@ -669,7 +709,9 @@ func (s *GenericAPIServer) InstallAPIGroups(apiGroupInfos ...*APIGroupInfo) erro
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exposes the given api group in the API.
|
// InstallAPIGroup exposes the given api group in the API.
|
||||||
|
// The <apiGroupInfo> passed into this function shouldn't be used elsewhere as the
|
||||||
|
// underlying storage will be destroyed on this servers shutdown.
|
||||||
func (s *GenericAPIServer) InstallAPIGroup(apiGroupInfo *APIGroupInfo) error {
|
func (s *GenericAPIServer) InstallAPIGroup(apiGroupInfo *APIGroupInfo) error {
|
||||||
return s.InstallAPIGroups(apiGroupInfo)
|
return s.InstallAPIGroups(apiGroupInfo)
|
||||||
}
|
}
|
||||||
|
@ -544,6 +544,9 @@ func (p *testGetterStorage) New() runtime.Object {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *testGetterStorage) Destroy() {
|
||||||
|
}
|
||||||
|
|
||||||
func (p *testGetterStorage) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (p *testGetterStorage) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@ -565,6 +568,9 @@ func (p *testNoVerbsStorage) New() runtime.Object {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *testNoVerbsStorage) Destroy() {
|
||||||
|
}
|
||||||
|
|
||||||
func fakeVersion() version.Info {
|
func fakeVersion() version.Info {
|
||||||
return version.Info{
|
return version.Info{
|
||||||
Major: "42",
|
Major: "42",
|
||||||
|
@ -147,6 +147,12 @@ func (r *StatusREST) New() runtime.Object {
|
|||||||
return &apiregistration.APIService{}
|
return &apiregistration.APIService{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy cleans up resources on shutdown.
|
||||||
|
func (r *StatusREST) Destroy() {
|
||||||
|
// Given that underlying store is shared with REST,
|
||||||
|
// we don't destroy it here explicitly.
|
||||||
|
}
|
||||||
|
|
||||||
// Get retrieves the object from the storage. It is required to support Patch.
|
// Get retrieves the object from the storage. It is required to support Patch.
|
||||||
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||||
return r.store.Get(ctx, name, options)
|
return r.store.Get(ctx, name, options)
|
||||||
|
@ -20,7 +20,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
genericregistry "k8s.io/apiserver/pkg/registry/generic/registry"
|
genericregistry "k8s.io/apiserver/pkg/registry/generic/registry"
|
||||||
"k8s.io/apiserver/pkg/registry/rest"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// REST implements a RESTStorage for API services against etcd
|
// REST implements a RESTStorage for API services against etcd
|
||||||
@ -31,7 +30,7 @@ type REST struct {
|
|||||||
// RESTInPeace is just a simple function that panics on error.
|
// RESTInPeace is just a simple function that panics on error.
|
||||||
// Otherwise returns the given storage object. It is meant to be
|
// Otherwise returns the given storage object. It is meant to be
|
||||||
// a wrapper for wardle registries.
|
// a wrapper for wardle registries.
|
||||||
func RESTInPeace(storage rest.StandardStorage, err error) rest.StandardStorage {
|
func RESTInPeace(storage *REST, err error) *REST {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("unable to create REST storage for a resource due to %v, will die", err)
|
err = fmt.Errorf("unable to create REST storage for a resource due to %v, will die", err)
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -104,22 +105,28 @@ func TestPriorityLevelIsolation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stopCh := make(chan struct{})
|
stopCh := make(chan struct{})
|
||||||
defer close(stopCh)
|
wg := sync.WaitGroup{}
|
||||||
|
defer func() {
|
||||||
|
close(stopCh)
|
||||||
|
wg.Wait()
|
||||||
|
}()
|
||||||
|
|
||||||
// "elephant"
|
// "elephant"
|
||||||
|
wg.Add(concurrencyShares + queueLength)
|
||||||
streamRequests(concurrencyShares+queueLength, func() {
|
streamRequests(concurrencyShares+queueLength, func() {
|
||||||
_, err := noxu1Client.CoreV1().Namespaces().List(context.Background(), metav1.ListOptions{})
|
_, err := noxu1Client.CoreV1().Namespaces().List(context.Background(), metav1.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
}, stopCh)
|
}, &wg, stopCh)
|
||||||
// "mouse"
|
// "mouse"
|
||||||
|
wg.Add(3)
|
||||||
streamRequests(3, func() {
|
streamRequests(3, func() {
|
||||||
_, err := noxu2Client.CoreV1().Namespaces().List(context.Background(), metav1.ListOptions{})
|
_, err := noxu2Client.CoreV1().Namespaces().List(context.Background(), metav1.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
}, stopCh)
|
}, &wg, stopCh)
|
||||||
|
|
||||||
time.Sleep(time.Second * 10) // running in background for a while
|
time.Sleep(time.Second * 10) // running in background for a while
|
||||||
|
|
||||||
@ -312,9 +319,10 @@ func createPriorityLevelAndBindingFlowSchemaForUser(c clientset.Interface, usern
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func streamRequests(parallel int, request func(), stopCh <-chan struct{}) {
|
func streamRequests(parallel int, request func(), wg *sync.WaitGroup, stopCh <-chan struct{}) {
|
||||||
for i := 0; i < parallel; i++ {
|
for i := 0; i < parallel; i++ {
|
||||||
go func() {
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-stopCh:
|
case <-stopCh:
|
||||||
|
@ -136,7 +136,7 @@ func StartRealAPIServerOrDie(t *testing.T, configFuncs ...func(*options.ServerRu
|
|||||||
|
|
||||||
stopCh := make(chan struct{})
|
stopCh := make(chan struct{})
|
||||||
|
|
||||||
kubeAPIServer, err := app.CreateServerChain(completedOptions, stopCh)
|
kubeAPIServer, err := app.CreateServerChain(completedOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -186,6 +186,7 @@ func startAPIServerOrDie(controlPlaneConfig *controlplane.Config, incomingServer
|
|||||||
m.GenericAPIServer.RunPreShutdownHooks()
|
m.GenericAPIServer.RunPreShutdownHooks()
|
||||||
}
|
}
|
||||||
close(stopCh)
|
close(stopCh)
|
||||||
|
m.GenericAPIServer.Destroy()
|
||||||
s.Close()
|
s.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user