Documentation
¶
Overview ¶
This file owns KnativeProvider — the implementation of the domain Provider interface that handles both TLS strategies via Knative networking and cert-manager.
Strategy dispatch:
platform → ensurePlatform: ClusterDomainClaim only.
The platform DNS01 wildcard cert (*.<zone>) already covers this
host via a ClusterIssuer. No Certificate resource is created.
custom → ensureCustom: Issuer + ClusterDomainClaim + Certificate.
A namespaced HTTP01 Issuer is created per tenant namespace.
An ACME Certificate is issued via the nginx solver. The controller
requeues (ErrCertProvisioning) until the Certificate reaches Ready.
ClusterDomainClaim:
Knative's networking.internal.knative.dev/v1alpha1 ClusterDomainClaim is cluster-scoped (no namespace). It delegates domain ownership to a specific namespace via spec.namespace. Created for both TLS strategies.
TLS Secret naming:
The cert-manager Certificate writes its secret as blanketops-tls-{host}
(sanitized). The Route provider (pkg/routes/api/knative.go) references this
same name in DomainMapping.Spec.TLS.SecretName — a shared naming convention
avoids any cross-package coupling.
See also:
- pkg/domain/api/provider.go — Provider interface
- pkg/domain/domain/model.go — TLSStrategy constants
- pkg/routes/api/knative.go — references certSecretName(host) for TLS wiring
- pkg/domain/application/backend_selector.go — wires this provider
This file owns the Provider interface for the domain package — the contract that all Domain backend implementations must satisfy.
A Provider is responsible for materializing the cert/mapping chain for a host. What it emits depends on the TLSStrategy:
platform: DomainClaim only — the platform DNS01 wildcard cert already covers
this host, so no Certificate work is needed.
custom: Issuer + DomainClaim + Certificate — HTTP01 ACME challenge via
the nginx solver in the tenant namespace.
Ensure is idempotent — calling it multiple times for the same Domain CR must produce the same set of resources with no unintended side effects.
The concrete implementation lives in knative.go. Provider never writes to the Domain CR status — that belongs to pkg/domain/application/status.go.
See also:
- pkg/domain/api/knative.go — Knative/cert-manager implementation
- pkg/domain/application/backend_selector.go — selects Provider by TLSStrategy
- pkg/domain/application/service.go — calls Provider.Ensure and handles result
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ACMEConfig ¶
type ACMEConfig struct {
// Server is the ACME directory URL (e.g. Let's Encrypt production endpoint).
Server string
// Email is the ACME account email for cert expiry notifications.
Email string
// PrivateKeySecretName is the name of the Secret storing the ACME account
// private key. Created in the target namespace by cert-manager.
PrivateKeySecretName string
}
ACMEConfig carries the HTTP01 ACME issuer configuration injected at construction time. Keeps provider logic free of hardcoded platform values.
type KnativeProvider ¶
type KnativeProvider struct {
// contains filtered or unexported fields
}
KnativeProvider implements Provider for the Knative + cert-manager stack.
func NewKnativeProvider ¶
func NewKnativeProvider(c client.Client, log logr.Logger, acme ACMEConfig) *KnativeProvider
NewKnativeProvider constructs a KnativeProvider with the given dependencies.
func (*KnativeProvider) Ensure ¶
func (p *KnativeProvider) Ensure( ctx context.Context, resolved *domainResolution.ResolvedDomain, d domain.Domain, ) (domain.DomainResult, error)
Ensure provisions the cert/mapping chain for the given Domain. Dispatches to ensurePlatform or ensureCustom based on TLSStrategy.
type Provider ¶
type Provider interface {
// Ensure provisions or reconciles the cert/mapping chain for the given
// Domain. Returns PhaseReady when complete and PhaseFailed on terminal
// failure. PhaseProvisioning is returned as a Go error (ErrCertProvisioning)
// so the controller requeues while ACME challenge or cert issuance is
// in progress.
Ensure(ctx context.Context, resolved *domainResolution.ResolvedDomain, d domain.Domain) (domain.DomainResult, error)
// Teardown releases the ClusterDomainClaim and, for custom-strategy domains,
// the per-host Certificate created by Ensure. Idempotent — a missing
// resource is not an error. The shared per-namespace Issuer is left alone.
Teardown(ctx context.Context, d domain.Domain) error
}
Provider materializes and maintains the cert/mapping chain for a Domain CR. Implementations must be idempotent and must not mutate the Domain CR directly.