ops

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 53 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// ControlPlaneGroupMembersReferenceResolvedConditionType sets the condition for control plane groups
	// to show whether all of its members are programmed and attached to the group.
	ControlPlaneGroupMembersReferenceResolvedConditionType = "MembersReferenceResolved"
	// ControlPlaneGroupMembersReferenceResolvedReasonResolved indicates that all members of the control plane group
	// are created and attached to the group in Konnect.
	ControlPlaneGroupMembersReferenceResolvedReasonResolved kcfgconsts.ConditionReason = "Resolved"
	// ControlPlaneGroupMembersReferenceResolvedReasonPartialNotResolved indicates that some members of the control plane group
	// are not resolved (not found or not created in Konnect).
	ControlPlaneGroupMembersReferenceResolvedReasonPartialNotResolved kcfgconsts.ConditionReason = "SomeMemberNotResolved"
	// ControlPlaneGroupMembersReferenceResolvedReasonFailedToSet indicates that error happened on setting control plane as
	// member of the control plane.
	ControlPlaneGroupMembersReferenceResolvedReasonFailedToSet kcfgconsts.ConditionReason = "SetGroupMemberFailed"
)
View Source
const (
	// KubernetesNamespaceLabelKey is the key for the Kubernetes namespace label.
	KubernetesNamespaceLabelKey = "k8s-namespace"

	// KubernetesNameLabelKey is the key for the Kubernetes name label.
	KubernetesNameLabelKey = "k8s-name"

	// KubernetesUIDLabelKey is the key for the Kubernetes UID label.
	KubernetesUIDLabelKey = "k8s-uid"

	// KubernetesGenerationLabelKey is the key for the Kubernetes generation label.
	KubernetesGenerationLabelKey = "k8s-generation"

	// KubernetesKindLabelKey is the key for the Kubernetes kind label.
	KubernetesKindLabelKey = "k8s-kind"

	// KubernetesGroupLabelKey is the key for the Kubernetes group label.
	KubernetesGroupLabelKey = "k8s-group"

	// KubernetesVersionLabelKey is the key for the Kubernetes version label.
	KubernetesVersionLabelKey = "k8s-version"

	// ManagedByLabelKey is the key for the label that indicates the manager of the Konnect entity.
	ManagedByLabelKey = "managed-by"

	// ManagedByKongOperatorLabelValue is the value for the label that indicates the kong operator is the manager of the Konnect entity.
	ManagedByKongOperatorLabelValue = "kong-operator"
)
View Source
const (
	// DefaultRateLimitRetryAfter is the default retry-after duration when the
	// Retry-After header is not present in the rate limit response.
	DefaultRateLimitRetryAfter = 15 * time.Second

	// DefaultReferenceRetryAfter is the fixed retry-after duration used when a Konnect
	// operation returns a 400 with only ERROR_TYPE_REFERENCE errors. This avoids
	// controller-runtime's exponential backoff (which can grow into minutes) for a
	// condition that is inherently transient (e.g. all targets recreated at once while
	// the upstream is not yet present in Konnect).
	DefaultReferenceRetryAfter = 500 * time.Millisecond
)

Variables

View Source
var ErrNilResponse = errors.New("nil response received")

ErrNilResponse is an error indicating that a Konnect operation returned an empty response. This can sometimes happen regardless of the err being nil.

View Source
var ErrUnexpectedIDType = errors.New("unexpected ID type from SDK response")

ErrUnexpectedIDType is returned by generated getForUID code when an SDK list/get response item exposes an ID via GetID() whose dynamic type is neither string nor *string. Surfacing this explicitly avoids silently treating the entity as "not found" and looping on create conflicts.

Functions

func Adopt added in v2.1.1

func Adopt[
	T constraints.SupportedKonnectEntityType,
	TEnt constraints.EntityType[T],
](
	ctx context.Context,
	sdk sdkops.SDKWrapper,
	syncPeriod time.Duration,
	cl client.Client,
	metricRecorder metrics.Recorder,
	e TEnt,
	adoptOptions commonv1alpha1.AdoptOptions,
) (ctrl.Result, error)

Adopt adopts an exiting entity in Konnect and take over the management of the entity.

func ClearInstanceFromError

func ClearInstanceFromError(err error) error

ClearInstanceFromError clears the instance field from the error. This is needed because the instance field contains the trace ID which changes with each request and makes the reconciliation loop requeue the resource instead of performing the backoff.

func Create

func Create[
	T constraints.SupportedKonnectEntityType,
	TEnt constraints.EntityType[T],
](
	ctx context.Context,
	sdk sdkops.SDKWrapper,
	cl client.Client,
	metricRecorder metrics.Recorder,
	e TEnt,
) (*T, error)

Create creates a Konnect entity.

func CreateGeneratedOps added in v2.2.0

func CreateGeneratedOps[
	T constraints.SupportedKonnectEntityType,
	TEnt constraints.EntityType[T],
](
	ctx context.Context,
	sdk sdkops.SDKWrapper,
	cl client.Client,
	e TEnt,
) error

CreateGeneratedOps dispatches create operations to per-entity generated create functions. It is a stub dispatcher intended for Konnect entities whose ops layer is fully generated; entities handled by hand-written ops remain in the Create function in ops.go.

func CreateKongDataPlaneClientCertificate

func CreateKongDataPlaneClientCertificate(
	ctx context.Context,
	sdk sdkkonnectgo.DPCertificatesSDK,
	cert *configurationv1alpha1.KongDataPlaneClientCertificate,
) error

