helpers

package
v1.0.0-2021-09-24-18-3... Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const AnnotationNodeSelector = "open-cluster-management/nodeSelector"

AnnotationNodeSelector key name of nodeSelector annotation synced from mch

Variables

This section is empty.

Functions

func AddManagedClusterFinalizer

func AddManagedClusterFinalizer(modified *bool, managedCluster *clusterv1.ManagedCluster, finalizer string)

AddManagedClusterFinalizer add a finalizer to a managed cluster

func ApplyResources

func ApplyResources(clientHolder *ClientHolder, recorder events.Recorder,
	scheme *runtime.Scheme, owner metav1.Object, objs ...runtime.Object) error

ApplyResources apply resources, includes: serviceaccount, secret, deployment, clusterrole, clusterrolebinding, crdv1beta1, crdv1, manifestwork and klusterlet

func GetComponentNamespace

func GetComponentNamespace() (string, error)

func GetMaxConcurrentReconciles

func GetMaxConcurrentReconciles() int

GetMaxConcurrentReconciles get the max concurrent reconciles from MAX_CONCURRENT_RECONCILES env, if the reconciles cannot be found, return 1

func GetNodeSelector

func GetNodeSelector(cluster *clusterv1.ManagedCluster) (map[string]string, error)

func ImportManagedClusterFromSecret

func ImportManagedClusterFromSecret(client *ClientHolder, restMapper meta.RESTMapper, recorder events.Recorder,
	importSecret *corev1.Secret) error

ImportManagedClusterFromSecret use managed clustr client to import managed cluster from import-secret

func IsAPIExtensionV1Supported

func IsAPIExtensionV1Supported(kubeVersion string) bool

IsAPIExtensionV1Supported if the cluster can support the crdv1, return true

func ManifestsEqual

func ManifestsEqual(newManifests, oldManifests []workv1.Manifest) bool

ManifestsEqual if two manifests are equal, return true

func MustCreateAssetFromTemplate

func MustCreateAssetFromTemplate(name string, tb []byte, config interface{}) []byte

MustCreateAssetFromTemplate render a template with its configuration If it's failed, this function will panic

func MustCreateObjectFromTemplate

func MustCreateObjectFromTemplate(file string, template []byte, config interface{}) runtime.Object

MustCreateObjectFromTemplate render a template to a runtime object with its configuration If it's failed, this function will panic

func NewEventRecorder

func NewEventRecorder(kubeClient kubernetes.Interface, controllerName string) events.Recorder

func RemoveManagedClusterFinalizer

func RemoveManagedClusterFinalizer(ctx context.Context, runtimeClient client.Client, recorder events.Recorder,
	managedCluster *clusterv1.ManagedCluster, finalizer string) error

RemoveManagedClusterFinalizer remove a finalizer from a managed cluster

func SplitYamls

func SplitYamls(yamls []byte) [][]byte

SplitYamls split yamls with sperator `---`

func UpdateManagedClusterStatus

func UpdateManagedClusterStatus(client client.Client, recorder events.Recorder,
	managedClusterName string, cond metav1.Condition) error

UpdateManagedClusterStatus update managed cluster status

func ValidateImportSecret

func ValidateImportSecret(importSecret *corev1.Secret) error

ValidateImportSecret validate managed cluster import secret

Types

type ClientHolder

type ClientHolder struct {
	KubeClient          kubernetes.Interface
	APIExtensionsClient apiextensionsclient.Interface
	OperatorClient      operatorclient.Interface
	RuntimeClient       client.Client
}

func GenerateClientFromSecret

func GenerateClientFromSecret(secret *corev1.Secret) (*ClientHolder, meta.RESTMapper, error)

GenerateClientFromSecret generate a client from a given secret

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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