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

Investigate what actions should be taken in order to deploy component without "odo deploy" #4482

Open
lgrossma opened this issue Sep 18, 2024 · 3 comments
Assignees

Comments

@lgrossma
Copy link
Contributor

No description provided.

@lgrossma lgrossma self-assigned this Sep 18, 2024
@lgrossma lgrossma moved this to 📋 Backlog in IDE Cloudaptors Sep 18, 2024
@lgrossma
Copy link
Contributor Author

lgrossma commented Oct 9, 2024

Odo deploy basically consists of 2 steps - build the application and creating a deployment (probably more steps could be added if needed). The deploy command has to be defined in a devfile.

Build step:

  1. The user must have a defined Dockerfile
  2. Upon calling odo deploy the odo first builds a docker image locally (using podman/docker) as defined in the Dockerfile
  3. The image is pushed into a registry (The user must setup this connection somehow. In odo, there is a command/setting preference set ImageRegistry $registry)

Create deployment step:

  1. The user must have a defined Deployment.yaml
  2. Odo creates a deployment based on this file

Here is how odo decides what to do based on a devfile

commands:
- apply:
    component: image-build
  id: build-image
- apply:
    component: kubernetes-deploy
  id: deployk8s
- composite:
    commands:
    - build-image
    - deployk8s
    group:
      isDefault: true
      kind: deploy
  id: deploy
components:
- image:
    dockerfile:
      buildContext: .
      rootRequired: false
      uri: Dockerfile
    imageName: nodejs-image:latest
  name: image-build
- attributes:
    deployment/container-port: 3001
    deployment/cpuRequest: 10m
    deployment/memoryRequest: 50Mi
    deployment/replicas: 1
  kubernetes:
    endpoints:
    - name: http-3001
      path: /
      secure: true
      targetPort: 3001
    uri: deploy.yaml
  name: kubernetes-deploy
metadata:
  attributes:
    alpha.dockerimage-port: 3001
  description: Stack with Node.js 18
  displayName: Node.js Runtime
  language: JavaScript
  name: nodejs-starter
  projectType: Node.js
  provider: Red Hat
  supportUrl: https://github.com/devfile-samples/devfile-support#support-information
  tags:
  - Node.js
  - Express
  - ubi8
  version: 3.0.0
parent:
  id: nodejs
  registryUrl: https://registry.devfile.io
  version: 2.2.0
schemaVersion: 2.2.0

The deploy command here is defined as

- composite:
    commands:
    - build-image
    - deployk8s
    group:
      isDefault: true
      kind: deploy
  id: deploy

First, it executes command build-image that is defined as

- apply:
    component: image-build
  id: build-image

This applies a component with name image-build that is defined by

- image:
    dockerfile:
      buildContext: .
      rootRequired: false
      uri: Dockerfile
    imageName: nodejs-image:latest
  name: image-build

Odo then uses referenced Dockerfile to build a docker image. After the build is finished, it pushes the image to a user specified repository.

Second, it executes command deployk8s, which is defined as

- apply:
    component: kubernetes-deploy
  id: deployk8s

This applies to a component with name kubernetes-deploy, that is defined by

 kubernetes:
    endpoints:
    - name: http-3001
      path: /
      secure: true
      targetPort: 3001
    uri: deploy.yaml
  name: kubernetes-deploy

Odo then uses referenced deploy.yaml file to create a Kubernetes deployment

@lgrossma lgrossma moved this from 📋 Backlog to 📝 In Progress in IDE Cloudaptors Oct 9, 2024
@lgrossma
Copy link
Contributor Author

lgrossma commented Oct 9, 2024

@vrubezhny

@lgrossma lgrossma moved this from 📝 In Progress to 👀 In review in IDE Cloudaptors Oct 18, 2024
@adietish
Copy link
Contributor

adietish commented Oct 28, 2024

@lgrossma excellent, detailed explanation. Thanks!

So afaiu to replace odo deploy we'd have to find replacements for

  • building a docker image using a user provided Dockerfile
  • Push the image to a user provided registry
  • and apply a user provided deployment.yaml to the cluster defined as the current context in kubeconf

@vrubezhny, @datho7561: can you please confirm?

ps. given the new plugin(s) we'd work on, we'd most likely stick to odo as long as possible. Still excellent to share the knowledge on what would be needed to replace it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👀 In review
Development

No branches or pull requests

2 participants