Git Product home page Git Product logo

redhat-developer / odo Goto Github PK

View Code? Open in Web Editor NEW
780.0 40.0 243.0 216.62 MB

odo - Developer-focused CLI for fast & iterative container-based application development on Podman and Kubernetes. Implementation of the open Devfile standard.

Home Page: https://odo.dev

License: Apache License 2.0

Makefile 0.32% Go 83.66% Shell 1.95% C# 0.04% JavaScript 0.23% Java 0.10% Python 0.01% Dockerfile 0.07% PowerShell 0.10% HTML 9.13% CSS 0.18% TypeScript 4.21%
golang openshift kubernetes go developer-experience developer-tool developer-tools podman containers devfiles

odo's Introduction

odo - Fast, Iterative and Simplified container-based application development

GitHub release License Godoc Netlify Status

logo

Overview

odo is a fast, and iterative CLI tool for container-based application development. It is an implementation of the open Devfile standard, supporting Podman, Kubernetes and OpenShift.

Why use odo?

  • Easy onboarding: By auto-detecting the project source code, you can easily get started with odo.
  • No cluster needed: With Podman support, having a Kubernetes cluster is not required to get started with odo. Using a common abstraction, odo can run your application on Podman, Kubernetes or OpenShift.
  • Fast: Spend less time maintaining your application deployment infrastructure and more time coding. Immediately have your application running each time you save.
  • Standalone: odo is a standalone tool that communicates directly with the container orchestrator API.
  • No configuration needed: There is no need to dive into complex Kubernetes YAML configuration files. odo abstracts those concepts away and lets you focus on what matters most: code.
  • Containers first: We provide first class support for Podman, Kubernetes and OpenShift. Choose your favourite container orchestrator and develop your application.
  • Easy to learn: Simple syntax and design centered around concepts familiar to developers, such as projects, applications, and components.

Learn more about the features provided by odo on odo.dev.

Demo

odo-preview-with-podman.hd.webm

Installing odo

Please check the installation guide on odo.dev.

Official documentation

Visit odo.dev to learn more about odo.

Community, discussion, contribution, and support

Chat

All of our developer and user discussions happen in the #odo channel on the official Kubernetes Slack.

If you haven't already joined the Kubernetes Slack, you can invite yourself here.

Ask questions, inquire about odo or even discuss a new feature.

Issues

If you find an issue with odo, please file it here.

Contributing

  • Code: We are currently working on updating our code contribution guide.
  • Documentation: To contribute to the documentation, please have a look at our Documentation Guide.

We are an open community who welcomes any concerns, changes or ideas for odo! Come join the chat and hang out, ask or give feedback and just generally have a good time.

Meetings

All our calls are open to public. You are welcome to join any of our calls.

You can find the exact dates of all scheduled team calls together with sprint dates in the google calendar (iCal format).

Legal

License

Unless otherwise stated (ex. /vendor files), all code is licensed under the Apache 2.0 License.

Usage data

When odo is ran for the first time, you will be asked to opt in to Red Hat's telemetry collection program.

With your approval, odo will collect pseudonymized usage data and send it to Red Hat servers to help improve our products and services. Read our privacy statement to learn more about it. For the specific data being collected and to configure this data collection process, see Usage data.

odo's People

Contributors

amitkrout avatar anandrkskd avatar anmolbabu avatar ashetty1 avatar cdrage avatar concaf avatar danielhelfand avatar dependabot[bot] avatar dharmit avatar feloy avatar geekarthur avatar geoand avatar girishramnani avatar github-actions[bot] avatar jgwest avatar jichenjc avatar johnmcollier avatar kadel avatar maysunfaisal avatar metacosm avatar mik-dass avatar mohammedzee1000 avatar preeticp avatar prietyc123 avatar rm3l avatar rnapoles-rh avatar surajnarwade avatar syamgk avatar valaparthvi avatar zhengxiaomei123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

odo's Issues

Build a `oc` wrapper library of sorts

We need to build a wrapper around the oc commands that we will frequently use instead of always execing to oc.
Ideal case would be to use https://github.com/openshift/client-go, but AFAIK it does have support for all the oc commands, so till happens, we will need a wrapper which we can easily replace later on.

This could very well be a different package or even a project outside which we simply import.

implement `component create`

component create <component_type> [component_name] [--app app_name] [--binary binary_path] [--git git_url] [--dir directory]

component_type is a type of the application such as php, nodejs, python etc…., or it can be mongodb, mariadb etc…
component_name - is an optional parameter, its value defaults to the component_type value,
Component is created in context of current application by default
--app is set than component is created in context of application set by this parameter

add proper documentation

Documentation
We should be providing documentation for installing ocdev to cover:

  • Pre-requisities
  • Download and Installing: MacOS, Windows, Linux
  • Verify your installation
  • Getting started - @containscafeine
  • Update ocdevcli
  • Troubleshooting
  • Uninstallation

parent issue: #70

An application should not map to a project

Looking at the output and source code, it looks like an application is mapped to a project.

$ oc get project
NAME                  DISPLAY NAME   STATUS
devconfcz18                          Active
labs                                 Active
samplelabs                           Active
the-lounge-jmorales                  Active

$ ocdev application list
devconfcz18
labs
samplelabs
the-lounge-jmorales

As can be inferred from "Use case 14: As a developer, I want to list all applications in my project" an OpenShift project can have multiple applications.

`ocdev component push` should push contents of current directory, but it fails

$ ocdev component push -v                                        
DEBU[0000] component push called                               
DEBU[0000] No component name passed, assuming current component                                                                
DEBU[0000] getOcBinary - searching for oc binary               
DEBU[0000] envKubectlPluginCaller =                            
                               
DEBU[0000] envOcBin =          
                                                               
DEBU[0000] using oc from PATH                                  
DEBU[0000] using oc from %s/usr/bin/oc                         
DEBU[0000] running oc command with arguments: /usr/bin/oc project                                                              
                               
DEBU[0000] getOcBinary - searching for oc binary               
DEBU[0000] envKubectlPluginCaller =                            
                               
DEBU[0000] envOcBin =          
                                                               
DEBU[0000] using oc from PATH                                  
DEBU[0000] using oc from %s/usr/bin/oc                         
DEBU[0000] running oc command with arguments: /usr/bin/oc project -q                                                           
                               
pushing changes to component: nodejs                           
DEBU[0000] getOcBinary - searching for oc binary               
DEBU[0000] envKubectlPluginCaller =                            
                               
DEBU[0000] envOcBin =          
                                                               
DEBU[0000] using oc from PATH                                  
DEBU[0000] using oc from %s/usr/bin/oc                         
DEBU[0000] running oc command with arguments: /usr/bin/oc start-build nodejs --follow --from-dir                               
                               
failed to push component: nodejs

implement catalog search

We can use queries like oc new-app --search --image-stream=httpd to implement ocdev component search <component name>

implement `application create`

Because there is nothing that can represent the application in openshift we need to create something.

First we should figure out where we will keep application metadata and also context of active application.

It can be either client side (in config files in directory like ~/.ocdev/<application_name>).

Or it could be in cluster using CRD. We could take inspiration form Kubernetes Application API proposal, and use something like this:

apiVersion: ocdev.apps.openshift.com/v1beta1
Kind: Application
metadata:
  name: wordpress
spec:
  components:
    - wordpress-mysql-hsvc:
        version: v1
        kind: Service
    - wordpress-mysql:
        group: apps
        version: v1
        kind: StatefulSet
    - wordpress-webserver-hsvc:
        version: v1
        kind: Service
    - wordpress-webserver-svc:
        version: v1
        kind: Service
    - wordpress-mysql:
        group: apps
        version: v1
        kind: StatefulSet
    - wordpress-webserver:
        group: apps
        version: v1
        kind: StatefulSet

Simple `ocdev` installation/update/uninstallation

Goal

The goal of this epic is to provide a simple installation flow for ocdev as well as update and uninstallation.
While the installation might not be difficult, we should make it really simple so the users could (ideally) install ocdev with a single instruction line.

Description

Getting Started

We need to think about the getting started experience of the end-user with ocdev and try to provide the best first experience. This implies a certain requirements on how the user can install ocdev as well as a flow in the documentation to help the user to quickly ramp up.

The installation of ocdev is requiring some pre-requisites that we need to document.

Once those pre-requisites are installed, we should be looking at how we can simplify the installation of ocdev. For example, on MacOS, we could be using homebrew packages, on Linux we could install from a single command line wget -qO- https://github.com/redhat-developer/ocdev/master/blob/install-ocdev.sh | sh . This should be properly documented too.

After having proceed of the installation, we should guide the user to verify that ocdev has been properly installed.

Now that ocdev is ready, we should provide a default basic set of first commands, something like:

  • oc login
  • ocdev application create first-app
  • ocdev component create nodejs
  • ocdev ocdev component create --git https://github.com/openshift/nodejs-ex
  • ocdev component push

Staying up to date

How do we handle the updates of ocdev ? Could we be looking at different solutions so that ocdev keep itself automatically up to date?
To start, we can just put a warning to notify the user that there is a new version of ocdev available, and point to the installation/upgrade documentation.

Troubleshooting

What happens when the developer is hitting some issues? Can we provide different DEBUG information when interacting with the OpenShift API?

Uninstallation

We need to provide a way for the developer to properly uninstall ocdev.
If ocdev was installed with homebrew, we can have an uninstall command.
We should provide proper set of instructions to delete on Linux and Windows too.

Documentation

We should be providing documentation for installing ocdev to cover:

  • Pre-requisities
  • Download and Installing: MacOS, Windows, Linux
  • Verify your installation
  • Getting started
  • Update ocdevcli
  • Troubleshooting
  • Uninstallation

Sub Tasks

  • Create Homebrew package - #69
  • show warning when user is running older ocdev version -  #71
  • Create installation bash script #74
  • add proper documentation #75
  • [ ]
  • [ ]
  • [ ]

Labels for app and component should be the standard

When creating applications on OpenShift/K8S, there's currently one label that is standard "app" and that the OpenSHift UI uses to group components that belong to the same application. OpenShift/K8S are trying to standardize on other labels, (e.g. component), and this should be used, so that the application is properly visualized, and in the future, managed with other tools.

I have created an application called devconfcz18 and then a component called httpd.

This are the labels set on the deployment:
screen shot 2018-02-13 at 17 08 44

And this is what can be seen in the Overview.
screen shot 2018-02-13 at 17 12 35

As can be seen in the second image, OpenShift identifies the application as "httpd" and not as "devconfcz18"

Verify the cluster that you're trying to work with is up

As the tool relies on "oc" command, it can happen that a developer uses "ocdev" with a context selected in .kube/config of a cluster not accesible. A check should be made, or this error should be properly captured and reported.

$ ocdev application list
unable to list applications: unable to get projects: command: [/usr/local/bin/oc get project -o custom-columns=NAME:.metadata.name] failed to run:
Unable to connect to the server: dial tcp 192.168.64.40:8443: i/o timeout
: exit status 1

Create installation bash script

We should have bash script that takes care of installing ocdev in your $PATH. It also determines if oc binary is present or not, and installs it if absent.

add project commads

ocdev project create <project_name>
ocdev project set <project_name>
ocdev project

project maps to normal openshift project

fix broken build as side effect of `ocdev component create --dir`

ocdev component create nodejs --dir=... or any other component with --dir will return a build that fails and another one that passes. This is how the code has been implemented because we first need to run oc new-app nodejs~temp-dir and that directory has no code. This means that the first build will fail. And then we run the second build using oc start-build --from-dir.
This is done because there is no way in oc new-app cannot take local source code as input but instead detected the origin remote from the given repo as input and then pulls it and deploys it.

The output looks like -

$ oc get pods
NAME             READY     STATUS      RESTARTS   AGE
nodejs-1-build   0/1       Error       0          1m
nodejs-1-vst86   1/1       Running     0          1m
nodejs-2-build   0/1       Completed   0          1m

This is not a good user experience.
We need to either remove the extra build in ocdev, or we need a better way of implementing this.

Deleting a component should unset it as well, if set

$ ocdev component delete httpd
buildconfig "httpd" deleted
imagestream "httpd" deleted
deploymentconfig "httpd" deleted
pod "httpd-1-lrqlp" deleted
service "httpd" deleted

$ ocdev component get
The current component is: httpd

"ocdev application get" fails when current_context don't have a namespace

If there's no project selected, which can happen if the entry in .kube/config for the context defined by the current_context is empty, there's an error:

$ ocdev application get
unable to get the active application: unable to get current project name: command: [/Users/jmorales/repositories/jorgemoralespou/openshift-evangelists/oc-login.git/oc-origin project -q] failed to run:
error: no project has been set
: exit status 1

implement `application get`

app get [--short]

app get
Display message: "You are currently working on the XYZ application"

app get --short
display just application name nothing else

(use-case 7)

implement `ocdev url` to create routes

This is needed quite a lot right now, since demoing the tool to someone should not require running any oc commands but right now we need to do an ocdev expose service <service name>

Make ocdev version also get OpenShift version

When we run ocdev version, it should also get the version of OpenShift client and server.
Will help in troubleshooting and determining if it's being used with the compatible versions or not.

Interactive mode

Goals

Interactive mode for ocdev would be particularly interesting. When a developer is new to the CLI, he does not necessarily know what are the different commands and options.
The interactive mode would help and guide the user to provide the right commands and options.

Enable/Disable options

The interactive mode for ocdev should be unactivable.
We should enable the interactive mode by default, but have options to disable it so that the

Sub-tasks

  • Study how to provide interactive mode in ocdev
  • #1272

`ocdev application` story

So, right now we have ocdev application create which creates a new application and binds it to the current project.
We should have the following behavior as well -
ocdev application ___

  • <name> - sets the given application as the current application #128
  • list - lists all the applications
  • get - gets the currently active application #23
  • delete - deletes the given application

There is no command "ocdev push" but "ocdev component push"

"Use case 24: As a developer, I want to be able to push local directory contents or a binary artifact." defines that:

"As a developer, I want to be able to push local directory contents or an artifact, if I have built a binary artifact that can be directly pushed. The push commands will default to push contents of the local directory, but with a flag the behaviour changes to push a binary artifact."

The push command should push whatever is set, based on the create command mode/flags. By default local directory content, but if the component has been created from a binary, it should try to push the binary.

Add component/application/service autocompletion

Description

When using the commands pointing to a particular component or application, like ocdev application delete <application_name>, it would be handy to provide autocompletion.
This way the developer can:

  • get the list of all applications / components, in case he does not have them in mind
  • fasten the interaction with the commands

component create fails in case of no directory provide

looks like it needs to handle the error properly and check required flags argument in place before calling oc binary under the hood. The current error message is not intuitive for any new users.

$ ./ocdev component create hello
command: [/home/prkumar/.minishift/cache/oc/v3.7.1/linux/oc new-app hello~/tmp/fakeSource753103845 --name hello --labels app.ocdev.developers.redhat.com=myproject,component.ocdev.developers.redhat.com=hello] failed to run:
error: Errors occurred while determining argument types:

hello~/tmp/fakeSource753103845 as a local directory pointing to a Git repository:  stat hello~/tmp/fakeSource753103845: no such file or directory

Errors occurred during resource creation:
error: no match for "hello"

The 'oc new-app' command will match arguments to the following types:

  1. Images tagged into image streams in the current project or the 'openshift' project
     - if you don't specify a tag, we'll add ':latest'
  2. Images in the Docker Hub, on remote registries, or on the local Docker engine
  3. Templates in the current project or the 'openshift' project
  4. Git repository URLs or local paths that point to Git repositories

--allow-missing-images can be used to point to an image that does not exist yet.

See 'oc new-app -h' for examples.
: exit status 1

Auto generate documentation

Since ocdev is a very CLI centric tool, it'd be great if we could somehow generate entire CLI documentation and push it on every merge. This takes away the task of manually writing docs, all we will need to do is to put in good descriptions and usages in every command we have with cobra, and we can generate the docs using that.

Cobra lets us generate markdown, man pages, etc, so we could leverage that.
https://github.com/spf13/cobra#generating-documentation-for-your-command

implement ocd push

push [component_name] [--app app_name] [--dir directory]

Push content to component
If compoenent_name is not set it uses current component
If app_name is not specified uses current application
use dir as --from-dir for oc start-build

if --dir is not set use current directory (.)

exit with an error message when `oc` isn't running

When oc cluster isn't running, we should display a proper error message that the cluster isn't up and running;

# ocdev application create
Creating application: app
unable to create application: app: unable to create new project: command: [/usr/bin/oc new-project app] failed to run:
error: Missing or incomplete configuration info.  Please login or point to an existing, complete config file:

  1. Via the command-line flag --config
  2. Via the KUBECONFIG environment variable
  3. In your home directory as ~/.kube/config

To view or setup config directly use the 'config' command.
: exit status 1

component create should fail before if directory does not exist

$ ocdev component create nodejs --dir ./nodejs-ex                                                      
--> Found image cbb7eed (5 days old) in image stream "openshift/nodejs" under tag "6" for "nodejs"                             

    Node.js 6                  
    ---------                  
    Node.js 6 available as docker container is a base platform for building and running various Node.js 6 applications and frameworks. Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

    Tags: builder, nodejs, nodejs6                             

    * A source build using binary input will be created        
      * The resulting image will be pushed to image stream "nodejs:latest"                                                     
      * A binary build was created, use 'start-build --from-dir' to trigger a new build                                        
    * This image will be deployed in deployment config "nodejs"                                                                
    * Port 8080/tcp will be load balanced by service "nodejs"  
      * Other containers can access this service through the hostname "nodejs"                                                 

--> Creating resources with label app.ocdev.developers.redhat.com=app,component.ocdev.developers.redhat.com=nodejs ...         
    imagestream "nodejs" created                               
    buildconfig "nodejs" created                               
    deploymentconfig "nodejs" created                          
    service "nodejs" created   
--> Success                    
    Build scheduled, use 'oc logs -f bc/nodejs' to track its progress.                                                         
    Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:   
     'oc expose svc/nodejs'    
    Run 'oc status' to view your app.                          

please wait, building application...                           
failed to execute oc command   
 error: stat /home/concaf/ocdev/src/github.com/redhat-developer/ocdev/nodejs-ex: no such file or directory                    

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.