You are viewing development documentation built from the latest commit on main (last tag v0.2.0-rc.2, source commit 25e1a892).
APIs and features are subject to change.
Cert-Manager Builders
The certmanager package provides the generated constructors and the admissible sugar for cert-manager Kubernetes resources. These are the low-level building blocks used by Kure’s higher-level stack and workflow packages.
Overview
Every kind is built the same way: the generated Create<Kind> wrapper gives you an object carrying identity only, and the upstream cert-manager struct is the construction API — set Spec fields directly, or through the few Set*/Add* helpers the builder contract admits.
Each block on this page is the body of an Example function in example_test.go, which go test
runs: it imports this package as certmanager, github.com/go-kure/kure/pkg/kubernetes, the
upstream APIs as certv1 "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1",
cmacme "github.com/cert-manager/cert-manager/pkg/apis/acme/v1" and
cmmeta "github.com/cert-manager/cert-manager/pkg/apis/meta/v1",
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1", k8s.io/utils/ptr, time, and fmt for the
line that prints what the example built.
Constructors
Every kind this package registers has a generated Create<Kind> wrapper in zz_generated_create.go, produced from the scheme by pkg/kubernetes/internal/gen (make gen-builders, checked by make check-builders in CI). A wrapper delegates to kubernetes.Create[T] and emits TypeMeta and identity only: no default, no label, no spec value. Namespaced kinds take (name, namespace), cluster-scoped kinds take (name).
There is no second construction path.
The config-struct layer this package used to carry (certmanager.Certificate(&certmanager.CertificateConfig{...}), Issuer, ClusterIssuer, and the sealed IssuerVariant / ACMESolver / DNS01Provider sums behind them) was retired by release 2 of the builder contract: it reached 5 of a Certificate’s 24 spec fields and 2 of an issuer’s 5 arms, and a consumer could not add a Vault issuer or an Azure DNS solver even by hand.
A caller sets the upstream field directly; the config field that used to feed it is gone. No hand-written Create* helper for a spec fragment remains either — a sub-type that is not a client.Object takes a struct literal, which is shorter and shows every field being set.
The kinds this package registers, their scope, and what stated that scope are rows in the generated Supported kinds and field maturity tables. The sections below are worked examples, not the coverage list.
See the Kubernetes Builders page for the full builder contract: construction, sugar admission classes, purity and the migration ledgers.
Supported Resources
Certificate
Every field of certv1.CertificateSpec is reachable this way — PrivateKey, Usages, Subject, Keystores, the lot — because the spec is the upstream struct, not a copy of it.
Issuer
certv1.IssuerSpec embeds the upstream one-of, IssuerConfig, with a pointer per arm (ACME, CA, Vault, SelfSigned, Venafi). Set exactly one; cert-manager rejects an issuer with two at apply time. The two most common arms have a pointer setter:
A DNS-01 solver is the same shape with a provider set on ACMEChallengeSolverDNS01 — Cloudflare, Route 53, Google CloudDNS, and every other provider cert-manager knows (Azure DNS, DigitalOcean, RFC 2136, AcmeDNS, a webhook). AddACMEIssuerSolver appends one solver at a time when the list is assembled incrementally:
The other arms are plain pointer assignments on the embedded struct:
ClusterIssuer
Modifier Functions
Update existing resources:
Related Packages
- stack - Domain model that produces Kubernetes resources