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

Add PodPreset support#917

Merged
jpeeler merged 2 commits into
kubernetes-retired:masterfrom
pmorie:pod-preset
Jun 9, 2017
Merged

Add PodPreset support#917
jpeeler merged 2 commits into
kubernetes-retired:masterfrom
pmorie:pod-preset

Conversation

@pmorie
Copy link
Copy Markdown
Contributor

@pmorie pmorie commented Jun 6, 2017

Closes #266

Incorporates lessons learned in #760

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 6, 2017
@pmorie pmorie added this to the 0.0.10 milestone Jun 6, 2017
@pmorie pmorie changed the title WIP: Add PodPreset support Add PodPreset support Jun 7, 2017
@arschles
Copy link
Copy Markdown
Contributor

arschles commented Jun 7, 2017

@pmorie if this closes #266, can you say so in the OP?

// Binding.
type AlphaPodPresetTemplate struct {
// Name is the name of the PodPreset to create.
Name string
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 we make this optional? And let it default to the name of the binding?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 {
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.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.
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.

Name of the PodPreset to create.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.
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.

ditto.

// Binding.
type AlphaPodPresetTemplate struct {
// Name is the name of the PodPreset to create.
Name string
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.

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
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 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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@arschles
Copy link
Copy Markdown
Contributor

arschles commented Jun 7, 2017

@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.

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

arschles commented Jun 7, 2017

@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"

@pmorie
Copy link
Copy Markdown
Contributor Author

pmorie commented Jun 7, 2017

I may have pushed the wrong version of this code - hang tight.

@pmorie pmorie force-pushed the pod-preset branch 2 times, most recently from 4cf6a35 to 86263b3 Compare June 8, 2017 14:51
@pmorie pmorie closed this Jun 8, 2017
@pmorie pmorie reopened this Jun 8, 2017
@pmorie
Copy link
Copy Markdown
Contributor Author

pmorie commented Jun 8, 2017

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.

@pmorie
Copy link
Copy Markdown
Contributor Author

pmorie commented Jun 8, 2017

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.

@vaikas vaikas added the LGTM2 label Jun 9, 2017
@jpeeler jpeeler added the LGTM3 label Jun 9, 2017
@jpeeler jpeeler merged commit cbfa39b into kubernetes-retired:master Jun 9, 2017
@pmorie
Copy link
Copy Markdown
Contributor Author

pmorie commented Jun 13, 2017

Created #922 to gate this feature

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 LGTM3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants