-
Notifications
You must be signed in to change notification settings - Fork 252
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 to download from a remote registry #27
Add support to download from a remote registry #27
Conversation
The goal is to reuse 'conFigMap loader' to load operator manifest(s) downloaded from a remote registry (ie. quay.io) into a sqlite database. - Refactor ConfigMapLoader to use map[string]string instead of a `configMap` object to refer to data section. - Parameterize the logger so that we can pass in `WithFields` logger specific to appregistry or ConfigMap.
pkg/apprclient/adapter.go
Outdated
|
||
appr "github.com/operator-framework/go-appr/appregistry" | ||
appr_blobs "github.com/operator-framework/go-appr/appregistry/blobs" | ||
appr_package "github.com/operator-framework/go-appr/appregistry/package_appr" |
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.
Removed underscores
pkg/apprclient/adapter.go
Outdated
) | ||
|
||
const ( | ||
mediaType string = "helm" |
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.
nit: no need for explicit typing here
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.
Removed explicit typing
apprclient package is an adapter that can talk to appregistry server. The new binary we are adding will use this go package to download operator manifest(s) from remote app registry.
Add a new binary 'appregistry-server' that can be used to download operator manifest(s) from a remote app registry and generate a sqlite database to be served using grpc.
- Add appregistry-server binary into image for OpenShift. - Add a new docker file for upstream
8fafbc0
to
063f3f4
Compare
@njhale Addressed the comments you posted, let me know if you have more questions. |
/test e2e-aws |
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.
Thank you for adding this. Great Job! I think in the next sprint we'll want to decouple appregistry-server
from marketplace CRDs though.
/approve
/lgtm
"github.com/go-openapi/runtime" | ||
httptransport "github.com/go-openapi/runtime/client" | ||
"github.com/go-openapi/strfmt" | ||
apprclient "github.com/operator-framework/go-appr/appregistry" |
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.
Should the import be aliased with the same name as the enclosing package?
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.
you are right, didn't realize this at all. I will fix this in a separate PR next sprint.
Decode(encoded []byte) ([]byte, error) | ||
} | ||
|
||
type blobDecoderImpl struct { |
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.
Just for fun, the other way you could do this is by declaring a function type that implements blobDecoder
:
type DecoderFunc func(encoded []byte) ([]byte, error)
func (d DecoderFunc) Decode(encoded []byte) ([]byte, error) {
return d.Decode(encoded)
}
func Decode(encoded []byte) ([]byte, error) {
....
}
Then the function Decode
of type DecoderFunc
implements blobDecoder
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, I like it, makes it concise.
Packages []string | ||
} | ||
|
||
func (i *Input) PackagesToMap() map[string]bool { |
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.
The native golang set is map[<type>]struct{}
.
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 was thinking of using truct{}
, but then came across this in effective go -
A set can be implemented as a map with value type bool. Set the map entry to true to put the value in the set, and then test it by simple indexing
attended := map[string]bool{
"Ann": true,
"Joe": true,
...
}
if attended[person] { // will be false if person is not in the map
fmt.Println(person, "was at the meeting")
}
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: njhale, tkashem 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:
Approvers can indicate their approval by writing |
/test e2e-aws |
Add a new binary 'appregistry-server' that can be used to download operator manifest(s) from a remote app registry and generate a sqlite database to be served using grpc.
https://jira.coreos.com/browse/MKTPLC-108
https://jira.coreos.com/browse/MKTPLC-240
TBD: