Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Only validate status on updates #1972

Merged
merged 1 commit into from
Apr 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/apis/servicecatalog/validation/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func internalValidateServiceBinding(binding *sc.ServiceBinding, create bool) fie
validateServiceBindingName,
field.NewPath("metadata"))...)
allErrs = append(allErrs, validateServiceBindingSpec(&binding.Spec, field.NewPath("spec"), create)...)
allErrs = append(allErrs, validateServiceBindingStatus(&binding.Status, field.NewPath("status"), create)...)
if create {
allErrs = append(allErrs, validateServiceBindingCreate(binding)...)
} else {
Expand Down Expand Up @@ -244,5 +243,6 @@ func ValidateServiceBindingUpdate(new *sc.ServiceBinding, old *sc.ServiceBinding
func ValidateServiceBindingStatusUpdate(new *sc.ServiceBinding, old *sc.ServiceBinding) field.ErrorList {
allErrs := field.ErrorList{}
allErrs = append(allErrs, internalValidateServiceBinding(new, false)...)
allErrs = append(allErrs, validateServiceBindingStatus(&new.Status, field.NewPath("status"), false)...)
return allErrs
}
2 changes: 2 additions & 0 deletions pkg/apis/servicecatalog/validation/binding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"

"github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog"
)
Expand Down Expand Up @@ -567,6 +568,7 @@ func TestValidateServiceBinding(t *testing.T) {

for _, tc := range cases {
errs := internalValidateServiceBinding(tc.binding, tc.create)
errs = append(errs, validateServiceBindingStatus(&tc.binding.Status, field.NewPath("status"), false)...)
if len(errs) != 0 && tc.valid {
t.Errorf("%v: unexpected error: %v", tc.name, errs)
continue
Expand Down