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 Kube YAML parser/reader #137

Merged
merged 3 commits into from
Aug 17, 2022
Merged

Conversation

maysunfaisal
Copy link
Member

Signed-off-by: Maysun J Faisal maysunaneek@gmail.com

What does this PR do?:

Adds in the Kubernetes YAML parser. This allows us to parse and read the YAML files specified in a Kubernetes/OpenShift component in a devfile

Three srcs - Path, URL and Data

Which issue(s) this PR fixes:

PR acceptance criteria:

Testing and documentation do not need to be complete in order for this PR to be approved. We just need to ensure tracking issues are opened.

  • Open new test/doc issues under the devfile/api repo
  • Check each criteria if:
  • There is a separate tracking issue. Add the issue link under the criteria
    or
  • test/doc updates are made as part of this PR
  • If unchecked, explain why it's not needed

How to test changes / Special notes to the reviewer:

  • Call the function with a Kubernetes YAML as one of the src
  • Or, alternatively run the test specified

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>
@maysunfaisal maysunfaisal requested a review from yangcao77 August 8, 2022 20:38
@openshift-ci openshift-ci bot requested review from elsony and kim-tsao August 8, 2022 20:38
@openshift-ci openshift-ci bot added the approved label Aug 8, 2022
@maysunfaisal maysunfaisal requested review from yangcao77 and johnmcollier and removed request for elsony and yangcao77 August 8, 2022 20:38
Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>
pkg/devfile/parser/reader.go Outdated Show resolved Hide resolved
pkg/devfile/parser/reader.go Outdated Show resolved Hide resolved
pkg/devfile/parser/reader.go Outdated Show resolved Hide resolved
Copy link
Member

@johnmcollier johnmcollier left a comment

Choose a reason for hiding this comment

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

Just two suggestions.

var err error

if src.URL != "" {
data, err = util.DownloadFileInMemory(src.URL)
Copy link
Member

@johnmcollier johnmcollier Aug 9, 2022

Choose a reason for hiding this comment

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

Can we separate the logic to download / read the Kubernetes yaml file, from the logic to parse the files resources? I.e. maybe rename ReadKubernetesYaml to ParseKubernetesYaml and have it take in a byte array?

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

@@ -0,0 +1,120 @@
apiVersion: apps/v1
Copy link
Member

@johnmcollier johnmcollier Aug 9, 2022

Choose a reason for hiding this comment

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

Can you add a test file with multiple deployments/service/other resources?

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>
Copy link
Collaborator

@yangcao77 yangcao77 left a comment

Choose a reason for hiding this comment

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

changes look good to me

@openshift-ci
Copy link

openshift-ci bot commented Aug 17, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: johnmcollier, maysunfaisal, yangcao77

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [maysunfaisal,yangcao77]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@maysunfaisal maysunfaisal merged commit abb8431 into devfile:main Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants