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

Adding lifecycle hooks to deis-controller api #1311

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

Adding lifecycle hooks to deis-controller api #1311

wants to merge 29 commits into from

Conversation

Cryptophobia
Copy link
Contributor

@Cryptophobia Cryptophobia commented Jun 29, 2017

Adding the lifecycle hooks feature to the deis-controller api. This allows users to attach lifecycle postStart and preStop hook commands to kubernetes api via the deis api.

Example of a preStop hook that would gracefully shutdown Resque worker processes:
https://gist.github.com/Cryptophobia/447ecea7858d26141359b22161e70ee2

Example of the POST to deis.$hostname/v2/apps/testing-again/config:

JSON Body:

 "lifecycle_pre_stop": {
        "worker": "echo 'Running the postStop script' && chmod +x bin/kube-resque-pre-stop.sh 
&& ./bin/kube-resque-pre-stop.sh;"
    }

For long running preStop hooks the terminationGracePeriodSeconds needs to be increased for the worker pods:

deis config:set KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS=900 -a testing-worker

The tests are not written yet.
Code in deis-cli has not been written yet.

@rvadim
Copy link
Contributor

rvadim commented Jul 5, 2017

This MR probably fixes #1254

@Cryptophobia
Copy link
Contributor Author

Cryptophobia commented Jul 5, 2017

@rvadim : Yes, it would give you a graceful showdown option now. However, you still need to make sure that bash shell is present in the docker container that you are deploying. I was originally testing with one of the docker example Go apps and interestingly, the bash shell is not in there...

@Cryptophobia
Copy link
Contributor Author

Cryptophobia commented Jul 25, 2017

@mboersma : How do I get passed these three workflow-e2e failures in the build, they do not seem to be related to the deis-controller changes here?

lshemesh added a commit to lshemesh/controller-sdk-go that referenced this pull request Jul 28, 2017
Introducing lifecycle hooks into Deis workflow requires
that these types be added to config. This change is required
in order to make further changes to deiscli and in conjunction
with deis/controller#1311
@mboersma mboersma added this to the v2.18 milestone Aug 1, 2017
@codecov-io
Copy link

codecov-io commented Aug 9, 2017

Codecov Report

Merging #1311 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1311   +/-   ##
=======================================
  Coverage   86.84%   86.84%           
=======================================
  Files          45       45           
  Lines        3944     3944           
  Branches      682      682           
=======================================
  Hits         3425     3425           
  Misses        348      348           
  Partials      171      171

@Cryptophobia
Copy link
Contributor Author

The remote upstream/master was merged on top of the branch rather than rebase. Is that okay?

@mboersma
Copy link
Member

Is that okay?

The project has preferred git rebase just to keep merge commits at a minimum, but no worries--not a blocker.

Looks like Jenkins failed this randomly. I'll run it again and 🤞.

@Cryptophobia
Copy link
Contributor Author

Cryptophobia commented Aug 15, 2017

@mboersma : Looks like the build is still stuck in pending? It looks like it passed when you view the text output log.

@Cryptophobia
Copy link
Contributor Author

How do I get this one passed as well? Looks like it failed because of a network issue related to ?missing namespace? in the Kubernetes cluster?

@mboersma
Copy link
Member

mboersma commented Sep 4, 2017

Jenkins, test this please.

@Cryptophobia
Copy link
Contributor Author

Jenkins, will you please pass this? Jenkins, no don't eat that off the floor! Jenkins, sit! Jenkins, be nice to me and I'll give you a cookie. 🍪 🐩

Looks like it failed because the Jenkins server could not create the "deis" user group. Seems like a server error. @mboersma , what do you think?

adduser: `/usr/sbin/groupadd -g 106 deis' returned error code 10. Exiting.

@mboersma mboersma removed this from the v2.18 milestone Sep 7, 2017
@Cryptophobia
Copy link
Contributor Author

This PR has been recreated for the https://github.com/deisthree fork here: teamhephy/controller#3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants