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 dev cannot handle additional resources created for resources present in the Devfile #6373

Closed
valaparthvi opened this issue Dec 5, 2022 · 5 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). triage/not-reproducible Indicates an issue can not be reproduced as described.

Comments

@valaparthvi
Copy link
Contributor

valaparthvi commented Dec 5, 2022

/kind bug

What versions of software are you using?

Operating System:
Fedora 35
Output of odo version:

odo v3.3.0 (c71eb5118b)

Server: https://192.168.49.2:8443
Kubernetes: v1.23.3

How did you run odo exactly?

  1. Run init
odo init --devfile nodejs --name node --starter nodejs-starter
  1. Replace the content of Devfile with the following.
Use this Devfile
commands:
- exec:
    commandLine: npm install
    component: runtime
    group:
      isDefault: true
      kind: build
    workingDir: /project
  id: install
- exec:
    commandLine: npm start
    component: runtime
    group:
      isDefault: true
      kind: run
    workingDir: /project
  id: run
- exec:
    commandLine: npm run debug
    component: runtime
    group:
      isDefault: true
      kind: debug
    workingDir: /project
  id: debug
- exec:
    commandLine: npm test
    component: runtime
    group:
      isDefault: true
      kind: test
    workingDir: /project
  id: test
- id: build-image
  apply:
    component: outerloop-build
# - id: deployk8s
#   apply:
#     component: outerloop-deploy
- id: deploy
  composite:
    commands:
      - build-image
      # - deployk8s
    group:
      kind: deploy
      isDefault: true
components:
- container:
    endpoints:
    - name: http-3000
      targetPort: 3000
    image: registry.access.redhat.com/ubi8/nodejs-14:latest
    memoryLimit: 1024Mi
    mountSources: true
    sourceMapping: /project
  name: runtime
- name: outerloop-build
  image:
    imageName: "{{CONTAINER_IMAGE}}"
    dockerfile:
      uri: ./Dockerfile
      buildContext: ${PROJECTS_ROOT}
      rootRequired: false
  
- name: outerloop-deploy
  kubernetes:
    inlined: |
      kind: Deployment
      apiVersion: apps/v1
      metadata:
        name: my-component
      spec:
        replicas: 1
        selector:
          matchLabels:
            app: node-app
        template:
          metadata:
            labels:
              app: node-app
          spec:
            containers:
              - name: main
                image: {{CONTAINER_IMAGE}}
                resources:
                  limits:
                    memory: "128Mi"
                    cpu: "500m"
      ---
      kind: Service
      apiVersion: v1
      metadata:
        name: my-component-svc
      spec:
        ports:
        - name: http-8081
          port: 8081
          protocol: TCP
          targetPort: 8081
        selector:
          app: node-app

metadata:
  description: Stack with Node.js 14
  displayName: Node.js Runtime
  icon: https://nodejs.org/static/images/logos/nodejs-new-pantone-black.svg
  language: javascript
  name: node
  projectType: nodejs
  tags:
  - NodeJS
  - Express
  - ubi8
  version: 1.0.1
schemaVersion: 2.2.0
starterProjects:
- git:
    remotes:
      origin: https://github.com/odo-devfiles/nodejs-ex.git
  name: nodejs-starter
variables:
  CONTAINER_IMAGE: quay.io/unknown-account/myimage
  1. Run odo dev.

Actual behavior

odo dev deletes Endpoints and EndpointSlice created for the Service inside outerloop-deploy Devfile component because they are not present in the Devfile, even though their related Service is.

Expected behavior

It should not try to delete the resources created for the service. It should be able to identify the resources associated with any resource present within the Devfile.

Any logs, error output, etc?

Error Output:
$  odo dev                                                                                                                  
  __                                                                                                                                    
 /  \__     Developing using the "node" Devfile                                                                                         
 \__/  \    Namespace: default                                                                                                          
 /  \__/    odo version: v3.3.0                                                                                                         
 \__/                                                                                                                                   
                                                                                                                                        
↪ Deploying to the cluster in developer mode                                                                                            
 •  Waiting for Kubernetes resources  ...                                                                                               
 ✓  Creating resource Deployment/my-component                                                                                           
 ✓  Creating resource Service/my-component-svc                                                                                          
 ⚠  Pod is Pending                                                                                                                      
 ✓  Deleting resources not present in the Devfile: Endpoints/my-component-svc, EndpointSlice/my-component-svc-4ktwz [440ms]             
 ✓  Deleting resources not present in the Devfile: EndpointSlice/my-component-svc-4qgr7, Endpoints/my-component-svc [810ms]             
 ✓  Deleting resources not present in the Devfile: Endpoints/my-component-svc [497ms] 
 ✓  Deleting resources not present in the Devfile: Endpoints/my-component-svc, EndpointSlice/my-component-svc-qnpfx [550ms]
 ✓  Pod is Running
 ✓  Deleting resources not present in the Devfile: EndpointSlice/my-component-svc-8fmcv, Endpoints/my-component-svc [473ms]
 ✓  Syncing files into the container [274ms]
 ✓  Building your application in container on cluster (command: install) [3s]
 •  Executing the application (command: run)  ...
 -  Forwarding from 127.0.0.1:40001 -> 3000


↪ Dev mode
 Status:
 Watching for changes in the current directory /tmp/nodejs-demo

 Keyboard Commands:
[Ctrl+c] - Exit and delete resources from the cluster
     [p] - Manually apply local changes to the application on the cluster
Pushing files...


File /tmp/nodejs-demo/.odo/devstate.json changed
 •  Waiting for Kubernetes resources  ...
 ✓  Deleting resources not present in the Devfile: Endpoints/my-component-svc, EndpointSlice/my-component-svc-qfswt [365ms]
 ✓  Syncing files into the container [20ms]

↪ Dev mode
 Status:
 Watching for changes in the current directory /tmp/nodejs-demo

 Keyboard Commands:
[Ctrl+c] - Exit and delete resources from the cluster
     [p] - Manually apply local changes to the application on the cluster
 ✓  Deleting resources not present in the Devfile: Endpoints/my-component-svc [301ms]
 ✓  Deleting resources not present in the Devfile: Endpoints/my-component-svc, EndpointSlice/my-component-svc-jjs5d [378ms]
@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 5, 2022
@rm3l rm3l added this to odo Project Dec 5, 2022
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. label Dec 5, 2022
@kadel kadel added the priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). label Dec 5, 2022
@kadel
Copy link
Member

kadel commented Dec 5, 2022

Isn't this duplicate to #6275 ??

@valaparthvi
Copy link
Contributor Author

Not a duplicate precisely, but an issue that I discovered while working on that issue. Even though odo manages to identify resources that are related to the Devfile, it still fails to identify related resources. For eg, creating a Service might create Endpoints or EndpointSlice, but odo fails to identify them and starts to delete them.

@github-actions
Copy link
Contributor

A friendly reminder that this issue had no activity for 90 days. Stale issues will be closed after an additional 30 days of inactivity.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 20, 2023
@github-actions
Copy link
Contributor

This issue was closed because it has been inactive for 30 days since being marked as stale.

@github-actions github-actions bot added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Aug 20, 2023
@github-project-automation github-project-automation bot moved this to Done ✅ in odo Project Aug 20, 2023
@rm3l
Copy link
Member

rm3l commented Aug 23, 2023

I just tried to see if this (High priority) issue could eventually be reopened, but I could not reproduce it using odo v3.13.0.

$ odo dev
  __
 /  \__     Developing using the "node" Devfile
 \__/  \    Namespace: default
 /  \__/    odo version: v3.13.0
 \__/

 ⚠  You are using "default" namespace, odo may not work as expected in the default namespace.
 ⚠  You may set a new namespace by running `odo create namespace <name>`, or set an existing one by running `odo set namespace <name>`

↪ Running on the cluster in Dev mode
I0823 14:08:02.332378  204897 watcher.go:69] error adding watcher for path "./Dockerfile": no such file or directory
 ✓  Web console accessible at http://localhost:20000/ 
 ✓  API Server started at http://localhost:20000/api/v1 
 ✓  API documentation accessible at http://localhost:20000/swagger-ui/ 
 •  Waiting for Kubernetes resources  ...
 ✓  Creating resource Deployment/my-component 
 ✓  Creating resource Service/my-component-svc 
 ⚠  Pod is Pending
 ✓  Pod is Running
 ✓  Syncing files into the container [133ms]
 ✓  Building your application in container (command: install) [2s]
 •  Executing the application (command: run)  ...
 ✓  Waiting for the application to be ready [1s]
 -  Forwarding from 127.0.0.1:20001 -> 3000


↪ Dev mode
 Status:
 Watching for changes in the current directory /tmp/test

Web console accessible at http://localhost:20000/

Keyboard Commands:
[Ctrl+c] - Exit and delete resources from the cluster
     [p] - Manually apply local changes to the application on the cluster
Pushing files...


File /tmp/test/server.js changed
 •  Waiting for Kubernetes resources  ...
 ✓  Syncing files into the container [110ms]
 ✓  Building your application in container (command: install) [1s]
 ✓  Finished executing the application (command: run) [33s]
 •  Executing the application (command: run)  ...
 ✓  Waiting for the application to be ready [1s]

↪ Dev mode
 Status:
 Watching for changes in the current directory /tmp/test

Web console accessible at http://localhost:20000/

Keyboard Commands:
[Ctrl+c] - Exit and delete resources from the cluster
     [p] - Manually apply local changes to the application on the cluster

Please feel free to reopen if you think otherwise.

@rm3l rm3l added triage/not-reproducible Indicates an issue can not be reproduced as described. and removed needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. labels Aug 23, 2023
@rm3l rm3l closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). triage/not-reproducible Indicates an issue can not be reproduced as described.
Projects
Archived in project
Development

No branches or pull requests

3 participants