CreateKongDataPlaneClientCertificate creates a KongDataPlaneClientCertificate in Konnect. It sets the KonnectID in the KongDataPlaneClientCertificate status.

func Delete

func Delete[
	T constraints.SupportedKonnectEntityType,
	TEnt constraints.EntityType[T],
](ctx context.Context, sdk sdkops.SDKWrapper, cl client.Client, metricRecorder metrics.Recorder, ent TEnt) error

Delete deletes a Konnect entity. It returns an error if the entity does not have a Konnect ID or if the operation fails.

func DeleteConfigStoreSecret added in v2.4.0

func DeleteConfigStoreSecret(
	ctx context.Context,
	sdk sdkkonnectgo.ConfigStoreSecretsSDK,
	controlPlaneID, configStoreID, key string,
) error

DeleteConfigStoreSecret deletes one entry. A missing entry (404) is treated as already deleted.

func DeleteGeneratedOps added in v2.2.0

func DeleteGeneratedOps[
	T constraints.SupportedKonnectEntityType,
	TEnt constraints.EntityType[T],
](
	ctx context.Context,
	sdk sdkops.SDKWrapper,
	e TEnt,
) error

DeleteGeneratedOps dispatches delete operations to per-entity generated delete functions. It is a stub dispatcher intended for Konnect entities whose ops layer is fully generated; entities handled by hand-written ops remain in the Delete function in ops.go.

func DeleteKongDataPlaneClientCertificate

func DeleteKongDataPlaneClientCertificate(
	ctx context.Context,
	sdk sdkkonnectgo.DPCertificatesSDK,
	cert *configurationv1alpha1.KongDataPlaneClientCertificate,
) error

DeleteKongDataPlaneClientCertificate deletes a KongDataPlaneClientCertificate in Konnect. The KongDataPlaneClientCertificate must have a KonnectID set in its status. It returns an error if the operation fails.

func EntityPersistsKonnectID added in v2.2.0

func EntityPersistsKonnectID(obj konnectIDPersister) bool

EntityPersistsKonnectID reports whether an entity persists a Konnect ID in status. Entities that persist a Konnect ID require it to be present for update and delete operations, while non-persisting entities (e.g. singleton sub-resources) are reconciled, finalized, and deleted without one.

func ErrIsNotFound added in v2.1.1

func ErrIsNotFound(err error) bool

ErrIsNotFound returns true if the provided error indicates that the entity was not found on Konnect.

func ErrorIsCreateConflict

func ErrorIsCreateConflict(err error) bool

ErrorIsCreateConflict returns true if the provided error is a Konnect conflict error.

Example error body:

{
	"status": 409,
	"title": "Conflict",
	"instance": "kong:trace:14893476519012495000",
	"detail": "Key (org_id, name)=(8a6e97b1-1111-1111-1111-111111111111, test1) already exists."
}

NOTE: Konnect APIs specific for Konnect only APIs like Gateway Control Planes return 409 conflict for already existing entities and return ConflictError. APIs that are shared with Kong Admin API return 400 for conflicts and return SDKError.

func ErrorIsForbiddenError

func ErrorIsForbiddenError(err error) bool

ErrorIsForbiddenError returns true if the provided error is a 403 Forbidden error. This can happen when the requested operation is not permitted. Example SDKError body (SDKError message is a separate field from body message):

{
	"code": 7,
	"message": "usage constraint error",
	"details": [
		{
			"@type": "type.googleapis.com/kong.admin.model.v1.ErrorDetail",
			"messages": [
				"operation not permitted on KIC cluster"
			]
		}
	]
}

func ErrorIsRateLimited added in v2.1.1

func ErrorIsRateLimited(err error) bool

ErrorIsRateLimited returns true if the provided error is a 429 Too Many Requests error. This can happen when the Konnect API rate limit is exhausted.

func ErrorIsSDKBadRequestError

func ErrorIsSDKBadRequestError(err error) bool

ErrorIsSDKBadRequestError returns true if the provided error is a BadRequestError.

func ErrorIsSDKError400

func ErrorIsSDKError400(err error) bool

ErrorIsSDKError400 returns true if the provided error is a 400 BadRequestError. This can happen when the requested entity fails the validation.

It returns false when the error can be parsed as SDK error and all sub errors are of type ERROR_TYPE_REFERENCE since those depend on other entities that can be independently created/deleted in Konnect.

If the provided SDK error's details are empty or cannot be parsed, it returns true.

func ErrorIsServerError added in v2.4.0

func ErrorIsServerError(err error) bool

ErrorIsServerError returns true if the provided error is a Konnect 5xx server error.

func GenerateTagsForObject

func GenerateTagsForObject(obj ObjectWithMetadata, additionalTags ...string) []string

GenerateTagsForObject generates tags for the given object based on its Kubernetes metadata and annotations. An optional set of tags can be passed to be included in the generated tags (e.g. tags from the spec). It returns a slice of unique, sorted strings for deterministic output.

func GetConfigStoreSecretMetadata added in v2.4.0

func GetConfigStoreSecretMetadata(
	ctx context.Context,
	sdk sdkkonnectgo.ConfigStoreSecretsSDK,
	controlPlaneID, configStoreID, key string,
) (updatedAt time.Time, found bool, err error)

GetConfigStoreSecretMetadata returns the store-side updated_at timestamp of one entry. Reads are metadata-only: the value is never returned by the API. found is false when the entry does not exist.

