Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

pods: setupConfig: merge config from config store #889

Closed
wants to merge 24 commits into from

Conversation

petertseng
Copy link
Collaborator

No need to review yet, just letting Travis build this because I'm too lazy to do it locally nor make my own fork do Travis.

Advice requested on the question "When do the pod labels get set? Will they be available when the preparer is installing the pod?"

@petertseng
Copy link
Collaborator Author

"When do the pod labels get set? Will they be available when the preparer is installing the pod?"

By the RC. It's fine, they'll be available.

Next question. Given that a pod has some labels L, with which subset of those labels should we query for a matching pod cluster?

  1. Hard code. Doesn't seem sensible. The RC doesn't hard code the labels it applies (Right?)
  2. Config. I guess that works
  3. Take the current labels, subtract pod_id and replication_controller_id, use that. Trying to be clever but require zero config. Brittle if an unexpected label gets added.

@petertseng petertseng force-pushed the pc-config branch 5 times, most recently from 851e310 to 61a6eb6 Compare July 19, 2017 00:19
@petertseng
Copy link
Collaborator Author

Oooookay, I think we now merge the config in on install time. If the code works on the first try.

@petertseng petertseng force-pushed the pc-config branch 2 times, most recently from 8b0d8e5 to 9e40554 Compare July 19, 2017 23:18
@petertseng petertseng changed the title WIP: merge configs from PC pods: setupConfig: merge config from config store Jul 19, 2017
Copy link
Collaborator Author

@petertseng petertseng left a comment

Choose a reason for hiding this comment

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

I think we are good to go on this, but I haven't bothered doing watches yet.

Note the TODOs and advise whether something should be done about them!

@@ -53,7 +53,9 @@ func main() {
pod := hookFactory.NewHookPod(manifest.ID())

// for now use noop verifier in this CLI
err = pod.Install(manifest, auth.NopVerifier(), artifact.NewRegistry(*registryURI, uri.DefaultFetcher, osversion.DefaultDetector))
// TODO: should this have config store/labeler to merge hook configs?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

a TODO I was concerned about, but less so

@@ -88,7 +88,8 @@ func main() {
podFactory := pods.NewFactory(*podRoot, types.NodeName(*nodeName), fetcher, "")
pod := podFactory.NewLegacyPod(manifest.ID())

err = pod.Install(manifest, auth.NopVerifier(), artifact.NewRegistry(*artifactRegistryURL, fetcher, osversion.DefaultDetector))
// TODO: config store/labeler? Otherwise, p2-launch ignores the config store, which doesn't seem ideal.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

a TODO I was concerned about, more so

Copy link
Collaborator

Choose a reason for hiding this comment

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

hmmmmmmmmmmmmmmmmmmmmmm yeah we're really hampering p2-launch here because now the manifest isn't all the info you need to run a pod

Copy link
Contributor

Choose a reason for hiding this comment

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

Passing nil arguments to a function we control is a smell. Can you write a function with a more descriptive name and a more correct arity?

@petertseng
Copy link
Collaborator Author

I need #896 for this. I should probably just rebase off that branch...

@petertseng
Copy link
Collaborator Author

temporarily cherry picking it in to make sure the build would pass with it, I didn't rebase directly because #896 is itself out of date, but maybe it's not missing any commit I need, so maybe not necessary

@petertseng
Copy link
Collaborator Author

Hmm. Install and InstallWithConfig? I wouldn't want to imply that Install installs without config though.

@petertseng petertseng force-pushed the pc-config branch 4 times, most recently from 3a8c280 to 56131d4 Compare July 24, 2017 21:58
Sean Sorrell and others added 14 commits July 25, 2017 10:55
Golang's JSON marshal doesn't support arbitrary types as keys, probably because
JSON itself does not support this.
Will be useful when we are merging configs
The type of map used by pkg/manifest is map[interface{}]interface{} so it
behooves us to match that. The map[string]interface{} change was to support JSON
marshalling of config stanzas, which seems less important now than it once did.
This will make it easier to initialize a config store
This will allow callers to switch on the special error type the labels
library returns when there are no labels for a type (NoLabelsFound)
@petertseng
Copy link
Collaborator Author

--- FAIL: TestDeleteConfigTxn (0.44s)
consultest.go:98: starting Consul server with port: 33739
store_test.go:279: Expected to receive an error when fetching deleted configuration. Got: {map[] }
consultest.go:111: stopping Consul server with port: 33739
FAIL
FAIL github.com/square/p2/pkg/store/consul/configstore 0.551s

@petertseng
Copy link
Collaborator Author

--- FAIL: TestDeleteConfig (0.00s)
store_test.go:171: Expected to receive an error when fetching deleted configuration. Got: {map[] }

@petertseng
Copy link
Collaborator Author

2017/07/26 01:54:55 Bootstrapping complete
2017/07/26 01:54:58 Status of preparer: p2-preparer OK
2017/07/26 01:54:59 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 127.0.0.1:3000: getsockopt: connection refused"; Reconnecting to {localhost:3000 }
2017/07/26 01:55:00 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 127.0.0.1:3000: getsockopt: connection refused"; Reconnecting to {localhost:3000 }
2017/07/26 01:55:02 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 127.0.0.1:3000: getsockopt: connection refused"; Reconnecting to {localhost:3000 }
2017/07/26 01:55:04 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 127.0.0.1:3000: getsockopt: connection refused"; Reconnecting to {localhost:3000 }
2017/07/26 01:55:08 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 127.0.0.1:3000: getsockopt: connection refused"; Reconnecting to {localhost:3000 }
label-store-server tail:
2017-07-26_01:55:08.48305 time="2017-07-26T01:55:08Z" level=info msg="Listening tcp on port 3000" Counter=0 PID=11962

Copy link
Collaborator Author

@petertseng petertseng left a comment

Choose a reason for hiding this comment

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

Hey there. It looks like this is pretty old and we haven't had a need to roll it out widely. As a result I'd like to close it to get it out of the queue.

"encoding/json"
"path"

"github.com/square/p2/pkg/util" // TODO this is wrong
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I no longer remember why this is wrong

@petertseng petertseng closed this Aug 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants