Documentation
¶
Index ¶
- Constants
- func AsNamespacedName(maybeNamespacedName, defaultNamespace string) types.NamespacedName
- func WaitObjectAssumesState[T ObjectStruct, PT PObjectStruct[T]](ctx context.Context, apiServerClient ctrl_client.Client, ...) (*T, error)
- type DcpModelObject
- type DeepCopyable
- type DynamicServiceProducer
- type ListWithObjectItems
- type NamespacedNameWithKind
- type NamespacedNameWithKindAndUid
- type ObjectList
- type ObjectStruct
- type PCopyableObjectStruct
- type PObjectList
- type PObjectStruct
- type PObjectWithStatusStruct
- type ServiceProducer
- type UnexpectedObjectStateError
Constants ¶
View Source
const (
ServiceProducerAnnotation = "service-producer"
)
View Source
const ( // The key used to create client cache indexes to query for object owners efficiently. // See controllers.SetupEndpointIndexWithManager() for an example of usage with Endpoint objects. WorkloadOwnerKey = ".metadata.owner" )
Variables ¶
This section is empty.
Functions ¶
func AsNamespacedName ¶
func AsNamespacedName(maybeNamespacedName, defaultNamespace string) types.NamespacedName
func WaitObjectAssumesState ¶
func WaitObjectAssumesState[T ObjectStruct, PT PObjectStruct[T]]( ctx context.Context, apiServerClient ctrl_client.Client, name types.NamespacedName, isInState func(*T) (bool, error), ) (*T, error)
Types ¶
type DcpModelObject ¶
type DcpModelObject interface {
apiserver_resource.Object
ctrl_client.Object
NamespacedName() types.NamespacedName
}
type DeepCopyable ¶
type DeepCopyable[T ObjectStruct] interface { DeepCopy() *T }
type DynamicServiceProducer ¶
type DynamicServiceProducer interface {
ServicesProduced() []ServiceProducer
}
DynamicServiceProducer is an object for which the set of produced services can change at run time.
type ListWithObjectItems ¶
type ListWithObjectItems[T ObjectStruct, PT PObjectStruct[T]] interface { ctrl_client.ObjectList ItemCount() uint32 GetItems() []PT }
type NamespacedNameWithKind ¶
type NamespacedNameWithKind struct {
types.NamespacedName
Kind schema.GroupVersionKind
}
+kubebuilder:object:generate=false +k8s:openapi-gen=false
func GetNamespacedNameWithKind ¶
func GetNamespacedNameWithKind(obj ctrl_client.Object) NamespacedNameWithKind
func GetNamespacedNameWithKindForResourceObject ¶
func GetNamespacedNameWithKindForResourceObject(obj apiserver_resource.Object) NamespacedNameWithKind
func (NamespacedNameWithKind) Empty ¶
func (nnk NamespacedNameWithKind) Empty() bool
func (NamespacedNameWithKind) String ¶
func (nnk NamespacedNameWithKind) String() string
type NamespacedNameWithKindAndUid ¶
type NamespacedNameWithKindAndUid struct {
NamespacedNameWithKind
Uid types.UID
}
+kubebuilder:object:generate=false +k8s:openapi-gen=false
type ObjectList ¶
type ObjectList interface {
}
type ObjectStruct ¶
type ObjectStruct interface {
}
type PCopyableObjectStruct ¶
type PCopyableObjectStruct[T ObjectStruct] interface { DeepCopyable[T] PObjectStruct[T] }
type PObjectList ¶
type PObjectList[T ObjectStruct, LT ObjectList, PT PObjectStruct[T]] interface { *LT ctrl_client.ObjectList apiserver_resource.ObjectList ListWithObjectItems[T, PT] }
type PObjectStruct ¶
type PObjectStruct[T ObjectStruct] interface { *T DcpModelObject }
type PObjectWithStatusStruct ¶
type PObjectWithStatusStruct[T ObjectStruct] interface { PObjectStruct[T] apiserver_resource.ObjectWithStatusSubResource }
type ServiceProducer ¶
type ServiceProducer struct {
// Name of the service that the workload implements.
ServiceName string `json:"serviceName"`
// Namespace of the service that the workload implements.
// It is optional and defaults to the namespace of the workload.
ServiceNamespace string `json:"serviceNamespace,omitempty"`
// Address that should be used (listened on) by the workload to serve the service.
// It defaults to localhost if not present.
// For Containers this is the address that the workload should listen on INSIDE the container.
// This is NOT the address that the Container will be available on the host network;
// that address is part of the Container spec, specifically it is the HostIP property of the ContainerPort definition(s).
Address string `json:"address,omitempty"`
// Port used by the workload to serve the service.
//
// For Containers it is mandatory and must match one of the Container ports.
// We first match on HostPort, and if one is found, we use that port.
// If no HostPort is found, we match on ContainerPort.
// If such port is found, we proxy to the corresponding host port.
//
// For Executables it is required UNLESS the Executable also expect the port to be injected into it
// via environment variable and {{- portForServing "<service-name>" -}} template function.
Port int32 `json:"port,omitempty"`
}
func GetServiceProducersForObject ¶
func GetServiceProducersForObject(owner DcpModelObject, log logr.Logger) ([]ServiceProducer, error)
func (*ServiceProducer) InferServiceNamespace ¶
func (sp *ServiceProducer) InferServiceNamespace(owner ctrl_client.Object)
func (*ServiceProducer) ServiceNamespacedName ¶
func (sp *ServiceProducer) ServiceNamespacedName() types.NamespacedName
type UnexpectedObjectStateError ¶
type UnexpectedObjectStateError struct {
// contains filtered or unexported fields
}
UnexpectedObjectStateError can be used to provide additional context when an object is not in the expected state. In is meant to be used from within isInState() function passed to waitObjectAssumesState(). Unlike any other error, it won't stop the wait when returned from isInState(), but if the wait times out and the object is still not in desired state, the test will be terminated with the UnexpectedObjectStateError serving as the terminating error.
func (*UnexpectedObjectStateError) Error ¶
func (e *UnexpectedObjectStateError) Error() string
Click to show internal directories.
Click to hide internal directories.