File: HOWTOMOVE.md

package info (click to toggle)
golang-k8s-utils 0.0~git20221128.99ec85e-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports
  • size: 912 kB
  • sloc: sh: 206; makefile: 24
file content (31 lines) | stat: -rw-r--r-- 1,501 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# How to move a utility pkg from other kubernetes repos

It has 2 steps to move a pkg from other Kubernetes repos to `k8s.io/utils` repo:
- copy the pkg to `k8s.io/utils` repo
- update the import paths and `vendor/` in the repos that refer this pkg

## Copy the pkg to `k8s.io/utils` repo

Copying should preserve all the git history associated with it.
[Here](http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/) is a working approach.
Note: You may need to use `--allow-unrelated-histories` if you get error when running `git pull` following the post above.

Then, you may need to restructure the package to make sure it has the following structure.

    .
    ├── doc.go                  # Description for this package
    ├── <utilname1>.go          # utility go file
    ├── <utilname>_test.go      # go unit tests
    └── testing                 # All the testing framework
        └── fake_<utilname>.go  # Testing framework go file

[#5](https://github.com/kubernetes/utils/pull/5) is an example for this step.

## Update the repos that refer the pkg

You should update the import paths.
Then follow [this doc](https://github.com/kubernetes/community/blob/master/contributors/devel/godep.md) to update `vendor/` and `Godeps/`.

You may want to run `make bazel-test` to make sure all new references work.

[kubernetes/kubernetes#49234](https://github.com/kubernetes/kubernetes/pull/49234) is an example for this step.