func GetControlPlaneByID

func GetControlPlaneByID(
	ctx context.Context,
	sdk sdkkonnectgo.ControlPlanesSDK,
	id string,
) (*sdkkonnectcomp.ControlPlane, error)

GetControlPlaneByID returns the Konnect ControlPlane that matches the provided ID.

func GetRetryAfterFromRateLimitError added in v2.1.1

func GetRetryAfterFromRateLimitError(err error) (time.Duration, bool)

GetRetryAfterFromRateLimitError extracts the Retry-After duration from a rate limit error. It checks for the Retry-After header in the HTTP response. If the header is not present or cannot be parsed, it returns the default retry-after duration. If the error is not a rate limit error, it returns 0 and false.

func IgnoreAlreadyHandledErr added in v2.1.1

func IgnoreAlreadyHandledErr(err error, logger logr.Logger) error

IgnoreAlreadyHandledErr ignores errors that have already been handled by setting the appropriate conditions in the object's status. For now, it only handles cross-namespace reference errors: those should not be logged, retried or reported to controller runtime's error handling.

func IgnoreUnrecoverableAPIErr

func IgnoreUnrecoverableAPIErr(err error, logger logr.Logger) error

IgnoreUnrecoverableAPIErr ignores unrecoverable errors that would cause the reconciler to endlessly requeue, and wraps transient errors with a fixed retry-after duration to avoid controller-runtime's exponential backoff.

func ListKongDataPlaneClientCertificates

func ListKongDataPlaneClientCertificates(
	ctx context.Context,
	sdk sdkkonnectgo.DPCertificatesSDK,
	cpID string,
) ([]sdkkonnectcomp.DataPlaneClientCertificate, error)

ListKongDataPlaneClientCertificates lists KongDataPlaneClientCertificates in Konnect. It returns an error if the operation fails.

func ParseSDKErrorBody

func ParseSDKErrorBody(body string) (sdkErrorBody, error)

ParseSDKErrorBody parses the body of an SDK error response. Exemplary body:

{
	"code": 3,
	"message": "data constraint error",
	"details": [
		{
			"@type": "type.googleapis.com/kong.admin.model.v1.ErrorDetail",
			"type": "ERROR_TYPE_REFERENCE",
			"field": "name",
			"messages": [
				"name (type: unique) constraint failed"
			]
		}
	]
}

func SDKErrorIsConflict

func SDKErrorIsConflict(sdkError *sdkkonnecterrs.SDKError) bool

