Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config files to use kubernetes container pool and invoker-agent #155

Merged
merged 3 commits into from
Mar 28, 2018

Conversation

dgrove-oss
Copy link
Member

@dgrove-oss dgrove-oss commented Jan 26, 2018

config files for deploying an invoker that uses the k8s container pool of apache/openwhisk#3219.

Also adds an invoker-agent that can perform node-level operations like pause/unpause and log extraction on the worker node on behalf of a potentially remote invoker pod.

Fixes #110.

@dgrove-oss dgrove-oss changed the title initial config files to use kubernetes container pool WIP - initial config files to use kubernetes container pool Feb 13, 2018
@dgrove-oss dgrove-oss added the wip label Feb 13, 2018
@dgrove-oss dgrove-oss force-pushed the kube-container-pool branch 2 times, most recently from 54a44ae to 4ad1636 Compare February 13, 2018 22:30
@dgrove-oss dgrove-oss removed the wip label Feb 22, 2018
@dgrove-oss dgrove-oss changed the title WIP - initial config files to use kubernetes container pool config files to use kubernetes container pool and invoker-agent Feb 22, 2018
@dgrove-oss dgrove-oss force-pushed the kube-container-pool branch 2 times, most recently from 15a091a to ba9b2b1 Compare February 23, 2018 19:44
@dgrove-oss dgrove-oss requested a review from dubee February 26, 2018 17:49
@dgrove-oss
Copy link
Member Author

@dubeejw -- would you have time to look at the Go piece of this PR? This is my first Go program, so I'm looking for style feedback and someone to catch newbie mistakes.

@glikson
Copy link

glikson commented Feb 28, 2018

Would it make sense to (eventually) use CRI instead of direct interaction with the docker daemon?

@glikson
Copy link

glikson commented Feb 28, 2018

Would it make sense to have invoker-agent in a different repo? It doesn't seem to be too related to kube deployment - at least at the moment..

@dgrove-oss dgrove-oss force-pushed the kube-container-pool branch 4 times, most recently from 7a92eff to 15f6e8c Compare March 16, 2018 14:12
1. Deployment files for invoker statefulset using KubernetesContainerPool.
2. Update invoker configuration to describe the two container factory options
3. Implement simple Go invoker-agent to proxy pause/unpause operations
   and log consolidation for a remote invoker instance.
@dgrove-oss dgrove-oss force-pushed the kube-container-pool branch from 15f6e8c to 5aa4721 Compare March 16, 2018 14:17
@dgrove-oss dgrove-oss requested review from rabbah and removed request for dubee March 16, 2018 14:34
@rabbah rabbah self-assigned this Mar 17, 2018
Copy link
Member

@rabbah rabbah left a comment

Choose a reason for hiding this comment

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

LGTM, would be nice to have a test in particular for the log reader.

}

// handler for /resume route
func suspendUserAction(w http.ResponseWriter, r *http.Request) {
Copy link
Member

Choose a reason for hiding this comment

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

can you add to the comment/function docs what the expected contract is? ie receive container value as a parameter.

should this have some defensive logic in case of a missing container value?

w.WriteHeader(500)
fmt.Fprintf(w, "Pausing %s failed with error: %v\n", container, err)
} else if resp.StatusCode < 200 || resp.StatusCode > 299 {
w.WriteHeader(resp.StatusCode)
Copy link
Member

Choose a reason for hiding this comment

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

post status of 500? i'd think the contract to the caller should be success or failure.

*/

// handler for /resume route
func resumeUserAction(w http.ResponseWriter, r *http.Request) {
Copy link
Member

Choose a reason for hiding this comment

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

similar comments to suspend below.

}

// Request handler for /logs route
func forwardLogsFromUserAction(w http.ResponseWriter, r *http.Request) {
Copy link
Member

Choose a reason for hiding this comment

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

it would be nice to test this logic - perhaps a slight refactoring to avoid having to mock the http call would make a unit test easier to write.

}

vars := mux.Vars(r)
container := vars["container"]
Copy link
Member

Choose a reason for hiding this comment

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

defensively error out if container is not set?

container := vars["container"]

var lfi LogForwardInfo
b, err := ioutil.ReadAll(r.Body)
Copy link
Member

Choose a reason for hiding this comment

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

what's expected in the body (looks like last seek position) - can you document in the function docs?

@dgrove-oss
Copy link
Member Author

added basic documentation to the entrypoint functions & opened an issue to add unit tests for invokerAgent later.

@dgrove-oss
Copy link
Member Author

@rabbah -- I added a little documentation on the key methods and opened an issue to document need for unit testing of log extraction of invokerAgent. Good enough for now?

@rabbah rabbah merged commit 9815bd8 into apache:master Mar 28, 2018
@dgrove-oss dgrove-oss deleted the kube-container-pool branch March 28, 2018 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants