-
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
feat(opm): add unprivileged registry add #213
feat(opm): add unprivileged registry add #213
Conversation
456c309
to
0db37f3
Compare
/retest |
pkg/image/registry.go
Outdated
|
||
type Registry interface { | ||
// Pull fetches and stores an image by reference. | ||
Pull(ctx context.Context, ref string) error |
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.
One thing I like is using custom types for specificity such a type ImageReference string
and then in the interface it would take in a ref ImageReference
type as the arg. I'm not sure how appropriate it is here but something worth noting as it makes the code more readable IMO.
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 wouldn't insist on it, but I also appreciate the extra compile-time safety of derived types for this kind of thing.
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.
Okay -- I'll change this
pkg/image/shellout/registry.go
Outdated
@@ -0,0 +1,38 @@ | |||
package shellout |
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.
@njhale while reading through the code I realized that I understand what unprivileged
means in the context on this PR due to the commit message, but I'm not sure what shellout
is for. What are your thoughts on adding comments that summaries the intent of a package/it's name?
Even with unprivileged
I guess I'd have to go back and open up the PR to understand the motive behind it.
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.
@anik120 I totally understand -- I actually spent a long time thinking about the naming here without coming up with anything better.
FYI: "shellout" is for shelling out to an external tool.
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.
looking great - left comments inline.
go.mod
Outdated
gopkg.in/yaml.v2 v2.2.8 | ||
k8s.io/api v0.17.3 | ||
k8s.io/apiextensions-apiserver v0.17.3 | ||
k8s.io/apimachinery v0.17.3 | ||
k8s.io/client-go v0.17.3 | ||
k8s.io/klog v1.0.0 | ||
k8s.io/kubectl v0.17.3 | ||
rsc.io/letsencrypt v0.0.3 // indirect |
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.
this is unexpected
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.
this should be gone now
pkg/image/registry.go
Outdated
Pack(ctx context.Context, ref string, from io.Reader) (next string, err error) | ||
} | ||
|
||
// We also need to generate Dockerfiles |
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 know this isn't final yet, but there are a few left over comments like 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.
It should be cleaned up now.
pkg/image/unprivileged/options.go
Outdated
return nil, err | ||
} | ||
|
||
bdb, err := bolt.Open(config.DBPath, 0644, 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.
At least we got bolt in here somehow!
We don't expect to have endianness concerns with this because this is a generated always at runtime and never persisted, correct?
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.
Yup, it's always generated at runtime unless you really want to use an existing file.
@@ -27,7 +27,6 @@ func newRegistryAddCmd() *cobra.Command { | |||
rootCmd.Flags().StringP("database", "d", "bundles.db", "relative path to database file") | |||
rootCmd.Flags().StringSliceP("bundle-images", "b", []string{}, "comma separated list of links to bundle image") | |||
rootCmd.Flags().Bool("permissive", false, "allow registry load errors") | |||
rootCmd.Flags().StringP("container-tool", "c", "podman", "tool to interact with container images (save, build, etc.). One of: [docker, podman]") |
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 should consider making this a hidden flag in case anyone was relying on it existing (instead of throwing an error about not knowing the flag).
If we're confident no one is relying on it yet, we can remove.
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.
@benluddy and I were discussing this in an earlier review. Within Red Hat, I know there's some unreleased automation making use of the default value (not specifying --container-tool
). However, I do think it's safer to use a hidden flag. Can we meet in the middle with a hidden flag that logs a warning when specified and continues with the daemonless implementation?
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 made it a deprecated flag, which is both hidden and gives a warning when used.
@@ -31,3 +39,5 @@ require ( | |||
k8s.io/klog v1.0.0 | |||
k8s.io/kubectl v0.17.3 | |||
) | |||
|
|||
replace github.com/docker/distribution => github.com/docker/distribution v0.0.0-20191216044856-a8371794149d |
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.
is there any way to resolve this? we just got these all cleaned up...
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 could just not run an in-process docker registry, which I expect would make the tests more complex.
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.
This is also a test dependency, which I think means it's not required by dependents to use the operator-registry module.
pkg/image/unprivileged/resolver.go
Outdated
|
||
func NewResolver(username, password string, configs ...string) (remotes.Resolver, error) { | ||
// TODO(njhale): make plainHTTP and insecure optional | ||
plainHTTP := true |
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 should figure out these options before we merge - not supporting tls verification will be an issue.
b709f6b
to
aa29131
Compare
I received some internal feedback to implement this with opencontainers instead of containerd if possible. /hold |
- Add the ability to pull and unpack bundle images without using to an external tool or daemon - Introduce a new set of bundle image oriented interfaces to decouple image interaction from shelling out to external tools - Add testdata dir and dot-import ginkgo - Add pull and unpack unit tests - Deprecate registry add container-tool opt - Add skip-tls option to registry add
this still requires some refactoring and does not implement Unpack
- Add image.Reference interface and SimpleReference implementation as parameters of image.Registry methods (in place of strings) - Refactor image.Registry tests into suite - Add registry implementation notes - Remove buildah from builds (Note: should be re-added once it's complete)
Update vendor directory to include dependencies needed for the containerd image.Registry implementation.
/lgtm |
/hold |
/hold cancel Now I'm ready :) |
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ecordell, njhale 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 |
Add the ability to pull and unpack bundle images without using an external tool or daemon. Make this the only supported mode by removing the
--container-tool
option from theregistry add
subcommand.Ex.
Also, introduce a new bundle oriented image interface to decouple actions (pull, push, pack, unpack) from their underlying implementation.