| 1 |
# Releasing a new version of apiserver-network-proxy |
| 2 |
|
| 3 |
Please note this guide is only intended for the admins of this repository, and requires write access. |
| 4 |
|
| 5 |
Creating a new release of network proxy involves releasing a new version of the client library (konnectivity-client) and new images for the proxy agent and server. Generally we also want to upgrade kubernetes/kubernetes with the latest version of the images and library, but this is a GCE specific change. |
| 6 |
|
| 7 |
1. If increasing the minor version (the `y` in `x.y.z`), a new release branch must be created. The name of this branch should be `release-x.y` where `x` and `y` correspond to the major and minor release numbers for apiserver-network-proxy. For example, if increasing the apiserver-network-proxy from verision `0.98.4` to `0.99.0` a new branch should be created named `release-0.99`. |
| 8 |
|
| 9 |
After making the new tag for the release version, use the following command to create the new branch: |
| 10 |
|
| 11 |
``` |
| 12 |
# assuming a release version of 0.99.0 |
| 13 |
export RELEASE=release-0.99 |
| 14 |
git checkout -b "${RELEASE}" |
| 15 |
git push upstream "${RELEASE}" |
| 16 |
``` |
| 17 |
|
| 18 |
2. The first step involves creating a new git tag for the release, following semver for go libraries. A tag is required for both the repository and the konnectivity-client library. For example releasing the `0.99.0` version will have two tags `v0.99.0` and `konnectivity-client/v0.99.0` on the appropriate commit. The minor version number (the `y` in `x.y.z`) should match the minor version of the Kubernetes version that is utilized by the apiserver-network-proxy. The patch level version number (the `z` in `x.y.z`) should increase by one unless a new minor version is being created, in which case it should be `0`. |
| 19 |
|
| 20 |
In the master branch, choose the appropriate commit, and determine a patch version based on the required Kubernetes version and the current patch level. |
| 21 |
|
| 22 |
Example commands for `HEAD` of `master` branch. (Assumes you have `git remote add upstream [email protected]:kubernetes-sigs/apiserver-network-proxy.git`.) |
| 23 |
|
| 24 |
``` |
| 25 |
# Assuming v0.2.1 exists |
| 26 |
export TAG=v0.2.2 |
| 27 |
export MESSAGE="Meaningful description of change." |
| 28 |
|
| 29 |
git fetch upstream |
| 30 |
git tag -a "${TAG}" -m "${MESSAGE}" upstream/master |
| 31 |
git tag -a "konnectivity-client/${TAG}" -m "${MESSAGE}" upstream/master |
| 32 |
git push upstream "${TAG}" |
| 33 |
git push upstream "konnectivity-client/${TAG}" |
| 34 |
``` |
| 35 |
|
| 36 |
In a release branch, the process is similar but corresponds to earlier minor versions. |
| 37 |
|
| 38 |
Example commands for `HEAD` of `release-0.0` branch: |
| 39 |
|
| 40 |
``` |
| 41 |
# Assuming v0.1.35 exists, then it is on the release-0.1 branch |
| 42 |
export RELEASE=release-0.1 |
| 43 |
export TAG=v0.1.36 |
| 44 |
export MESSAGE="Meaningful description of change." |
| 45 |
|
| 46 |
git fetch upstream |
| 47 |
git tag -a "${TAG}" -m "${MESSAGE}" upstream/${RELEASE} |
| 48 |
git tag -a "konnectivity-client/${TAG}" -m "${MESSAGE}" upstream/${RELEASE} |
| 49 |
git push upstream "${TAG}" |
| 50 |
git push upstream "konnectivity-client/${TAG}" |
| 51 |
``` |
| 52 |
|
| 53 |
Once the two tags are created, the konnectivity-client can be imported as a library in kubernetes/kubernetes and other go programs. |
| 54 |
|
| 55 |
3. To publish the proxy server and proxy agent images, they must be promoted from the k8s staging repo. An example PR can be seen here: [https://github.com/kubernetes/k8s.io/pull/5686](https://github.com/kubernetes/k8s.io/pull/5686) |
| 56 |
|
| 57 |
The SHA in the PR corresponds to the SHA of the image within the k8s staging repo. (This is under the **Name** column) |
| 58 |
|
| 59 |
The images can be found here for the [proxy server](https://console.cloud.google.com/artifacts/docker/k8s-staging-kas-network-proxy/us/gcr.io/proxy-server?gcrImageListsize=30) and [proxy agent](https://console.cloud.google.com/artifacts/docker/k8s-staging-kas-network-proxy/us/gcr.io/proxy-agent?gcrImageListsize=30). |
| 60 |
|
| 61 |
Please ensure that the commit shown on the tag of the image matches the one shown in the tags page in the network proxy repo. |
| 62 |
|
| 63 |
<img src="https://user-images.githubusercontent.com/7691399/106816880-09040600-6644-11eb-8907-f50c53dfe475.png" width="400px" height="300px" /> <img src="https://user-images.githubusercontent.com/7691399/106815303-a4e04280-6641-11eb-82d2-4ef4fb34437a.png" width="400px" height="300px" /> |
| 64 |
|
| 65 |
4. Finally, update kubernetes/kubernetes with the new client library and images. |
| 66 |
|
| 67 |
An example PR can be found here: [https://github.com/kubernetes/kubernetes/pull/94983](https://github.com/kubernetes/kubernetes/pull/94983) |
| 68 |
|
| 69 |
Image paths must be bumped and are located in: |
| 70 |
|
| 71 |
- cluster/gce/addons/konnectivity-agent/konnectivity-agent-ds.yaml |
| 72 |
- cluster/gce/manifests/konnectivity-server.yaml |
| 73 |
|
| 74 |
To update the library, no go.mod files need to be manually modified and running these commands in k/k will perform the necessary go.mod changes. |
| 75 |
|
| 76 |
``` |
| 77 |
./hack/pin-dependency.sh sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15 |
| 78 |
./hack/update-codegen.sh |
| 79 |
./hack/update-vendor.sh |
| 80 |
``` |
| 81 |
|
| 82 |
## Updating Go Dependencies |
| 83 |
|
| 84 |
`go.mod` versions should be kept consistent between the apiserver-network-proxy [main module](go.mod), |
| 85 |
and the [konnectivity-client module](/konnectivity-client/go.mod). |
| 86 |
|
| 87 |
Konnectivity-client dependency versions must be compatible |
| 88 |
[Kubernetes go.mod versions](https://github.com/kubernetes/kubernetes/blob/master/go.mod), |
| 89 |
meaning for a given release branch the konnectivity-client versions must not be newer than the |
| 90 |
Kubernetes versions. |
| 91 |
|
| 92 |
In practice, this means that to update `konnectivity-client/go.mod` dependencies, a new Konnectivity |
| 93 |
branch must be cut, and the dependencies should be pinned to the latest versions used by Kubernetes. |