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

Instance never provisioned should not invoke broker#891

Merged
pmorie merged 1 commit into
kubernetes-retired:masterfrom
derekwaynecarr:fix-instance-delete
Jun 14, 2017
Merged

Instance never provisioned should not invoke broker#891
pmorie merged 1 commit into
kubernetes-retired:masterfrom
derekwaynecarr:fix-instance-delete

Conversation

@derekwaynecarr
Copy link
Copy Markdown
Contributor

@derekwaynecarr derekwaynecarr commented May 24, 2017

Fixes #878

If you create an Instance that references a ServiceClass that does not exist, you were never able to delete the Instance, as the controller error-ed out when the ServiceClass is not resolvable. In this scenario, the Instance is never able to be provisioned, so there is no need to gate deletion on ability to deprovision. For this PR, we do not invoke the broker upon deletion if an instance never actually provisioned.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 24, 2017
@derekwaynecarr
Copy link
Copy Markdown
Contributor Author

Right now, this is an e2e that demonstrates the problem, working on the fix.

@derekwaynecarr derekwaynecarr force-pushed the fix-instance-delete branch 2 times, most recently from 68a5701 to 2d46035 Compare May 24, 2017 21:55
@derekwaynecarr derekwaynecarr changed the title WIP: An instance should be deleted if it references non-existent ServiceClass An instance should be deleted if it references non-existent ServiceClass May 24, 2017
@derekwaynecarr
Copy link
Copy Markdown
Contributor Author

ok, this should be ready for review.

@derekwaynecarr derekwaynecarr force-pushed the fix-instance-delete branch 3 times, most recently from 8c5068f to b03693d Compare May 24, 2017 23:43
@derekwaynecarr derekwaynecarr changed the title An instance should be deleted if it references non-existent ServiceClass Instance never provisioned should not invoke broker May 24, 2017
@pmorie
Copy link
Copy Markdown
Contributor

pmorie commented May 25, 2017

@derekwaynecarr rebase needed, thanks to you!

@pmorie pmorie added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 25, 2017
@pmorie pmorie added this to the 0.0.9 milestone May 27, 2017
@vaikas vaikas modified the milestones: 0.0.10, 0.0.9 May 31, 2017
@arschles
Copy link
Copy Markdown
Contributor

arschles commented Jun 5, 2017

This is related to #908

@derekwaynecarr let me know when this is rebased, and I'll review.

@derekwaynecarr
Copy link
Copy Markdown
Contributor Author

@arschles -- this is rebased.

@derekwaynecarr derekwaynecarr force-pushed the fix-instance-delete branch 2 times, most recently from c0ef021 to e7dda8a Compare June 8, 2017 19:51
@pmorie pmorie removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 8, 2017
@pmorie
Copy link
Copy Markdown
Contributor

pmorie commented Jun 8, 2017

Looks like this is haunted by the same ghost or spectre as #917:

[Build & Unit/Integration Tests] --- FAIL: TestReconcileInstanceDelete (0.00s)
[Build & Unit/Integration Tests] 	controller_test.go:1036: []
[Build & Unit/Integration Tests] 	controller_test.go:1006: goroutine 298 [running]:
[Build & Unit/Integration Tests] 		runtime/debug.Stack(0x189957d, 0x8, 0x434601)
[Build & Unit/Integration Tests] 			/usr/local/go/src/runtime/debug/stack.go:24 +0x87
[Build & Unit/Integration Tests] 		github.com/kubernetes-incubator/service-catalog/pkg/controller.fatalf(0xc42024cc30, 0x1b83a3b, 0x33, 0xc42026bb30, 0x3, 0x3)
[Build & Unit/Integration Tests] 			/go/src/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_test.go:1006 +0x34
[Build & Unit/Integration Tests] 		github.com/kubernetes-incubator/service-catalog/pkg/controller.testNumberOfActions(0xc42024cc30, 0x0, 0x0, 0x1bc1138, 0x25c8cd8, 0x0, 0x0, 0x3, 0xc420223068)
[Build & Unit/Integration Tests] 			/go/src/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_test.go:1037 +0x31d
[Build & Unit/Integration Tests] 		github.com/kubernetes-incubator/service-catalog/pkg/controller.assertNumberOfActions(0xc42024cc30, 0x25c8cd8, 0x0, 0x0, 0x3)
[Build & Unit/Integration Tests] 			/go/src/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_test.go:1022 +0x7f
[Build & Unit/Integration Tests] 		github.com/kubernetes-incubator/service-catalog/pkg/controller.TestReconcileInstanceDelete(0xc42024cc30)
[Build & Unit/Integration Tests] 			/go/src/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_instance_test.go:629 +0xd9d
[Build & Unit/Integration Tests] 		testing.tRunner(0xc42024cc30, 0x1bc1078)
[Build & Unit/Integration Tests] 			/usr/local/go/src/testing/testing.go:657 +0x108
[Build & Unit/Integration Tests] 		created by testing.(*T).Run
[Build & Unit/Integration Tests] 			/usr/local/go/src/testing/testing.go:697 +0x544
[Build & Unit/Integration Tests] 		
[Build & Unit/Integration Tests] 	controller_test.go:1007: Unexpected number of actions: expected 3, got 0
[Build & Unit/Integration Tests] --- FAIL: TestReconcileInstanceDeleteDoesNotInvokeBroker (0.01s)
[Build & Unit/Integration Tests] 	controller_test.go:1036: []
[Build & Unit/Integration Tests] 	controller_test.go:1006: goroutine 304 [running]:
[Build & Unit/Integration Tests] 		runtime/debug.Stack(0x189957d, 0x8, 0x434601)
[Build & Unit/Integration Tests] 			/usr/local/go/src/runtime/debug/stack.go:24 +0x87
[Build & Unit/Integration Tests] 		github.com/kubernetes-incubator/service-catalog/pkg/controller.fatalf(0xc42024d450, 0x1b83a3b, 0x33, 0xc420fd8750, 0x3, 0x3)
[Build & Unit/Integration Tests] 			/go/src/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_test.go:1006 +0x34
[Build & Unit/Integration Tests] 		github.com/kubernetes-incubator/service-catalog/pkg/controller.testNumberOfActions(0xc42024d450, 0x0, 0x0, 0x1bc1138, 0x25c8cd8, 0x0, 0x0, 0x2, 0xc420223338)
[Build & Unit/Integration Tests] 			/go/src/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_test.go:1037 +0x31d
[Build & Unit/Integration Tests] 		github.com/kubernetes-incubator/service-catalog/pkg/controller.assertNumberOfActions(0xc42024d450, 0x25c8cd8, 0x0, 0x0, 0x2)
[Build & Unit/Integration Tests] 			/go/src/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_test.go:1022 +0x7f
[Build & Unit/Integration Tests] 		github.com/kubernetes-incubator/service-catalog/pkg/controller.TestReconcileInstanceDeleteDoesNotInvokeBroker(0xc42024d450)
[Build & Unit/Integration Tests] 			/go/src/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_instance_test.go:679 +0xc6d
[Build & Unit/Integration Tests] 		testing.tRunner(0xc42024d450, 0x1bc1070)
[Build & Unit/Integration Tests] 			/usr/local/go/src/testing/testing.go:657 +0x108
[Build & Unit/Integration Tests] 		created by testing.(*T).Run
[Build & Unit/Integration Tests] 			/usr/local/go/src/testing/testing.go:697 +0x544
[Build & Unit/Integration Tests] 		
[Build & Unit/Integration Tests] 	controller_test.go:1007: Unexpected number of actions: expected 2, got 0
[Build & Unit/Integration Tests] FAIL
[Build & Unit/Integration Tests] FAIL	github.com/kubernetes-incubator/service-catalog/pkg/controller	5.818s

