deploy

package
v1.6.1-0...-f207c0f Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TestIDLabel is the label key used to identify resources created by the test suite.
	TestIDLabel = "konghq.com/test-id"
	// KonnectTestIDLabel is the label key added in the Konnect entity used to identify them created by the test suite.
	// Since the label cannot start with `kong`, we use another key.
	KonnectTestIDLabel = "operator-test-id"
)

Variables

View Source
var TestValidCACertPEM = string(testValidCertPEM)

TestValidCACertPEM is a valid CA certificate PEM to be used in tests.

View Source
var TestValidCertKeyPEM = string(testValidCertKeyPEM)

TestValidCertKeyPEM is a valid certificate key PEM to be used in tests.

View Source
var TestValidCertPEM = string(testValidCertPEM)

TestValidCertPEM is a valid certificate PEM to be used in tests.

Functions

func KongCACertificateAttachedToCP

KongCACertificateAttachedToCP deploys a KongCACertificate resource attached to a CP and returns the resource.

func KongCertificateAttachedToCP

KongCertificateAttachedToCP deploys a KongCertificate resource attached to a CP and returns the resource.

func KongConsumer

func KongConsumer(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	username string,
	opts ...ObjOption,
) *configurationv1.KongConsumer

KongConsumer deploys a KongConsumer resource and returns it.

func KongConsumerGroupAttachedToCP

func KongConsumerGroupAttachedToCP(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	opts ...ObjOption,
) *configurationv1beta1.KongConsumerGroup

KongConsumerGroupAttachedToCP deploys a KongConsumerGroup resource attached to a Control Plane and returns the resource.

func KongConsumerWithProgrammed

func KongConsumerWithProgrammed(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	consumer *configurationv1.KongConsumer,
) *configurationv1.KongConsumer

KongConsumerWithProgrammed deploys a KongConsumer resource and returns the resource.

func KongCredentialACL

func KongCredentialACL(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	consumerName string,
	groupName string,
) *configurationv1alpha1.KongCredentialACL

KongCredentialACL deploys a KongCredentialACL resource and returns the resource.

func KongCredentialAPIKey

func KongCredentialAPIKey(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	consumerName string,
) *configurationv1alpha1.KongCredentialAPIKey

KongCredentialAPIKey deploys a KongCredentialAPIKey resource and returns the resource.

func KongCredentialBasicAuth

func KongCredentialBasicAuth(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	consumerName string,
	username string,
	password string,
) *configurationv1alpha1.KongCredentialBasicAuth

KongCredentialBasicAuth deploys a KongCredentialBasicAuth resource and returns the resource.

func KongCredentialHMAC

func KongCredentialHMAC(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	consumerName string,
) *configurationv1alpha1.KongCredentialHMAC

KongCredentialHMAC deploys a KongCredentialHMAC resource and returns the resource.

func KongCredentialJWT

func KongCredentialJWT(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	consumerName string,
) *configurationv1alpha1.KongCredentialJWT

KongCredentialJWT deploys a KongCredentialJWT resource and returns the resource.

func KongDataPlaneClientCertificateAttachedToCP

func KongDataPlaneClientCertificateAttachedToCP(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	opts ...ObjOption,
) *configurationv1alpha1.KongDataPlaneClientCertificate

KongDataPlaneClientCertificateAttachedToCP deploys a KongDataPlaneClientCertificate resource and returns the resource.

func KongKey

func KongKey(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	kid, name string,
	opts ...ObjOption,
) *configurationv1alpha1.KongKey

KongKey deploys a KongKey resource and returns the resource.

func KongKeySet

func KongKeySet(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	name string,
	opts ...ObjOption,
) *configurationv1alpha1.KongKeySet

KongKeySet deploys a KongKeySet resource and returns the resource.

func KongPluginBinding

KongPluginBinding deploys a KongPluginBinding resource and returns the resource.

func KongRoute

func KongRoute(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	opts ...ObjOption,
) *configurationv1alpha1.KongRoute

KongRoute deploys a KongRoute resource and returns the resource.

func KongSNIAttachedToCertificate

func KongSNIAttachedToCertificate(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	cert *configurationv1alpha1.KongCertificate,
	opts ...ObjOption,
) *configurationv1alpha1.KongSNI

KongSNIAttachedToCertificate deploys a KongSNI resource attached to a KongCertificate and returns the resource.

func KongService

func KongService(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	opts ...ObjOption,
) *configurationv1alpha1.KongService

KongService deploys a KongService resource and returns the resource.

func KongServiceWithID

func KongServiceWithID(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	opts ...ObjOption,
) *configurationv1alpha1.KongService

