Skip to content

Commit 6d470a8

Browse files
committed
weird: clusterresourceoverride admission with a fake limit ranger
1 parent 7664a45 commit 6d470a8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/quota/admission/clusterresourceoverride/admission.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ func (d *limitRangerActions) SupportsAttributes(a admission.Attributes) bool {
107107
func (d *limitRangerActions) SupportsLimit(limitRange *kapi.LimitRange) bool {
108108
return true
109109
}
110-
func (d *limitRangerActions) Limit(limitRange *kapi.LimitRange, resourceName string, obj runtime.Object) error {
110+
func (d *limitRangerActions) MutateLimit(limitRange *kapi.LimitRange, resourceName string, obj runtime.Object) error {
111+
return nil
112+
}
113+
func (d *limitRangerActions) ValidateLimit(limitRange *kapi.LimitRange, resourceName string, obj runtime.Object) error {
111114
return nil
112115
}
113116

@@ -194,7 +197,7 @@ func (a *clusterResourceOverridePlugin) Admit(attr admission.Attributes) error {
194197
// Reuse LimitRanger logic to apply limit/req defaults from the project. Ignore validation
195198
// errors, assume that LimitRanger will run after this plugin to validate.
196199
glog.V(5).Infof("%s: initial pod limits are: %#v", api.PluginName, pod.Spec)
197-
if err := a.LimitRanger.Admit(attr); err != nil {
200+
if err := a.LimitRanger.(admission.MutationInterface).Admit(attr); err != nil {
198201
glog.V(5).Infof("%s: error from LimitRanger: %#v", api.PluginName, err)
199202
}
200203
glog.V(5).Infof("%s: pod limits after LimitRanger: %#v", api.PluginName, pod.Spec)

0 commit comments

Comments
 (0)