remove dead code in lifecycle admission
Kubernetes-commit: 22398f8d3c0d71db5869eace174f5721f8499224
This commit is contained in:
parent
88c9c9d9be
commit
d14a5efcb8
|
@ -69,22 +69,9 @@ type Lifecycle struct {
|
||||||
forceLiveLookupCache *utilcache.LRUExpireCache
|
forceLiveLookupCache *utilcache.LRUExpireCache
|
||||||
}
|
}
|
||||||
|
|
||||||
type forceLiveLookupEntry struct {
|
|
||||||
expiry time.Time
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ = initializer.WantsExternalKubeInformerFactory(&Lifecycle{})
|
var _ = initializer.WantsExternalKubeInformerFactory(&Lifecycle{})
|
||||||
var _ = initializer.WantsExternalKubeClientSet(&Lifecycle{})
|
var _ = initializer.WantsExternalKubeClientSet(&Lifecycle{})
|
||||||
|
|
||||||
func makeNamespaceKey(namespace string) *v1.Namespace {
|
|
||||||
return &v1.Namespace{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: namespace,
|
|
||||||
Namespace: "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *Lifecycle) Admit(a admission.Attributes) error {
|
func (l *Lifecycle) Admit(a admission.Attributes) error {
|
||||||
// prevent deletion of immortal namespaces
|
// prevent deletion of immortal namespaces
|
||||||
if a.GetOperation() == admission.Delete && a.GetKind().GroupKind() == v1.SchemeGroupVersion.WithKind("Namespace").GroupKind() && l.immortalNamespaces.Has(a.GetName()) {
|
if a.GetOperation() == admission.Delete && a.GetKind().GroupKind() == v1.SchemeGroupVersion.WithKind("Namespace").GroupKind() && l.immortalNamespaces.Has(a.GetName()) {
|
||||||
|
@ -182,7 +169,7 @@ func (l *Lifecycle) Admit(a admission.Attributes) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This should probably not be a 403
|
// TODO: This should probably not be a 403
|
||||||
return admission.NewForbidden(a, fmt.Errorf("unable to create new content in namespace %s because it is being terminated.", a.GetNamespace()))
|
return admission.NewForbidden(a, fmt.Errorf("unable to create new content in namespace %s because it is being terminated", a.GetNamespace()))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue