Documentation
¶
Index ¶
Constants ¶
const ( CACertificateKey = "ca.crt" CAPrivateKeyKey = "ca.key" GeneratedSecretLabel = "operator.ptah.run/generated-webhook-certificate" GeneratedSecretLabelValue = "true" HelmManagedByLabel = "app.kubernetes.io/managed-by" HelmManagedByLabelValue = "Helm" HelmReleaseNameAnnotation = "meta.helm.sh/release-name" HelmReleaseNamespaceAnnotation = "meta.helm.sh/release-namespace" )
const ( StagingSecretLabel = "operator.ptah.run/certificate-rotation-staging" StagingSecretLabelValue = "true" // StagingFormat is the version of the record a staging Secret holds. A // rotator refuses a record in any other format rather than resume a // transition it would read differently. v1 is the format the first // tagged release writes; the versions before it counted commits nobody // installed. StagingFormat = "v1" )
const ResultTrustLabel = "operator.ptah.run/result-trust"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Namespace string
ReleaseName string
SecretName string
StagingSecretName string
LeaseName string
MutatingWebhookConfiguration string
MutatingWebhookNames []string
ValidatingWebhookConfiguration string
ValidatingWebhookNames []string
ServiceName string
ServiceNamespace string
EndpointPortName string
HolderIdentity string
RecreateMissingSecret bool
// Logger, when set, receives one line per reconciliation step so a
// reconciliation that blocks inside a wait says where. It never receives
// key or certificate material.
Logger *slog.Logger
RenewalThreshold time.Duration
ServingCertificateValidity time.Duration
CACertificateValidity time.Duration
// CASwitchDelay is how long every managed webhook entry trusts both the
// old and the new CA before the serving certificate moves to the new one.
CASwitchDelay time.Duration
ProbeTimeout time.Duration
ProbeInterval time.Duration
LeaseDuration time.Duration
AcquireTimeout time.Duration
}
Config names the exact objects in one chart-managed certificate lifecycle. It contains no credentials or certificate material.
type Result ¶
type Result struct {
// Pending means a durable transition advanced without an endpoint verdict.
// The supervisor must retry without claiming readiness.
Pending bool
// RequeueAfter is positive while a CA transition waits for its switch.
RequeueAfter time.Duration
}
Result tells the caller when the next reconciliation is due, if that is sooner than its own schedule.
type ResultConfig ¶
ResultConfig names precreated installation objects. The projection contains the manager's six mounted files; the journal also holds private server CAs. The public policy contains only enrollment digests. No CREATE grant is needed.
type ResultRotator ¶
type ResultRotator struct {
// contains filtered or unexported fields
}
func NewResultRotator ¶
func NewResultRotator(api kubernetes.Interface, config ResultConfig) (*ResultRotator, error)
type Rotator ¶
type Rotator struct {
// contains filtered or unexported fields
}
Rotator serializes and performs one fail-closed reconciliation of the chart-managed webhook certificate and trust bundles.
type SecretCreateGuard ¶
type SecretCreateGuard struct {
Namespace string
ReleaseName string
SecretName string
ServiceAccountName string
}
SecretCreateGuard is the admission policy that narrows the certificate rotator's Secret CREATE grant to the one generated TLS Secret it may recreate. RBAC cannot scope CREATE by resource name, so when recreation is opted into the chart grants create on every Secret in the release namespace, and this policy refuses every CREATE the rotator's ServiceAccount makes that is not exactly that Secret: its name, its namespace, the labels and Helm ownership annotations the rotator writes, the TLS type, and the four keys with material in each.
This is the only place the policy is written. hack/chartpolicies generates templates/certificate-secret-guard.yaml from it, with the release namespace, the release name, the Secret name and the rotator's ServiceAccount left as Helm expressions, and verify-source refuses a template the generator did not write.
func (SecretCreateGuard) Binding ¶
func (g SecretCreateGuard) Binding() *admissionregistrationv1.ValidatingAdmissionPolicyBinding
Binding enforces Policy in the release namespace alone: the rotator's grant is a Role there, so a CREATE anywhere else is refused by RBAC before admission sees it.
func (SecretCreateGuard) Policy ¶
func (g SecretCreateGuard) Policy() *admissionregistrationv1.ValidatingAdmissionPolicy
Policy is the guard's ValidatingAdmissionPolicy. It is named after the rotator's ServiceAccount, as the binding is.