Documentation ¶
Index ¶
- func AddAnnotations(obj metav1.Object, annotations map[string]string)
- func CreateNamespaceIfNotExist(ctx context.Context, k8sClient client.Client, namespace string) error
- func DeleteObject(ctx context.Context, k8sClient client.Client, obj *unstructured.Unstructured) (bool, error)
- func GetClusterId(ctx context.Context, runtimeClient client.Client, clusterName string) (string, error)
- func GetRootPolicy(ctx context.Context, runtimeClient client.Client, namespacedName string) (*policyv1.Policy, error)
- func HasAnnotation(obj metav1.Object, annotation string) bool
- func HasLabel(obj metav1.Object, label string) bool
- func UpdateObject(ctx context.Context, k8sClient client.Client, obj *unstructured.Unstructured) error
- type LabelsField
- type MetadataField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAnnotations ¶
AddAnnotations adds the given annotations to the given object. if obj is nil or annotations are nil, it's a no-op.
func CreateNamespaceIfNotExist ¶
func CreateNamespaceIfNotExist(ctx context.Context, k8sClient client.Client, namespace string) error
CreateNamespaceIfNotExist creates a namespace in case it doesn't exist.
func DeleteObject ¶
func DeleteObject(ctx context.Context, k8sClient client.Client, obj *unstructured.Unstructured) (bool, error)
DeleteObject tries to delete the given object from k8s. returns error and true/false if object was deleted or not.
func GetClusterId ¶ added in v0.7.0
func GetRootPolicy ¶ added in v0.7.0
func GetRootPolicy(ctx context.Context, runtimeClient client.Client, namespacedName string) (*policyv1.Policy, error, )
get the root policy from the cluster policy label value(namespace.name)
func HasAnnotation ¶
HasAnnotation returns a bool if the given annotation exists in annotations.
func UpdateObject ¶
func UpdateObject(ctx context.Context, k8sClient client.Client, obj *unstructured.Unstructured) error
UpdateObject function updates a given k8s object.
Types ¶
type LabelsField ¶
type LabelsField struct {
Labels map[string]struct{} `json:"f:labels"`
}
LabelsField presents a "f:labels" field subfield of metadataField.
type MetadataField ¶
type MetadataField struct {
LabelsField `json:"f:metadata"`
}
MetadataField presents a "f:metadata" field subfield of v1.FieldsV1.
Click to show internal directories.
Click to hide internal directories.