neondatabase / autoscaling

Postgres vertical autoscaling in k8s
Apache License 2.0
153 stars 21 forks source link

vm-builder: Use docker auth #977

Closed sharnoff closed 3 weeks ago

sharnoff commented 3 months ago

Rebased #817. Recently hit this issue, want to get it across the line.

Fixes #814.

sharnoff commented 3 months ago

Looks like pull auth isn't currently working. In build-test-vm:

2024/06/19 04:53:46 Load docker credentials
2024/06/19 04:53:46 Found docker credentials for https://index.docker.io/v1/
2024/06/19 04:53:46 Setup docker connection
2024/06/19 04:53:46 No docker credentials found for docker.io
2024/06/19 04:53:46 Pull source docker image: postgres:16-bullseye
sharnoff commented 3 months ago

Fixed the index.docker.io legacy weirdness. After that, I saw this sequence of logs previously, and was a little worried:

2024/06/19 05:40:26 Pull source docker image: postgres:16-bullseye
2024/06/19 05:40:28 Build docker image for virtual machine (disk size 1G): neondatabase/vm-postgres-16-bullseye:924e783.9575793460
2024/06/19 05:40:28 Error response from daemon: No such image: postgres:16-bullseye

But I tested locally after logging in with my dockerhub credentials and it seems totally fine.

Still not 100% convinced that we're successfully logged in for image pulls during the build, but :shrug:

bayandin commented 3 weeks ago

It seems it doesn't work as expected:

Run bin/vm-builder -src neondatabase/test-private:alpine-3.16 -dst neondatabase/vm-alpine:3.16
2024/09/10 13:31:01 Load docker credentials
2024/09/10 13:31:01 Found docker credentials for https://index.docker.io/v1/
2024/09/10 13:31:01 Setup docker connection
2024/09/10 13:31:01 Pull source docker image: neondatabase/test-private:alpine-3.16
2024/09/10 13:31:02 Error response from daemon: pull access denied for neondatabase/test-private, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

https://github.com/neondatabase/autoscaling/actions/runs/10793525437/job/29935653185#step:8:9

Tested with https://github.com/neondatabase/autoscaling/pull/977/commits/90ecc6322b3a78ef5e33477de74b06d03098e17e

bayandin commented 3 weeks ago

It works!

github-actions[bot] commented 3 weeks ago

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ :robot:
github.com/neondatabase/autoscaling/neonvm/tools/vm-builder 0.00% (ø)

Coverage by file ### Changed files (no unit tests) | Changed File | Coverage Δ | Total | Covered | Missed | :robot: | |--------------|------------|-------|---------|--------|---------| | github.com/neondatabase/autoscaling/neonvm/tools/vm-builder/main.go | 0.00% (ø) | 208 (+28) | 0 | 208 (+28) | | _Please note that the "Total", "Covered", and "Missed" counts above refer to ***code statements*** instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code._

HTML Report

Click to open