Documentation
¶
Index ¶
- Constants
- Variables
- func Create[T constraints.SupportedKonnectEntityType, TEnt constraints.EntityType[T]](ctx context.Context, sdk sdkops.SDKWrapper, cl client.Client, e TEnt) (*T, error)
- func Delete[T constraints.SupportedKonnectEntityType, TEnt constraints.EntityType[T]](ctx context.Context, sdk sdkops.SDKWrapper, cl client.Client, e *T) error
- func ErrorIsCreateConflict(err error) bool
- func GenerateTagsForObject(obj ObjectWithMetadata, additionalTags ...string) []string
- func ParseSDKErrorBody(body string) (sdkErrorBody, error)
- func SDKErrorIsConflict(sdkError *sdkkonnecterrs.SDKError) bool
- func SetKonnectEntityProgrammedCondition(obj entityType)
- func SetKonnectEntityProgrammedConditionFalse(obj entityType, reason consts.ConditionReason, msg string)
- func UIDLabelForObject(obj client.Object) string
- func Update[T constraints.SupportedKonnectEntityType, TEnt constraints.EntityType[T]](ctx context.Context, sdk sdkops.SDKWrapper, syncPeriod time.Duration, ...) (ctrl.Result, error)
- func WithKubernetesMetadataLabels(obj ObjectWithMetadata, userSetLabels map[string]string) map[string]string
- type CantPerformOperationWithoutControlPlaneIDError
- type EntityWithMatchingUIDNotFoundError
- type FailedKonnectOpError
- type KonnectEntityCreatedButRelationsFailedError
- type ObjectWithMetadata
- type Op
- type Response
- type ServerURL
Constants ¶
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" )
Variables ¶
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.
Functions ¶
func Create ¶
func Create[ T constraints.SupportedKonnectEntityType, TEnt constraints.EntityType[T], ]( ctx context.Context, sdk sdkops.SDKWrapper, cl client.Client, e TEnt, ) (*T, error)
Create creates a Konnect entity.
func Delete ¶
func Delete[ T constraints.SupportedKonnectEntityType, TEnt constraints.EntityType[T], ](ctx context.Context, sdk sdkops.SDKWrapper, cl client.Client, e *T) 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 ErrorIsCreateConflict ¶
ErrorIsCreateConflict returns true if the provided error is a Konnect conflict error.
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 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 ParseSDKErrorBody ¶
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.
func SetKonnectEntityProgrammedCondition ¶
func SetKonnectEntityProgrammedCondition( obj entityType, )
SetKonnectEntityProgrammedCondition sets the KonnectEntityProgrammed condition to true on the provided object.
func SetKonnectEntityProgrammedConditionFalse ¶
func SetKonnectEntityProgrammedConditionFalse( obj entityType, reason consts.ConditionReason, msg string, )
SetKonnectEntityProgrammedConditionFalse sets the KonnectEntityProgrammed condition to false on the provided object.
func UIDLabelForObject ¶
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, 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 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).
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 ¶
func (e CantPerformOperationWithoutControlPlaneIDError) Error() string
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 ¶
func (e EntityWithMatchingUIDNotFoundError) Error() string
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 KonnectEntityCreatedButRelationsFailedError ¶
type KonnectEntityCreatedButRelationsFailedError struct { KonnectID string Reason consts.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 ¶
func (e KonnectEntityCreatedButRelationsFailedError) Error() string
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 ServerURL ¶
type ServerURL string
ServerURL is a type to represent a server URL.
func NewServerURL ¶
NewServerURL creates a new ServerURL from a string. It accepts either a full URL or a hostname.
Source Files
¶
- conditions.go
- errors.go
- objects_metadata.go
- ops.go
- ops_controlplane.go
- ops_credentialacl.go
- ops_credentialapikey.go
- ops_credentialbasicauth.go
- ops_credentialhmac.go
- ops_credentialjwt.go
- ops_errors.go
- ops_kongcacertificate.go
- ops_kongcertificate.go
- ops_kongconsumer.go
- ops_kongconsumergroup.go
- ops_kongdataplaneclientcertificate.go
- ops_kongkey.go
- ops_kongkeyset.go
- ops_kongpluginbinding.go
- ops_kongroute.go
- ops_kongservice.go
- ops_kongsni.go
- ops_kongtarget.go
- ops_kongupstream.go
- ops_kongvault.go
- server_url.go