Skip to content

Add certificate export command for Docker registry trust - #555

Open
greghaynes wants to merge 3 commits into
mainfrom
get-certificate-command
Open

Add certificate export command for Docker registry trust#555
greghaynes wants to merge 3 commits into
mainfrom
get-certificate-command

Conversation

@greghaynes

Copy link
Copy Markdown
Contributor

Implements 'idpbuilder get certificate' command to export the self-signed TLS certificate from the cluster. This solves the Docker trust issue with the Gitea container registry without requiring a Docker daemon restart.

Features:

  • Default: Prints certificate to stdout for flexibility
  • --docker flag: Exports to Docker's per-registry cert directory (~/.docker/certs.d//ca.crt)
  • --output flag: Exports to a custom file path
  • Provides platform-specific instructions for system-wide trust
  • Works without Docker restart, avoiding cluster shutdown

Includes comprehensive test coverage for certificate retrieval, file operations, registry host determination, and command flags.

@greghaynes

Copy link
Copy Markdown
Contributor Author

@copilot merge in main

Copilot AI commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

@greghaynes I've opened a new pull request, #557, to work on those changes. Once the pull request is ready, I'll request review from you.

Implements 'idpbuilder get certificate' command to export the self-signed
TLS certificate from the cluster. This solves the Docker trust issue with
the Gitea container registry without requiring a Docker daemon restart.

Features:
- Default: Prints certificate to stdout for flexibility
- --docker flag: Exports to Docker's per-registry cert directory
  (~/.docker/certs.d/<registry-host>/ca.crt)
- --output flag: Exports to a custom file path
- Provides platform-specific instructions for system-wide trust
- Works without Docker restart, avoiding cluster shutdown

Includes comprehensive test coverage for certificate retrieval,
file operations, registry host determination, and command flags.

Signed-off-by: Greg Haynes <greg@greghaynes.net>
@greghaynes
greghaynes force-pushed the get-certificate-command branch from c1e4f67 to 2b3efc3 Compare December 19, 2025 16:53
Signed-off-by: Greg Haynes <greg@greghaynes.net>
@greghaynes
greghaynes force-pushed the get-certificate-command branch from 16338f9 to 42732ae Compare December 19, 2025 17:00
Signed-off-by: Greg Haynes <greg@greghaynes.net>
@greghaynes
greghaynes requested a review from a team as a code owner December 19, 2025 17:09
Comment on lines +77 to +79
registryHost = fmt.Sprintf("%s:%s", config.Host, config.Port)
} else {
registryHost = fmt.Sprintf("gitea.%s:%s", config.Host, config.Port)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think config.Host is the right variable to use here, I think config.IngressHost is more appropriate. It's not totally clear to me why we have these two config options separated but they can be out of sync and when they are IngressHost should be correct I think.

@squidboylan

Copy link
Copy Markdown
Contributor

This feels like something we should have an e2e test for?

Short: "Export the TLS certificate from the cluster",
Long: `Export the self-signed TLS certificate from the cluster.

By default, the certificate is printed to stdout. Use the --docker flag to automatically

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a command is specific to docker and will not work for podman certainly. Add then a remark or enhance the code to support to export the certificate for docker or podman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants