Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
6946cce0
Commit
6946cce0
authored
Sep 14, 2016
by
Kubernetes Submit Queue
Committed by
GitHub
Sep 14, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #32533 from smarterclayton/rest_options_gc
Automatic merge from submit-queue EnableGarbageCollection should be part of generic.RESTOptions
parents
dab16bf8
716bac3b
Hide whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
68 additions
and
42 deletions
+68
-42
options.go
cmd/kube-apiserver/app/options/options.go
+0
-5
etcd.go
federation/registry/cluster/etcd/etcd.go
+1
-0
config.go
pkg/genericapiserver/config.go
+9
-7
server_run_options.go
pkg/genericapiserver/options/server_run_options.go
+6
-0
master.go
pkg/master/master.go
+1
-0
etcd.go
pkg/registry/certificates/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/clusterrole/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/clusterrolebinding/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/configmap/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/controller/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/daemonset/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/deployment/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/endpoint/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/event/etcd/etcd.go
+3
-1
options.go
pkg/registry/generic/options.go
+5
-4
store.go
pkg/registry/generic/registry/store.go
+6
-6
store_test.go
pkg/registry/generic/registry/store_test.go
+3
-6
etcd.go
pkg/registry/horizontalpodautoscaler/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/ingress/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/job/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/limitrange/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/namespace/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/networkpolicy/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/node/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/persistentvolume/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/persistentvolumeclaim/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/petset/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/pod/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/poddisruptionbudget/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/podsecuritypolicy/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/podtemplate/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/replicaset/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/resourcequota/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/role/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/rolebinding/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/scheduledjob/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/secret/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/service/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/serviceaccount/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/storageclass/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/thirdpartyresource/etcd/etcd.go
+1
-0
etcd.go
pkg/registry/thirdpartyresourcedata/etcd/etcd.go
+1
-0
garbage_collector_test.go
test/integration/garbagecollector/garbage_collector_test.go
+1
-13
No files found.
cmd/kube-apiserver/app/options/options.go
View file @
6946cce0
...
...
@@ -24,7 +24,6 @@ import (
genericoptions
"k8s.io/kubernetes/pkg/genericapiserver/options"
kubeletclient
"k8s.io/kubernetes/pkg/kubelet/client"
"k8s.io/kubernetes/pkg/master/ports"
"k8s.io/kubernetes/pkg/registry/generic/registry"
"github.com/spf13/pflag"
)
...
...
@@ -123,8 +122,4 @@ func (s *APIServer) AddFlags(fs *pflag.FlagSet) {
"If true, server will do its best to fix the update request to pass the validation, "
+
"e.g., setting empty UID in update request to its existing value. This flag can be turned off "
+
"after we fix all the clients that send malformed updates."
)
fs
.
BoolVar
(
&
registry
.
EnableGarbageCollector
,
"enable-garbage-collector"
,
true
,
""
+
"Enables the generic garbage collector. MUST be synced with the corresponding flag "
+
"of the kube-controller-manager."
)
}
federation/registry/cluster/etcd/etcd.go
View file @
6946cce0
...
...
@@ -73,6 +73,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
},
PredicateFunc
:
cluster
.
MatchCluster
,
QualifiedResource
:
federation
.
Resource
(
"clusters"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
cluster
.
Strategy
,
...
...
pkg/genericapiserver/config.go
View file @
6946cce0
...
...
@@ -72,13 +72,14 @@ type Config struct {
// Allows api group versions or specific resources to be conditionally enabled/disabled.
APIResourceConfigSource
APIResourceConfigSource
// allow downstream consumers to disable the index route
EnableIndex
bool
EnableProfiling
bool
EnableWatchCache
bool
APIPrefix
string
APIGroupPrefix
string
CorsAllowedOriginList
[]
string
Authenticator
authenticator
.
Request
EnableIndex
bool
EnableProfiling
bool
EnableWatchCache
bool
EnableGarbageCollection
bool
APIPrefix
string
APIGroupPrefix
string
CorsAllowedOriginList
[]
string
Authenticator
authenticator
.
Request
// TODO(roberthbailey): Remove once the server no longer supports http basic auth.
SupportsBasicAuth
bool
Authorizer
authorizer
.
Authorizer
...
...
@@ -169,6 +170,7 @@ func NewConfig(options *options.ServerRunOptions) *Config {
AuditLogMaxAge
:
options
.
AuditLogMaxAge
,
AuditLogMaxBackups
:
options
.
AuditLogMaxBackups
,
AuditLogMaxSize
:
options
.
AuditLogMaxSize
,
EnableGarbageCollection
:
options
.
EnableGarbageCollection
,
EnableIndex
:
true
,
EnableLogsSupport
:
options
.
EnableLogsSupport
,
EnableProfiling
:
options
.
EnableProfiling
,
...
...
pkg/genericapiserver/options/server_run_options.go
View file @
6946cce0
...
...
@@ -83,6 +83,7 @@ type ServerRunOptions struct {
AuditLogMaxAge
int
AuditLogMaxBackups
int
AuditLogMaxSize
int
EnableGarbageCollection
bool
EnableLogsSupport
bool
EnableProfiling
bool
EnableSwaggerUI
bool
...
...
@@ -133,6 +134,7 @@ func NewServerRunOptions() *ServerRunOptions {
DefaultStorageMediaType
:
"application/json"
,
DefaultStorageVersions
:
registered
.
AllPreferredGroupVersions
(),
DeleteCollectionWorkers
:
1
,
EnableGarbageCollection
:
true
,
EnableLogsSupport
:
true
,
EnableProfiling
:
true
,
EnableWatchCache
:
true
,
...
...
@@ -306,6 +308,10 @@ func (s *ServerRunOptions) AddUniversalFlags(fs *pflag.FlagSet) {
fs
.
IntVar
(
&
s
.
AuditLogMaxSize
,
"audit-log-maxsize"
,
s
.
AuditLogMaxSize
,
"The maximum size in megabytes of the audit log file before it gets rotated. Defaults to 100MB."
)
fs
.
BoolVar
(
&
s
.
EnableGarbageCollection
,
"enable-garbage-collector"
,
s
.
EnableGarbageCollection
,
""
+
"Enables the generic garbage collector. MUST be synced with the corresponding flag "
+
"of the kube-controller-manager."
)
fs
.
BoolVar
(
&
s
.
EnableProfiling
,
"profiling"
,
s
.
EnableProfiling
,
"Enable profiling via web interface host:port/debug/pprof/"
)
...
...
pkg/master/master.go
View file @
6946cce0
...
...
@@ -781,6 +781,7 @@ func (m *Master) GetRESTOptionsOrDie(c *Config, resource unversioned.GroupResour
StorageConfig
:
storageConfig
,
Decorator
:
m
.
StorageDecorator
(),
DeleteCollectionWorkers
:
m
.
deleteCollectionWorkers
,
EnableGarbageCollection
:
c
.
Config
.
EnableGarbageCollection
,
ResourcePrefix
:
c
.
StorageFactory
.
ResourcePrefix
(
resource
),
}
}
...
...
pkg/registry/certificates/etcd/etcd.go
View file @
6946cce0
...
...
@@ -66,6 +66,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *ApprovalREST) {
return
csrregistry
.
Matcher
(
label
,
field
)
},
QualifiedResource
:
certificates
.
Resource
(
"certificatesigningrequests"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
csrregistry
.
Strategy
,
...
...
pkg/registry/clusterrole/etcd/etcd.go
View file @
6946cce0
...
...
@@ -61,6 +61,7 @@ func NewREST(opts generic.RESTOptions) *REST {
},
PredicateFunc
:
clusterrole
.
Matcher
,
QualifiedResource
:
rbac
.
Resource
(
"clusterroles"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
clusterrole
.
Strategy
,
...
...
pkg/registry/clusterrolebinding/etcd/etcd.go
View file @
6946cce0
...
...
@@ -61,6 +61,7 @@ func NewREST(opts generic.RESTOptions) *REST {
},
PredicateFunc
:
clusterrolebinding
.
Matcher
,
QualifiedResource
:
rbac
.
Resource
(
"clusterrolebindings"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
clusterrolebinding
.
Strategy
,
...
...
pkg/registry/configmap/etcd/etcd.go
View file @
6946cce0
...
...
@@ -75,6 +75,7 @@ func NewREST(opts generic.RESTOptions) *REST {
QualifiedResource
:
api
.
Resource
(
"configmaps"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
configmap
.
Strategy
,
...
...
pkg/registry/controller/etcd/etcd.go
View file @
6946cce0
...
...
@@ -95,6 +95,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
PredicateFunc
:
controller
.
MatchController
,
QualifiedResource
:
api
.
Resource
(
"replicationcontrollers"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
// Used to validate controller creation
...
...
pkg/registry/daemonset/etcd/etcd.go
View file @
6946cce0
...
...
@@ -70,6 +70,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
// Used to match objects based on labels/fields for list and watch
PredicateFunc
:
daemonset
.
MatchDaemonSet
,
QualifiedResource
:
extensions
.
Resource
(
"daemonsets"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
// Used to validate daemon set creation
...
...
pkg/registry/deployment/etcd/etcd.go
View file @
6946cce0
...
...
@@ -93,6 +93,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *RollbackREST) {
// Used to match objects based on labels/fields for list.
PredicateFunc
:
deployment
.
MatchDeployment
,
QualifiedResource
:
extensions
.
Resource
(
"deployments"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
// Used to validate deployment creation.
...
...
pkg/registry/endpoint/etcd/etcd.go
View file @
6946cce0
...
...
@@ -59,6 +59,7 @@ func NewREST(opts generic.RESTOptions) *REST {
},
PredicateFunc
:
endpoint
.
MatchEndpoints
,
QualifiedResource
:
api
.
Resource
(
"endpoints"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
endpoint
.
Strategy
,
...
...
pkg/registry/event/etcd/etcd.go
View file @
6946cce0
...
...
@@ -52,7 +52,9 @@ func NewREST(opts generic.RESTOptions, ttl uint64) *REST {
TTLFunc
:
func
(
runtime
.
Object
,
uint64
,
bool
)
(
uint64
,
error
)
{
return
ttl
,
nil
},
QualifiedResource
:
api
.
Resource
(
"events"
),
QualifiedResource
:
api
.
Resource
(
"events"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
event
.
Strategy
,
...
...
pkg/registry/generic/options.go
View file @
6946cce0
...
...
@@ -20,9 +20,10 @@ import "k8s.io/kubernetes/pkg/storage/storagebackend"
// RESTOptions is set of configuration options to generic registries.
type
RESTOptions
struct
{
StorageConfig
*
storagebackend
.
Config
Decorator
StorageDecorator
DeleteCollectionWorkers
int
StorageConfig
*
storagebackend
.
Config
Decorator
StorageDecorator
ResourcePrefix
string
EnableGarbageCollection
bool
DeleteCollectionWorkers
int
ResourcePrefix
string
}
pkg/registry/generic/registry/store.go
View file @
6946cce0
...
...
@@ -42,10 +42,6 @@ import (
"github.com/golang/glog"
)
// EnableGarbageCollector affects the handling of Update and Delete requests. It
// must be synced with the corresponding flag in kube-controller-manager.
var
EnableGarbageCollector
bool
// Store implements generic.Registry.
// It's intended to be embeddable, so that you can implement any
// non-generic functions if needed.
...
...
@@ -93,6 +89,10 @@ type Store struct {
// Called to cleanup storage clients.
DestroyFunc
func
()
// EnableGarbageCollection affects the handling of Update and Delete requests. It
// must be synced with the corresponding flag in kube-controller-manager.
EnableGarbageCollection
bool
// DeleteCollectionWorkers is the maximum number of workers in a single
// DeleteCollection call.
DeleteCollectionWorkers
int
...
...
@@ -272,7 +272,7 @@ func (e *Store) Create(ctx api.Context, obj runtime.Object) (runtime.Object, err
// it further checks if the object's DeletionGracePeriodSeconds is 0. If so, it
// returns true.
func
(
e
*
Store
)
shouldDelete
(
ctx
api
.
Context
,
key
string
,
obj
,
existing
runtime
.
Object
)
bool
{
if
!
EnableGarbageCollector
{
if
!
e
.
EnableGarbageCollection
{
return
false
}
newMeta
,
err
:=
api
.
ObjectMetaFor
(
obj
)
...
...
@@ -694,7 +694,7 @@ func (e *Store) Delete(ctx api.Context, name string, options *api.DeleteOptions)
var
ignoreNotFound
bool
var
deleteImmediately
bool
=
true
var
lastExisting
,
out
runtime
.
Object
if
!
EnableGarbageCollector
{
if
!
e
.
EnableGarbageCollection
{
// TODO: remove the check on graceful, because we support no-op updates now.
if
graceful
{
err
,
ignoreNotFound
,
deleteImmediately
,
out
,
lastExisting
=
e
.
updateForGracefulDeletion
(
ctx
,
name
,
key
,
options
,
preconditions
,
obj
)
...
...
pkg/registry/generic/registry/store_test.go
View file @
6946cce0
...
...
@@ -618,9 +618,7 @@ func TestStoreDelete(t *testing.T) {
}
func
TestGracefulStoreHandleFinalizers
(
t
*
testing
.
T
)
{
EnableGarbageCollector
=
true
initialGeneration
:=
int64
(
1
)
defer
func
()
{
EnableGarbageCollector
=
false
}()
podWithFinalizer
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Finalizers
:
[]
string
{
"foo.com/x"
},
Generation
:
initialGeneration
},
Spec
:
api
.
PodSpec
{
NodeName
:
"machine"
},
...
...
@@ -628,6 +626,7 @@ func TestGracefulStoreHandleFinalizers(t *testing.T) {
testContext
:=
api
.
WithNamespace
(
api
.
NewContext
(),
"test"
)
destroyFunc
,
registry
:=
NewTestGenericStoreRegistry
(
t
)
registry
.
EnableGarbageCollection
=
true
defaultDeleteStrategy
:=
testRESTStrategy
{
api
.
Scheme
,
api
.
SimpleNameGenerator
,
true
,
false
,
true
}
registry
.
DeleteStrategy
=
testGracefulStrategy
{
defaultDeleteStrategy
}
defer
destroyFunc
()
...
...
@@ -678,9 +677,7 @@ func TestGracefulStoreHandleFinalizers(t *testing.T) {
}
func
TestNonGracefulStoreHandleFinalizers
(
t
*
testing
.
T
)
{
EnableGarbageCollector
=
true
initialGeneration
:=
int64
(
1
)
defer
func
()
{
EnableGarbageCollector
=
false
}()
podWithFinalizer
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Finalizers
:
[]
string
{
"foo.com/x"
},
Generation
:
initialGeneration
},
Spec
:
api
.
PodSpec
{
NodeName
:
"machine"
},
...
...
@@ -688,6 +685,7 @@ func TestNonGracefulStoreHandleFinalizers(t *testing.T) {
testContext
:=
api
.
WithNamespace
(
api
.
NewContext
(),
"test"
)
destroyFunc
,
registry
:=
NewTestGenericStoreRegistry
(
t
)
registry
.
EnableGarbageCollection
=
true
defer
destroyFunc
()
// create pod
_
,
err
:=
registry
.
Create
(
testContext
,
podWithFinalizer
)
...
...
@@ -755,9 +753,7 @@ func TestNonGracefulStoreHandleFinalizers(t *testing.T) {
}
func
TestStoreDeleteWithOrphanDependents
(
t
*
testing
.
T
)
{
EnableGarbageCollector
=
true
initialGeneration
:=
int64
(
1
)
defer
func
()
{
EnableGarbageCollector
=
false
}()
podWithOrphanFinalizer
:=
func
(
name
string
)
*
api
.
Pod
{
return
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
name
,
Finalizers
:
[]
string
{
"foo.com/x"
,
api
.
FinalizerOrphan
,
"bar.com/y"
},
Generation
:
initialGeneration
},
...
...
@@ -984,6 +980,7 @@ func TestStoreDeleteWithOrphanDependents(t *testing.T) {
testContext
:=
api
.
WithNamespace
(
api
.
NewContext
(),
"test"
)
destroyFunc
,
registry
:=
NewTestGenericStoreRegistry
(
t
)
registry
.
EnableGarbageCollection
=
true
defer
destroyFunc
()
for
_
,
tc
:=
range
testcases
{
...
...
pkg/registry/horizontalpodautoscaler/etcd/etcd.go
View file @
6946cce0
...
...
@@ -68,6 +68,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
// Used to match objects based on labels/fields for list
PredicateFunc
:
horizontalpodautoscaler
.
MatchAutoscaler
,
QualifiedResource
:
autoscaling
.
Resource
(
"horizontalpodautoscalers"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
// Used to validate autoscaler creation
...
...
pkg/registry/ingress/etcd/etcd.go
View file @
6946cce0
...
...
@@ -70,6 +70,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
// Used to match objects based on labels/fields for list and watch
PredicateFunc
:
ingress
.
MatchIngress
,
QualifiedResource
:
extensions
.
Resource
(
"ingresses"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
// Used to validate controller creation
...
...
pkg/registry/job/etcd/etcd.go
View file @
6946cce0
...
...
@@ -70,6 +70,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
// Used to match objects based on labels/fields for list and watch
PredicateFunc
:
job
.
MatchJob
,
QualifiedResource
:
batch
.
Resource
(
"jobs"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
// Used to validate job creation
...
...
pkg/registry/limitrange/etcd/etcd.go
View file @
6946cce0
...
...
@@ -59,6 +59,7 @@ func NewREST(opts generic.RESTOptions) *REST {
},
PredicateFunc
:
limitrange
.
MatchLimitRange
,
QualifiedResource
:
api
.
Resource
(
"limitranges"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
limitrange
.
Strategy
,
...
...
pkg/registry/namespace/etcd/etcd.go
View file @
6946cce0
...
...
@@ -77,6 +77,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *FinalizeREST) {
},
PredicateFunc
:
namespace
.
MatchNamespace
,
QualifiedResource
:
api
.
Resource
(
"namespaces"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
namespace
.
Strategy
,
...
...
pkg/registry/networkpolicy/etcd/etcd.go
View file @
6946cce0
...
...
@@ -69,6 +69,7 @@ func NewREST(opts generic.RESTOptions) *REST {
// Used to match objects based on labels/fields for list and watch
PredicateFunc
:
networkpolicy
.
MatchNetworkPolicy
,
QualifiedResource
:
extensionsapi
.
Resource
(
"networkpolicies"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
// Used to validate controller creation
...
...
pkg/registry/node/etcd/etcd.go
View file @
6946cce0
...
...
@@ -92,6 +92,7 @@ func NewStorage(opts generic.RESTOptions, connection client.ConnectionInfoGetter
},
PredicateFunc
:
node
.
MatchNode
,
QualifiedResource
:
api
.
Resource
(
"nodes"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
node
.
Strategy
,
...
...
pkg/registry/persistentvolume/etcd/etcd.go
View file @
6946cce0
...
...
@@ -60,6 +60,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
},
PredicateFunc
:
persistentvolume
.
MatchPersistentVolumes
,
QualifiedResource
:
api
.
Resource
(
"persistentvolumes"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
persistentvolume
.
Strategy
,
...
...
pkg/registry/persistentvolumeclaim/etcd/etcd.go
View file @
6946cce0
...
...
@@ -60,6 +60,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
},
PredicateFunc
:
persistentvolumeclaim
.
MatchPersistentVolumeClaim
,
QualifiedResource
:
api
.
Resource
(
"persistentvolumeclaims"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
persistentvolumeclaim
.
Strategy
,
...
...
pkg/registry/petset/etcd/etcd.go
View file @
6946cce0
...
...
@@ -70,6 +70,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
// Used to match objects based on labels/fields for list and watch
PredicateFunc
:
petset
.
MatchPetSet
,
QualifiedResource
:
appsapi
.
Resource
(
"petsets"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
// Used to validate controller creation
...
...
pkg/registry/pod/etcd/etcd.go
View file @
6946cce0
...
...
@@ -87,6 +87,7 @@ func NewStorage(opts generic.RESTOptions, k client.ConnectionInfoGetter, proxyTr
},
PredicateFunc
:
pod
.
MatchPod
,
QualifiedResource
:
api
.
Resource
(
"pods"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
pod
.
Strategy
,
...
...
pkg/registry/poddisruptionbudget/etcd/etcd.go
View file @
6946cce0
...
...
@@ -70,6 +70,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
// Used to match objects based on labels/fields for list and watch
PredicateFunc
:
poddisruptionbudget
.
MatchPodDisruptionBudget
,
QualifiedResource
:
policyapi
.
Resource
(
"poddisruptionbudgets"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
// Used to validate controller creation
...
...
pkg/registry/podsecuritypolicy/etcd/etcd.go
View file @
6946cce0
...
...
@@ -61,6 +61,7 @@ func NewREST(opts generic.RESTOptions) *REST {
},
PredicateFunc
:
podsecuritypolicy
.
MatchPodSecurityPolicy
,
QualifiedResource
:
extensions
.
Resource
(
"podsecuritypolicies"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
podsecuritypolicy
.
Strategy
,
...
...
pkg/registry/podtemplate/etcd/etcd.go
View file @
6946cce0
...
...
@@ -59,6 +59,7 @@ func NewREST(opts generic.RESTOptions) *REST {
},
PredicateFunc
:
podtemplate
.
MatchPodTemplate
,
QualifiedResource
:
api
.
Resource
(
"podtemplates"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
podtemplate
.
Strategy
,
...
...
pkg/registry/replicaset/etcd/etcd.go
View file @
6946cce0
...
...
@@ -93,6 +93,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
// Used to match objects based on labels/fields for list and watch
PredicateFunc
:
replicaset
.
MatchReplicaSet
,
QualifiedResource
:
api
.
Resource
(
"replicasets"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
// Used to validate ReplicaSet creation
...
...
pkg/registry/resourcequota/etcd/etcd.go
View file @
6946cce0
...
...
@@ -60,6 +60,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
},
PredicateFunc
:
resourcequota
.
MatchResourceQuota
,
QualifiedResource
:
api
.
Resource
(
"resourcequotas"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
resourcequota
.
Strategy
,
...
...
pkg/registry/role/etcd/etcd.go
View file @
6946cce0
...
...
@@ -61,6 +61,7 @@ func NewREST(opts generic.RESTOptions) *REST {
},
PredicateFunc
:
role
.
Matcher
,
QualifiedResource
:
rbac
.
Resource
(
"roles"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
role
.
Strategy
,
...
...
pkg/registry/rolebinding/etcd/etcd.go
View file @
6946cce0
...
...
@@ -61,6 +61,7 @@ func NewREST(opts generic.RESTOptions) *REST {
},
PredicateFunc
:
rolebinding
.
Matcher
,
QualifiedResource
:
rbac
.
Resource
(
"rolebindings"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
rolebinding
.
Strategy
,
...
...
pkg/registry/scheduledjob/etcd/etcd.go
View file @
6946cce0
...
...
@@ -70,6 +70,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
// Used to match objects based on labels/fields for list and watch
PredicateFunc
:
scheduledjob
.
MatchScheduledJob
,
QualifiedResource
:
batch
.
Resource
(
"scheduledjobs"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
// Used to validate scheduled job creation
...
...
pkg/registry/secret/etcd/etcd.go
View file @
6946cce0
...
...
@@ -59,6 +59,7 @@ func NewREST(opts generic.RESTOptions) *REST {
},
PredicateFunc
:
secret
.
Matcher
,
QualifiedResource
:
api
.
Resource
(
"secrets"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
secret
.
Strategy
,
...
...
pkg/registry/service/etcd/etcd.go
View file @
6946cce0
...
...
@@ -60,6 +60,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
},
PredicateFunc
:
service
.
MatchServices
,
QualifiedResource
:
api
.
Resource
(
"services"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
service
.
Strategy
,
...
...
pkg/registry/serviceaccount/etcd/etcd.go
View file @
6946cce0
...
...
@@ -59,6 +59,7 @@ func NewREST(opts generic.RESTOptions) *REST {
},
PredicateFunc
:
serviceaccount
.
Matcher
,
QualifiedResource
:
api
.
Resource
(
"serviceaccounts"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
serviceaccount
.
Strategy
,
...
...
pkg/registry/storageclass/etcd/etcd.go
View file @
6946cce0
...
...
@@ -60,6 +60,7 @@ func NewREST(opts generic.RESTOptions) *REST {
},
PredicateFunc
:
storageclass
.
MatchStorageClasses
,
QualifiedResource
:
storageapi
.
Resource
(
"storageclasses"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
storageclass
.
Strategy
,
...
...
pkg/registry/thirdpartyresource/etcd/etcd.go
View file @
6946cce0
...
...
@@ -51,6 +51,7 @@ func NewREST(opts generic.RESTOptions) *REST {
},
PredicateFunc
:
thirdpartyresource
.
Matcher
,
QualifiedResource
:
extensions
.
Resource
(
"thirdpartyresources"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
thirdpartyresource
.
Strategy
,
UpdateStrategy
:
thirdpartyresource
.
Strategy
,
...
...
pkg/registry/thirdpartyresourcedata/etcd/etcd.go
View file @
6946cce0
...
...
@@ -54,6 +54,7 @@ func NewREST(opts generic.RESTOptions, group, kind string) *REST {
},
PredicateFunc
:
thirdpartyresourcedata
.
Matcher
,
QualifiedResource
:
extensions
.
Resource
(
"thirdpartyresourcedatas"
),
EnableGarbageCollection
:
opts
.
EnableGarbageCollection
,
DeleteCollectionWorkers
:
opts
.
DeleteCollectionWorkers
,
CreateStrategy
:
thirdpartyresourcedata
.
Strategy
,
UpdateStrategy
:
thirdpartyresourcedata
.
Strategy
,
...
...
test/integration/garbagecollector/garbage_collector_test.go
View file @
6946cce0
...
...
@@ -38,7 +38,6 @@ import (
"k8s.io/kubernetes/pkg/client/typed/dynamic"
"k8s.io/kubernetes/pkg/controller/garbagecollector"
"k8s.io/kubernetes/pkg/controller/garbagecollector/metaonly"
"k8s.io/kubernetes/pkg/registry/generic/registry"
"k8s.io/kubernetes/pkg/runtime/serializer"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/wait"
...
...
@@ -121,6 +120,7 @@ func newOwnerRC(name, namespace string) *v1.ReplicationController {
func
setup
(
t
*
testing
.
T
)
(
*
httptest
.
Server
,
*
garbagecollector
.
GarbageCollector
,
clientset
.
Interface
)
{
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
.
EnableCoreControllers
=
false
masterConfig
.
EnableGarbageCollection
=
true
_
,
s
:=
framework
.
RunAMaster
(
masterConfig
)
clientSet
,
err
:=
clientset
.
NewForConfig
(
&
restclient
.
Config
{
Host
:
s
.
URL
})
...
...
@@ -153,9 +153,6 @@ func TestCascadingDeletion(t *testing.T) {
ns
:=
framework
.
CreateTestingNamespace
(
"gc-cascading-deletion"
,
s
,
t
)
defer
framework
.
DeleteTestingNamespace
(
ns
,
s
,
t
)
oldEnableGarbageCollector
:=
registry
.
EnableGarbageCollector
registry
.
EnableGarbageCollector
=
true
defer
func
()
{
registry
.
EnableGarbageCollector
=
oldEnableGarbageCollector
}()
rcClient
:=
clientSet
.
Core
()
.
ReplicationControllers
(
ns
.
Name
)
podClient
:=
clientSet
.
Core
()
.
Pods
(
ns
.
Name
)
...
...
@@ -262,9 +259,6 @@ func TestCreateWithNonExistentOwner(t *testing.T) {
ns
:=
framework
.
CreateTestingNamespace
(
"gc-non-existing-owner"
,
s
,
t
)
defer
framework
.
DeleteTestingNamespace
(
ns
,
s
,
t
)
oldEnableGarbageCollector
:=
registry
.
EnableGarbageCollector
registry
.
EnableGarbageCollector
=
true
defer
func
()
{
registry
.
EnableGarbageCollector
=
oldEnableGarbageCollector
}()
podClient
:=
clientSet
.
Core
()
.
Pods
(
ns
.
Name
)
pod
:=
newPod
(
garbageCollectedPodName
,
ns
.
Name
,
[]
v1
.
OwnerReference
{{
UID
:
"doesn't matter"
,
Name
:
toBeDeletedRCName
}})
...
...
@@ -367,9 +361,6 @@ func TestStressingCascadingDeletion(t *testing.T) {
ns
:=
framework
.
CreateTestingNamespace
(
"gc-stressing-cascading-deletion"
,
s
,
t
)
defer
framework
.
DeleteTestingNamespace
(
ns
,
s
,
t
)
oldEnableGarbageCollector
:=
registry
.
EnableGarbageCollector
registry
.
EnableGarbageCollector
=
true
defer
func
()
{
registry
.
EnableGarbageCollector
=
oldEnableGarbageCollector
}()
stopCh
:=
make
(
chan
struct
{})
go
gc
.
Run
(
5
,
stopCh
)
defer
close
(
stopCh
)
...
...
@@ -452,9 +443,6 @@ func TestOrphaning(t *testing.T) {
ns
:=
framework
.
CreateTestingNamespace
(
"gc-orphaning"
,
s
,
t
)
defer
framework
.
DeleteTestingNamespace
(
ns
,
s
,
t
)
oldEnableGarbageCollector
:=
registry
.
EnableGarbageCollector
registry
.
EnableGarbageCollector
=
true
defer
func
()
{
registry
.
EnableGarbageCollector
=
oldEnableGarbageCollector
}()
podClient
:=
clientSet
.
Core
()
.
Pods
(
ns
.
Name
)
rcClient
:=
clientSet
.
Core
()
.
ReplicationControllers
(
ns
.
Name
)
// create the RC with the orphan finalizer set
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment