support

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigmapName      = "hosts"
	ConfigmapNamespace = "kcp-glbc"
)
View Source
const (
	TestTimeoutShort  = 1 * time.Minute
	TestTimeoutMedium = 5 * time.Minute
	TestTimeoutLong   = 10 * time.Minute

	MaxGeneratedNameLength = maxNameLength - randomLength
)
View Source
const ComputeServiceExportName = "kubernetes"

Variables

View Source
var (
	GLBCResources = []string{"ingresses.networking.k8s.io", "services", "deployments.apps", "secrets", "configmaps"}

	WithKubeConfigByName = &withKubeConfigByName{}
)
View Source
var (
	TestOrganization = getEnvLogicalClusterName(testWorkspaceName, tenancyv1alpha1.RootCluster.Join("kuadrant"))
	GLBCWorkspace    = getEnvLogicalClusterName(glbcWorkspaceName, TestOrganization)
	GLBCExportName   = env.GetEnvString(glbcExportName, "glbc-root-kuadrant")

	ApplyOptions = metav1.ApplyOptions{FieldManager: "kcp-glbc-e2e", Force: true}
)

Functions

func APIBinding

func APIBinding(t Test, workspace, name string) func(g gomega.Gomega) *apisv1alpha1.APIBinding

func AddRecord

func AddRecord(t Test, host string, record Record) error

func Annotations

func Annotations(object metav1.Object) map[string]string

func Certificate

func Certificate(secret *corev1.Secret) (*x509.Certificate, error)

func CertificateFrom

func CertificateFrom(secret *corev1.Secret) (*x509.Certificate, error)

func ConditionStatus

func ConditionStatus(conditionType conditionsapi.ConditionType) func(getter conditionsutil.Getter) corev1.ConditionStatus

func ConfigMap

func ConfigMap(t Test, namespace *corev1.Namespace, name string) func(g gomega.Gomega) *corev1.ConfigMap

func DNSRecord

func DNSRecord(t Test, namespace *corev1.Namespace, name string) func(g gomega.Gomega) *kuadrantv1.DNSRecord

func DNSRecordCondition

func DNSRecordCondition(zoneID, condition string) func(record *kuadrantv1.DNSRecord) *kuadrantv1.DNSZoneCondition

func DNSRecordEndpoints

func DNSRecordEndpoints(record *kuadrantv1.DNSRecord) []*kuadrantv1.Endpoint

func DNSRecordEndpointsCount

func DNSRecordEndpointsCount(record *kuadrantv1.DNSRecord) int

func DNSRecordToIngressCertReady

func DNSRecordToIngressCertReady(t Test, namespace *corev1.Namespace, name string) func(dnsrecord *kuadrantv1.DNSRecord) string

func DNSRecords

func DNSRecords(t Test, namespace *corev1.Namespace, labelSelector string) func(g gomega.Gomega) []kuadrantv1.DNSRecord

func DeploymentConfiguration

func DeploymentConfiguration(namespace, name string) *appsv1apply.DeploymentApplyConfiguration

func Deployments

func Deployments(t Test, namespace *corev1.Namespace, labelSelector string) func(g gomega.Gomega) []appsv1.Deployment

func DomainToken

func DomainToken(verification *kuadrantv1.DomainVerification) string

func DomainVerification

func DomainVerification(t Test, clusterName logicalcluster.Name, name string) func(g gomega.Gomega) *kuadrantv1.DomainVerification

func DomainVerificationFor

func DomainVerificationFor(verification *kuadrantv1.DomainVerification) string

func DomainVerified

func DomainVerified(verification *kuadrantv1.DomainVerification) bool

func EqualP

func EqualP(expected interface{}) types.GomegaMatcher

func GetAPIBinding

func GetAPIBinding(t Test, workspace, name string) *apisv1alpha1.APIBinding

func GetCertificate

func GetCertificate(t Test, namespace, name string) *certman.Certificate

func GetDNSRecord

func GetDNSRecord(t Test, namespace *corev1.Namespace, name string) *kuadrantv1.DNSRecord

func GetDNSRecords

func GetDNSRecords(t Test, namespace *corev1.Namespace, labelSelector string) []kuadrantv1.DNSRecord

func GetDefaultSpec

func GetDefaultSpec(host, tlsSecretName, serviceName string) networkingv1.IngressSpec

func GetDeployments

func GetDeployments(t Test, namespace *corev1.Namespace, labelSelector string) []appsv1.Deployment

func GetIngress

func GetIngress(t Test, namespace *corev1.Namespace, name string) *traffic.Ingress

func GetIngresses

func GetIngresses(t Test, namespace *corev1.Namespace, labelSelector string) []networkingv1.Ingress

func GetSecret

func GetSecret(t Test, namespace *corev1.Namespace, name string) *corev1.Secret

func GetSecrets

func GetSecrets(t Test, namespace *corev1.Namespace, labelSelector string) []corev1.Secret

func GetServices

func GetServices(t Test, namespace *corev1.Namespace, labelSelector string) []corev1.Service

func HasImportedAPIs

func HasImportedAPIs(t Test, workspace *tenancyv1beta1.Workspace, GVKs ...schema.GroupVersionKind) func(g gomega.Gomega) bool

func HasTLSSecretForGeneratedHost

func HasTLSSecretForGeneratedHost(secret string) func(ingress *traffic.Ingress) bool

func HostsEqualsToGeneratedHost

func HostsEqualsToGeneratedHost(ingress *traffic.Ingress) bool

HostsEqualsToGeneratedHost checks Ingress hosts are the same as the generated hosts

func Ingress

func Ingress(t Test, namespace *corev1.Namespace, name string) func(g gomega.Gomega) *traffic.Ingress

func IngressConfiguration

func IngressConfiguration(namespace, name, serviceName, host string) *networkingv1apply.IngressApplyConfiguration

func IngressEndpoints

func IngressEndpoints(t Test, ingress *traffic.Ingress, res dns.HostResolver) []types.GomegaMatcher

func IngressHosts

func IngressHosts(ingress *traffic.Ingress) map[string]string

IngressHosts returns each unique host used in the rules

func IngressPendingHosts

func IngressPendingHosts(ingress *traffic.Ingress) map[string]string

IngressPendingHosts returns each unique host in the pending rules annotation

func IngressTLS

func IngressTLS(ingress *networkingv1.Ingress) []networkingv1.IngressTLS

func Ingresses

func Ingresses(t Test, namespace *corev1.Namespace, labelSelector string) func(g gomega.Gomega) []networkingv1.Ingress

func LBHostEqualToGeneratedHost

func LBHostEqualToGeneratedHost(ingress *traffic.Ingress) bool

func Labels

func Labels(object metav1.Object) map[string]string

func LoadBalancerIngresses

func LoadBalancerIngresses(ingress *traffic.Ingress) []corev1.LoadBalancerIngress

func MatchFieldsP

func MatchFieldsP(options gstruct.Options, fields gstruct.Fields) types.GomegaMatcher

func OriginalSpecUnchanged

func OriginalSpecUnchanged(t Test, originalSpec *networkingv1.IngressSpec) func(ingress *traffic.Ingress) bool

func Secret

func Secret(t Test, namespace *corev1.Namespace, name string) func(g gomega.Gomega) *corev1.Secret

func Secrets

func Secrets(t Test, namespace *corev1.Namespace, labelSelector string) func(g gomega.Gomega) []corev1.Secret

func ServiceConfiguration

func ServiceConfiguration(namespace, name string, annotations map[string]string) *corev1apply.ServiceApplyConfiguration

func Services

func Services(t Test, namespace *corev1.Namespace, labelSelector string) func(g gomega.Gomega) []corev1.Service

func SetARecord

func SetARecord(t Test, host, value string) error

func SetTXTRecord

func SetTXTRecord(t Test, host, value string) error

func SyncTarget

func SyncTarget(t Test, workspace, name string) func(g gomega.Gomega) *workloadv1alpha1.SyncTarget

func Syncer

func Syncer() *syncer

func TLSCertificate

func TLSCertificate(t Test, namespace, name string) func(g gomega.Gomega) *certman.Certificate

func TLSCertificateSpec

func TLSCertificateSpec(cert *certman.Certificate) certman.CertificateSpec

func TransformedSpec

func TransformedSpec(test Test, expectedSpec networkingv1.IngressSpec) func(ingress *traffic.Ingress) bool

TransformedSpec will look at the transforms applied and compare them to the expected spec. cbrookes TODO(look at whether we could take the ingress apply configuration)

func ValidateTransformedIngress

func ValidateTransformedIngress(expectedSpec networkingv1.IngressSpec, transformed *traffic.Ingress) error

func ValidateTransformedRoute

func ValidateTransformedRoute(expectedSpec routev1.RouteSpec, transformed *traffic.Route) error

func Workspace

func Workspace(t Test, name string) func() *tenancyv1beta1.Workspace

Types

type Client

type Client interface {
	Core() kubernetes.ClusterInterface
	Kcp() kcp.ClusterInterface
	Kuadrant() kuadrantv1.ClusterInterface
	Certs() certmanclient.Interface
	GetConfig() *rest.Config
}

type Option

type Option interface {
	// contains filtered or unexported methods
}

func InWorkspace

func InWorkspace(workspace interface{}) Option

func WithComputeServiceExport

func WithComputeServiceExport(path logicalcluster.Name) Option

func WithExportReference

func WithExportReference(path logicalcluster.Name, exportName string) Option

func WithGLBCAcceptablePermissionClaims

func WithGLBCAcceptablePermissionClaims(identityHash string) Option

func WithKubeConfigByID

func WithKubeConfigByID(id string) Option

func WithLabel

func WithLabel(key, value string) Option

func WithLabels

func WithLabels(labels map[string]string) Option

type Record

type Record struct {
	TXT string `json:"TXT,omitempty"`
	A   string `json:"A,omitempty"`
}

type T

type T struct {
	*gomega.WithT
	// contains filtered or unexported fields
}

func (*T) Client

func (t *T) Client() Client

func (*T) CreateGLBCAPIBindings

func (t *T) CreateGLBCAPIBindings(targetWorkspace *tenancyv1beta1.Workspace, glbcWorkspace logicalcluster.Name, glbcExportName string)

func (*T) CreatePlacements

func (t *T) CreatePlacements(targetWorkspace *tenancyv1beta1.Workspace)

func (*T) Ctx

func (t *T) Ctx() context.Context

func (*T) NewAPIBinding

func (t *T) NewAPIBinding(name string, options ...Option) *apisv1alpha1.APIBinding

func (*T) NewSyncTarget

func (t *T) NewSyncTarget(name string, options ...Option) *workloadv1alpha1.SyncTarget

func (*T) NewTestNamespace

func (t *T) NewTestNamespace(options ...Option) *corev1.Namespace

func (*T) NewTestWorkspace

func (t *T) NewTestWorkspace() *tenancyv1beta1.Workspace

func (*T) T

func (t *T) T() *testing.T

type Test

type Test interface {
	T() *testing.T
	Ctx() context.Context
	Client() Client

	gomega.Gomega

	CreateGLBCAPIBindings(*tenancyv1beta1.Workspace, logicalcluster.Name, string)
	CreatePlacements(workspace *tenancyv1beta1.Workspace)
	NewAPIBinding(name string, options ...Option) *apisv1alpha1.APIBinding
	NewSyncTarget(name string, options ...Option) *workloadv1alpha1.SyncTarget
	NewTestNamespace(...Option) *corev1.Namespace
	NewTestWorkspace() *tenancyv1beta1.Workspace
}

func With

func With(t *testing.T) Test

type Zone

type Zone []Record

func GetZone

func GetZone(t Test, host string) (Zone, error)

Jump to

Keyboard shortcuts

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