-
Notifications
You must be signed in to change notification settings - Fork 31
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 OVA provider and inventory #419
Conversation
da5e719
to
c8622d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preliminary comments.
Makefile
Outdated
@@ -279,7 +288,8 @@ push-all-images: push-api-image \ | |||
push-operator-index-image \ | |||
push-populator-controller-image \ | |||
push-ovirt-populator-image \ | |||
push-openstack-populator-image | |||
push-openstack-populator-image\ | |||
push-ova-parses-image | |||
|
|||
.PHONY: check_container_runtmime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to the patch but I see we have a typo in the word "runtime" here.
cmd/ova-parser/ova-parser.go
Outdated
if err != nil { | ||
fmt.Println("Error extracting OVF from OVA:", err) | ||
continue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using defer os.RemoveAll(tmpDir)
here instead calling it separately below. Either way you may want to log the error from os.RemoveAll
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah and we should also check if we really need to extract the file to a temporary directory, it should be possible to read the content of the OVF directly from the OVA (found this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a library is probably preferable if it can be used easily. But you can also tell tar
to dump the file to stdout with -O/--to-stdout
. But you also need to call tar
multiple times -- first to list the files and then get the output. (Just saying.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you also need to call
tar
multiple times -- first to list the files and then get the output. (Just saying.)
according to the OVF specification, the OVF descriptor should always be the first entry ("The ordering restriction ensures that it is possible to extract the OVF descriptor from a compressed OVF package without scanning the entire archive. ")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory yes. In reality there are plenty of hand crafted OVAs not following the specs. Some of which are not even TAR files (are e.g. ZIP files). And it's fine to discard those as not supported. But you don't want such files to cause you troubles.
Specifically in this context, if you just run tar xOf somethig.ova --wildcards '*.ovf'
and the archive contains multiple OVF files you will end up with their content concatenated together which will confuse the XML parser and produce bogus errors. That's what I meant.
hack/ova-parser/Containerfile
Outdated
@@ -0,0 +1,10 @@ | |||
FROM registry.access.redhat.com/ubi8/go-toolset:1.18.9-8 as builder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be cleaner if we created a separate directory for the Container files naming them e.g. ova-parser.Containerfile
and leave the hack
directory only for support scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like a good starting point
cmd/ova-parser/ova-parser.go
Outdated
http.HandleFunc("/networks", networkHandler) | ||
http.HandleFunc("/watch", watchdHandler) | ||
|
||
http.ListenAndServe(":8080", nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about separating out the other parts to a different file and renaming this one to ova-data-server.go?
cmd/ova-parser/ova-parser.go
Outdated
if err != nil { | ||
fmt.Println("Error extracting OVF from OVA:", err) | ||
continue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah and we should also check if we really need to extract the file to a temporary directory, it should be possible to read the content of the OVF directly from the OVA (found this)
hack/ova-parser/Containerfile
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we used Container files for populators that were hard to build with bazel, I guess that was the reference for this, right? it should be easy to build this with bazel instead
5d20cfc
to
fed2fc7
Compare
|
||
// Tree. | ||
func (h TreeHandler) Tree(ctx *gin.Context) { | ||
// status := h.Prepare(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to be modified for the UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partial review
8ee60e6
to
e3e36bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
complete review
operator/roles/forkliftcontroller/templates/controller/ova-scc.yml.j2
Outdated
Show resolved
Hide resolved
operator/roles/forkliftcontroller/templates/controller/ova-scc.yml.j2
Outdated
Show resolved
Hide resolved
operator/roles/forkliftcontroller/templates/controller/ova-scc.yml.j2
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding comments from sonarcloud
7153340
to
b94a5d5
Compare
Signed-off-by: Bella Khizgiyaev <[email protected]>
1. Remove unused empty function WorkloadHandler#List 2. Reduce Cognitive Complexity of ProviderHandler#ListContent Signed-off-by: Arik Hadas <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Adding new OVA type provider, once the provider is added a new OVA-server deployment will be applied, the controller will query the new server pod and build the provider inventory based on the info that will be provided by it.