odo
odo copied to clipboard
`odo dev` deletes remote resources not present in the Devfile
What type of PR is this: /kind bug /area dev
What does this PR do / why we need it:
With this PR, odo dev
now handles K8s component related changes to the Devfile. It will remove resources from the cluster that are not present in the local Devfile.
Which issue(s) this PR fixes:
Fixes #5943 Fixes #6101
PR acceptance criteria:
-
[ ] Unit test
-
[x] Integration test
-
[ ] Documentation
How to test changes / Special notes to the reviewer: 1.
odo init --devfile nodejs --name my-node-app --starter nodejs-starter
- Replace the devfile.yaml with content below.
devfile.yaml
commands:
- exec:
commandLine: npm install
component: runtime
group:
isDefault: true
kind: build
hotReloadCapable: false
workingDir: ${PROJECT_SOURCE}
id: install
- exec:
commandLine: npm start
component: runtime
group:
isDefault: true
kind: run
hotReloadCapable: false
workingDir: ${PROJECT_SOURCE}
id: run
- exec:
commandLine: npm run debug
component: runtime
group:
isDefault: true
kind: debug
hotReloadCapable: false
workingDir: ${PROJECT_SOURCE}
id: debug
- exec:
commandLine: npm test
component: runtime
group:
isDefault: true
kind: test
hotReloadCapable: false
workingDir: ${PROJECT_SOURCE}
id: test
components:
- container:
args:
- tail
- -f
- /dev/null
dedicatedPod: false
endpoints:
- name: http-node
secure: false
targetPort: 3000
image: registry.access.redhat.com/ubi8/nodejs-16:latest
memoryLimit: 1024Mi
mountSources: true
name: runtime
- name: my-node-app-app-cluster-sample
kubernetes:
inlined: |
apiVersion: servicebinding.io/v1beta1
kind: ServiceBinding
metadata:
name: my-node-app-app-cluster-sample
spec:
workload:
apiVersion: apps/v1
kind: Deployment
name: my-node-app-app
service:
apiVersion: postgresql.k8s.enterprisedb.io/v1
kind: Cluster
name: cluster-sample
- name: deploy-k8s-resource
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: registry.access.redhat.com/ubi8/nodejs-12:1-36
resources:
limits:
memory: "128Mi"
cpu: "500m"
metadata:
description: Stack with Node.js 16
displayName: Node.js Runtime
icon: https://nodejs.org/static/images/logos/nodejs-new-pantone-black.svg
language: javascript
name: my-node-app
projectType: nodejs
tags:
- NodeJS
- Express
- ubi8
version: 2.0.0
schemaVersion: 2.1.0
starterProjects:
- git:
remotes:
origin: https://github.com/odo-devfiles/nodejs-ex.git
name: nodejs-starter
- After you run the command below, ensure that
odo dev
detects the change, and removes ServiceBinding.v1beta1.servicebinding.io from the cluster.
odo remove binding --name my-node-app-cluster-sample
- Remove the deployment K8s component from devfile.yaml, and ensure that
odo dev
detects it and removes it from the cluster.
Deploy Preview for odo-docusaurus-preview ready!
Name | Link |
---|---|
Latest commit | 0afa07367a97e7e6a6eff3656c3ff563097cbc07 |
Latest deploy log | https://app.netlify.com/sites/odo-docusaurus-preview/deploys/637751ba84716300095d1d83 |
Deploy Preview | https://deploy-preview-6189--odo-docusaurus-preview.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
Unit Tests on commit 2b7f9d878fcbfa72a98ea2eda1568fd48a9dd0d9 finished successfully. View logs: TXT HTML
Validate Tests on commit 2b7f9d878fcbfa72a98ea2eda1568fd48a9dd0d9 finished successfully. View logs: TXT HTML
Windows Tests (OCP) on commit 2b7f9d878fcbfa72a98ea2eda1568fd48a9dd0d9 finished successfully. View logs: TXT HTML
Kubernetes Tests on commit 2b7f9d878fcbfa72a98ea2eda1568fd48a9dd0d9 finished successfully. View logs: TXT HTML
OpenShift Tests on commit 2b7f9d878fcbfa72a98ea2eda1568fd48a9dd0d9 finished successfully. View logs: TXT HTML
OCP failure seems flaky:
Summarizing 1 Failure:
[FAIL] odo dev command tests port-forwarding for the component when devfile has single endpoint when running odo dev when modifying memoryLimit for container in Devfile [BeforeEach] should expose the endpoint on localhost
Timed out after 180.000s.
Expected
<string>: âš Pod is Terminating
✗ Finished executing the application (command: devrun) [38s]
âš No pod exists
âš Pod is Pending
✓ Pod is Running
• Syncing files into the container ...
✓ Syncing files into the container [586ms]
cat: /opt/odo/.odo_cmd_devrun.pid: No such file or directory
• Building your application in container on cluster (command: devbuild) ...
✓ Building your application in container on cluster (command: devbuild) [4s]
• Executing the application (command: devrun) ...
44
0
44
0
- Forwarding from 127.0.0.1:40247 -> 3000
↪ Dev mode
Keyboard Commands:
[Ctrl+c] - Exit and delete resources from the cluster
[p] - Manually apply local changes to the application on the cluster
To satisfy at least one of these matchers: [%!s(*matchers.ContainSubstringMatcher=&{Pushing files... []}) %!s(*matchers.ContainSubstringMatcher=&{Updating Component... []})]
In [BeforeEach] at: /go/odo_1/tests/helper/helper_run.go:53
/retest
/retest
/retest Flaky test.
/approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: feloy
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [feloy]
Approvers can indicate their approval by writing /approve
in a comment
Approvers can cancel approval by writing /approve cancel
in a comment
@rm3l I've attempted to implement parallel resource deletion, but I cannot say for sure if it is working as expected. I'll leave it to you to test the functionality.
Also, locally I am seeing the following error in my IDE
Cannot use '(*Adapter)(nil)' (type *Adapter) as the type ComponentAdapter Type does not implement 'ComponentAdapter' as some methods are missing: Push(parameters adapters.PushParameters, componentStatus *watch.ComponentStatus) error
Can you confirm if you too are seeing it ? I am using Go 1.18 locally.
For parallel deletion, you can use WaitGroups: https://gobyexample.com/waitgroups
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
1 Code Smell
No Coverage information
0.4% Duplication
@valaparthvi: The following test failed, say /retest
to rerun all failed tests or /retest-required
to rerun all mandatory failed tests:
Test name | Commit | Details | Required | Rerun command |
---|---|---|---|---|
ci/prow/v4.11-integration-e2e | 0364cc8800d3e5d9c677bfed65a7eff0aad19b83 | link | true | /test v4.11-integration-e2e |
Full PR test history. Your PR dashboard.
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. I understand the commands that are listed here.
@rm3l I've attempted to implement parallel resource deletion, but I cannot say for sure if it is working as expected. I'll leave it to you to test the functionality.
Also, locally I am seeing the following error in my IDE
Cannot use '(*Adapter)(nil)' (type *Adapter) as the type ComponentAdapter Type does not implement 'ComponentAdapter' as some methods are missing: Push(parameters adapters.PushParameters, componentStatus *watch.ComponentStatus) error
Can you confirm if you too are seeing it ? I am using Go 1.18 locally.
I didn't see this error. Are you still seeing it?
@rm3l I've attempted to implement parallel resource deletion, but I cannot say for sure if it is working as expected. I'll leave it to you to test the functionality. Also, locally I am seeing the following error in my IDE
Cannot use '(*Adapter)(nil)' (type *Adapter) as the type ComponentAdapter Type does not implement 'ComponentAdapter' as some methods are missing: Push(parameters adapters.PushParameters, componentStatus *watch.ComponentStatus) error
Can you confirm if you too are seeing it ? I am using Go 1.18 locally.
I didn't see this error. Are you still seeing it?
Not on Go1.17
NoCluster Tests on commit 2b7f9d878fcbfa72a98ea2eda1568fd48a9dd0d9 finished successfully. View logs: TXT HTML
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
1 Code Smell
No Coverage information
0.4% Duplication
/test v4.11-integration-e2e
/override ci/prow/v4.11-integration-e2e
@feloy: Overrode contexts on behalf of feloy: ci/prow/v4.11-integration-e2e
In response to this:
/override ci/prow/v4.11-integration-e2e
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.