Documentation ¶
Index ¶
- func AddOwnerReference(object, owner client.Object)
- func GetDynamicResourceInterface(config *rest.Config, gvk schema.GroupVersionKind, namespace string) (dynamic.ResourceInterface, error)
- func GetKubeconfigWithUserToken(ctx context.Context, idToken, caData []byte, userID, server string) ([]byte, error)
- func GetKubernetesVersion(ctx context.Context, cfg *rest.Config, logger logr.Logger) (string, error)
- func GetUnstructured(object []byte) (*unstructured.Unstructured, error)
- func HasSveltosResourcesAsOwnerReference(object client.Object) bool
- func IsOnlyOwnerReference(object, owner client.Object) bool
- func IsOwnerReference(object, owner client.Object) bool
- func RemoveOwnerReference(object, owner client.Object)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOwnerReference ¶
AddOwnerReference adds Sveltos resource owning a resource as an object's OwnerReference. OwnerReferences are used as ref count. Different Sveltos resources might match same cluster and reference same ConfigMap. This means a policy contained in a ConfigMap is deployed in a Cluster because of different Sveltos resources. When cleaning up, a policy can be removed only if no more Sveltos resources are listed as OwnerReferences.
func GetDynamicResourceInterface ¶
func GetDynamicResourceInterface(config *rest.Config, gvk schema.GroupVersionKind, namespace string) (dynamic.ResourceInterface, error)
GetDynamicResourceInterface returns a dynamic ResourceInterface for the policy's GroupVersionKind
func GetKubeconfigWithUserToken ¶
func GetKubeconfigWithUserToken(ctx context.Context, idToken, caData []byte, userID, server string) ([]byte, error)
GetKubeconfigWithUserToken() accepts a k8s client interface, OIDC IDToken, username (e.g. user@example.org) and server with scheme, host, and port (e.g. https://127.0.0.1:1234) to return a kube-config with credentials set for the user.
func GetKubernetesVersion ¶
func GetUnstructured ¶
func GetUnstructured(object []byte) (*unstructured.Unstructured, error)
GetUnstructured returns an unstructured given a []bytes containing it
func HasSveltosResourcesAsOwnerReference ¶
HasSveltosResourcesAsOwnerReference returns true if at least one of current OwnerReferences is a Sveltos resource
func IsOnlyOwnerReference ¶
IsOnlyOwnerReference returns true if clusterprofile is the only ownerreference for object
func IsOwnerReference ¶
IsOwnerReference returns true is owner is one of the OwnerReferences for object
func RemoveOwnerReference ¶
RemoveOwnerReference removes Sveltos resource as an OwnerReference from object. OwnerReferences are used as ref count. Different Sveltos resources might match same cluster and reference same ConfigMap. This means a policy contained in a ConfigMap is deployed in a Cluster because of different SveltosResources. When cleaning up, a policy can be removed only if no more SveltosResources are listed as OwnerReferences.
Types ¶
This section is empty.