KongServiceWithID deploys a KongService resource and returns the resource. The Status ID and Programmed condition are set on the Service using status Update() call. It can be useful where the reconciler for KonnectGatewayControlPlane is not started and hence the status has to be filled manually.

func KongTargetAttachedToUpstream

func KongTargetAttachedToUpstream(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	upstream *configurationv1alpha1.KongUpstream,
	opts ...ObjOption,
) *configurationv1alpha1.KongTarget

KongTargetAttachedToUpstream deploys a KongTarget resource attached to a Control Plane and returns the resource.

func KongUpstream

func KongUpstream(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	opts ...ObjOption,
) *configurationv1alpha1.KongUpstream

KongUpstream deploys a KongUpstream resource and returns it.

func KongVaultAttachedToCP

func KongVaultAttachedToCP(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	backend string,
	prefix string,
	rawConfig []byte,
	cp *konnectv1alpha2.KonnectGatewayControlPlane,
	opts ...ObjOption,
) *configurationv1alpha1.KongVault

KongVaultAttachedToCP deploys a KongVault resource attached to a CP and returns the resource.

func KonnectAPIAuthConfiguration

func KonnectAPIAuthConfiguration(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	opts ...ObjOption,
) *konnectv1alpha1.KonnectAPIAuthConfiguration

KonnectAPIAuthConfiguration deploys a KonnectAPIAuthConfiguration resource and returns the resource.

func KonnectAPIAuthConfigurationWithProgrammed

func KonnectAPIAuthConfigurationWithProgrammed(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
) *konnectv1alpha1.KonnectAPIAuthConfiguration

KonnectAPIAuthConfigurationWithProgrammed deploys a KonnectAPIAuthConfiguration resource and returns the resource. The Programmed condition is set on the returned resource using status Update() call. It can be useful where the reconciler for KonnectAPIAuthConfiguration is not started and hence the status has to be filled manually.

func KonnectCloudGatewayDataPlaneGroupConfiguration

func KonnectCloudGatewayDataPlaneGroupConfiguration(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	dataplaneGroups []konnectv1alpha1.KonnectConfigurationDataPlaneGroup,
	opts ...ObjOption,
) *konnectv1alpha1.KonnectCloudGatewayDataPlaneGroupConfiguration

KonnectCloudGatewayDataPlaneGroupConfiguration deploys a KonnectCloudGatewayDataPlaneGroupConfiguration resource and returns the resource.

func KonnectCloudGatewayNetwork

KonnectCloudGatewayNetwork deploys a KonnectCloudGatewayNetwork resource and returns it.

func KonnectCloudGatewayNetworkWithProgrammed

func KonnectCloudGatewayNetworkWithProgrammed(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	apiAuth *konnectv1alpha1.KonnectAPIAuthConfiguration,
	opts ...ObjOption,
) *konnectv1alpha1.KonnectCloudGatewayNetwork

KonnectCloudGatewayNetworkWithProgrammed deploys a KonnectNetwork resource and returns it. The Programmed condition is set on the returned resource using status Update() call. It can be useful where the reconciler for KonnectNetwork is not started and hence the status has to be filled manually.

func KonnectExtension

func KonnectExtension(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	opts ...ObjOption,
) *konnectv1alpha2.KonnectExtension

KonnectExtension deploys a KonnectExtension.

func KonnectExtensionReferencingKonnectGatewayControlPlane

func KonnectExtensionReferencingKonnectGatewayControlPlane(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	cp *konnectv1alpha2.KonnectGatewayControlPlane,
) *konnectv1alpha2.KonnectExtension

KonnectExtensionReferencingKonnectGatewayControlPlane deploys a KonnectExtension attached to a Konnect CP represented by the given KonnectGatewayControlPlane.

func KonnectGatewayControlPlane

KonnectGatewayControlPlane deploys a KonnectGatewayControlPlane resource and returns the resource.

func KonnectGatewayControlPlaneWithID

func KonnectGatewayControlPlaneWithID(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	apiAuth *konnectv1alpha1.KonnectAPIAuthConfiguration,
	opts ...ObjOption,
) *konnectv1alpha2.KonnectGatewayControlPlane

KonnectGatewayControlPlaneWithID deploys a KonnectGatewayControlPlane resource and returns the resource. The Status ID and Programmed condition are set on the CP using status Update() call. It can be useful where the reconciler for KonnectGatewayControlPlane is not started and hence the status has to be filled manually.

func ProxyCachePlugin

func ProxyCachePlugin(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
) *configurationv1.KongPlugin

ProxyCachePlugin deploys the proxy-cache KongPlugin resource and returns the resource. The provided client should be namespaced, i.e. created with `client.NewNamespacedClient(client, ns)`

