util

package
v0.5.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyKCCTargetConfigToCNC

func ApplyKCCTargetConfigToCNC(cnc *apisv1alpha1.CustomNodeConfig,
	gvr metav1.GroupVersionResource, kccTarget *unstructured.Unstructured,
)

ApplyKCCTargetConfigToCNC sets the hash value for the given configurations in CNC

func EnsureKCCTargetFinalizer

func EnsureKCCTargetFinalizer(ctx context.Context, unstructuredControl control.UnstructuredControl, finalizerName string,
	gvr metav1.GroupVersionResource, target *unstructured.Unstructured,
) (*unstructured.Unstructured, error)

EnsureKCCTargetFinalizer is used to add finalizer in kcc target any component (that depends on kcc target) should add a specific finalizer in the target CR

func FindMatchedKCCTargetConfigForNode

func FindMatchedKCCTargetConfigForNode(cnc *apisv1alpha1.CustomNodeConfig, targetAccessor kcctarget.KatalystCustomConfigTargetAccessor) (*unstructured.Unstructured, error)

FindMatchedKCCTargetConfigForNode is to find this cnc needed config, if there are some configs are still not updated, we skip it. The rule of cnc match to config is: 1. if there is only one matched nodeNames config, and it is valid, return it 2. if there is only one matched labelSelector config with the highest priority, and it is valid, return it 3. if there is only one global config (either nodeNames or labelSelector is not existed), and it is valid, return it 4. otherwise, return nil to keep current state no changed

func GetRelatedCNCForTargetConfig

func GetRelatedCNCForTargetConfig(customNodeConfigLister v1alpha1.CustomNodeConfigLister, unstructured *unstructured.Unstructured) ([]*apisv1alpha1.CustomNodeConfig, error)

GetRelatedCNCForTargetConfig retrieves the currently related CNCs for the configuration based on the following rules: 1. Only configurations that have been updated or marked for deletion are considered. This is determined by checking if ObservedGeneration and Generation are equal, ensuring that the configuration has been validated by the KCC controller. 2. Only valid configurations are considered, as invalid configurations may affect the associated CNCs and should maintain their current state. 3. All CNCs are selected because modifying the target resource can involve more CNCs than those initially selected for the target resource.

func RemoveKCCTargetFinalizer

func RemoveKCCTargetFinalizer(ctx context.Context, unstructuredControl control.UnstructuredControl, finalizerName string,
	gvr metav1.GroupVersionResource, target *unstructured.Unstructured,
) error

RemoveKCCTargetFinalizer is used to remove finalizer in kcc target any component (that depends on kcc target) should make sure its dependency has been relieved before remove

func UpdateKCCTGenericConditions

func UpdateKCCTGenericConditions(status *apisv1alpha1.GenericConfigStatus, conditionType apisv1alpha1.ConfigConditionType,
	conditionStatus v1.ConditionStatus, reason, message string,
) bool

UpdateKCCTGenericConditions is used to update conditions for kcc

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL