kubernetes / autoscaler

Autoscaling components for Kubernetes
Apache License 2.0
8.11k stars 3.98k forks source link

VPA release 0.14.0 #5851

Closed kgolab closed 1 year ago

kgolab commented 1 year ago

Following instructions in RELEASE.md.

I'm planning to do the release now, as asked by jbartosik@. It's been a while since K8s 1.27 was releases and IIUC we wanted to release a new minor VPA version around new K8s minor release.

I can also see that golang version has been bumped a few times to address vulnerabilities so I guess it's good to prepare a release for that reason as well.

I don't see any pending PRs which should block the release. In case I missed something, I will simply redo the process.

kgolab commented 1 year ago

The instructions say:

Update VPA version const
[ ] Wait for all VPA changes that will be in the release to merge.
[ ] Wait for [the end to end tests](https://k8s-testgrid.appspot.com/sig-autoscaling-vpa) to run with all VPA changes included.
[ ] Make sure the end to end VPA tests are green.

I can see the tests being green here https://k8s-testgrid.appspot.com/sig-autoscaling-vpa#Summary (there's a single flake from actuation suite) but it's really hard to verify what exactly was built.

The only thing I'm sure is that we're using golang 1.20.5 which means that #5434 was already included. Luckily this is the last merged PR so it seems we're good to go further.

I'll try to see if we can improve (or simply document) matching a test run with the latest included commit.

kgolab commented 1 year ago

I updated version const and created a new release branch.

However I ran into trouble during Build and stage images step. Notice amd64 being built twice (via usual go build plus via docker buildx), resulting in an error later:

docker run -v `pwd`/../..:/gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler vpa-autoscaling-builder:latest bash -c 'cd /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler && make build-binary-with-vendor-amd64 -C pkg/recommender'
make: Entering directory '/gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender'
CGO_ENABLED=0 LD_FLAGS=-s GO111MODULE=on GOARCH=amd64 GOOS=linux go build -mod vendor -o recommender-amd64
make: Leaving directory '/gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender'
[...]
docker buildx build --pull --platform linux/amd64 -t gcr.io/k8s-staging-autoscaling/vpa-recommender-amd64:0.14.0 --build-arg ARCH=amd64 .
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
[+] Building 6.1s (7/7) FINISHED                                                                                                                                                                  
[...]
docker push gcr.io/k8s-staging-autoscaling/vpa-recommender-amd64:0.14.0
The push refers to repository [gcr.io/k8s-staging-autoscaling/vpa-recommender-amd64]
An image does not exist locally with the tag: gcr.io/k8s-staging-autoscaling/vpa-recommender-amd64
make: *** [Makefile:63: do-push-amd64] Error 1

The same double build is visible for all architectures but the push error is only logged for amd64 (maybe it aborts other pushes).

Investigating...

kgolab commented 1 year ago

@voelzmo , are there any special requirements to build the release after your #5746?

It seems that the previous release @jbartosik did was prior to this change. I'm trying to build the next one but I ran into errors as shown in the previous comment. Hopefully you can help here :-)

voelzmo commented 1 year ago

Ah I think the problem is that I didn't specify a builder explicitly in the Makefile and therefore it is using the one you currently have: docker-container, which needs an output specified. (see context in the official docs about builders) On my machine, I'm using the standard docker builder, which doesn't have the option to specify and output. Here's how the whole things looks for me (when using dockerhub as a registry)

 ALL_ARCHITECTURES="amd64 arm64" REGISTRY=voelzmo TAG=v0.99.1-dev make release
rm -f recommender-amd64
rm -f recommender-arm64
docker build -t vpa-autoscaling-builder ../../builder
[+] Building 2.4s (9/9) FINISHED
 => [internal] load .dockerignore                                                                                                                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                     0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                0.0s
 => => transferring dockerfile: 923B                                                                                                                                                                                                                                                0.0s
 => [internal] load metadata for docker.io/library/golang:1.20.5                                                                                                                                                                                                                    2.4s
 => [auth] library/golang:pull token for registry-1.docker.io                                                                                                                                                                                                                       0.0s
 => [1/4] FROM docker.io/library/golang:1.20.5@sha256:6b3fa4b908676231b50acbbc00e84d8cee9c6ce072b1175c0ff352c57d8a612f                                                                                                                                                              0.0s
 => CACHED [2/4] RUN go version                                                                                                                                                                                                                                                     0.0s
 => CACHED [3/4] RUN go install github.com/tools/godep@latest                                                                                                                                                                                                                       0.0s
 => CACHED [4/4] RUN godep version                                                                                                                                                                                                                                                  0.0s
 => exporting to image                                                                                                                                                                                                                                                              0.0s
 => => exporting layers                                                                                                                                                                                                                                                             0.0s
 => => writing image sha256:51f4edec31cf2a1d1e78ecd1b6852e6340423dfebf6d94008051b96bae77cf22                                                                                                                                                                                        0.0s
 => => naming to docker.io/library/vpa-autoscaling-builder                                                                                                                                                                                                                          0.0s
docker run -v `pwd`/../..:/gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler vpa-autoscaling-builder:latest bash -c 'cd /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler && make build-binary-with-vendor-amd64 -C pkg/recommender'
make: Entering directory '/gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender'
CGO_ENABLED=0 LD_FLAGS=-s GO111MODULE=on GOARCH=amd64 GOOS=linux go build -mod vendor -o recommender-amd64
make: Leaving directory '/gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender'
docker run -v `pwd`/../..:/gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler vpa-autoscaling-builder:latest bash -c 'cd /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler && make build-binary-with-vendor-arm64 -C pkg/recommender'
make: Entering directory '/gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender'
CGO_ENABLED=0 LD_FLAGS=-s GO111MODULE=on GOARCH=arm64 GOOS=linux go build -mod vendor -o recommender-arm64
make: Leaving directory '/gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender'
docker buildx build --pull --platform linux/amd64 -t voelzmo/vpa-recommender-amd64:v0.99.1-dev --build-arg ARCH=amd64 .
[+] Building 1.1s (7/7) FINISHED
 => [internal] load .dockerignore                                                                                                                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                     0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                0.0s
 => => transferring dockerfile: 944B                                                                                                                                                                                                                                                0.0s
 => [internal] load metadata for gcr.io/distroless/static:latest                                                                                                                                                                                                                    0.5s
 => [internal] load build context                                                                                                                                                                                                                                                   0.3s
 => => transferring context: 56.41MB                                                                                                                                                                                                                                                0.3s
 => [1/2] FROM gcr.io/distroless/static:latest@sha256:7198a357ff3a8ef750b041324873960cf2153c11cc50abb9d8d5f8bb089f6b4e                                                                                                                                                              0.1s
 => => resolve gcr.io/distroless/static:latest@sha256:7198a357ff3a8ef750b041324873960cf2153c11cc50abb9d8d5f8bb089f6b4e                                                                                                                                                              0.0s
 => => sha256:bc535c40cfde8f8f1601f6cc9b51d3387db0722a7c4756896c68e3de4f074966 1.65kB / 1.65kB                                                                                                                                                                                      0.0s
 => => sha256:7198a357ff3a8ef750b041324873960cf2153c11cc50abb9d8d5f8bb089f6b4e 1.46kB / 1.46kB                                                                                                                                                                                      0.0s
 => => sha256:961207f62413aa501b775c9bbd0e5eea27f3c20ae52dd198bf9d73a4f7277604 1.27kB / 1.27kB                                                                                                                                                                                      0.0s
 => [2/2] COPY recommender-amd64 /recommender                                                                                                                                                                                                                                       0.1s
 => exporting to image                                                                                                                                                                                                                                                              0.1s
 => => exporting layers                                                                                                                                                                                                                                                             0.1s
 => => writing image sha256:9d4d66d17409329e24cc6f61045784c0d421a6992210acd3dc84784a9287ed39                                                                                                                                                                                        0.0s
 => => naming to docker.io/voelzmo/vpa-recommender-amd64:v0.99.1-dev                                                                                                                                                                                                                0.0s
docker buildx build --pull --platform linux/arm64 -t voelzmo/vpa-recommender-arm64:v0.99.1-dev --build-arg ARCH=arm64 .
[+] Building 1.4s (7/7) FINISHED
 => [internal] load .dockerignore                                                                                                                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                     0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                0.0s
 => => transferring dockerfile: 944B                                                                                                                                                                                                                                                0.0s
 => [internal] load metadata for gcr.io/distroless/static:latest                                                                                                                                                                                                                    1.0s
 => [internal] load build context                                                                                                                                                                                                                                                   0.4s
 => => transferring context: 54.29MB                                                                                                                                                                                                                                                0.3s
 => [1/2] FROM gcr.io/distroless/static:latest@sha256:7198a357ff3a8ef750b041324873960cf2153c11cc50abb9d8d5f8bb089f6b4e                                                                                                                                                              0.0s
 => CACHED [2/2] COPY recommender-arm64 /recommender                                                                                                                                                                                                                                0.0s
 => exporting to image                                                                                                                                                                                                                                                              0.0s
 => => exporting layers                                                                                                                                                                                                                                                             0.0s
 => => writing image sha256:2395fa826b7a7fd34e7fd4dccb25cb7ce369fdad0c864d4c221c24878452aa7a                                                                                                                                                                                        0.0s
 => => naming to docker.io/voelzmo/vpa-recommender-arm64:v0.99.1-dev                                                                                                                                                                                                                0.0s
docker push voelzmo/vpa-recommender-amd64:v0.99.1-dev
The push refers to repository [docker.io/voelzmo/vpa-recommender-amd64]
46fb3b6d56e3: Pushed
4cb10dd2545b: Layer already exists
d2d7ec0f6756: Layer already exists
1a73b54f556b: Layer already exists
e624a5370eca: Layer already exists
d52f02c6501c: Layer already exists
ff5700ec5418: Layer already exists
7bea6b893187: Layer already exists
6fbdf253bbc2: Layer already exists
e023e0e48e6e: Mounted from voelzmo/vpa-admission-controller-amd64
v0.99.1-dev: digest: sha256:df4c28ba038017a56141df4947cf5e017d2dde1c77b021d03ed5bc76e781868e size: 2402
docker push voelzmo/vpa-recommender-arm64:v0.99.1-dev
The push refers to repository [docker.io/voelzmo/vpa-recommender-arm64]
a78b7a1eee64: Layer already exists
4cb10dd2545b: Layer already exists
d2d7ec0f6756: Layer already exists
1a73b54f556b: Layer already exists
e624a5370eca: Layer already exists
d52f02c6501c: Layer already exists
ff5700ec5418: Layer already exists
7bea6b893187: Layer already exists
6fbdf253bbc2: Layer already exists
20655aa3102c: Layer already exists
v0.99.1-dev: digest: sha256:5563cb3f7e05f94b388be54b344416771ecae1a83244ed8f72002c7ff99d8e08 size: 2402
docker manifest create --amend voelzmo/vpa-recommender:v0.99.1-dev voelzmo/vpa-recommender-amd64:v0.99.1-dev voelzmo/vpa-recommender-arm64:v0.99.1-dev
Created manifest list docker.io/voelzmo/vpa-recommender:v0.99.1-dev
docker manifest push --purge voelzmo/vpa-recommender:v0.99.1-dev
Pushed ref docker.io/voelzmo/vpa-recommender@sha256:df4c28ba038017a56141df4947cf5e017d2dde1c77b021d03ed5bc76e781868e with digest: sha256:df4c28ba038017a56141df4947cf5e017d2dde1c77b021d03ed5bc76e781868e
Pushed ref docker.io/voelzmo/vpa-recommender@sha256:5563cb3f7e05f94b388be54b344416771ecae1a83244ed8f72002c7ff99d8e08 with digest: sha256:5563cb3f7e05f94b388be54b344416771ecae1a83244ed8f72002c7ff99d8e08
sha256:27b2b114774e90eeff06fff98d2758474073976ccb4d5893451bb104ef0df33a
Full in-docker release vpa-recommender:v0.99.1-dev completed

I guess the fix is to include specification (and deletion) of a builder in the Makefile, to ensure that this is self-contained and not polluted by the env.

voelzmo commented 1 year ago

@kgolab uploaded a PR to fix this at https://github.com/kubernetes/autoscaler/pull/5867

kgolab commented 1 year ago

Images were built successfully, thanks @voelzmo for the docker fix :-)

