1# How to move a utility pkg from other kubernetes repos
2
3It has 2 steps to move a pkg from other Kubernetes repos to `k8s.io/utils` repo:
4- copy the pkg to `k8s.io/utils` repo
5- update the import paths and `vendor/` in the repos that refer this pkg
6
7## Copy the pkg to `k8s.io/utils` repo
8
9Copying should preserve all the git history associated with it.
10[Here](http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/) is a working approach.
11Note: You may need to use `--allow-unrelated-histories` if you get error when running `git pull` following the post above.
12
13Then, you may need to restructure the package to make sure it has the following structure.
14
15    .
16    ├── doc.go                  # Description for this package
17    ├── <utilname1>.go          # utility go file
18    ├── <utilname>_test.go      # go unit tests
19    └── testing                 # All the testing framework
20        └── fake_<utilname>.go  # Testing framework go file
21
22[#5](https://github.com/kubernetes/utils/pull/5) is an example for this step.
23
24## Update the repos that refer the pkg
25
26You should update the import paths.
27Then follow [this doc](https://github.com/kubernetes/community/blob/master/contributors/devel/godep.md) to update `vendor/` and `Godeps/`.
28
29You may want to run `make bazel-test` to make sure all new references work.
30
31[kubernetes/kubernetes#49234](https://github.com/kubernetes/kubernetes/pull/49234) is an example for this step.
32