@pmorie
Copy link
Copy Markdown
Contributor

pmorie commented Jun 8, 2017

...the difference being that this didn't pass anywhere, so perhaps this is a legit failure

v1alpha1.InstanceConditionReady,
v1alpha1.ConditionUnknown,
errorDeprovisionCalledReason,
"Deprovision call failed. "+s)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note, nothing necessary to do for this PR - this is the code that we'll need to change in order to fix #908

Copy link
Copy Markdown
Contributor

@arschles arschles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@derekwaynecarr looks good, I just have 2 changes - one nit and one in response code handling for the deprovision

v1alpha1.InstanceConditionReady,
v1alpha1.ConditionFalse,
successDeprovisionReason,
successDeprovisionMessage,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessarily a successful deprovision in this case - only if http.StatusOK is returned. Otherwise, we should update to a failure message. I've done something similar for provision in #923

}
}

func TestReconcileInstanceDeleteDoesNotInvokeBroker(t *testing.T) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put a comment above this func to explain basically what it's testing? A sentence or 2 is enough

@derekwaynecarr
Copy link
Copy Markdown
Contributor Author

@arschles @pmorie -- fixed up.

Copy link
Copy Markdown
Contributor

@pmorie pmorie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM, a couple little nits and one questions


// if the instance is marked for deletion, handle that first.
if instance.ObjectMeta.DeletionTimestamp != nil {
glog.V(4).Infof("Soft-deleting Instance %v/%v", instance.Namespace, instance.Name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure exactly what "soft-deleting" means here - can you clarify?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize now that was in the existing code, FORGIVENESS PLEASE

return err
}
}
glog.V(4).Infof("Adding/Updating Instance %v/%v", instance.Namespace, instance.Name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not feedback about your PR, just a signpost: this is where we will have to determine whether we're doing an add or an update.


// reconcileInstance is the control-loop for reconciling Instances.
func (c *controller) reconcileInstance(instance *v1alpha1.Instance) error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signpost, not an issue with your PR: we will need to recalculate the checksums here eventually based on the total parameter payload that we would send to broker, which may include stuff that is not in the spec (ie, content of a secret that may have changed).

}
}

// TestReconcileInstanceDeleteDoesNotInvokeBroker verfies that if an instance is created that is never
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, 'verifies'


// TestReconcileInstanceDeleteDoesNotInvokeBroker verfies that if an instance is created that is never
// actually provisioned the instance is able to be deleted and is not blocked by any interaction with
// a broker (since its very likely that a broker never actually existed).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even sorrier, 'it's'

@pmorie pmorie added the LGTM1 label Jun 9, 2017
@arschles
Copy link
Copy Markdown
Contributor

LGTM

The two typos that @pmorie found would be fine with me to do in a follow-up

@arschles arschles added the LGTM2 label Jun 13, 2017
@pmorie pmorie merged commit 1bfff53 into kubernetes-retired:master Jun 14, 2017
vaikas pushed a commit to vaikas/service-catalog that referenced this pull request Jun 16, 2017
vaikas pushed a commit to vaikas/service-catalog that referenced this pull request Jun 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. LGTM1 LGTM2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants