helper

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Poll is how often the API is polled in Wait operations by default
	Poll = time.Second * 2

	// PodStartTimeout is the default amount of time to wait in pod start operations
	PodStartTimeout = time.Minute * 2
)

Variables

This section is empty.

Functions

func GetPodCondition

func GetPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)

GetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.

func GetPodReadyCondition

func GetPodReadyCondition(status corev1.PodStatus) *corev1.PodCondition

GetPodReadyCondition extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.

func IsPodReady

func IsPodReady(pod *corev1.Pod) bool

IsPodReady returns true if a pod is ready; false otherwise.

func IsPodReadyConditionTrue

func IsPodReadyConditionTrue(status corev1.PodStatus) bool

IsPodReadyConditionTrue returns true if a pod is ready; false otherwise.

Types

type Helper

type Helper struct {
	KubeClient kubernetes.Interface
	CMClient   cmclient.Interface
	// contains filtered or unexported fields
}

Helper provides methods for common operations needed during tests.

func NewHelper added in v0.7.0

func NewHelper(cfg *config.Config) *Helper

func (*Helper) CertificateSigningRequestDurationValid added in v1.4.0

func (h *Helper) CertificateSigningRequestDurationValid(csr *certificatesv1.CertificateSigningRequest, duration, fuzz time.Duration) error

func (*Helper) DefaultValidationSet added in v1.1.0

func (h *Helper) DefaultValidationSet() []ValidationFunc

func (*Helper) Kubectl added in v0.7.0

func (h *Helper) Kubectl(ns string) *Kubectl

func (*Helper) ValidateCertificate added in v1.1.0

func (h *Helper) ValidateCertificate(ns, name string, validations ...ValidationFunc) error

ValidateCertificate retrieves the issued certificate and runs all validation functions

func (*Helper) ValidateIssuedCertificate added in v0.7.0

func (h *Helper) ValidateIssuedCertificate(certificate *cmapi.Certificate, rootCAPEM []byte) (*x509.Certificate, error)

ValidateIssuedCertificate will ensure that the given Certificate has a certificate issued for it, and that the details on the x509 certificate are correct as defined by the Certificate's spec.

func (*Helper) ValidateIssuedCertificateRequest added in v0.9.0

func (h *Helper) ValidateIssuedCertificateRequest(cr *cmapi.CertificateRequest, key crypto.Signer, rootCAPEM []byte) (*x509.Certificate, error)

ValidateIssuedCertificateRequest will ensure that the given CertificateRequest has a certificate issued for it, and that the details on the x509 certificate are correct as defined by the CertificateRequest's spec.

func (*Helper) ValidateIssuedCertificateSigningRequest added in v1.4.0

func (h *Helper) ValidateIssuedCertificateSigningRequest(kubeCSR *certificatesv1.CertificateSigningRequest, key crypto.Signer, rootCAPEM []byte) (*x509.Certificate, error)

ValidateIssuedCertificateSigningRequest will ensure that the given CertificateSigningRequest has a certificate issued for it, and that the details on the x509 certificate are correct as defined by the CertificateSigningRequest's spec.

func (*Helper) ValidationSetForUnsupportedFeatureSet added in v1.1.0

func (h *Helper) ValidationSetForUnsupportedFeatureSet(fs featureset.FeatureSet) []ValidationFunc

func (*Helper) WaitCertificateIssued added in v1.1.0

func (h *Helper) WaitCertificateIssued(ns, name string, timeout time.Duration) error

func (*Helper) WaitCertificateRequestIssuedValid added in v0.9.0

func (h *Helper) WaitCertificateRequestIssuedValid(ns, name string, timeout time.Duration, key crypto.Signer) error

func (*Helper) WaitCertificateRequestIssuedValidTLS added in v0.9.0

func (h *Helper) WaitCertificateRequestIssuedValidTLS(ns, name string, timeout time.Duration, key crypto.Signer, rootCAPEM []byte) error

func (*Helper) WaitCertificateSigningRequestIssuedValidTLS added in v1.4.0

func (h *Helper) WaitCertificateSigningRequestIssuedValidTLS(ns, name string, timeout time.Duration, key crypto.Signer, rootCAPEM []byte) error

func (*Helper) WaitForAllPodsRunningInNamespace

func (h *Helper) WaitForAllPodsRunningInNamespace(ns string) error

WaitForAllPodsRunningInNamespace waits default amount of time (PodStartTimeout) for all pods in the specified namespace to become running.

func (*Helper) WaitForAllPodsRunningInNamespaceTimeout

func (h *Helper) WaitForAllPodsRunningInNamespaceTimeout(ns string, timeout time.Duration) error

func (*Helper) WaitForCertificateNotReady added in v0.7.0

func (h *Helper) WaitForCertificateNotReady(ns, name string, timeout time.Duration) (*cmapi.Certificate, error)

WaitForCertificateNotReady waits for the certificate resource to enter a non-Ready state.

func (*Helper) WaitForCertificateReady added in v0.7.0

func (h *Helper) WaitForCertificateReady(ns, name string, timeout time.Duration) (*cmapi.Certificate, error)

WaitForCertificateReady waits for the certificate resource to enter a Ready state.

func (*Helper) WaitForCertificateRequestReady added in v0.9.0

func (h *Helper) WaitForCertificateRequestReady(ns, name string, timeout time.Duration) (*cmapi.CertificateRequest, error)

WaitForCertificateRequestReady waits for the CertificateRequest resource to enter a Ready state.

func (*Helper) WaitForCertificateSigningRequestSigned added in v1.4.0

func (h *Helper) WaitForCertificateSigningRequestSigned(ns, name string, timeout time.Duration) (*certificatesv1.CertificateSigningRequest, error)

WaitForCertificateSigningRequestSigned waits for the CertificateSigningRequest resource to be signed.

func (*Helper) WaitForSecretCertificateData added in v0.11.0

func (h *Helper) WaitForSecretCertificateData(ns, name string, timeout time.Duration) (*corev1.Secret, error)

WaitForSecretCertificateData waits for the certificate data to be ready inside a Secret created by cert-manager.

type Kubectl added in v0.7.0

type Kubectl struct {
	// contains filtered or unexported fields
}

func (*Kubectl) Describe added in v0.7.0

func (k *Kubectl) Describe(resources ...string) error

func (*Kubectl) DescribeResource added in v0.7.0

func (k *Kubectl) DescribeResource(resource, name string) error

func (*Kubectl) Run added in v0.7.0

func (k *Kubectl) Run(args ...string) error

type ValidationFunc added in v1.1.0

type ValidationFunc func(certificate *cmapi.Certificate, secret *v1.Secret) error

ValidationFunc describes a certificate validation helper function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL