|
| 1 | +# Move docker-registry to separate repository |
| 2 | + |
| 3 | +## Problem |
| 4 | + |
| 5 | +The `docker/distribution` has a lot of dependencies. Since `kubernetes` began to use docker/distribution |
| 6 | +it has become very difficult to update `docker/distribution` in the part where you need to combine the |
| 7 | +dependencies of these projects. There is no guarantee that the merge of the dependencies would not make |
| 8 | +regression in these projects. |
| 9 | + |
| 10 | +## Constraints and Assumptions |
| 11 | + |
| 12 | +The docker-registry is highly integrated in a common code-base so it is very difficult to describe |
| 13 | +all the difficulties of separation. |
| 14 | + |
| 15 | +## Investigation |
| 16 | + |
| 17 | +### etcd |
| 18 | + |
| 19 | +The docker-registry does not have its own `etcd`. All metadata are stored to the `origin` database using |
| 20 | +client API. |
| 21 | + |
| 22 | +### code-base |
| 23 | + |
| 24 | +The `origin` interacts with the docker-registry only through client library (no internal calls), |
| 25 | +but this cannot be said about docker-regisrty. |
| 26 | + |
| 27 | +1. docker-registry should use [clientsets](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/generating-clientset.md) |
| 28 | +of `origin`. |
| 29 | +2. docker-registry should use [clientsets](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/generating-clientset.md) |
| 30 | +of `kubernetes`. |
| 31 | +3. We need to create versioned client (clientsets?) for docker-registry as well. |
| 32 | +4. We need to split some utilities to reduce the number of dependencies to `origin`. |
| 33 | +5. We need to make common framework for tests. Currently docker-registry uses a common test utilities and clients. |
| 34 | + |
| 35 | +### testing |
| 36 | + |
| 37 | +Use versioning clients will allow us maintain compatibility between repositories. In this case, |
| 38 | +in the jenkins job for `origin` we can build the image from the separate repository before build and |
| 39 | +test `origin` itself. Right now we make docker-registry image from the `origin` repository. |
| 40 | + |
| 41 | +### release scripts |
| 42 | + |
| 43 | +/TODO/ |
| 44 | + |
| 45 | +## Dependencies |
| 46 | + |
| 47 | +`cmd/dockerregistry` uses |
| 48 | +``` |
| 49 | +github.com/openshift/origin/pkg/api/install |
| 50 | +github.com/openshift/origin/pkg/cmd/dockerregistry |
| 51 | +github.com/openshift/origin/pkg/cmd/util (Env) |
| 52 | +github.com/openshift/origin/pkg/cmd/util/serviceability (BehaviorOnPanic, Profile) |
| 53 | +
|
| 54 | +k8s.io/kubernetes/pkg/api/install |
| 55 | +k8s.io/kubernetes/pkg/apis/extensions/install |
| 56 | +``` |
| 57 | + |
| 58 | +`pkg/cmd/dockerregistry` uses |
| 59 | +``` |
| 60 | +github.com/openshift/origin/pkg/cmd/server/crypto |
| 61 | +github.com/openshift/origin/pkg/dockerregistry/server |
| 62 | +``` |
| 63 | + |
| 64 | +`pkg/dockerregistry/server` uses |
| 65 | +``` |
| 66 | +github.com/openshift/origin/pkg/authorization/api |
| 67 | +github.com/openshift/origin/pkg/client |
| 68 | +github.com/openshift/origin/pkg/cmd/util/clientcmd |
| 69 | +github.com/openshift/origin/pkg/image/admission (AdmitImage) |
| 70 | +github.com/openshift/origin/pkg/image/api |
| 71 | +github.com/openshift/origin/pkg/image/importer |
| 72 | +github.com/openshift/origin/pkg/quota/util (IsErrorQuotaExceeded) |
| 73 | +github.com/openshift/origin/pkg/util/httprequest (SchemeHost) |
| 74 | +
|
| 75 | +k8s.io/kubernetes/pkg/api |
| 76 | +k8s.io/kubernetes/pkg/api/errors |
| 77 | +k8s.io/kubernetes/pkg/client/cache |
| 78 | +k8s.io/kubernetes/pkg/client/restclient |
| 79 | +k8s.io/kubernetes/pkg/client/unversioned |
| 80 | +k8s.io/kubernetes/pkg/runtime |
| 81 | +k8s.io/kubernetes/pkg/util |
| 82 | +k8s.io/kubernetes/pkg/util/sets |
| 83 | +``` |
| 84 | + |
| 85 | +`pkg/dockerregistry/server` tests uses |
| 86 | +``` |
| 87 | +github.com/openshift/origin/pkg/api/install |
| 88 | +github.com/openshift/origin/pkg/api/latest |
| 89 | +github.com/openshift/origin/pkg/authorization/api |
| 90 | +github.com/openshift/origin/pkg/client |
| 91 | +github.com/openshift/origin/pkg/client/testclient |
| 92 | +github.com/openshift/origin/pkg/cmd/util/clientcmd |
| 93 | +github.com/openshift/origin/pkg/dockerregistry/testutil |
| 94 | +github.com/openshift/origin/pkg/image/admission/testutil |
| 95 | +github.com/openshift/origin/pkg/image/api |
| 96 | +github.com/openshift/origin/pkg/user/api |
| 97 | +
|
| 98 | +k8s.io/kubernetes/pkg/api |
| 99 | +k8s.io/kubernetes/pkg/apimachinery/registered |
| 100 | +k8s.io/kubernetes/pkg/client/restclient |
| 101 | +k8s.io/kubernetes/pkg/client/unversioned |
| 102 | +k8s.io/kubernetes/pkg/client/unversioned/testclient |
| 103 | +k8s.io/kubernetes/pkg/runtime |
| 104 | +k8s.io/kubernetes/pkg/util |
| 105 | +k8s.io/kubernetes/pkg/util/diff |
| 106 | +``` |
| 107 | + |
| 108 | +### docker-registry -> k8s -> docker/distribution |
| 109 | + |
| 110 | +Right now we have dependencies between kubernetes and docker/distribution: |
| 111 | +``` |
| 112 | +cmd/dockerregistry/main.go: |
| 113 | +`-> github.com/openshift/origin/pkg/api/install, k8s.io/kubernetes/pkg/api/install |
| 114 | + `-> k8s.io/kubernetes/pkg/api/v1 |
| 115 | + `-> k8s.io/kubernetes/pkg/util/parsers |
| 116 | + `-> github.com/docker/distribution/reference |
| 117 | +
|
| 118 | +pkg/dockerregistry/server/repositorymiddleware.go: |
| 119 | +`-> k8s.io/kubernetes/pkg/client/restclient |
| 120 | + `-> k8s.io/kubernetes/pkg/api/v1 |
| 121 | + `-> k8s.io/kubernetes/pkg/util/parsers |
| 122 | + `-> github.com/docker/distribution/reference |
| 123 | +
|
| 124 | +pkg/dockerregistry/server/token.go: |
| 125 | +`-> k8s.io/kubernetes/pkg/client/restclient |
| 126 | + `-> k8s.io/kubernetes/pkg/api/v1 |
| 127 | + `-> k8s.io/kubernetes/pkg/util/parsers |
| 128 | + `-> github.com/docker/distribution/reference |
| 129 | +
|
| 130 | +pkg/dockerregistry/server/auth.go: |
| 131 | +`-> k8s.io/kubernetes/pkg/client/restclient |
| 132 | + `-> k8s.io/kubernetes/pkg/api/v1 |
| 133 | + `-> k8s.io/kubernetes/pkg/util/parsers |
| 134 | + `-> github.com/docker/distribution/reference |
| 135 | +
|
| 136 | +pkg/dockerregistry/testutil/util.go: |
| 137 | +`-> k8s.io/kubernetes/pkg/client/unversioned/testclient |
| 138 | + `-> k8s.io/kubernetes/pkg/api/v1 |
| 139 | + `-> k8s.io/kubernetes/pkg/util/parsers |
| 140 | + `-> github.com/docker/distribution/reference |
| 141 | +``` |
0 commit comments