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

odo should automatically create url for previewUrl #2858

Closed
4 tasks
kadel opened this issue Apr 9, 2020 · 12 comments
Closed
4 tasks

odo should automatically create url for previewUrl #2858

kadel opened this issue Apr 9, 2020 · 12 comments
Labels
area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. area/openshift Issues or PRs related to OpenShift kind/user-story An issue of user-story kind lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/Medium Nice to have issue. Getting it done before priority changes would be great. triage/needs-information Indicates an issue needs more information in order to work on it. v2 Issue or PR that applies to the v2 of odo

Comments

@kadel
Copy link
Member

kadel commented Apr 9, 2020

/kind user-story

User Story

As a user I want to just run odo push after cloning project with devfile.yaml in the project root and have the project running and accessible in the cluster, without executing any other command.

Acceptance Criteria

  • odo push should automatically create URL for any previewUrl defined in devfile.yaml
  • Url should be by default represented by Route on OpenShift and by Ingress on Kuberenetes (Add option to create Route instead of Ingress #2727)
  • odo push against k8s cluster with devfile that has previewUrl should show a warning listing all previewUrl ports and inform user that she/he needs to use odo url create command to specify host for URL
  • odo push --ignorePreviewUrl should ignore all previewUrl in the devfile. No Ingress or Route will be auto-created based on the previewUrls in devfile.yaml

Notes

PreviewUrl documentation https://github.com/redhat-developer/devfile/blob/master/docs/devfile.md#previewurl

  • This might be possible just for OpenShift, and for Kubernetes, the Ingress host might be required.
  • What to do for Kubernetes than?
    • Options:
      • fail and tell the user to run odo url create --port 9080 --host mycluster.example.com ?
      • ignore preview and tell user to run odo url create with --host to create url?

Example:
For the following devfile, odo push should automatically create URL for port 9080

apiVersion: 1.0.0
metadata:
  generateName: openLiberty
attributes:
  odo.autorestart: "false"
projects:
  - name: openLiberty
    source:
      type: git
      location: https://github.com/rajivnathan/openLiberty.git
components:
  - alias: devruntime
    mountSources: true
    type: dockerimage
    image: jeevandroid/open-liberty-dev:latest
    memoryLimit: 768Mi
    volumes:
      - name: m2
        containerPath: /home/user/.m2
    endpoints:
      - name: 9080/tcp
        port: 9080
      - name: 9443/tcp
        port: 9443
commands:
  - actions:
      - command: /artifacts/bin/build.sh
        component: devruntime
        type: exec
        workdir: /projects/openLiberty
    name: devBuild
  - name: devRun
    previewUrl:
      port: 9080
      path: /
    actions:
      - type: exec
        command: /artifacts/bin/run.sh
        component: devruntime
        workdir: /projects/openLiberty

/kind user-story
/area OpenShift
/area url
/area devfile
/priority medium

@openshift-ci-robot openshift-ci-robot added kind/user-story An issue of user-story kind area/openshift Issues or PRs related to OpenShift area/url area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. labels Apr 9, 2020
@johnmcollier
Copy link
Member

I'm in favour of option #2 for Kube:

  • If a preview URL is set in the devfile, and the user hasn't already run odo url create ..., then we tell them to run it after odo push completes.

What about also adding --host and --port flags to odo push? Then the user could specify them during their first odo push, if they wish.

@kadel
Copy link
Member Author

kadel commented Apr 14, 2020

  • If a preview URL is set in the devfile, and the user hasn't already run odo url create ..., then we tell them to run it after odo push completes.

+1

What about also adding --host and --port flags to odo push? Then the user could specify them during their first odo push, if they wish.

I was thinking about that.
But I'm afraid that it would get too complicated. For example, there might be multiple previewUrls in a devfile. Plus I would like to be a little bit careful with adding flags to odo push as it could get quickly out of the hands.
Much better is to have --now flag in most of the commands. When used it will execute push action automatically. For example, you can do odo url create --now instead of odo url create; odo push

@openshift-ci-robot openshift-ci-robot added the priority/Medium Nice to have issue. Getting it done before priority changes would be great. label Apr 14, 2020
@girishramnani girishramnani added the triage/needs-information Indicates an issue needs more information in order to work on it. label Apr 20, 2020
@girishramnani girishramnani changed the title odo should automaticaly create url for previewUrl odo should automatically create url for previewUrl Apr 20, 2020
@mik-dass
Copy link
Contributor

But I'm afraid that it would get too complicated. For example, there might be multiple previewUrls in a devfile. Plus I would like to be a little bit careful with adding flags to odo push as it could get quickly out of the hands.
Much better is to have --now flag in most of the commands. When used it will execute push action automatically.

+1

@kadel @girishramnani Should we save this previewURL in the env.yaml file before push? Also what if the previewURL port is not exposed by the component? Should we fail or ignore?

@girishramnani
Copy link
Contributor

girishramnani commented Apr 23, 2020

blocked on #2885

@kadel
Copy link
Member Author

kadel commented May 7, 2020

Should we save this previewURL in the env.yaml file before push?

If needed we can save some information there.

Also what if the previewURL port is not exposed by the component? Should we fail or ignore?

Not sure to be honest. We might have to check the devfile spec if this is valid or verify what Che does in this situation.

@kadel
Copy link
Member Author

kadel commented May 7, 2020

One possible way how this could be implemented is:

when using OpenShift:

when odo push detects that there is a previewURL present in the devfile (this needs to happen early in the process) it does the equivalent of odo url create --port <previewURL.port> (saves the information to the env.yaml) and then continues with the normal odo push process

when using Kubernetes:

when odo push detects that there is a previewURL present in the devfile (this needs to happen early in the process) it shows the warning message: "previewURL for port is defined in devfile, but it cannot be automatically created. Please use 'odo url create' command to create url"

when using Docker:

when odo push detects that there is a previewURL present in the devfile (this needs to happen early in the process) it does the equivalent of odo url create --port <previewURL.port> (saves the information to the env.yaml) and then continues with the normal odo push process

When doing the equivalent of odo url create --port <previewURL.port> for OpenShift or Docker, the URL name should be autogenerated based on the rules that we normally have. If there is a conflict with URL that is already defined in env.yaml, odo puh should just show a warning and skip url creation

@mik-dass
Copy link
Contributor

@kadel I also feel the creation of previewURL should be done only on the first push.

odo create nodejs
odo push
// preview URL created of route kind
odo url delete <name> -f
odo url create <new-name> --ingress --host com
odo push

In this scenario odo push shouldn't create the preview URL again. So I guess it's best to only create preview URLs only during first push.

Also on a openshift cluster

odo create nodejs
odo url create <new-name> --ingress --host com
odo push
// preview URL created of route kind

So we should detect if a URL already exists for a certain port and avoid creation of preview URLs.

@kadel
Copy link
Member Author

kadel commented May 11, 2020

@kadel I also feel the creation of previewURL should be done only on the first push.

I would actually be ok if it creates url again. If It is defined in devfile it should be created. If someone wants to really delete the URL then it should be deleted from devfile.yaml

Otherwise, you will have problems when someone adds previewUrl into devfile.yaml after it was pushed.

odo create nodejs
odo push
// preview URL created of route kind
odo url delete <name> -f
odo push
# the url should be recreated

So we should detect if a URL already exists for a certain port and avoid creation of preview URLs.

Yes

@openshift-bot
Copy link

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

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 11, 2020
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

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

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci-robot openshift-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 10, 2020
@openshift-bot
Copy link

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci-robot
Copy link
Collaborator

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@rm3l rm3l added the v2 Issue or PR that applies to the v2 of odo label Jun 16, 2023
@rm3l rm3l added this to odo Project Jun 16, 2023
@rm3l rm3l moved this to Done ✅ in odo Project Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. area/openshift Issues or PRs related to OpenShift kind/user-story An issue of user-story kind lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/Medium Nice to have issue. Getting it done before priority changes would be great. triage/needs-information Indicates an issue needs more information in order to work on it. v2 Issue or PR that applies to the v2 of odo
Projects
Archived in project
Development

No branches or pull requests

7 participants