mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
status writers are supposed to be constrained to modifying the status stanza
This commit is contained in:
parent
ba604434a8
commit
21620165e3
@ -19,6 +19,7 @@ package servicecidr
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||||
"k8s.io/apiserver/pkg/registry/rest"
|
"k8s.io/apiserver/pkg/registry/rest"
|
||||||
@ -144,6 +145,7 @@ func (serviceCIDRStatusStrategy) PrepareForUpdate(ctx context.Context, obj, old
|
|||||||
oldServiceCIDR := old.(*networking.ServiceCIDR)
|
oldServiceCIDR := old.(*networking.ServiceCIDR)
|
||||||
// status changes are not allowed to update spec
|
// status changes are not allowed to update spec
|
||||||
newServiceCIDR.Spec = oldServiceCIDR.Spec
|
newServiceCIDR.Spec = oldServiceCIDR.Spec
|
||||||
|
metav1.ResetObjectMetaForStatus(&newServiceCIDR.ObjectMeta, &oldServiceCIDR.ObjectMeta)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateUpdate is the default update validation for an end user updating status
|
// ValidateUpdate is the default update validation for an end user updating status
|
||||||
|
Loading…
Reference in New Issue
Block a user