Skip to content

Commit aa1652d

Browse files
Merge pull request #213 from njhale/daemonless
feat(opm): add unprivileged registry add
2 parents 33c4e8f + 3067694 commit aa1652d

File tree

1,365 files changed

+227426
-48076
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,365 files changed

+227426
-48076
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,5 +454,10 @@ bin
454454
# Ignore vscode
455455
.vscode
456456

457-
# Igore apprclient meta
457+
# Ignore apprclient meta
458458
pkg/apprclient/openapi/git_push.sh
459+
460+
# Never ignore testdata
461+
!pkg/**/testdata/**
462+
!test/**testdata/**
463+

cmd/opm/registry/add.go

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package registry
22

33
import (
4-
"github.com/operator-framework/operator-registry/pkg/lib/registry"
5-
64
"github.com/sirupsen/logrus"
75
"github.com/spf13/cobra"
6+
7+
"github.com/operator-framework/operator-registry/pkg/lib/registry"
88
)
99

1010
func newRegistryAddCmd() *cobra.Command {
@@ -27,36 +27,39 @@ func newRegistryAddCmd() *cobra.Command {
2727
rootCmd.Flags().StringP("database", "d", "bundles.db", "relative path to database file")
2828
rootCmd.Flags().StringSliceP("bundle-images", "b", []string{}, "comma separated list of links to bundle image")
2929
rootCmd.Flags().Bool("permissive", false, "allow registry load errors")
30-
rootCmd.Flags().StringP("container-tool", "c", "podman", "tool to interact with container images (save, build, etc.). One of: [docker, podman]")
30+
rootCmd.Flags().Bool("skip-tls", false, "skip TLS certificate verification for container image registries while pulling bundles")
31+
32+
rootCmd.Flags().StringP("container-tool", "c", "", "")
33+
if err := rootCmd.Flags().MarkDeprecated("container-tool", "ignored in favor of standalone image manipulation"); err != nil {
34+
logrus.Panic(err.Error())
35+
}
3136

3237
return rootCmd
3338
}
3439

3540
func addFunc(cmd *cobra.Command, args []string) error {
36-
bundleImages, err := cmd.Flags().GetStringSlice("bundle-images")
41+
permissive, err := cmd.Flags().GetBool("permissive")
3742
if err != nil {
3843
return err
3944
}
40-
41-
fromFilename, err := cmd.Flags().GetString("database")
45+
skipTLS, err := cmd.Flags().GetBool("skip-tls")
4246
if err != nil {
4347
return err
4448
}
45-
permissive, err := cmd.Flags().GetBool("permissive")
49+
fromFilename, err := cmd.Flags().GetString("database")
4650
if err != nil {
4751
return err
4852
}
49-
50-
containerTool, err := cmd.Flags().GetString("container-tool")
53+
bundleImages, err := cmd.Flags().GetStringSlice("bundle-images")
5154
if err != nil {
5255
return err
5356
}
5457

5558
request := registry.AddToRegistryRequest{
56-
Bundles: bundleImages,
57-
InputDatabase: fromFilename,
5859
Permissive: permissive,
59-
ContainerTool: containerTool,
60+
SkipTLS: skipTLS,
61+
InputDatabase: fromFilename,
62+
Bundles: bundleImages,
6063
}
6164

6265
logger := logrus.WithFields(logrus.Fields{"bundles": bundleImages})

docs/design/opm-tooling.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,30 @@ which can be pushed to appregistry.
128128

129129
**Note**: the appregistry format is being deprecated in favor of the new index image and image bundle format.
130130

131-
### Container Tooling
131+
### External Container Tooling
132132

133-
Of note, many of these commands require some form of shelling to common container tooling (in the general case at least to pull the bundle image and extract the contents to update the registry). By default, the container tool that `opm` shells to is [podman](https://podman.io/). However, we also support overriding this via the `--container-tool` flag in all of these commands:
133+
Of note, many of these commands require some form of shelling to common container tooling. By default, the container tool that `opm` shells to is [podman](https://podman.io/). However, we also support overriding this via the `--container-tool`.
134134

135-
`opm registry add -b "quay.io/operator-framework/operator-bundle-prometheus:0.14.0" -d "test-registry.db" --container-tool docker`
135+
_Ex._
136136

137-
This will run `opm registry add` via the docker runtime.
137+
`opm index add --bundles quay.io/operator-framework/operator-bundle-prometheus:0.14.0 --tag quay.io/operator-framework/monitoring-index:1.0.0 --container-tool docker`
138+
139+
These commands require shelling to an external tool:
140+
141+
- `opm index add`
142+
- `opm index rm`
143+
- `opm index export`
144+
145+
### Self-Contained Container Tooling
146+
147+
There are a few commands that use self-contained container tooling. These commands do not require shelling to an external tool:
148+
149+
- `opm registry add`
150+
151+
#### Configuration
152+
153+
By default, the self-contained tooling uses the standard [Docker config](https://docs.docker.com/engine/reference/commandline/cli/#configuration-files) in the `~/.docker` directory. This can be changed by setting the `DOCKER_CONFIG` environment variable.
154+
155+
#### Authentication
156+
157+
Authentication options [can be added](https://docs.docker.com/engine/reference/commandline/login/#credentials-store) to the standard Docker config. The self-contained tooling should also be able to use the system credential store out-of-the-box.

go.mod

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,50 @@ module github.com/operator-framework/operator-registry
33
go 1.13
44

55
require (
6+
github.com/Microsoft/hcsshim v0.8.7 // indirect
67
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6
78
github.com/blang/semver v3.5.0+incompatible
9+
github.com/containerd/containerd v1.3.2
10+
github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c // indirect
11+
github.com/docker/cli v0.0.0-20200130152716-5d0cf8839492
812
github.com/docker/distribution v2.7.1+incompatible
13+
github.com/docker/docker v1.4.2-0.20200203170920-46ec8731fbce
14+
github.com/docker/docker-credential-helpers v0.6.3 // indirect
15+
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
16+
github.com/docker/go-metrics v0.0.1 // indirect
17+
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
918
github.com/ghodss/yaml v1.0.0
19+
github.com/gogo/protobuf v1.3.1 // indirect
1020
github.com/golang-migrate/migrate/v4 v4.6.2
1121
github.com/golang/mock v1.3.1
1222
github.com/golang/protobuf v1.3.2
23+
github.com/google/go-cmp v0.4.0 // indirect
24+
github.com/gorilla/mux v1.7.4 // indirect
1325
github.com/grpc-ecosystem/grpc-health-probe v0.2.1-0.20181220223928-2bf0a5b182db
26+
github.com/imdario/mergo v0.3.8 // indirect
1427
github.com/mattn/go-sqlite3 v1.10.0
1528
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2
16-
github.com/onsi/ginkgo v1.10.1
17-
github.com/onsi/gomega v1.7.0
29+
github.com/morikuni/aec v1.0.0 // indirect
30+
github.com/onsi/ginkgo v1.12.0
31+
github.com/onsi/gomega v1.9.0
32+
github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6
33+
github.com/opencontainers/runc v1.0.0-rc9 // indirect
34+
github.com/opencontainers/runtime-spec v0.1.2-0.20190618234442-a950415649c7 // indirect
1835
github.com/operator-framework/api v0.1.1
1936
github.com/otiai10/copy v1.0.2
20-
github.com/pkg/errors v0.8.1
37+
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
38+
github.com/pkg/errors v0.9.1
2139
github.com/sirupsen/logrus v1.4.2
22-
github.com/spf13/cobra v0.0.5
23-
github.com/stretchr/testify v1.4.0
40+
github.com/spf13/cobra v0.0.6
41+
github.com/stretchr/testify v1.5.1
42+
go.etcd.io/bbolt v1.3.4
43+
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 // indirect
44+
golang.org/x/mod v0.2.0
2445
golang.org/x/net v0.0.0-20191028085509-fe3aa8a45271
2546
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
47+
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
2648
google.golang.org/grpc v1.24.0
49+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
2750
gopkg.in/yaml.v2 v2.2.8
2851
k8s.io/api v0.17.3
2952
k8s.io/apiextensions-apiserver v0.17.3
@@ -32,3 +55,5 @@ require (
3255
k8s.io/klog v1.0.0
3356
k8s.io/kubectl v0.17.3
3457
)
58+
59+
replace github.com/docker/distribution => github.com/docker/distribution v0.0.0-20191216044856-a8371794149d

0 commit comments

Comments
 (0)