util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 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 ClearUnNeededConfigForNode

func ClearUnNeededConfigForNode(cnc *apisv1alpha1.CustomNodeConfig, needToDelete func(metav1.GroupVersionResource) bool)

ClearUnNeededConfigForNode delete those un-needed configurations from CNC status

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, 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 get current related cnc for the config obey follow rule: 1. only updated and deleting config will be concerned, which means that ObservedGeneration and Generation is equal, to make sure the config has been checked by kcc controller 2. only valid config will be concerned, because invalid config cover cnc should keep current state 3. select related cnc by the config's labelSelector or nodeNames

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