Kong / Kong/kubernetes-testing-framework

Pushing to a registry addon from the host fails with "certificate signed by unknown authority"

Open
#992 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
44
Forks
11
PR merge metrics
No merged PRs in 30d

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

When I deploy a registry addon with the metallb ingress and cert-manager, pushing images into the registry with docker fails with the message `Get "https://172.18.0.100/v2/": tls: failed to verify certificate: x509: certificate signed by unknown authority`

I believe this is because the host does not know the cert-manager authority used for the generated self-signed certificates. Might be loosely related to #169 but not 100% sure.

### Expected Behavior

Pushing images into the registry should work and the images should be made available to the cluster.

### Steps To Reproduce

1. Deploy a registry
```go
registry := registry.NewBuilder().WithServiceTypeLoadBalancer().Build()
env, err = environments.NewBuilder().WithAddons(
certmanager.New(),
metallb.New(),
registry,
).Build(ctx)
```

2. Attempt to push an image with the docker go sdk
```go
cli, err := dockerClient.NewClientWithOpts(dockerClient.FromEnv)

source := "quay.io/bpfman-userspace/go-tc-counter:latest"
index := strings.LastIndex(source, "/")
target := fmt.Sprintf("%s/%s", registry.LoadBalancerAddress(), source[index+1:])

err = cli.ImageTag(context.Background(), source, target)
if err != nil {
return err
}

closer, err := cli.ImagePush(context.Background(), image.target, dockerTypes.ImagePushOptions{
All: true,
RegistryAuth: "something",
})

if err != nil {
return err
}

io.Copy(os.Stdout, closer)
closer.Close()
```
3. Alternatively trying to push images manually with the docker cli produces the same error
```bash
docker tag quay.io/bpfman-userspace/go-tc-counter:latest 172.18.0.100/go-tc-counter:latest
docker push 172.18.0.100/go-tc-counter:latest
```

### Kong Kubernetes Testing Framework Version

```shell
v0.24.1
```

### Kubernetes version

```shell
kind v0.22.0 go1.21.7 linux/amd64
Client Version: v1.29.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.2
```

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with registry.NewBuilder, certmanager.New, and metallb.New, then compare the Docker CLI and dockerClient.ImagePush paths. Trace how the registry address and generated certificates are exposed to the host; done means the documented host push succeeds and the image is available to the cluster.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go, kubernetes
Domain
devops, infrastructure, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.