carvel-dev / carvel-dev/imgpkg

Imgpkg will use http for in cluster service dns names

Open
#107 2 comments 0 reactions 0 assignees View on GitHub
bug priority/awaiting-more-evidence triage/needs-more-information
Dominant language
Go
Stars
284
Forks
70
PR merge metrics
No merged PRs in 30d

Description

**What steps did you take:**
1. Start a minikube or kind cluster locally
2. Deploy a registry with self signed certs to the cluster (registry.yml in https://gist.github.com/ewrenn8/ab66e8df50b7a79905b3ba7fefcd0aa0)
Note: the certs in the gist aren't used anywhere, so they're ok to include in the issue

3. deploy a debug image with a terminal and imgpkg (debug.yml in https://gist.github.com/ewrenn8/ab66e8df50b7a79905b3ba7fefcd0aa0)
5. exec on to debug pod: `k exec -it -- /bin/bash`
4. run `imgpkg pull regsitry-svc.registry.svc.cluster.local:443/my-repo/image -o /tmp/b` (this image doesn't exist, but it's enough to see the issue)

**What happened:**
Imgpkg fails with two error messages:
```
Error: Collecting images: Working with registry-svc.registry.svc.cluster.local/my-repo/image:latest: Get "https://registry-svc.registry.svc.cluster.local/v2/": x509: certificate relies on legacy Common Name field, use SANs or temporarily enable Common Name matching with GODEBUG=x509ignoreCN=0; Get "http://registry-svc.registry.svc.cluster.local/v2/": dial tcp 10.107.213.254:80: i/o timeout
```

Which shows that it tried to communicate with the registry over both https (which failed because of invalid certs) and http.

**What did you expect:**
Imgpkg to not try to use http since I didn't use the `--registry-insecure` flag.

**Anything else you would like to add:**
This is seems to be because of the ggcr local host [regex](https://github.com/google/go-containerregistry/blob/8a2841911ffee4f6892ca0083e89752fb46c48dd/pkg/name/registry.go#L31) which is used to determine if [http should be used as a fallback](https://github.com/google/go-containerregistry/blob/8a2841911ffee4f6892ca0083e89752fb46c48dd/pkg/name/registry.go#L94-L96)

**Environment:**

- imgpkg version (use `imgpkg --version`): 0.5.0
- Docker registry used (e.g. `Docker HUB`): [Registry Image](https://hub.docker.com/_/registry)
- OS (e.g. from `/etc/os-release`): Photon 3.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.