helper

package
v1.12.11 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 36 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

func NewHelper(cfg *config.Config) *Helper

func (*Helper) Kubectl

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

func (*Helper) ValidateCertificate

func (h *Helper) ValidateCertificate(certificate *cmapi.Certificate, validations ...certificates.ValidationFunc) error

ValidateCertificate retrieves the issued certificate and runs all validation functions

func (*Helper) ValidateCertificateSigningRequest

func (h *Helper) ValidateCertificateSigningRequest(name string, key crypto.Signer, validations ...certificatesigningrequests.ValidationFunc) error

ValidateCertificateSigningRequest retrieves the issued certificate and runs all validation functions

func (*Helper) ValidateIssuedCertificateRequest

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) WaitCertificateRequestIssuedValid

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

func (*Helper) WaitCertificateRequestIssuedValidTLS

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

func (*Helper) WaitClusterIssuerReady

func (h *Helper) WaitClusterIssuerReady(issuer *cmapi.ClusterIssuer, timeout time.Duration) (*cmapi.ClusterIssuer, error)

WaitClusterIssuerReady waits for the Cluster Issuer resource to be in a Ready=True state The Ready=True condition will be checked against the provided issuer to make sure its ready.

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) WaitForCertificateNotReadyAndDoneIssuing

func (h *Helper) WaitForCertificateNotReadyAndDoneIssuing(cert *cmapi.Certificate, timeout time.Duration) (*cmapi.Certificate, error)

WaitForCertificateNotReadyAndDoneIssuing waits for the certificate resource to be in a Ready=False state and not be in an Issuing state. The Ready=False condition will be checked against the provided certificate to make sure that it is up-to-date (condition gen. >= cert gen.).

func (*Helper) WaitForCertificateReadyAndDoneIssuing

func (h *Helper) WaitForCertificateReadyAndDoneIssuing(cert *cmapi.Certificate, timeout time.Duration) (*cmapi.Certificate, error)

WaitForCertificateReadyAndDoneIssuing waits for the certificate resource to be in a Ready=True state and not be in an Issuing state. The Ready=True condition will be checked against the provided certificate to make sure that it is up-to-date (condition gen. >= cert gen.).

func (*Helper) WaitForCertificateRequestReady

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

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

WaitForCertificateSigningRequestSigned waits for the CertificateSigningRequest resource to be signed.

func (*Helper) WaitForCertificateToExist

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

WaitForCertificateToExist waits for the named certificate to exist and returns the certificate

func (*Helper) WaitForSecretCertificateData

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.

func (*Helper) WaitIssuerReady

func (h *Helper) WaitIssuerReady(issuer *cmapi.Issuer, timeout time.Duration) (*cmapi.Issuer, error)

WaitIssuerReady waits for the Issuer resource to be in a Ready=True state The Ready=True condition will be checked against the provided issuer to make sure its ready.

type Kubectl

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

func (*Kubectl) Describe

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

func (*Kubectl) DescribeResource

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

func (*Kubectl) Run

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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