Documentation ¶
Index ¶
- Constants
- func CheckAPIisPresent(dc *discovery.DiscoveryClient, gvr schema.GroupVersionResource) bool
- func CheckWorkStatusPresence(config *rest.Config) bool
- func CreateStatusPatch(unstrObj *unstructured.Unstructured, status map[string]interface{}) *unstructured.Unstructured
- func EmptyUnstructuredObjectFromIdentifier(objIdentifier ObjectIdentifier) *unstructured.Unstructured
- func GetBindingGVR() schema.GroupVersionResource
- func GetBindingPolicyGVR() schema.GroupVersionResource
- func GetIMBSKubeconfig(logger logr.Logger) (*rest.Config, string, error)
- func GetWDSKubeconfig(logger logr.Logger, wdsName, wdsLabel string) (*rest.Config, string, error)
- func GetWorkStatusStatus(workStatus runtime.Object) (map[string]interface{}, error)
- func IsAPIGroupAllowed(apiGroup string, allowedAPIGroups sets.Set[string]) bool
- func IsCRD(o interface{}) bool
- func ObjIdentifierIsForBinding(objIdentifier ObjectIdentifier) bool
- func ObjIdentifierIsForBindingPolicy(objIdentifier ObjectIdentifier) bool
- func ObjIdentifierIsForCRD(objIdentifier ObjectIdentifier) bool
- func ParseAPIGroupsString(apiGroups string) sets.Set[string]
- func PatchStatus(ctx context.Context, unstrObj *unstructured.Unstructured, ...) error
- func SelectorsMatchLabels(selectors []metav1.LabelSelector, labelsSet labels.Set) (bool, error)
- type ConcurrentMap
- type GVKObjRef
- type Label
- type MRObject
- type ObjectIdentifier
- type SourceRef
Constants ¶
const ( ControlPlaneTypeLabel = "kflex.kubestellar.io/cptype" ControlPlaneTypeIMBS = "imbs" ControlPlaneTypeWDS = "wds" // errors ErrNoControlPlane = "no control plane found. At least one control plane labeled with %s=%s must be present" ErrControlPlaneNotFound = "control plane with label %s=%s and name %s was not found" ErrMultipleControlPlanes = "more than one control plane with same label %s=%s was found and no name was specified" )
const ( // BindingPolicyLabelSingletonStatusKey is the key for the singleton status reporting requirement. BindingPolicyLabelSingletonStatusKey = "managed-by.kubestellar.io/singletonstatus" // BindingPolicyLabelSingletonStatusValueSet is the value when the status reporting is required. BindingPolicyLabelSingletonStatusValueSet = "true" // BindingPolicyLabelSingletonStatusValueUnset is the value when the status reporting is not required. BindingPolicyLabelSingletonStatusValueUnset = "false" )
const ( CRDKind = "CustomResourceDefinition" AnyVersion = "*" ServiceVersion = "v1" ServiceKind = "Service" BindingPolicyKind = "BindingPolicy" BindingPolicyResource = "bindingpolicies" BindingKind = "Binding" BindingResource = "bindings" WorkStatusGroup = "control.kubestellar.io" WorkStatusVersion = "v1alpha1" WorkStatusResource = "workstatuses" AnnotationToPreserveValuesKey = "annotations.kubestellar.io/preserve" PreserveNodePortValue = "nodeport" )
Variables ¶
This section is empty.
Functions ¶
func CheckAPIisPresent ¶
func CheckAPIisPresent(dc *discovery.DiscoveryClient, gvr schema.GroupVersionResource) bool
func CheckWorkStatusPresence ¶ added in v0.21.0
func CreateStatusPatch ¶ added in v0.21.2
func CreateStatusPatch(unstrObj *unstructured.Unstructured, status map[string]interface{}) *unstructured.Unstructured
CreateStatusPatch creates a status patch for unstructured object.
func EmptyUnstructuredObjectFromIdentifier ¶ added in v0.21.0
func EmptyUnstructuredObjectFromIdentifier(objIdentifier ObjectIdentifier) *unstructured.Unstructured
func GetBindingGVR ¶ added in v0.21.0
func GetBindingGVR() schema.GroupVersionResource
func GetBindingPolicyGVR ¶ added in v0.21.0
func GetBindingPolicyGVR() schema.GroupVersionResource
func GetWDSKubeconfig ¶
func GetWorkStatusStatus ¶
func IsAPIGroupAllowed ¶
IsResourceGroupAllowed checks if a API group is explicitly allowed by user, an empty or nil allowedResources slice is equivalent to allow all.
func ObjIdentifierIsForBinding ¶ added in v0.21.0
func ObjIdentifierIsForBinding(objIdentifier ObjectIdentifier) bool
func ObjIdentifierIsForBindingPolicy ¶ added in v0.21.0
func ObjIdentifierIsForBindingPolicy(objIdentifier ObjectIdentifier) bool
func ObjIdentifierIsForCRD ¶ added in v0.21.0
func ObjIdentifierIsForCRD(objIdentifier ObjectIdentifier) bool
func ParseAPIGroupsString ¶
ParseAPIGroupsString takes a comma separated string list of api groups in the form of <api-group1>, <api-group2> .. and returns a sets.Set[string]
func PatchStatus ¶ added in v0.21.2
func PatchStatus(ctx context.Context, unstrObj *unstructured.Unstructured, status map[string]interface{}, namespace string, gvr schema.GroupVersionResource, dynamicClient dynamic.Interface) error
PatchStatus updates the object status with Patch.
func SelectorsMatchLabels ¶
Types ¶
type ConcurrentMap ¶ added in v0.21.1
type ConcurrentMap[K comparable, V any] interface { // Set sets the value for the given key. Set(key K, value V) // Remove removes the value for the given key. Remove(key K) // Get gets the value for the given key. // The second return value is true if the key exists in the map, otherwise // false. Getting a key does not guarantee that no other goroutine will // also work with it. Get(key K) (V, bool) // Iterator iterates over the map and calls the given function for each // key/value pair sequentially. // If the given function returns an error, the iteration is stopped and // the error is returned. // During the iteration, the map must not be mutated by the given function. // If the map is mutated during the iteration, the behavior is undefined. Iterator(yield func(K, V) error) error // Len returns the number of items in the map. Len() int }
ConcurrentMap is a thread-safe map.
func NewConcurrentMap ¶ added in v0.21.1
func NewConcurrentMap[K comparable, V any]() ConcurrentMap[K, V]
NewConcurrentMap creates a new ConcurrentMap.
type GVKObjRef ¶
func RefToRuntimeObj ¶
RefToRuntimeObj creates a GVKObjRef to a runtime.Object.
type Label ¶
func SplitLabelKeyAndValue ¶
type ObjectIdentifier ¶ added in v0.21.0
type ObjectIdentifier struct { GVK schema.GroupVersionKind Resource string ObjectName cache.ObjectName }
ObjectIdentifier struct is used to add items to the workqueue. The ObjectIdentifier contains all the necessary information to retrieve an object.
func IdentifierForObject ¶ added in v0.21.0
func IdentifierForObject(mrObj MRObject, resource string) ObjectIdentifier
IdentifierForObject creates an ObjectIdentifier given an object that implements MRObject.
func (*ObjectIdentifier) GVR ¶ added in v0.21.0
func (identifier *ObjectIdentifier) GVR() schema.GroupVersionResource
type SourceRef ¶
type SourceRef struct { Group string `json:"group,omitempty"` Version string `json:"version,omitempty"` Resource string `json:"resource,omitempty"` Kind string `json:"kind,omitempty"` Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` }
this type is used in status-addon, which we cannot import due to conflicting versions of packages used in Open Cluster Management AddOn framework (otel - open telemetry) TODO - consider separating APIs in a different git repo to become independent of libs deps in different projects