Documentation

Overview

package gen implements helper functions to construct API resource test fixtures.

Index

Constants

const (
	// DefaultTestNamespace is the default namespace set on resources that
	// are namespaced.
	DefaultTestNamespace = "default-unit-test-ns"
)

Variables

This section is empty.

Functions

func CSR

func CSR(keyAlgorithm x509.PublicKeyAlgorithm, mods ...CSRModifier) (csr []byte, sk crypto.Signer, err error)

func Certificate

func Certificate(name string, mods ...CertificateModifier) *v1.Certificate

func CertificateFrom

func CertificateFrom(crt *v1.Certificate, mods ...CertificateModifier) *v1.Certificate

func CertificateRequest

func CertificateRequest(name string, mods ...CertificateRequestModifier) *v1.CertificateRequest

func Challenge

func Challenge(name string, mods ...ChallengeModifier) *cmacme.Challenge

func ChallengeFrom

func ChallengeFrom(ch *cmacme.Challenge, mods ...ChallengeModifier) *cmacme.Challenge

func ClusterIssuer

func ClusterIssuer(name string, mods ...IssuerModifier) *v1.ClusterIssuer

func ClusterIssuerFrom

func ClusterIssuerFrom(iss *v1.ClusterIssuer, mods ...IssuerModifier) *v1.ClusterIssuer

func Issuer

func Issuer(name string, mods ...IssuerModifier) *v1.Issuer

func IssuerFrom

func IssuerFrom(iss *v1.Issuer, mods ...IssuerModifier) *v1.Issuer

func ObjectMeta

func ObjectMeta(name string, mods ...ObjectMetaModifier) metav1.ObjectMeta

ObjectMeta creates a new metav1.ObjectMeta with the given name, optionally applying the provided ObjectMetaModifiers. It applies a DefaultTestNamespace by default. Cluster-scoped resource generators should explicitly add `SetNamespace("")` to their constructors.

func Order

func Order(name string, mods ...OrderModifier) *cmacme.Order

func OrderFrom

func OrderFrom(order *cmacme.Order, mods ...OrderModifier) *cmacme.Order

func Secret

func Secret(name string, mods ...SecretModifier) *corev1.Secret

func SecretFrom

func SecretFrom(sec *corev1.Secret, mods ...SecretModifier) *corev1.Secret

Types

type CSRModifier

type CSRModifier func(*x509.CertificateRequest)

func SetCSRDNSNames

func SetCSRDNSNames(dnsNames ...string) CSRModifier

func SetCSRIPAddresses

func SetCSRIPAddresses(ips ...net.IP) CSRModifier

func SetCSRURIs

func SetCSRURIs(uris ...*url.URL) CSRModifier

type CertificateModifier

type CertificateModifier func(*v1.Certificate)

func AddCertificateAnnotations

func AddCertificateAnnotations(annotations map[string]string) CertificateModifier

func AddCertificateLabels

func AddCertificateLabels(labels map[string]string) CertificateModifier

func SetCertificateCommonName

func SetCertificateCommonName(commonName string) CertificateModifier

func SetCertificateDNSNames

func SetCertificateDNSNames(dnsNames ...string) CertificateModifier

func SetCertificateDuration

func SetCertificateDuration(duration time.Duration) CertificateModifier

func SetCertificateIPs

func SetCertificateIPs(ips ...string) CertificateModifier

func SetCertificateIsCA

func SetCertificateIsCA(isCA bool) CertificateModifier

func SetCertificateIssuer

func SetCertificateIssuer(o cmmeta.ObjectReference) CertificateModifier

SetIssuer sets the Certificate.spec.issuerRef field

func SetCertificateKeyAlgorithm

func SetCertificateKeyAlgorithm(keyAlgorithm v1.PrivateKeyAlgorithm) CertificateModifier

func SetCertificateKeyEncoding

func SetCertificateKeyEncoding(keyEncoding v1.PrivateKeyEncoding) CertificateModifier

func SetCertificateKeySize

func SetCertificateKeySize(keySize int) CertificateModifier

func SetCertificateKeyUsages

func SetCertificateKeyUsages(usages ...v1.KeyUsage) CertificateModifier

func SetCertificateLastFailureTime

func SetCertificateLastFailureTime(p metav1.Time) CertificateModifier

func SetCertificateNamespace

func SetCertificateNamespace(namespace string) CertificateModifier

func SetCertificateNextPrivateKeySecretName

func SetCertificateNextPrivateKeySecretName(name string) CertificateModifier

func SetCertificateNotAfter

func SetCertificateNotAfter(p metav1.Time) CertificateModifier

func SetCertificateNotBefore

func SetCertificateNotBefore(p metav1.Time) CertificateModifier

func SetCertificateOrganization

func SetCertificateOrganization(orgs ...string) CertificateModifier

func SetCertificateRenewBefore

func SetCertificateRenewBefore(renewBefore time.Duration) CertificateModifier

func SetCertificateRenewalTIme

func SetCertificateRenewalTIme(p metav1.Time) CertificateModifier

func SetCertificateRevision

func SetCertificateRevision(revision int) CertificateModifier

func SetCertificateSecretName

func SetCertificateSecretName(secretName string) CertificateModifier

func SetCertificateStatusCondition

func SetCertificateStatusCondition(c v1.CertificateCondition) CertificateModifier

func SetCertificateUID

func SetCertificateUID(uid types.UID) CertificateModifier

