Documentation
¶
Index ¶
- Variables
- func ApplyOwnerReference(child *unstructured.Unstructured, owner *unstructured.Unstructured) error
- func CalculateHash(ctx context.Context, resource unstructured.Unstructured) (string, error)
- func CreateResource(ctx context.Context, c client.Client, obj *unstructured.Unstructured) error
- func DeleteResource(ctx context.Context, c client.Client, obj *unstructured.Unstructured) error
- func ExtractResourceNames(unstrucList *unstructured.UnstructuredList) []string
- func GetLabel(un *unstructured.Unstructured, key string) (string, error)
- func GetLiveResource(ctx context.Context, object *unstructured.Unstructured, pluralName string) (*unstructured.Unstructured, error)
- func GetResource(ctx context.Context, c client.Client, gvk schema.GroupVersionKind, ...) (*unstructured.Unstructured, error)
- func GetSecret(ctx context.Context, client k8sClient.Client, namespace, secretName string) (*corev1.Secret, error)
- func IsValidKubernetesManifestFile(fileName string) bool
- func IsValidKubernetesNamespace(name string) bool
- func ListLiveResource(ctx context.Context, apiGroup string, version string, pluralName string, ...) (unstructured.UnstructuredList, error)
- func ListPodsMetadataOnly(ctx context.Context, c k8sClient.Client, namespace, labels string) (*metav1.PartialObjectMetadataList, error)
- func ListResources(ctx context.Context, c client.Client, gvk schema.GroupVersionKind, ...) (unstructured.UnstructuredList, error)
- func MetaGVKToSchemaGVK(metaGVK metav1.GroupVersionKind) schema.GroupVersionKind
- func NewKubectl() kube.Kubectl
- func NewPodDisruptionBudget(name, namespace string, maxUnavailable int32, ...) *policyv1.PodDisruptionBudget
- func PatchResource(ctx context.Context, c client.Client, obj *unstructured.Unstructured, ...) error
- func RawExtensionToUnstructured(rawExtension runtime.RawExtension) (*unstructured.Unstructured, error)
- func SchemaGVKToMetaGVK(schemaGVK schema.GroupVersionKind) metav1.GroupVersionKind
- func SetClientSets(restConfig *rest.Config) error
- func SetLabel(target *unstructured.Unstructured, key, val string) error
- func StartConfigMapWatcher(ctx context.Context, config *rest.Config) error
- func UpdateResource(ctx context.Context, c client.Client, obj *unstructured.Unstructured) error
- type GenericStatus
- type ResourceFilter
- type ResourceType
Constants ¶
This section is empty.
Variables ¶
var DynamicClient *dynamic.DynamicClient
var KubernetesClient *clientkube.Clientset
var NumaplaneClient *versioned.Clientset
Functions ¶
func ApplyOwnerReference ¶ added in v0.22.0
func ApplyOwnerReference(child *unstructured.Unstructured, owner *unstructured.Unstructured) error
func CalculateHash ¶ added in v0.22.0
func CalculateHash(ctx context.Context, resource unstructured.Unstructured) (string, error)
Calculate the sha256 hash of a Resource's definition
func CreateResource ¶ added in v0.8.0
func CreateResource(ctx context.Context, c client.Client, obj *unstructured.Unstructured) error
CreateResource creates the resource in the kubernetes cluster
func DeleteResource ¶ added in v0.8.0
func DeleteResource(ctx context.Context, c client.Client, obj *unstructured.Unstructured) error
DeleteResource deletes the resource from the kubernetes cluster
func ExtractResourceNames ¶ added in v0.10.0
func ExtractResourceNames(unstrucList *unstructured.UnstructuredList) []string
ExtractResourceNames extracts the names of the resources from an UnstructuredList
func GetLabel ¶ added in v0.2.0
func GetLabel(un *unstructured.Unstructured, key string) (string, error)
GetLabel returns the label identified by "key"
func GetLiveResource ¶ added in v0.8.0
func GetLiveResource( ctx context.Context, object *unstructured.Unstructured, pluralName string, ) (*unstructured.Unstructured, error)
GetLiveResource converts the generic object to unstructured object and fetches the resource from the API server
func GetResource ¶
func GetResource(ctx context.Context, c client.Client, gvk schema.GroupVersionKind, namespacedName k8stypes.NamespacedName) (*unstructured.Unstructured, error)
GetResource retrieves the resource from the informer cache, if it's not found then it fetches from the API server.
func GetSecret ¶
func GetSecret(ctx context.Context, client k8sClient.Client, namespace, secretName string) (*corev1.Secret, error)
GetSecret gets secret using the kubernetes client
func ListLiveResource ¶ added in v0.8.0
func ListPodsMetadataOnly ¶ added in v0.14.0
func ListResources ¶ added in v0.8.0
func ListResources(ctx context.Context, c client.Client, gvk schema.GroupVersionKind, namespace string, opts ...client.ListOption) (unstructured.UnstructuredList, error)
ListResources retrieves the list of resources from the informer cache, if it's not found then it fetches from the API server.
func MetaGVKToSchemaGVK ¶ added in v0.22.0
func MetaGVKToSchemaGVK(metaGVK metav1.GroupVersionKind) schema.GroupVersionKind
func NewKubectl ¶
func NewPodDisruptionBudget ¶ added in v0.2.0
func NewPodDisruptionBudget(name, namespace string, maxUnavailable int32, ownerReference []metav1.OwnerReference) *policyv1.PodDisruptionBudget
func PatchResource ¶ added in v0.8.0
func PatchResource( ctx context.Context, c client.Client, obj *unstructured.Unstructured, patch string, patchType k8stypes.PatchType, ) error
func RawExtensionToUnstructured ¶ added in v0.26.1
func RawExtensionToUnstructured(rawExtension runtime.RawExtension) (*unstructured.Unstructured, error)
func SchemaGVKToMetaGVK ¶ added in v0.22.0
func SchemaGVKToMetaGVK(schemaGVK schema.GroupVersionKind) metav1.GroupVersionKind
func SetClientSets ¶ added in v0.10.0
func SetLabel ¶ added in v0.2.0
func SetLabel(target *unstructured.Unstructured, key, val string) error
SetLabel sets the label identified by "key" on an unstructured object
func StartConfigMapWatcher ¶
StartConfigMapWatcher will start a watcher for ConfigMaps with the given label key and value
func UpdateResource ¶ added in v0.8.0
func UpdateResource(ctx context.Context, c client.Client, obj *unstructured.Unstructured) error
UpdateResource updates the resource in the kubernetes cluster
Types ¶
type GenericStatus ¶
type GenericStatus struct {
Phase string `json:"phase,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}
func ParseStatus ¶
func ParseStatus(obj *unstructured.Unstructured) (GenericStatus, error)
type ResourceFilter ¶ added in v0.22.0
type ResourceFilter struct {
IncludedResources []ResourceType
}
ResourceFilter filter resources based on allowed Resource Types
func (*ResourceFilter) IsExcludedResource ¶ added in v0.22.0
func (n *ResourceFilter) IsExcludedResource(group, kind, _ string) bool
type ResourceType ¶ added in v0.22.0
func ParseResourceFilter ¶ added in v0.22.0
func ParseResourceFilter(rules string) ([]ResourceType, error)
ParseResourceFilter parse the given rules to generate the list of resources we allow or watch. The rules are delimited by ';', and each rule is composed by both 'group' and 'kind' which can be empty. For example, 'group=apps,kind=Deployment;group=,kind=ConfigMap'. Note that empty rule is valid.