Add PodPreset support#917
Conversation
| // Binding. | ||
| type AlphaPodPresetTemplate struct { | ||
| // Name is the name of the PodPreset to create. | ||
| Name string |
There was a problem hiding this comment.
can we make this optional? And let it default to the name of the binding?
There was a problem hiding this comment.
I'm fine doing that, but would rather do it in a follow-up (with label selector) if that's alright with you.
|
|
||
| // AlphaPodPresetTemplate represents how a PodPreset should be created for a | ||
| // Binding. | ||
| type AlphaPodPresetTemplate struct { |
There was a problem hiding this comment.
Is the word "template" necessary? Or are you trying to hammer home the idea that its not a true PodPreset its just a pseudo-one?
There was a problem hiding this comment.
I chose the name because I expect that we'll converge on a type in the core called 'PodPresetTemplate', which will eventually be the name of the same field.
There was a problem hiding this comment.
But yeah, driving home the idea that this isn't a full pod preset is also a goal
| // AlphaPodPresetTemplate represents how a PodPreset should be created for a | ||
| // Binding. | ||
| type AlphaPodPresetTemplate struct { | ||
| // Name is the name of the PodPreset to create. |
There was a problem hiding this comment.
Name of the PodPreset to create.
There was a problem hiding this comment.
Is this comment about the format of the godoc comment? This is the style we use elsewhere in godoc on fields (at least in types.go)
| type AlphaPodPresetTemplate struct { | ||
| // Name is the name of the PodPreset to create. | ||
| Name string | ||
| // Selector is the LabelSelector of the PodPreset to create. |
| // Binding. | ||
| type AlphaPodPresetTemplate struct { | ||
| // Name is the name of the PodPreset to create. | ||
| Name string |
There was a problem hiding this comment.
Any reason to not just use the name of the binding for this?
| // Name is the name of the PodPreset to create. | ||
| Name string | ||
| // Selector is the LabelSelector of the PodPreset to create. | ||
| Selector metav1.LabelSelector |
There was a problem hiding this comment.
not 100% sure but I think you have this so its a required field, is that correct? If so, can we make it optional so that all new pods in this namespace will be injected?
There was a problem hiding this comment.
It's a required field; I would be okay with a default, but would prefer to do the default in a follow-up if that's cool with you.
|
@pmorie I'm fine with this as-is, and to recap what we talked about on Slack, you're gonna file an issue to add a flag and admission controller to turn off pod preset functionality. |
|
@pmorie CI failure looks legit: --- FAIL: TestReconcileBindingDeleteWithPodPreset (0.00s)
controller_test.go:1036: []
controller_test.go:1006: goroutine 77 [running]:
runtime/debug.Stack(0x189e63d, 0x8, 0x434501)
/usr/local/go/src/runtime/debug/stack.go:24 +0x87
github.com/kubernetes-incubator/service-catalog/pkg/controller.fatalf(0xc4201cc680, 0x1b88c3b, 0x33, 0xc42019ac30, 0x3, 0x3)
/go/src/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_test.go:1006 +0x34
github.com/kubernetes-incubator/service-catalog/pkg/controller.testNumberOfActions(0xc4201cc680, 0x0, 0x0, 0x1bc62d0, 0x25cecd8, 0x0, 0x0, 0x2, 0xc42009b578)
/go/src/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_test.go:1037 +0x31d
github.com/kubernetes-incubator/service-catalog/pkg/controller.assertNumberOfActions(0xc4201cc680, 0x25cecd8, 0x0, 0x0, 0x2)
/go/src/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_test.go:1022 +0x7f
github.com/kubernetes-incubator/service-catalog/pkg/controller.TestReconcileBindingDeleteWithPodPreset(0xc4201cc680)
/go/src/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_binding_test.go:678 +0x10b8
testing.tRunner(0xc4201cc680, 0x1bc6128)
/usr/local/go/src/testing/testing.go:657 +0x108
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:697 +0x544
controller_test.go:1007: Unexpected number of actions: expected 2, got 0
E0607 18:54:52.410666 1865 controller_broker.go:328] ServiceClass "test-serviceclass" already exists with OSB guid "notTheSame", received different guid "SCGUID"
E0607 18:54:52.420657 1865 controller_broker.go:322] ServiceClass "test-serviceclass" for Broker "test-broker" already exists for Broker "notTheSame" |
|
I may have pushed the wrong version of this code - hang tight. |
4cf6a35 to
86263b3
Compare
|
I've removed the flaky test - spent all day debugging this and I'm out of time for now. I'm going to resubmit a PR with those commits, but for now I would like to get this in, since it works in my manual tests and adds happy-path test coverage for bind, and in an immediate follow-up continue debugging. |
|
Actually, the test itself was not necessarily flaky - it consistently passed everywhere but in travis, where it consistently failed, which doesn't fit my normal definition of a flake. |
|
Created #922 to gate this feature |
Closes #266
Incorporates lessons learned in #760