One note: during the build my machine ran out of disk so I needed to rerun the whole process after creating more space.

Tests passed:

Ran 5 of 304 Specs in 2224.103 seconds
SUCCESS! -- 5 Passed | 0 Failed | 0 Pending | 299 Skipped
--- PASS: TestE2E (2224.11s)
kgolab commented 1 year ago

Note: I tagged the commit fixing docker set-up (cd5ed0be530e2313f762e30042cb324b768507f6), not version bump (3221336162bd44c90b244af564d7feb101d3e503) as the release process states.

The rationale was simple: if someone would like to rebuild the release for whatever reason, this makes it possible.

kgolab commented 1 year ago

Release is published: https://github.com/kubernetes/autoscaler/releases/tag/vertical-pod-autoscaler-0.14.0

voelzmo commented 1 year ago

Note: I tagged the commit fixing docker set-up (cd5ed0b), not version bump (3221336) as the release process states.

The rationale was simple: if someone would like to rebuild the release for whatever reason, this makes it possible.

Seems like people expect the tag to be on a different commit: We didn't include https://github.com/kubernetes/autoscaler/commit/96cdd88856a801a1a5194ebad6e486e4312fd5e6 and therefore the vertical-pod-autoscaler-v0.14.0 tag provides deployment yaml files referencing v0.13.0