func SetCertificateURIs

func SetCertificateURIs(uris ...string) CertificateModifier

type CertificateRequestModifier

type CertificateRequestModifier func(*v1.CertificateRequest)

func AddCertificateRequestAnnotations

func AddCertificateRequestAnnotations(annotations map[string]string) CertificateRequestModifier

func AddCertificateRequestOwnerReferences

func AddCertificateRequestOwnerReferences(owners ...metav1.OwnerReference) CertificateRequestModifier

func DeleteCertificateRequestAnnotation

func DeleteCertificateRequestAnnotation(key string) CertificateRequestModifier

func SetCertificateRequestAnnotations

func SetCertificateRequestAnnotations(annotations map[string]string) CertificateRequestModifier

func SetCertificateRequestCA

func SetCertificateRequestCA(ca []byte) CertificateRequestModifier

func SetCertificateRequestCSR

func SetCertificateRequestCSR(csr []byte) CertificateRequestModifier

func SetCertificateRequestCertificate

func SetCertificateRequestCertificate(cert []byte) CertificateRequestModifier

func SetCertificateRequestDuration

func SetCertificateRequestDuration(duration *metav1.Duration) CertificateRequestModifier

func SetCertificateRequestFailureTime

func SetCertificateRequestFailureTime(p metav1.Time) CertificateRequestModifier

func SetCertificateRequestIsCA

func SetCertificateRequestIsCA(isCA bool) CertificateRequestModifier

func SetCertificateRequestIssuer

func SetCertificateRequestIssuer(o cmmeta.ObjectReference) CertificateRequestModifier

SetIssuer sets the CertificateRequest.spec.issuerRef field

func SetCertificateRequestKeyUsages

func SetCertificateRequestKeyUsages(usages ...v1.KeyUsage) CertificateRequestModifier

func SetCertificateRequestName

func SetCertificateRequestName(name string) CertificateRequestModifier

func SetCertificateRequestNamespace

func SetCertificateRequestNamespace(namespace string) CertificateRequestModifier

type ChallengeModifier

type ChallengeModifier func(*cmacme.Challenge)

func SetChallengeDNSName

func SetChallengeDNSName(dnsName string) ChallengeModifier

func SetChallengeIssuer

func SetChallengeIssuer(o cmmeta.ObjectReference) ChallengeModifier

SetIssuer sets the challenge.spec.issuerRef field

func SetChallengeNamespace

func SetChallengeNamespace(ns string) ChallengeModifier

func SetChallengePresented

func SetChallengePresented(p bool) ChallengeModifier

func SetChallengeProcessing

func SetChallengeProcessing(b bool) ChallengeModifier

func SetChallengeReason

func SetChallengeReason(s string) ChallengeModifier

func SetChallengeState

func SetChallengeState(s cmacme.State) ChallengeModifier

func SetChallengeToken

func SetChallengeToken(t string) ChallengeModifier

func SetChallengeURL

func SetChallengeURL(s string) ChallengeModifier

func SetChallengeWildcard

func SetChallengeWildcard(p bool) ChallengeModifier

type IssuerModifier

type IssuerModifier func(v1.GenericIssuer)

func AddIssuerCondition

func AddIssuerCondition(c v1.IssuerCondition) IssuerModifier

func SetIssuerACME

func SetIssuerACME(a cmacme.ACMEIssuer) IssuerModifier

func SetIssuerCA

func SetIssuerCA(a v1.CAIssuer) IssuerModifier

func SetIssuerNamespace

func SetIssuerNamespace(namespace string) IssuerModifier

func SetIssuerSelfSigned

func SetIssuerSelfSigned(a v1.SelfSignedIssuer) IssuerModifier

func SetIssuerVault

func SetIssuerVault(v v1.VaultIssuer) IssuerModifier

func SetIssuerVenafi

func SetIssuerVenafi(a v1.VenafiIssuer) IssuerModifier

type ObjectMetaModifier

type ObjectMetaModifier func(*metav1.ObjectMeta)

ObjectMetaModifier applies a transformation to the provider ObjectMeta

type OrderModifier

type OrderModifier func(*cmacme.Order)

func SetOrderCertificate

func SetOrderCertificate(d []byte) OrderModifier

func SetOrderCommonName

func SetOrderCommonName(commonName string) OrderModifier

func SetOrderCsr

func SetOrderCsr(csr []byte) OrderModifier

func SetOrderDNSNames

func SetOrderDNSNames(dnsNames ...string) OrderModifier

func SetOrderIssuer

func SetOrderIssuer(o cmmeta.ObjectReference) OrderModifier

SetIssuer sets the Order.spec.issuerRef field

func SetOrderNamespace

func SetOrderNamespace(namespace string) OrderModifier

func SetOrderReason

func SetOrderReason(reason string) OrderModifier

func SetOrderState

func SetOrderState(s cmacme.State) OrderModifier

func SetOrderStatus

func SetOrderStatus(s cmacme.OrderStatus) OrderModifier

func SetOrderURL

func SetOrderURL(url string) OrderModifier

type SecretModifier

type SecretModifier func(*corev1.Secret)

func SetSecretAnnotations

func SetSecretAnnotations(an map[string]string) SecretModifier

func SetSecretData

func SetSecretData(data map[string][]byte) SecretModifier

func SetSecretNamespace

func SetSecretNamespace(namespace string) SecretModifier