fix: route wildcard cert to DNS-01 issuer so apex SAN avoids HTTP-01 loop - #39
Closed
krist7599555 wants to merge 1 commit into
Closed
fix: route wildcard cert to DNS-01 issuer so apex SAN avoids HTTP-01 loop#39krist7599555 wants to merge 1 commit into
krist7599555 wants to merge 1 commit into
Conversation
A wildcard Certificate covers both `*.<domain>` and the bare apex `<domain>`. cert-manager auto-filters the HTTP-01 solver only for the `*.<domain>` SAN (Let's Encrypt rejects HTTP-01 for wildcards); the apex SAN still selects the shared `letsencrypt` Issuer's HTTP-01 (parapet ingress) solver. For a Cloudflare/CDN-proxied domain that HTTP-01 challenge can never complete — the request is redirected/404'd at the edge and never reaches the parapet solver — so cert-manager retries it indefinitely (observed ~10s cadence, ~17k failed /.well-known/acme-challenge/ requests/day). Pin wildcard rows to the DNS-01-only ClusterIssuer letsencrypt-dns01 (the issuer the original deploys-app#5 change referenced before the "reuse letsencrypt" simplification) so both the apex and wildcard SANs validate via DNS-01. Fixes deploys-app#38
krist7599555
force-pushed
the
fix/wildcard-apex-dns01
branch
from
August 19, 2026 17:21
637c382 to
b5a36f3
Compare
acoshift
reviewed
Aug 21, 2026
acoshift
left a comment
Member
There was a problem hiding this comment.
เดี๋ยวผมแก้โดยใช้วิธีอื่นแทนครับ
ใน cluster เราใช้ issuer ตัวเดียว ที่แยก selector ไว้ ไม่ได้แบ่ง http กับ dns issuer
| // DNS-01 for every SAN (apex included) — avoids the HTTP-01 solver that | ||
| // never validates behind a CDN. See the Wildcard field comment above. | ||
| issuerRef = cmmeta.ObjectReference{ | ||
| Name: "letsencrypt-dns01", |
Member
There was a problem hiding this comment.
บน cluster ไม่มี issuer นี้ครับ
Author
|
ปิด PR เนื่องจากมีวิธีที่เหมาะสมกว่าจาก maintainer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caution
This is vibe code, and not test it yet
Fixes #38
ปัญหา
wildcard
Certificate(k8s/cert.go) ครอบ 2 SAN:*.<domain>กับ apex<domain>เปล่า ๆcert-manager auto-filter HTTP-01 solver เฉพาะ
*.<domain>SAN เท่านั้น (Let's Encrypt ไม่ให้ใช้ HTTP-01 กับ wildcard) ส่วน apex SAN ยังไปหยิบ HTTP-01 (parapet ingress) solver ของ Issuerletsencryptที่ใช้ร่วมกันสำหรับ domain ที่ proxy ผ่าน Cloudflare/CDN → apex HTTP-01 challenge ไม่มีทางผ่าน (request โดน redirect/404 ที่ edge ไม่ถึง parapet solver) → cert-manager retry ไม่จบ
เจอกับ domain จริง: ยิงทุก ~10 วิ, ~17k
/.well-known/acme-challenge/requests/วัน ที่ fail ทั้ง apex และwwwทดสอบ edge:Root cause
083969d(#5) ตอนแรกชี้ wildcard rows ไป DNS-01 ClusterIssuer แยก แล้วมี commit "simplify" เปลี่ยนกลับมาใช้ Issuerletsencryptตัวเดียว โดยให้เหตุผลว่า "cert-manager filters HTTP-01 ... for wildcard SANs, so wildcard challenges naturally route to the Cloud DNS solver" — ซึ่งจริงเฉพาะ*.<domain>แต่ไม่จริงกับ apex SAN → เป็นที่มาของ loopวิธีแก้
pin wildcard rows ไปที่ ClusterIssuer
letsencrypt-dns01(DNS-01 ล้วน — ตัวที่ #5 อ้างถึงตอนแรก) เพื่อให้ ทั้ง apex และ wildcard SAN validate ผ่าน DNS-01 ส่วน non-wildcard เหมือนเดิม (letsencrypt,Issuer)โค้ดนี้อ้าง ClusterIssuer
letsencrypt-dns01ซึ่ง commit "simplify" เอาออกไปโดยบอกว่า "a ClusterIssuer that doesn't need to exist" → ต้องมี issuer ตัวนี้อยู่ใน cluster (DNS-01 solver, config Cloud DNS / CNAME delegation เดียวกับ DNS-01 solver ของ Issuerletsencrypt) ถึงจะทำงานถ้าอยากใช้ Issuer ตัวเดียวต่อ อีกทางเลือกคือขยาย
selectorของ DNS-01 solver ใน Issuerletsencryptให้ match apex identifier ด้วย — จะปรับ PR เป็นแบบไหนก็บอกได้ครับVerification
go build ./k8s/ผ่านgofmtclean🤖 Generated with Claude Code