Juju caas-image-repo not working with private repo that requires authentication to reach API
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
In Progress
|
High
|
Harry Pidcock |
Bug Description
# =======
Juju CLI 2.9.45
Microk8s 1.28
Container registry Jfrog
# =======
I am trying to bootstrap a Juju Controller on k8s using a private container registry
My assumption is:
It seems Juju CLI is trying to curl the container registry before using it to valide the URL exists, however, it doesn't seem to be using the provided credentials during this "ping" thus resulting in error
# =======
# ================
$ docker login 10.46.90.
Authenticating with existing credentials...
WARNING! Your password will be stored unencrypted in /root/snap/
Configure a credential helper to remove this warning. See
https:/
Login Succeeded
# ================ Using same credentials and URL that were used from Docker CLI to push images
$ juju bootstrap microk8s mk8s --debug --config caas-image-
13:20:10 INFO juju.cmd supercommand.go:56 running juju [2.9.45 afb8ee760af71d0
13:20:10 DEBUG juju.cmd supercommand.go:57 args: []string{
13:20:10 DEBUG juju.kubernetes
13:20:10 INFO juju.kubernetes
13:20:10 INFO juju.kubernetes
13:20:10 INFO juju.kubernetes
13:20:10 INFO juju.kubernetes
13:20:10 DEBUG juju.kubernetes
13:20:10 DEBUG juju.kubernetes
13:20:10 INFO cmd cloudcredential
13:20:10 DEBUG juju.cmd.
13:20:10 DEBUG juju.cmd.
13:20:11 DEBUG juju.docker.
ERROR constructing controller config: Get "https:/
13:20:11 DEBUG cmd supercommand.go:537 error stack:
failed to refresh bearer token
github.
github.
github.
github.
github.
github.
github.
github.
# =======
# ================ Public repo does not requires Auth to access API
curl https:/
<a href="/v2/">Moved Permanently</a>.
# ================ Private repo requiring Auth to access API
# It fails curling the API when not using token
curl -v https:/
* Trying 10.46.90.139:443...
* TCP_NODELAY set
* Connected to 10.46.90.139 (10.46.90.139) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: C=XX; ST=StateName; L=CityName; O=CompanyName; OU=CompanySecti
* start date: Oct 13 23:51:25 2023 GMT
* expire date: Oct 10 23:51:25 2033 GMT
* subjectAltName: host "10.46.90.139" matched cert's IP address!
* issuer: C=XX; ST=StateName; L=CityName; O=CompanyName; OU=CompanySecti
* SSL certificate verify ok.
> GET /artifactory/
> Host: 10.46.90.139
> User-Agent: curl/7.68.0
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
< HTTP/1.1 401
< Date: Wed, 18 Oct 2023 22:49:58 GMT
< Content-Type: application/
< Content-Length: 91
< Connection: keep-alive
< WWW-Authenticate: Basic realm="Artifactory Realm"
< X-Content-
<
{
"errors" : [ {
"status" : 401,
"message" : "Authentication is required"
} ]
* Connection #0 to host 10.46.90.139 left intact
}%
# It reponds 200 OK when using token
$ curl -H "Authorization: Bearer $token" https:/
* Trying 10.46.90.139:443...
* TCP_NODELAY set
* Connected to 10.46.90.139 (10.46.90.139) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: C=XX; ST=StateName; L=CityName; O=CompanyName; OU=CompanySecti
* start date: Oct 13 23:51:25 2023 GMT
* expire date: Oct 10 23:51:25 2033 GMT
* subjectAltName: host "10.46.90.139" matched cert's IP address!
* issuer: C=XX; ST=StateName; L=CityName; O=CompanyName; OU=CompanySecti
* SSL certificate verify ok.
> GET /artifactory/
> Host: 10.46.90.139
> User-Agent: curl/7.68.0
> Accept: */*
> Authorization: Bearer cmVmdGtuOjAxOjE
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
< HTTP/1.1 200
< Date: Wed, 18 Oct 2023 18:23:44 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-JFrog-Version: Artifactory/7.68.14 76814900
< X-Artifactory-Id: 0b7e7d6412f08a0
< X-Artifactory-
< Docker-
< X-Content-
< Strict-
<
* Connection #0 to host 10.46.90.139 left intact
{}%
description: | updated |
Subscribing to "field-critical" since it is blocking a current customer deployment