Skip to content

Commit b6b7abc

Browse files
authored
Merge pull request kubernetes#126683 from aojea/cidr_strategy
status writers are supposed to be constrained to modifying the status stanza
2 parents ba60443 + 2162016 commit b6b7abc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pkg/registry/networking/servicecidr/strategy.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package servicecidr
1919
import (
2020
"context"
2121

22+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2223
"k8s.io/apimachinery/pkg/runtime"
2324
"k8s.io/apimachinery/pkg/util/validation/field"
2425
"k8s.io/apiserver/pkg/registry/rest"
@@ -144,6 +145,7 @@ func (serviceCIDRStatusStrategy) PrepareForUpdate(ctx context.Context, obj, old
144145
oldServiceCIDR := old.(*networking.ServiceCIDR)
145146
// status changes are not allowed to update spec
146147
newServiceCIDR.Spec = oldServiceCIDR.Spec
148+
metav1.ResetObjectMetaForStatus(&newServiceCIDR.ObjectMeta, &oldServiceCIDR.ObjectMeta)
147149
}
148150

149151
// ValidateUpdate is the default update validation for an end user updating status

0 commit comments

Comments
 (0)