SDKErrorIsConflict returns true if the provided SDKError indicates a conflict. We currently handle two codes (as mapped in https://grpc.io/docs/guides/status-codes/#the-full-list-of-status-codes) from SDK error: - 3: INVALID_ARGUMENT - 6: ALREADY_EXISTS

Example error body:

{
"code": 3,
"message": "name (type: unique) constraint failed",
"details": [
  {
  "@type": "type.googleapis.com/kong.admin.model.v1.ErrorDetail",
  "type": "ERROR_TYPE_REFERENCE",
  "field": "name",
  "messages": [
    "name (type: unique) constraint failed"
  ]
  }
]
}

func SetControlPlaneGroupMembersReferenceResolvedCondition

func SetControlPlaneGroupMembersReferenceResolvedCondition(
	cpGroup *konnectv1alpha2.KonnectGatewayControlPlane,
)

SetControlPlaneGroupMembersReferenceResolvedCondition sets MembersReferenceResolved condition of control plane to True.

func SetControlPlaneGroupMembersReferenceResolvedConditionFalse

func SetControlPlaneGroupMembersReferenceResolvedConditionFalse(
	cpGroup *konnectv1alpha2.KonnectGatewayControlPlane,
	reason kcfgconsts.ConditionReason,
	msg string,
)

SetControlPlaneGroupMembersReferenceResolvedConditionFalse sets MembersReferenceResolved condition of control plane to False.

func SetKonnectEntityAdoptedConditionFalse added in v2.1.1

func SetKonnectEntityAdoptedConditionFalse(
	obj entityType,
	reason kcfgconsts.ConditionReason,
	err error,
)

SetKonnectEntityAdoptedConditionFalse sets the KonnectEntityAdopted condition to false on the provided object.

func SetKonnectEntityAdoptedConditionTrue added in v2.1.1

func SetKonnectEntityAdoptedConditionTrue(
	obj entityType,
)

SetKonnectEntityAdoptedConditionTrue sets the KonnectEntityAdopted condition to True on the provided object.

func SetKonnectEntityCreateInputsAppliedConditionTrue added in v2.4.0

func SetKonnectEntityCreateInputsAppliedConditionTrue(obj entityType)

SetKonnectEntityCreateInputsAppliedConditionTrue records a successful create.

func SetKonnectEntityMirroredConditionFalse

func SetKonnectEntityMirroredConditionFalse(
	obj entityType,
	err error,
)

SetKonnectEntityMirroredConditionFalse sets the KonnectEntityMirrored condition to false on the provided object.

func SetKonnectEntityMirroredConditionTrue

func SetKonnectEntityMirroredConditionTrue(
	obj entityType,
)

SetKonnectEntityMirroredConditionTrue sets the KonnectEntityMirrored condition to true on the provided object.

func SetKonnectEntityProgrammedConditionFalse

func SetKonnectEntityProgrammedConditionFalse(
	obj entityType,
	reason kcfgconsts.ConditionReason,
	err error,
)

SetKonnectEntityProgrammedConditionFalse sets the KonnectEntityProgrammed condition to false on the provided object.

func SetKonnectEntityProgrammedConditionTrue

func SetKonnectEntityProgrammedConditionTrue(
	obj entityType,
)

SetKonnectEntityProgrammedConditionTrue sets the KonnectEntityProgrammed condition to true on the provided object. Unlike the failure counterpart, the condition is upserted even when its content is unchanged, so LastTransitionTime advances on every successful Konnect operation. shouldUpdate uses that timestamp as the last-sync time to enforce the sync period, so it has to be refreshed on each success. LastTransitionTime therefore records the last successful sync, not the last status transition.

func SetListPageSize added in v2.4.0

func SetListPageSize(size int64) error

SetListPageSize sets the page size requested when listing Konnect entities page by page. It must be called before the controllers start, as it is not safe for concurrent use; size must be between 1 and consts.MaxKonnectListPageSize.

func UIDLabelForObject

func UIDLabelForObject(obj client.Object) string

UIDLabelForObject returns the Kubernetes UID label and provided object's UID separated by a semicolon.

func Update

func Update[
	T constraints.SupportedKonnectEntityType,
	TEnt constraints.EntityType[T],
](
	ctx context.Context,
	sdk sdkops.SDKWrapper,
	syncPeriod time.Duration,
	cl client.Client,
	metricRecorder metrics.Recorder,
	e TEnt,
) (ctrl.Result, error)

Update updates a Konnect entity. It returns an error if the entity does not have a Konnect ID or if the operation fails.

func UpdateGeneratedOps added in v2.2.0

func UpdateGeneratedOps[
	T constraints.SupportedKonnectEntityType,
	TEnt constraints.EntityType[T],
](
	ctx context.Context,
	sdk sdkops.SDKWrapper,
	cl client.Client,
	e TEnt,
) error

UpdateGeneratedOps dispatches update operations to per-entity generated update functions. It is a stub dispatcher intended for Konnect entities whose ops layer is fully generated; entities handled by hand-written ops remain in the Update function in ops.go.

func UpsertConfigStoreSecret added in v2.4.0

func UpsertConfigStoreSecret(
	ctx context.Context,
	sdk sdkkonnectgo.ConfigStoreSecretsSDK,
	controlPlaneID, configStoreID, key, value string,
) (created bool, updatedAt time.Time, err error)

UpsertConfigStoreSecret writes one Config Store entry with PUT. Konnect returns 201 when the key was created and 200 when it was updated.

func WithKubernetesMetadataLabels

func WithKubernetesMetadataLabels(obj ObjectWithMetadata, userSetLabels map[string]string) map[string]string

WithKubernetesMetadataLabels returns a map of user-provided labels to be assigned to a Konnect entity with the origin Kubernetes object's metadata added. These can be assigned to a Konnect entity that supports labels (e.g. ControlPlane). The Kubernetes metadata labels take precedence over user-provided labels with the same keys, so that users cannot override the labels the operator relies on (e.g. the UID label used to find the entity owned by an object).

func WithKubernetesMetadataLabelsPtr added in v2.2.0

func WithKubernetesMetadataLabelsPtr(obj ObjectWithMetadata, userSetLabels map[string]*string) map[string]*string

WithKubernetesMetadataLabelsPtr is the pointer-valued counterpart of WithKubernetesMetadataLabels for Konnect APIs whose label maps use nullable string values (map[string]*string). It preserves nil user-set entries (which semantically delete a label on update) while adding the Kubernetes metadata labels as non-nil values. As in WithKubernetesMetadataLabels, the Kubernetes metadata labels take precedence, so a user-set entry (nil or not) cannot override or delete them.

func WithResolvedConfigStoreID added in v2.3.0

func WithResolvedConfigStoreID(ctx context.Context, id string) context.Context

WithResolvedConfigStoreID makes a Config Store ID resolved during reference handling available to the KongVault operation in the same reconciliation.

func WithResolvedPolicyChainIDs added in v2.4.0

func WithResolvedPolicyChainIDs(ctx context.Context, obj policyChainObject, ids []string) context.Context

WithResolvedPolicyChainIDs passes validated, ordered IDs to the chain operation in the same reconciliation. Callers must resolve them again for each reconcile.

Types

type AIGatewayCustomPolicyInUseError added in v2.4.0

type AIGatewayCustomPolicyInUseError struct {
	// CustomPolicyName is the Konnect name of the custom policy.
	CustomPolicyName string
	// Users are the AIGatewayPolicy objects in the cluster (namespace/name)
	// behind the Konnect policies using the custom policy.
	Users []string
	// KonnectPolicies are the names of the Konnect policies using the custom
	// policy, including ones not managed from this cluster.
	KonnectPolicies []string
	// UnmanagedKonnectPolicies are the names of the KonnectPolicies with no
	// AIGatewayPolicy in the cluster behind them.
	UnmanagedKonnectPolicies []string
	// Err is the underlying Konnect API error.
	Err error
}

AIGatewayCustomPolicyInUseError is returned when Konnect rejects the deletion of an AIGatewayCustomPolicy because policies still use it (their type is the custom policy's Konnect name). Deletion is blocked until those policies are removed or stop using it.

func (AIGatewayCustomPolicyInUseError) DeletionBlockedMessage added in v2.4.0

func (e AIGatewayCustomPolicyInUseError) DeletionBlockedMessage() string

DeletionBlockedMessage returns a user-facing message naming what still uses the custom policy.

func (AIGatewayCustomPolicyInUseError) Error added in v2.4.0

Error implements the error interface.

func (AIGatewayCustomPolicyInUseError) Unwrap added in v2.4.0

Unwrap returns the underlying Konnect API error.

type AIGatewayDatastoreInUseError added in v2.4.0

type AIGatewayDatastoreInUseError struct {
	// DatastoreName is the Konnect name of the datastore.
	DatastoreName string
	// Users names the Konnect entities still referencing the datastore, as
	// "<type>/<name>". It is empty when Konnect didn't report them.
	Users []string
	// Err is the underlying Konnect API error.
	Err error
}

AIGatewayDatastoreInUseError is returned when Konnect rejects the deletion of an AIGatewayDatastore because other entities still use it. The deletion is blocked until those stop referencing it.

func (AIGatewayDatastoreInUseError) DeletionBlockedMessage added in v2.4.0

func (e AIGatewayDatastoreInUseError) DeletionBlockedMessage() string

DeletionBlockedMessage returns a user-facing message naming what still uses the datastore.

func (AIGatewayDatastoreInUseError) Error added in v2.4.0

Error implements the error interface.

func (AIGatewayDatastoreInUseError) Unwrap added in v2.4.0

Unwrap returns the underlying Konnect API error.

type CantPerformOperationWithoutControlPlaneIDError

type CantPerformOperationWithoutControlPlaneIDError struct {
	Entity entity
	Op     Op
}

CantPerformOperationWithoutControlPlaneIDError is an error indicating that an operation cannot be performed without a ControlPlane ID.

func (CantPerformOperationWithoutControlPlaneIDError) Error

Error implements the error interface.

func (CantPerformOperationWithoutControlPlaneIDError) Is added in v2.2.0

Is reports any error in err's tree matches target.

type CantPerformOperationWithoutEventGatewayIDError added in v2.2.0

type CantPerformOperationWithoutEventGatewayIDError struct {
	Entity entity
	Op     Op
}

CantPerformOperationWithoutEventGatewayIDError is an error indicating that an operation cannot be performed without a Konnect Event Gateway ID.

func (CantPerformOperationWithoutEventGatewayIDError) Error added in v2.2.0

type CantPerformOperationWithoutNetworkIDError

type CantPerformOperationWithoutNetworkIDError struct {
	Entity entity
	Op     Op
}

CantPerformOperationWithoutNetworkIDError is an error indicating that an operation cannot be performed without a Konnect network ID.

func (CantPerformOperationWithoutNetworkIDError) Error

type CantPerformOperationWithoutParentIDError added in v2.2.0

type CantPerformOperationWithoutParentIDError struct {
	Entity entity
	Parent string
	Op     Op
}

CantPerformOperationWithoutParentIDError is an error indicating that an operation cannot be performed because the parent entity's Konnect ID has not been populated on the child object's status. Used by generated ops code for non-root (scoped) entities.

func (CantPerformOperationWithoutParentIDError) Error added in v2.2.0

type ConflictOnCreateButNoConflifctHandlingImplementedError added in v2.2.0

type ConflictOnCreateButNoConflifctHandlingImplementedError struct {
	Entity client.Object
}

ConflictOnCreateButNoConflifctHandlingImplementedError is returned when a create request conflicts with an existing Konnect entity but no conflict resolution is implemented for the entity type.

func (ConflictOnCreateButNoConflifctHandlingImplementedError) Error added in v2.2.0

Error implements the error interface.

type ControlPlaneGroupMemberNoKonnectIDError

type ControlPlaneGroupMemberNoKonnectIDError struct {
	GroupName  string
	MemberName string
}

ControlPlaneGroupMemberNoKonnectIDError is an error type returned when member of control plane group does not have a Konnect ID.

func (ControlPlaneGroupMemberNoKonnectIDError) Error

Error implements the error interface.

type CredentialBasicAuthSDK

CredentialBasicAuthSDK is the interface for the Konnect CredentialBasicAuthSDK.

type DeletionBlockedError added in v2.4.0

type DeletionBlockedError interface {
	error
	DeletionBlockedMessage() string
}

DeletionBlockedError is implemented by errors returned when Konnect refuses to delete an entity until something else is removed first (e.g. a config store that still holds secret entries, or a custom policy still used by policies). The reconciler keeps the cleanup finalizer, reports DeletionBlockedMessage in a DeletionBlocked Programmed condition, and retries on a fixed period.

type EntityWithMatchingIDNotFoundError

type EntityWithMatchingIDNotFoundError struct {
	ID string
}

EntityWithMatchingIDNotFoundError is an error indicating that an entity with the matching ID was not found on Konnect.

func (EntityWithMatchingIDNotFoundError) Error

Error implements the error interface.

type EntityWithMatchingUIDNotFoundError

type EntityWithMatchingUIDNotFoundError struct {
	Entity entity
}

EntityWithMatchingUIDNotFoundError is an error indicating that an entity with a matching UID was not found on Konnect.

func (EntityWithMatchingUIDNotFoundError) Error

Error implements the error interface.

type EventGatewayEntityInUseError added in v2.4.0

type EventGatewayEntityInUseError struct {
	// What names the entity in messages, e.g. "virtual cluster".
	What string
	// Users are the policy objects of the entity's namespace referencing it,
	// as "Kind namespace/name", sorted.
	Users []string
	// OtherNamespacesUsers is the number of policy objects of other namespaces
	// referencing it, counted rather than named so as not to disclose them.
	OtherNamespacesUsers int
	// Unblock tells how to unblock the deletion, e.g. "delete them or stop
	// forwarding to the virtual cluster".
	Unblock string
	// Err is the underlying Konnect API error.
	Err error
}

EventGatewayEntityInUseError is returned when Konnect refuses to delete an Event Gateway entity that policy objects of the cluster, created in Konnect, still reference by object, e.g. a virtual cluster listener policies forward to. Deletion is blocked until those policies are deleted or stop referencing it: the entity's controller watches them, so the deletion is retried once one changes.

func (EventGatewayEntityInUseError) DeletionBlockedMessage added in v2.4.0

func (e EventGatewayEntityInUseError) DeletionBlockedMessage() string

DeletionBlockedMessage returns a user-facing message naming what still uses the entity.

func (EventGatewayEntityInUseError) Error added in v2.4.0

Error implements the error interface.

func (EventGatewayEntityInUseError) Unwrap added in v2.4.0

Unwrap returns the underlying Konnect API error.

type EventGatewayParentPolicyInUseError added in v2.4.0

type EventGatewayParentPolicyInUseError struct {
	// Users are the child policy objects in the namespace of the parent
	// (namespace/name, sorted).
	Users []string
	// OtherNamespacesUsers is the number of child policy objects in other
	// namespaces, counted rather than named so as not to disclose them.
	OtherNamespacesUsers int
}

EventGatewayParentPolicyInUseError blocks deletion while child policy objects reference a parent whose deletion would cascade in Konnect.

func (EventGatewayParentPolicyInUseError) DeletionBlockedMessage added in v2.4.0

func (e EventGatewayParentPolicyInUseError) DeletionBlockedMessage() string

DeletionBlockedMessage explains how to unblock the parent's deletion.

func (EventGatewayParentPolicyInUseError) Error added in v2.4.0

type EventGatewaySchemaRegistryInUseError added in v2.4.0

type EventGatewaySchemaRegistryInUseError struct {
	// ProduceUsers and ConsumeUsers are the policy objects in the schema
	// registry's namespace (namespace/name, sorted) behind the Konnect
	// policies using it.
	ProduceUsers []string
	ConsumeUsers []string
	// OtherNamespacesProduceUsers and OtherNamespacesConsumeUsers count the
	// policy objects in other namespaces behind the Konnect policies using the
	// schema registry, rather than naming them, so as not to disclose them.
	OtherNamespacesProduceUsers int
	OtherNamespacesConsumeUsers int
	// UnmanagedProducePolicies and UnmanagedConsumePolicies are the Konnect
	// policies (virtualCluster/policy, sorted) using the schema registry with
	// no policy object in the cluster behind them.
	UnmanagedProducePolicies []string
	UnmanagedConsumePolicies []string
	// Err is the underlying Konnect API error.
	Err error
}

EventGatewaySchemaRegistryInUseError is returned when Konnect rejects the deletion of an EventGatewaySchemaRegistry because produce or consume policies still use it. Deletion is blocked until those policies are removed or stop using it: the EventGatewaySchemaRegistry controller watches the policy objects, so the deletion is retried once one of them changes.

func (EventGatewaySchemaRegistryInUseError) DeletionBlockedMessage added in v2.4.0

func (e EventGatewaySchemaRegistryInUseError) DeletionBlockedMessage() string

DeletionBlockedMessage returns a user-facing message naming what still uses the schema registry.

func (EventGatewaySchemaRegistryInUseError) Error added in v2.4.0

Error implements the error interface.

func (EventGatewaySchemaRegistryInUseError) Unwrap added in v2.4.0

Unwrap returns the underlying Konnect API error.

type EventGatewayStaticKeyInUseError added in v2.4.0

type EventGatewayStaticKeyInUseError struct {
	// Users are the EventGatewayVirtualClusterProducePolicy objects in the
	// static key's namespace (namespace/name, sorted) behind the Konnect
	// policies using it.
	Users []string
	// OtherNamespacesUsers is the number of
	// EventGatewayVirtualClusterProducePolicy objects in other namespaces behind
	// the Konnect policies using the static key, counted rather than named so
	// as not to disclose them.
	OtherNamespacesUsers int
	// UnmanagedKonnectPolicies are the Konnect produce policies
	// (virtualCluster/policy, sorted) using the static key with no
	// EventGatewayVirtualClusterProducePolicy in the cluster behind them.
	UnmanagedKonnectPolicies []string
	// Err is the underlying Konnect API error.
	Err error
}

EventGatewayStaticKeyInUseError is returned when Konnect rejects the deletion of an EventGatewayStaticKey because produce policies still use it. Deletion is blocked until those policies are removed or stop using it.

func (EventGatewayStaticKeyInUseError) DeletionBlockedMessage added in v2.4.0

func (e EventGatewayStaticKeyInUseError) DeletionBlockedMessage() string

DeletionBlockedMessage returns a user-facing message naming what still uses the static key.

func (EventGatewayStaticKeyInUseError) Error added in v2.4.0

Error implements the error interface.

func (EventGatewayStaticKeyInUseError) Unwrap added in v2.4.0

Unwrap returns the underlying Konnect API error.

type EventGatewayTLSTrustBundleInUseError added in v2.4.0

type EventGatewayTLSTrustBundleInUseError struct {
	// Users are the EventGatewayListenerPolicy objects in the trust bundle's
	// namespace (namespace/name, sorted) behind the Konnect policies using it.
	Users []string
	// OtherNamespacesUsers is the number of EventGatewayListenerPolicy objects
	// in other namespaces behind the Konnect policies using the trust bundle,
	// counted rather than named so as not to disclose them.
	OtherNamespacesUsers int
	// UnmanagedKonnectPolicies are the Konnect policies (listener/policy,
	// sorted) using the trust bundle with no EventGatewayListenerPolicy in the
	// cluster behind them.
	UnmanagedKonnectPolicies []string
}

EventGatewayTLSTrustBundleInUseError is returned when an EventGatewayTLSTrustBundle is deleted while Konnect listener policies still reference it. Konnect allows deleting a TLS trust bundle used by listener policies, leaving them referencing a missing trust bundle, which fails their next update. The deletion is therefore blocked until those policies are removed or stop referencing it.

func (EventGatewayTLSTrustBundleInUseError) DeletionBlockedMessage added in v2.4.0

func (e EventGatewayTLSTrustBundleInUseError) DeletionBlockedMessage() string

DeletionBlockedMessage returns a user-facing message naming what still uses the trust bundle.

func (EventGatewayTLSTrustBundleInUseError) Error added in v2.4.0

Error implements the error interface.

type FailedKonnectOpError

type FailedKonnectOpError[T constraints.SupportedKonnectEntityType] struct {
	Op  Op
	Err error
}

FailedKonnectOpError is an error type that is returned when an operation against Konnect API fails.

func (FailedKonnectOpError[T]) Error

func (e FailedKonnectOpError[T]) Error() string

Error implements the error interface.

func (FailedKonnectOpError[T]) Unwrap

func (e FailedKonnectOpError[T]) Unwrap() error

Unwrap returns the underlying error.

type GetControlPlaneGroupMemberFailedError

type GetControlPlaneGroupMemberFailedError struct {
	MemberName string
	Err        error
}

GetControlPlaneGroupMemberFailedError is an error type returned when failed to get member of control plane group.

func (GetControlPlaneGroupMemberFailedError) Error

Error implements the error interface.

func (GetControlPlaneGroupMemberFailedError) Unwrap

Unwrap returns the underlying error.

type KonnectConfigStoreNotEmptyError added in v2.4.0

type KonnectConfigStoreNotEmptyError struct {
	// ConfigStoreID is the Konnect ID of the config store.
	ConfigStoreID string
	// Err is the underlying Konnect API error.
	Err error
}

KonnectConfigStoreNotEmptyError is returned when Konnect rejects the deletion of a KonnectConfigStore because the config store still holds secret entries. Deletion is blocked until the user removes the entries from the store.

func (KonnectConfigStoreNotEmptyError) DeletionBlockedMessage added in v2.4.0

func (e KonnectConfigStoreNotEmptyError) DeletionBlockedMessage() string

DeletionBlockedMessage returns a user-facing message describing that the config store deletion is blocked by the secret entries it still holds.

func (KonnectConfigStoreNotEmptyError) Error added in v2.4.0

Error implements the error interface.

func (KonnectConfigStoreNotEmptyError) Unwrap added in v2.4.0

Unwrap returns the underlying Konnect API error.

type KonnectEntityAdoptionFetchError added in v2.1.1

type KonnectEntityAdoptionFetchError struct {
	KonnectID string
	Err       error
}

KonnectEntityAdoptionFetchError is an error type returned when failed to fetch the entity on trying to adopt an existing entity in Konnect.

func (KonnectEntityAdoptionFetchError) Error added in v2.1.1

Error implements the error interface.

func (KonnectEntityAdoptionFetchError) Is added in v2.2.0

Is reports any error in err's tree matches target.

func (KonnectEntityAdoptionFetchError) Unwrap added in v2.1.1

Unwrap returns the underlying error.

type KonnectEntityAdoptionMissingControlPlaneIDError added in v2.2.0

type KonnectEntityAdoptionMissingControlPlaneIDError struct{}

KonnectEntityAdoptionMissingControlPlaneIDError is an error type returned particular ControlPlane ID does not exist.

func (KonnectEntityAdoptionMissingControlPlaneIDError) Error added in v2.2.0

Error implements the error interface.

func (KonnectEntityAdoptionMissingControlPlaneIDError) Is added in v2.2.0

Is reports any error in err's tree matches target.

type KonnectEntityAdoptionNotMatchError added in v2.1.1

type KonnectEntityAdoptionNotMatchError struct {
	KonnectID string
}

KonnectEntityAdoptionNotMatchError is an error type returned in adopting an existing entity in "match" mode but the configuration of the existing entity does not match the spec of the object.

func (KonnectEntityAdoptionNotMatchError) Error added in v2.1.1

Error implements the error interface.

func (KonnectEntityAdoptionNotMatchError) Is added in v2.2.0

Is reports any error in err's tree matches target.

type KonnectEntityAdoptionReferenceServiceIDMismatchError added in v2.2.0

type KonnectEntityAdoptionReferenceServiceIDMismatchError struct{}

KonnectEntityAdoptionReferenceServiceIDMismatchError is an error type returned when adopting an existing entity but the reference service ID does not match.

func (KonnectEntityAdoptionReferenceServiceIDMismatchError) Error added in v2.2.0

Error implements the error interface.

func (KonnectEntityAdoptionReferenceServiceIDMismatchError) Is added in v2.2.0

Is reports any error in err's tree matches target.

type KonnectEntityAdoptionRouteTypeNotSupportedError added in v2.2.0

type KonnectEntityAdoptionRouteTypeNotSupportedError struct {
	RouteType sdkkonnectcomp.RouteUnionType
}

KonnectEntityAdoptionRouteTypeNotSupportedError is an error type returned when adopting an existing entity but the route type is not supported.

func (KonnectEntityAdoptionRouteTypeNotSupportedError) Error added in v2.2.0

Error implements the error interface.

func (KonnectEntityAdoptionRouteTypeNotSupportedError) Is added in v2.2.0

Is reports any error in err's tree matches target.

type KonnectEntityAdoptionUIDTagConflictError added in v2.1.1

type KonnectEntityAdoptionUIDTagConflictError struct {
	KonnectID    string
	ActualUIDTag string
}

KonnectEntityAdoptionUIDTagConflictError is an error type returned in adopting an existing entity when the entity has a tag to note that the entity is managed by another object with a different UID.

func (KonnectEntityAdoptionUIDTagConflictError) Error added in v2.1.1

Error implements the error interface.

type KonnectEntityCreatedButRelationsFailedError

type KonnectEntityCreatedButRelationsFailedError struct {
	KonnectID string
	Reason    kcfgconsts.ConditionReason
	Err       error
}

KonnectEntityCreatedButRelationsFailedError is an error type that is returned when an entity is created successfully in Konnect (an ID is assigned) but subsequent operations to create relations to the entity fail.

func (KonnectEntityCreatedButRelationsFailedError) Error

Error implements the error interface.

func (KonnectEntityCreatedButRelationsFailedError) Is added in v2.2.0

Is reports any error in err's tree matches target.

func (KonnectEntityCreatedButRelationsFailedError) Unwrap added in v2.3.0

Unwrap returns the underlying error.

type KonnectOperationFailedError added in v2.2.0

type KonnectOperationFailedError struct {
	Op         Op
	EntityType string
	EntityKey  string
	Err        error
}

KonnectOperationFailedError is an error type returned when a Konnect API operation fails. It includes the operation type, entity type name, entity key, and underlying error.

func (KonnectOperationFailedError) Error added in v2.2.0

Error implements the error interface.

func (KonnectOperationFailedError) Is added in v2.2.0

func (e KonnectOperationFailedError) Is(target error) bool

Is reports any error in err's tree matches target.

func (KonnectOperationFailedError) Unwrap added in v2.2.0

type MirrorableEntity added in v2.3.0

type MirrorableEntity interface {
	GetSource() *commonv1alpha1.EntitySource
	GetMirror() *konnectv1alpha2.MirrorSpec
}

MirrorableEntity is implemented by generated Konnect CRD types that opted into Origin/Mirror source support via the crd-from-oas source.supportsMirror config. It lets isMirrorableEntity/isMirrorEntity recognize those types generically, without a per-type switch case. Hand-written mirror types (KonnectGatewayControlPlane, MCPServer) keep their explicit switch cases and do NOT implement this interface.

type MultipleEntitiesWithMatchingIDFoundError

type MultipleEntitiesWithMatchingIDFoundError struct {
	ID string
}

MultipleEntitiesWithMatchingIDFoundError is an error indicating that multiple entities with the same ID were found on Konnect.

func (MultipleEntitiesWithMatchingIDFoundError) Error

Error implements the error interface.

type ObjectWithMetadata

type ObjectWithMetadata interface {
	metav1.Object
	GetObjectKind() schema.ObjectKind
}

ObjectWithMetadata is an interface that accepts an object with Kubernetes metadata and object Kind information.

type Op

type Op string

Op is the type for the operation type of a Konnect entity.

const (
	// CreateOp is the operation type for creating a Konnect entity.
	CreateOp Op = "create"
	// GetOp is the operation type for getting a Konnect entity.
	GetOp Op = "get"
	// UpdateOp is the operation type for updating a Konnect entity.
	UpdateOp Op = "update"
	// DeleteOp is the operation type for deleting a Konnect entity.
	DeleteOp Op = "delete"
	// AdoptOp is the operation type for adopting an existing Konnect entity.
	AdoptOp Op = "adopt"
)

type RateLimitError added in v2.1.1

type RateLimitError struct {
	Err        error
	RetryAfter time.Duration
}

RateLimitError is an error type returned when a Konnect API operation fails due to rate limiting (HTTP 429 Too Many Requests). It includes the retry-after duration to indicate when the operation can be retried.

func (RateLimitError) Error added in v2.1.1

func (e RateLimitError) Error() string

Error implements the error interface.

func (RateLimitError) Unwrap added in v2.1.1

func (e RateLimitError) Unwrap() error

Unwrap returns the underlying error.

type ReferenceError added in v2.1.8

type ReferenceError struct {
	Err        error
	RetryAfter time.Duration
}

ReferenceError is an error type returned when a Konnect API operation fails with a 400 that contains only ERROR_TYPE_REFERENCE errors. These are transient conflicts with referenced entities (e.g. a referenced upstream isn't fully propagated in Konnect yet). It includes a fixed retry-after duration to avoid controller-runtime's exponential backoff, which can grow prohibitively large when many entities are recreated at once.

func (ReferenceError) Error added in v2.1.8

func (e ReferenceError) Error() string

Error implements the error interface.

func (ReferenceError) Unwrap added in v2.1.8

func (e ReferenceError) Unwrap() error

Unwrap returns the underlying error.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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