Change:
<!-- This form is for bug reports and feature requests ONLY! If you're looking for help check and the . --Is this a BUG REPORT or FEATURE REQUEST?: /kind bug What happened: When trying to forcefully update using command segmentatio voliation happens. What you expected to happen: podDistributionBudget to be replaced How to reproduce it (as minimally and precisely as possible): create : Create : Forcefull update (replace) : Anything else we need to know?: The same error happens on kubectl version 1.6 or 1.7. Manually deleting and recreating works. Environment: Kubernetes version (use ): 1.7 Cloud provider or hardware configuration**: gke OS (e.g. from /etc/os-release): Debian GNU/Linux 7 (wheezy) Kernel (e.g. ): 3.16.0-4-amd64
There are no sig labels on this issue. Please by:<br(1) mentioning a sig: <bre.g., for API Machinery<br(2) specifying the label manually: <bre.g., for sig/scalability<br<brNote: method (1) will trigger a notification to the team. You can find the team list and label list
/sig cli
This issue not only applies to PBP's but NetworkPolicy (and perhaps others).

Discussion:
restoreGeneration := pdb.Generation pdb.Generation = oldPdb.Generation <del> if !reflect.DeepEqual(pdb, oldPdb) { </del> <ins> if !reflect.DeepEqual(pdb.Spec, oldPdb.Spec) { </ins> allErrs = append(allErrs, field.Forbidden(field.NewPath("spec"), "updates to poddisruptionbudget spec are forbidden.")) } allErrs = append(allErrs, ValidatePodDisruptionBudgetStatus(pdb.Status, field.NewPath("status"))...)

} } } <ins> func TestValidatePodDisruptionBudgetUpdate(t *testing.T) { c1 := intstr.FromString("10%") c2 := intstr.FromInt(1) c3 := intstr.FromInt(2) oldPdb := &policy.PodDisruptionBudget{} pdb := &policy.PodDisruptionBudget{} testCases := []struct { generations []int64 name        string specs       []policy.PodDisruptionBudgetSpec status      []policy.PodDisruptionBudgetStatus ok          bool }{ { name:        "only update status", generations: []int64{int64(2), int64(3)}, specs: []policy.PodDisruptionBudgetSpec{ { MinAvailable:   &c1, MaxUnavailable: &c2, }, { MinAvailable:   &c1, MaxUnavailable: &c2, }, }, status: []policy.PodDisruptionBudgetStatus{ { PodDisruptionsAllowed: 10, CurrentHealthy:        5, ExpectedPods:          2, }, { PodDisruptionsAllowed: 8, CurrentHealthy:        5, DesiredHealthy:        3, }, }, ok: true, }, { name:        "only update pdb spec", generations: []int64{int64(2), int64(3)}, specs: []policy.PodDisruptionBudgetSpec{ { MaxUnavailable: &c2, }, { MinAvailable:   &c1, MaxUnavailable: &c3, }, }, status: []policy.PodDisruptionBudgetStatus{ { PodDisruptionsAllowed: 10, }, { PodDisruptionsAllowed: 10, }, }, ok: false, }, { name:        "update spec and status", generations: []int64{int64(2), int64(3)}, specs: []policy.PodDisruptionBudgetSpec{ { MaxUnavailable: &c2, }, { MinAvailable:   &c1, MaxUnavailable: &c3, }, }, status: []policy.PodDisruptionBudgetStatus{ { PodDisruptionsAllowed: 10, CurrentHealthy:        5, ExpectedPods:          2, }, { PodDisruptionsAllowed: 8, CurrentHealthy:        5, DesiredHealthy:        3, }, }, ok: false, }, } for i, tc := range testCases { oldPdb.Spec = tc.specs[0] oldPdb.Generation = tc.generations[0] oldPdb.Status = tc.status[0] pdb.Spec = tc.specs[1] pdb.Generation = tc.generations[1] oldPdb.Status = tc.status[1] errs := ValidatePodDisruptionBudgetUpdate(oldPdb, pdb) if tc.ok && len(errs) > 0 { t.Errorf("[%d:%s] unexpected errors: %v", i, tc.name, errs) } else if !tc.ok && len(errs) == 0 { t.Errorf("[%d:%s] expected errors: %v", i, tc.name, errs) } } } </ins>