Skip to content

credentials: reset all provider env vars before configuring a new one#67

Merged
tamalsaha merged 3 commits into
masterfrom
refactor/reset-all-provider-env
Jun 6, 2026
Merged

credentials: reset all provider env vars before configuring a new one#67
tamalsaha merged 3 commits into
masterfrom
refactor/reset-all-provider-env

Conversation

@tamalsaha

Copy link
Copy Markdown
Contributor

Summary

Each provider's credential setter reset only its own env vars (and Azure reset none). Switching providers across reconciles — or deleting one ExternalDNS and creating another with a different provider — would leave stale credentials from the previous provider in the process env.

This change centralizes the env reset in `SetCredential` so every known provider env var (AWS / GCP / Cloudflare) is unset before any per-provider setter runs.

Test plan

  • `go build ./...`
  • Manually verify that swapping an ExternalDNS from `cloudflare` to `aws` no longer leaves `CF_API_*` set in the operator process

Each provider-specific setter cleared only its own env vars (and
setAzureCredential cleared none). When a user switched the provider on
an ExternalDNS — or deleted one resource and created another with a
different provider — stale credentials from the previous provider stayed
in the process env. Combined with the per-process credential model, this
made cross-provider transitions fragile.

Centralize the reset in SetCredential so every provider env var we know
about is unset before any provider setter runs.

Signed-off-by: Tamal Saha <tamal@appscode.com>
kodiakhq[bot]
kodiakhq Bot previously approved these changes Jun 6, 2026
Signed-off-by: Tamal Saha <tamal@appscode.com>
kodiakhq[bot]
kodiakhq Bot previously approved these changes Jun 6, 2026
Signed-off-by: Tamal Saha <tamal@appscode.com>
@tamalsaha tamalsaha merged commit 51424e5 into master Jun 6, 2026
4 checks passed
@tamalsaha tamalsaha deleted the refactor/reset-all-provider-env branch June 6, 2026 16:05
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.

1 participant