-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add an ability to specify entrypoint for kube and openshift tool in Devfile #12693
Comments
Do you have an idea of how you want to define it in devfile? |
@l0rd Also it would be nice to see a use-case description here, with an example, motivation, etc. |
As about format, it may be like the following ---
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: Pod
metadata:
name: petclinic
labels:
app.kubernetes.io/name: petclinic
app.kubernetes.io/component: webapp
app.kubernetes.io/part-of: petclinic
spec:
containers:
- name: server
image: mariolet/petclinic
- name: mysql
image: centos/mysql-57-centos7 specVersion: 0.0.1
name: che-in-che
tools:
- name: che-dev
type: kubernetes
local: .che-dev.yaml
entrypoints:
- pod: petclinic \\ pod or deployment name. Is optional if local file contains only one pod/deployment
container: server \\ cointainer name. Is optional if pod/deployment contains one container
command:
arg: WDYT? |
Both pod and container could be optional if local YAML contains just a single pod with a single container which is common practice. |
@garagatyi Makes sense. Fixed the proposal. |
@sleshchenko I have updated the description using your proposal |
@l0rd You specified
Do you think it should be always optional? What should we do if tool has multiple pods/containers?
? |
@sleshchenko yeah. I mean, from the point of view of the devfile syntax it should be optional. From a semantics point of view I am perfectly +1 with your proposal and there may be other cases like this one (i.e. if a user specify |
@l0rd In #12856 I've added a couple more options to filter the containers by namely:
The thinking behind this is that it is feasible to think that 2 different deployments may have pods with the same As for the missing So all in all, the entrypoint can look like this: entrypoints:
- deployment: che
pod: che-host
container: che
command: ['sleep', 'infinity']
- deploymentSelector:
app: che
pod: postgres
args: ['-h', '0.0.0.0']
- podSelector:
.... Still, it is possible to use the simplied version of: endpoints:
- command: ['sleep', 'infinity'] in which case the command would be applied to all containers in the kubernetes list. I specifically chose not to throw any kind of error if the "filter" matches more than 1 container because that could actually be what user wanted. Do you think that is a reasonable thing to do? |
That makes sense and is very exhaustive! Great job @metlos. When you are done with the PR please remember to add those bits in the devfile documentation or all your great work will be difficult to use. |
So after a lengthy discussion with @sleshchenko that cleared up some of my misconceptions about the kubernetes model and the complexity that can or cannot arise, we arrived at a simpler model that I would like to agree on. It is very similar to the originally agreed upon proposal #12693 (comment) but has clarified semantics and in our opinion clearer naming. The most important finding is that it doesn't make sense to apply the selectors and name matching on any nested objects, just on the top level ones in the list (lists cannot nest and we don't handle lists of templates yet). If we'd like to for example match on labels of a pod template of a deployment (i.e. on a nested object), it is equivalent to matching on the name of the parent deployment (which needs to be unique). This is actually the only "drawback" of the proposal - a single declaration that would match on the pod template labels will now have to be repeated for each deployment (unless the same could be achieved by matching on the parent deployment's labels, which seems like a reasonable scenario). So the simplified matching model looks like this: entrypoints:
- parentName: <the name of the top level object to consider when looking for containers>
parentSelector: <selector for the labels of the top level object>
containerName: <the name of the container to apply the entrypoint to>
command: <the command>
args: <the args>
- ... Of course, the simpliest version still is: entrypoints:
- command: ... @l0rd wdyt? |
👍 |
PR #12856 has been merged. |
Description
@sleshchenko proposal for the format:
Applying that to a devfile that uses yamls from Kubernetes Node.js and MongoDB sample:
The text was updated successfully, but these errors were encountered: