| 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. 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`. |
| 8 | |
| 9 | In the master branch, choose the appropriate commit, and determine a patch version based on the required Kubernetes version and the current patch level. |
| 10 | |
| 11 | Example commands for `HEAD` of `master` branch. (Assumes you have `git remote add upstream [email protected]:kubernetes-sigs/apiserver-network-proxy.git`.) |
| 12 | |
| 13 | ``` |
| 14 | # Assuming v0.1.1 exists |
| 15 | export TAG=v0.1.2 |
| 16 | export MESSAGE="Meaningful description of change." |
| 17 | |
| 18 | git fetch upstream |
| 19 | git tag -a "${TAG}" -m "${MESSAGE}" upstream/master |
| 20 | git tag -a "konnectivity-client/${TAG}" -m "${MESSAGE}" upstream/master |
| 21 | git push upstream "${TAG}" |
| 22 | git push upstream "konnectivity-client/${TAG}" |
| 23 | ``` |
| 24 | |
| 25 | In a release branch, the process is similar but corresponds to earlier minor versions. |
| 26 | |
| 27 | Example commands for `HEAD` of `release-0.0` branch: |
| 28 | |
| 29 | ``` |
| 30 | # Assuming v0.0.35 exists |
| 31 | export TAG=v0.0.36 |
| 32 | export MESSAGE="Meaningful description of change." |
| 33 | |
| 34 | git fetch upstream |
| 35 | git tag -a "${TAG}" -m "${MESSAGE}" upstream/release-0.0 |
| 36 | git tag -a "konnectivity-client/${TAG}" -m "${MESSAGE}" upstream/release-0.0 |
| 37 | git push upstream "${TAG}" |
| 38 | git push upstream "konnectivity-client/${TAG}" |
| 39 | ``` |
| 40 | |
| 41 | Once the two tags are created, the konnectivity-client can be imported as a library in kubernetes/kubernetes and other go programs. |
| 42 | |
| 43 | 2. 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`. |
| 44 | |
| 45 | After making the new tag for the release version, use the following command to create the new branch: |
| 46 | |
| 47 | ``` |
| 48 | # assuming a release version of 0.99.0 |
| 49 | export RELEASE=release-0.99 |
| 50 | git checkout -b "${RELEASE}" |
| 51 | git push upstream "${RELEASE}" |
| 52 | ``` |
| 53 | |
| 54 | 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) |
| 55 | |
| 56 | The SHA in the PR corresponds to the SHA of the image within the k8s staging repo. (This is under the **Name** column) |
| 57 | |
| 58 | The images can be found here for the [proxy server](http://console.cloud.google.com/gcr/images/k8s-staging-kas-network-proxy/GLOBAL/proxy-server?gcrImageListsize=30) and [proxy agent](http://console.cloud.google.com/gcr/images/k8s-staging-kas-network-proxy/GLOBAL/proxy-agent?gcrImageListsize=30). |
| 59 | |
| 60 | 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. |
| 61 | |
| 62 | <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" /> |
| 63 | |
| 64 | 4. Finally, update kubernetes/kubernetes with the new client library and images. |
| 65 | |
| 66 | An example PR can be found here: [https://github.com/kubernetes/kubernetes/pull/94983](https://github.com/kubernetes/kubernetes/pull/94983) |
| 67 | |
| 68 | Image paths must be bumped and are located in: |
| 69 | |
| 70 | - cluster/gce/addons/konnectivity-agent/konnectivity-agent-ds.yaml |
| 71 | - cluster/gce/manifests/konnectivity-server.yaml |
| 72 | |
| 73 | 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. |
| 74 | |
| 75 | ``` |
| 76 | ./hack/pin-dependency.sh sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15 |
| 77 | ./hack/update-codegen.sh |
| 78 | ./hack/update-vendor.sh |
| 79 | ``` |
| 80 | |
| 81 | ## Updating Go Dependencies |
| 82 | |
| 83 | `go.mod` versions should be kept consistent between the apiserver-network-proxy [main module](go.mod), |
| 84 | and the [konnectivity-client module](/konnectivity-client/go.mod). |
| 85 | |
| 86 | Konnectivity-client dependency versions must be compatible |
| 87 | [Kubernetes go.mod versions](https://github.com/kubernetes/kubernetes/blob/master/go.mod), |
| 88 | meaning for a given release branch the konnectivity-client versions must not be newer than the |
| 89 | Kubernetes versions. |
| 90 | |
| 91 | In practice, this means that to update `konnectivity-client/go.mod` dependencies, a new Konnectivity |
| 92 | branch must be cut, and the dependencies should be pinned to the latest versions used by Kubernetes. |