ops

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 47 Imported by: 0

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 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 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 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 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.

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

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.

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.

Types

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