Documentation
¶
Index ¶
- Constants
- Variables
- func InstallIndexers(apiBindingInformer apisv1alpha2informers.APIBindingClusterInformer, ...)
- func NewController(crdClusterClient kcpapiextensionsclientset.ClusterInterface, ...) (*controller, error)
- func WithLockedResources(crds []*apiextensionsv1.CustomResourceDefinition, now time.Time, ...) (*corev1alpha1.LogicalCluster, []schema.GroupResource, ...)
- type APIBinding
- type APIBindingSpec
- type APIBindingStatus
- type CommitFunc
- type ExpirableLock
- type Lock
- type Patcher
- type Resource
- type ResourceBindingsAnnotation
Constants ¶
const (
ControllerName = "kcp-apibinding"
)
const ( // ResourceBindingsAnnotationKey is the key for the annotation on the LogicalCluster // to hold ResourceBindings. ResourceBindingsAnnotationKey = "internal.apis.kcp.io/resource-bindings" )
Variables ¶
var (
SystemBoundCRDsClusterName = logicalcluster.Name("system:bound-crds")
)
Functions ¶
func InstallIndexers ¶ added in v0.25.0
func InstallIndexers( apiBindingInformer apisv1alpha2informers.APIBindingClusterInformer, apiExportInformer apisv1alpha2informers.APIExportClusterInformer, globalAPIExportInformer apisv1alpha2informers.APIExportClusterInformer, )
InstallIndexers adds the additional indexers that this controller requires to the informers.
func NewController ¶
func NewController( crdClusterClient kcpapiextensionsclientset.ClusterInterface, kcpClusterClient kcpclientset.ClusterInterface, apiBindingInformer apisv1alpha2informers.APIBindingClusterInformer, apiExportInformer apisv1alpha2informers.APIExportClusterInformer, apiResourceSchemaInformer apisv1alpha1informers.APIResourceSchemaClusterInformer, apiConversionInformer apisv1alpha1informers.APIConversionClusterInformer, logicalClusterInformer corev1alpha1informers.LogicalClusterClusterInformer, globalAPIExportInformer apisv1alpha2informers.APIExportClusterInformer, globalAPIResourceSchemaInformer apisv1alpha1informers.APIResourceSchemaClusterInformer, globalAPIConversionInformer apisv1alpha1informers.APIConversionClusterInformer, crdInformer kcpapiextensionsv1informers.CustomResourceDefinitionClusterInformer, ) (*controller, error)
NewController returns a new controller for APIBindings.
func WithLockedResources ¶ added in v0.27.0
func WithLockedResources(crds []*apiextensionsv1.CustomResourceDefinition, now time.Time, lc *corev1alpha1.LogicalCluster, grs []schema.GroupResource, binding ExpirableLock) (*corev1alpha1.LogicalCluster, []schema.GroupResource, map[schema.GroupResource]Lock, error)
WithLockedResources tries to lock the resources for the given binding. It returns those resources that got successfully locked. If a resource is already locked by another binding, it is skipped and returned in the second return value.
The logical cluster is not mutated.
Types ¶
type APIBinding ¶ added in v0.8.0
type APIBinding = apisv1alpha2.APIBinding
type APIBindingSpec ¶ added in v0.8.0
type APIBindingSpec = apisv1alpha2.APIBindingSpec
type APIBindingStatus ¶ added in v0.8.0
type APIBindingStatus = apisv1alpha2.APIBindingStatus
type CommitFunc ¶ added in v0.8.0
type ExpirableLock ¶ added in v0.27.0
type ExpirableLock struct {
Lock `json:",inline"`
// Expiry is an optional timestamp. After that time, the CRD entry is not
// considered valid anymore IF the object cannot be found.
CRDExpiry *metav1.Time `json:"e,omitempty"`
}
ExpirableLock is a lock that can expire CRD entries.
type Lock ¶ added in v0.27.0
type Lock struct {
// Name is the name of the APIBinding, or empty.
Name string `json:"n,omitempty"`
// CRD is true if the binding is for a CRD.
CRD bool `json:"c,omitempty"`
}
Lock is a lock for a resource, part of the apis.kcp.io/resource-bindings annotation.
type Patcher ¶ added in v0.10.0
type Patcher = apisv1alpha2client.APIBindingInterface
type Resource ¶ added in v0.8.0
type Resource = committer.Resource[*APIBindingSpec, *APIBindingStatus]
type ResourceBindingsAnnotation ¶ added in v0.27.0
type ResourceBindingsAnnotation map[string]ExpirableLock
ResourceBindingsAnnotation is a map of "<resource>.<group>" to bindings. It is stored as a JSON string in the LogicalCluster annotation apis.kcp.io/resource-bindings. It serves as a lock for resources to prevent races of multiple bindings or CRDs owning the same resource.
func GetResourceBindings ¶
func GetResourceBindings(lc *corev1alpha1.LogicalCluster) (ResourceBindingsAnnotation, error)
GetResourceBindings reads ResourceBindingsAnnotation from LogicalCluster's annotation.
func UnmarshalResourceBindingsAnnotation ¶ added in v0.28.0
func UnmarshalResourceBindingsAnnotation(ann string) (ResourceBindingsAnnotation, error)
UnmarshalResourceBindingsAnnotation unmarshals JSON-formatted string into ResourceBindingsAnnotation map.