Skip to content

Code refactoring adding support of GoDaddy Api v3 - #71

Open
cmoulliard wants to merge 1 commit into
mainfrom
use-godaddy-api-v3
Open

Code refactoring adding support of GoDaddy Api v3#71
cmoulliard wants to merge 1 commit into
mainfrom
use-godaddy-api-v3

Conversation

@cmoulliard

@cmoulliard cmoulliard commented Aug 19, 2026

Copy link
Copy Markdown
Member
  • Code adding support of GoDaddy Api v3
  • Api v1 is now legacy
  • Refactoring of the project to better organize the code inernally
  • Use new script to install kubebuilder tool
  • Add new tests covering v2, v3
  • Improve the documentation to explain how to use v3 and PAT Auth

#63 #70

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the GoDaddy cert-manager DNS01 webhook to support GoDaddy Domains API v3 (including PAT/Bearer authentication), while keeping API v1 as the current default and reorganizing code into clearer internal packages with expanded unit testing and updated documentation.

Changes:

  • Introduces versioned GoDaddy API clients (internal/godaddy/v1 and internal/godaddy/v3) and PAT-based auth extraction (internal/auth), selected via apiVersion.
  • Updates developer workflow: new Makefile targets for unit tests, revised envtest binary setup script, and CI workflow for build/unit tests.
  • Expands documentation and testdata to cover v1/v3 configuration and testing.

Reviewed changes

Copilot reviewed 20 out of 23 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
testdata/godaddy/v3/config.json Adds v3 solver config fixture (includes apiVersion: v3).
testdata/godaddy/v1/config.json Adds v1 solver config fixture (default-style config).
testdata/godaddy/README.md Removes placeholder README content.
scripts/fetch-test-binaries.sh Switches envtest binary installation to setup-envtest.
README.md Updates docs for v3/PAT usage, testing workflow, and project structure.
Makefile Adds test-unit, test-v1, test-v3, and propagates TEST_API_VERSION.
main.go Refactors solver to use internal auth/dns/godaddy clients and API version selection.
internal/logging/logging.go Adds centralized logrus configuration helper.
internal/godaddy/v3/client.go Adds GoDaddy API v3 client implementation.
internal/godaddy/v3/client_test.go Adds unit tests for the v3 client via httptest.
internal/godaddy/v1/client.go Adds GoDaddy API v1 client implementation.
internal/godaddy/v1/client_test.go Adds unit tests for the v1 client via httptest.
internal/godaddy/types.go Adds shared client interface/types + shared HTTP request helper.
internal/dns/dns.go Extracts DNS zone/record-name helpers.
internal/auth/auth.go Adds secret parsing for v1 (key:secret) and v3 (PAT) formats.
internal/auth/auth_test.go Adds unit tests for secret parsing helpers.
dns_resolver_test.go Adds API-version-aware manifest selection for integration/conformance test.
deploy/charts/godaddy-webhook/templates/pki.yaml Minor comment wording fix (“self-signed”).
common/util.go Removes unused env var helper.
cmd.md Documents key make/test commands.
.gitignore Ignores versioned test secret manifests.
.github/workflows/ci.yml Adds CI workflow for build + unit tests.
.github/workflows/build-push-image-commit.yml Modernizes and gates image build/push on CI workflow.
Suppressed comments (4)

internal/auth/auth.go:35

  • This error message formats the Secret reference as "/" instead of "/".
	if len(parts) != 2 {
		return nil, fmt.Errorf("secret \"%s/%s\" key %q: expected format \"apiKey:apiSecret\"", secretName, namespace, secretKey)
	}

internal/auth/auth.go:56

  • The error message formats the Secret reference as "/", but Kubernetes convention is "/".
	if !ok {
		return "", fmt.Errorf("key %q not found in secret \"%s/%s\"", secretKey, secretName, namespace)
	}

internal/auth/auth.go:61

  • This error message formats the Secret reference as "/" instead of "/".
	if token == "" {
		return "", fmt.Errorf("secret \"%s/%s\" key %q: token is empty", secretName, namespace, secretKey)
	}

dns_resolver_test.go:32

  • The test log prints apiVersion (which may be empty) even though version is defaulted to v1. This can lead to misleading logs when TEST_API_VERSION is unset.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/godaddy/v3/client.go Outdated
Comment thread internal/godaddy/v3/client.go Outdated
Comment thread internal/godaddy/v1/client.go
Comment thread internal/godaddy/v3/client.go
Comment thread internal/godaddy/types.go Outdated
Comment thread internal/auth/auth.go
Comment thread main.go
Comment thread README.md Outdated
Comment thread scripts/fetch-test-binaries.sh
Comment thread internal/godaddy/v3/client.go
@github-actions

Copy link
Copy Markdown

Test image ready

quay.io/snowdrop/cert-manager-webhook-godaddy:pr-71

To test on a kind cluster:

# Pull, save, and load into kind
podman pull quay.io/snowdrop/cert-manager-webhook-godaddy:pr-71
podman save quay.io/snowdrop/cert-manager-webhook-godaddy:pr-71 -o /tmp/webhook-pr.tar
kind load image-archive /tmp/webhook-pr.tar --name cert-manager-test
rm /tmp/webhook-pr.tar

# Install or upgrade the webhook
helm upgrade --install -n cert-manager godaddy-webhook ./deploy/charts/godaddy-webhook \
  --set groupName=\$DOMAIN \
  --set image.tag=pr-71 \
  --set image.pullPolicy=Never

Add a v3 client that uses the new GoDaddy API v3 endpoints with Bearer
token (PAT) authentication. The v3 API uses per-record CRUD operations
(/v3/domains/zones/{zone}/dns-records) with records listed under "items"
and identified by "recordId" in the response envelope.

Also includes:
- Configurable TEST_TIMEOUT for DNS propagation tests
- CI workflow to build and publish PR images for testing
- How-to guide for local kind cluster deployment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

3 participants