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

init-container #12

Closed
kfox1111 opened this issue Nov 13, 2016 · 5 comments
Closed

init-container #12

kfox1111 opened this issue Nov 13, 2016 · 5 comments
Assignees

Comments

@kfox1111
Copy link

I'd like to use kubernetes-entrypoint in a k8s init-container instead of embededing it in directly into each regular container. This allows unmodified containers to be used, and also allows you to restrict k8s service tokens to just the init container, enhancing security.

I think this would work well, but the current implementation in kubernetes-entrypoint.go looks to fail if command is empty:

if comm = env.SplitEnvToList("COMMAND", " "); len(comm) == 0 {
logger.Error.Printf("COMMAND env is empty")
os.Exit(1)
}

Can a feature be added to allow it to simply os.Exit(0) after deps are resolved when set so it can be used as an init-container?

@PiotrProkop
Copy link
Collaborator

Sure,

i think entrypoint should first check if it is inside init-container, if so exit(0). Otherwise exit(1).

@DTadrzak DTadrzak self-assigned this Nov 14, 2016
@PiotrProkop
Copy link
Collaborator

Until this feature is not implemented. Please use COMMAND="echo Done".

@DTadrzak
Copy link
Collaborator

Dear @PiotrProkop,
In order to implement easy check, whether instance is init-container or not, user needs to pass container-name via env. I think it's not generic approach. So what I'd suggest is to change return code to 0 and log it as a warning.
Yours sincerely
Daniel

DTadrzak added a commit to DTadrzak/kubernetes-entrypoint that referenced this issue Nov 14, 2016
…s#12)

Signed-off-by: DTadrzak <daniel.tadrzak@intel.com>
PiotrProkop pushed a commit that referenced this issue Nov 14, 2016
Trivial fix according to discussion about init-containers (#12)
@PiotrProkop
Copy link
Collaborator

Merged.

@PiotrProkop
Copy link
Collaborator

Closing due to #13 .

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

No branches or pull requests

3 participants