func RateLimitingPlugin

func RateLimitingPlugin(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
) *configurationv1.KongPlugin

RateLimitingPlugin deploys the rate-limiting KongPlugin resource and returns the resource. The provided client should be namespaced, i.e. created with `client.NewNamespacedClient(client, ns)`

func Secret

func Secret(
	t *testing.T,
	ctx context.Context,
	cl client.Client,
	data map[string][]byte,
	opts ...ObjOption,
) *corev1.Secret

Secret deploys a Secret.

func WithTestIDLabel

func WithTestIDLabel(testID string) func(obj client.Object)

WithTestIDLabel returns an ObjOption that sets the test ID label on the object.

Types

type ObjOption

type ObjOption func(obj client.Object)

ObjOption is a function that modifies a client.Object.

func KonnectGatewayControlPlaneLabel

func KonnectGatewayControlPlaneLabel(key, value string) ObjOption

KonnectGatewayControlPlaneLabel returns an ObjOption that adds the given label to the `spec.createControlPlaneRequest.labels` of the KonnectGatewayControlPlane. This adds the given label on the created control plane in Konnect (instead of the label in the k8s metadata).

func KonnectGatewayControlPlaneType

func KonnectGatewayControlPlaneType(typ sdkkonnectcomp.CreateControlPlaneRequestClusterType) ObjOption

KonnectGatewayControlPlaneType returns an ObjOption that sets the cluster type on the CP.

func KonnectGatewayControlPlaneTypeWithCloudGatewaysEnabled

func KonnectGatewayControlPlaneTypeWithCloudGatewaysEnabled() ObjOption

KonnectGatewayControlPlaneTypeWithCloudGatewaysEnabled returns an ObjOption that enabled cloud gateways on the CP.

func WithAnnotation

func WithAnnotation(key, value string) ObjOption

WithAnnotation returns an ObjOption that sets the given key-value pair as an annotation on the object.

func WithKonnectConfiguration

func WithKonnectConfiguration[T ObjectSupportingKonnectConfiguration](
	konnectConfiguration konnectv1alpha2.KonnectConfiguration,
) ObjOption

WithKonnectConfiguration returns an option function that sets the `KonnectConfiguration` in the object.

func WithKonnectExtensionKonnectNamespacedRefControlPlaneRef

func WithKonnectExtensionKonnectNamespacedRefControlPlaneRef(cp *konnectv1alpha2.KonnectGatewayControlPlane) ObjOption

WithKonnectExtensionKonnectNamespacedRefControlPlaneRef returns an ObjOption that sets the ControlPlaneRef on the konnectExtension to a namespaced ref.

func WithKonnectID

func WithKonnectID(id string) ObjOption

WithKonnectID returns an ObjOption that sets the Konnect ID on the object.

func WithKonnectIDControlPlaneRef

func WithKonnectIDControlPlaneRef(cp *konnectv1alpha2.KonnectGatewayControlPlane) ObjOption

WithKonnectIDControlPlaneRef returns an ObjOption that sets the ControlPlaneRef on the object to a KonnectID.

func WithKonnectNamespacedRefControlPlaneRef

func WithKonnectNamespacedRefControlPlaneRef(cp *konnectv1alpha2.KonnectGatewayControlPlane) ObjOption

WithKonnectNamespacedRefControlPlaneRef returns an ObjOption that sets the ControlPlaneRef on the object to a namespaced ref.

NOTE: This only works with namespaced resources. Using it with cluster-scoped resources requires additional handling ( to only set the namespace when the resource is cluster-scoped).

func WithLabel

func WithLabel(key, value string) ObjOption

WithLabel returns an ObjOption that sets the given key-value pair as an label on the object.

func WithMirrorSource

func WithMirrorSource(konnectID string) ObjOption

WithMirrorSource returns an ObjOption that sets the Source as Mirror and Mirror fields on the object.

func WithName

func WithName(name string) ObjOption

WithName returns an ObjOption that sets the name of the object.

func WithNamespacedKongServiceRef

func WithNamespacedKongServiceRef(svc *configurationv1alpha1.KongService) ObjOption

WithNamespacedKongServiceRef returns an ObjOption that sets the ServiceRef on the object to a namespaced ref.

type ObjectSupportingKonnectConfiguration

type ObjectSupportingKonnectConfiguration interface {
	*konnectv1alpha2.KonnectGatewayControlPlane |
		*konnectv1alpha1.KonnectCloudGatewayNetwork
}

ObjectSupportingKonnectConfiguration defines the interface of types supporting setting `KonnectConfiguration`.

Jump to

Keyboard shortcuts

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