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

Add support for parsing multiple k8s definition in a single Devfile K8s component #6372

Conversation

valaparthvi
Copy link
Contributor

What type of PR is this:
/kind feature

What does this PR do / why we need it:
This PR adds support for parsing multiple k8s resources defined inside a single yaml against a Devfile K8s component.

Which issue(s) this PR fixes:

Fixes #6275

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

odo init --devfile java-springboot --starter springbootproject --na
me java-springboot
curl https://raw.githubusercontent.com/yangcao77/devfile-sample-java-springboot-basic/b76cfc10a2211c7bf7d369407a9141c7ed6e5814/deploy.yaml -o deploy.yaml  
curl https://raw.githubusercontent.com/yangcao77/devfile-sample-java-springboot-basic/b76cfc10a2211c7bf7d369407a9141c7ed6e5814/devfile.yaml -o devfile.yaml
odo dev
kubectl get service my-java-springboot-svc

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation label Dec 5, 2022
@netlify
Copy link

netlify bot commented Dec 5, 2022

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
🔨 Latest commit c332ad5
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/638f6f1eaf2422000932b136

@openshift-ci openshift-ci bot requested review from feloy and kadel December 5, 2022 03:26
@odo-robot
Copy link

odo-robot bot commented Dec 5, 2022

NoCluster Tests on commit d1a6689 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Dec 5, 2022

Unit Tests on commit d1a6689 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Dec 5, 2022

Validate Tests on commit d1a6689 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Dec 5, 2022

Kubernetes Tests on commit d1a6689 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Dec 5, 2022

Windows Tests (OCP) on commit d1a6689 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Dec 5, 2022

OpenShift Tests on commit d1a6689 finished successfully.
View logs: TXT HTML

@valaparthvi valaparthvi force-pushed the 6275-support-for-multiple-k8s-definition branch from 847f18e to eec32f0 Compare December 6, 2022 02:55
@valaparthvi valaparthvi closed this Dec 6, 2022
@valaparthvi valaparthvi reopened this Dec 6, 2022
@valaparthvi
Copy link
Contributor Author

/retest

if err != nil {
continue
}
// We default to the first object in the list because as far as ServiceBinding is concerned,
// we assume that only one resource will be defined for the Devfile K8s component; which is true
unstructuredObj := unstructuredObjs[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check that len(unstructuredObjs) > 0 before, or this will panic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's unlikely that the list will ever be empty. I've tried to run the remove binding command on non-existent bindings and it's never panicked. But you're right, I'll add the check to be on the safe side.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One should never under-estimate the imagination of users ...

@valaparthvi valaparthvi force-pushed the 6275-support-for-multiple-k8s-definition branch from eec32f0 to c332ad5 Compare December 6, 2022 16:34
@sonarcloud
Copy link

sonarcloud bot commented Dec 6, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.3% 0.3% Duplication

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Dec 7, 2022
@openshift-merge-robot openshift-merge-robot merged commit a399313 into redhat-developer:main Dec 7, 2022
@valaparthvi valaparthvi mentioned this pull request Dec 8, 2022
27 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Odo should support multiple k8s definition in a single yaml/inlined field
3 participants