openshift / ocm-container

Containerized environment for accessing OpenShift v4 clusters, packing necessary tools/scripts
Apache License 2.0
10 stars 63 forks source link

Discussion: --entrypoint vs dedicated `exec` command? #269

Open iamkirkbater opened 3 months ago

iamkirkbater commented 3 months ago

I was going through the readme for the new Golang version and I'm wondering if as an alternative to the --entrypoint logic we could add an explicit subcommand: ocm-container exec

Idea for usage would be something like this (using the same command as the README:

ocm-container exec -C $CLUSTER_ID -- ls -lah

Ideally this would function the same as the --entrypoint functionality as written today, but would (IMO) lead to more readable scripts if you are doing something that requires you to run this across multiple clusters and multiple ocm-container instances.

By default, exec would not create an interactive session, it would be a oneshot. For an interactive session we could consider using the -it flags, but I'd personally argue that we should not use those flags and if you require an interactive session then the root command itself should be used.

I'm opening this as a discussion and hoping to hear thoughts and comments here :D

Thanks!

clcollins commented 3 months ago

I think the --exec flag, particularly with the --headless flag you asked for earlier covers this case.

I think a subcommand might be overkill and probably more effort to maintain, but I think we can get --exec working the way you'd like.

I want to keep entrypoint and CMD working, though. There's value in this behaving like a standard container too. I think we can do both.

openshift-bot commented 4 days ago

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale