Documentation ¶
Index ¶
- Constants
- func AddManagedClusterFinalizer(modified *bool, managedCluster *clusterv1.ManagedCluster, finalizer string)
- func ApplyResources(clientHolder *ClientHolder, recorder events.Recorder, scheme *runtime.Scheme, ...) error
- func GetComponentNamespace() (string, error)
- func GetMaxConcurrentReconciles() int
- func GetNodeSelector(cluster *clusterv1.ManagedCluster) (map[string]string, error)
- func ImportManagedClusterFromSecret(client *ClientHolder, restMapper meta.RESTMapper, recorder events.Recorder, ...) error
- func IsAPIExtensionV1Supported(kubeVersion string) bool
- func ManifestsEqual(newManifests, oldManifests []workv1.Manifest) bool
- func MustCreateAssetFromTemplate(name string, tb []byte, config interface{}) []byte
- func MustCreateObjectFromTemplate(file string, template []byte, config interface{}) runtime.Object
- func NewEventRecorder(kubeClient kubernetes.Interface, controllerName string) events.Recorder
- func RemoveManagedClusterFinalizer(ctx context.Context, runtimeClient client.Client, recorder events.Recorder, ...) error
- func SplitYamls(yamls []byte) [][]byte
- func UpdateManagedClusterStatus(client client.Client, recorder events.Recorder, managedClusterName string, ...) error
- func ValidateImportSecret(importSecret *corev1.Secret) error
- type ClientHolder
Constants ¶
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 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 ¶
IsAPIExtensionV1Supported if the cluster can support the crdv1, return true
func ManifestsEqual ¶
ManifestsEqual if two manifests are equal, return true
func MustCreateAssetFromTemplate ¶
MustCreateAssetFromTemplate render a template with its configuration If it's failed, this function will panic
func MustCreateObjectFromTemplate ¶
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 UpdateManagedClusterStatus ¶
func UpdateManagedClusterStatus(client client.Client, recorder events.Recorder, managedClusterName string, cond metav1.Condition) error
UpdateManagedClusterStatus update managed cluster status
func ValidateImportSecret ¶
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