helpers

package
v0.0.0-...-d862735 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KlusterletDefaultNamespace is the default namespace of klusterlet
	KlusterletDefaultNamespace = "open-cluster-management-agent"
	// BootstrapHubKubeConfig is the secret name of bootstrap kubeconfig secret to connect to hub
	BootstrapHubKubeConfig = "bootstrap-hub-kubeconfig"
	// HubKubeConfig is the secret name of kubeconfig secret to connect to hub with mtls
	HubKubeConfig = "hub-kubeconfig-secret"
	// ClusterManagerNamespace is the namespace to deploy cluster manager components
	ClusterManagerNamespace = "open-cluster-management-hub"

	RegistrationWebhookSecret  = "registration-webhook-serving-cert"
	RegistrationWebhookService = "cluster-manager-registration-webhook"
	WorkWebhookSecret          = "work-webhook-serving-cert"
	WorkWebhookService         = "cluster-manager-work-webhook"
)

Variables

This section is empty.

Functions

func ApplyDeployment

func ApplyDeployment(
	client kubernetes.Interface,
	generationStatuses []operatorapiv1.GenerationStatus,
	manifests resourceapply.AssetFunc,
	recorder events.Recorder, file string) (operatorapiv1.GenerationStatus, error)

func ApplyDirectly

func ApplyDirectly(
	client kubernetes.Interface,
	apiExtensionClient apiextensionsclient.Interface,
	apiRegistrationClient apiregistrationclient.APIServicesGetter,
	recorder events.Recorder,
	manifests resourceapply.AssetFunc,
	files ...string) []resourceapply.ApplyResult

func CleanUpStaticObject

func CleanUpStaticObject(
	ctx context.Context,
	client kubernetes.Interface,
	apiExtensionClient apiextensionsclient.Interface,
	apiRegistrationClient apiregistrationclient.APIServicesGetter,
	manifests resourceapply.AssetFunc,
	file string) error

func ClusterManagerConfigmapQueueKeyFunc

func ClusterManagerConfigmapQueueKeyFunc(clusterManagerLister operatorlister.ClusterManagerLister) factory.ObjectQueueKeyFunc

func ClusterManagerDeploymentQueueKeyFunc

func ClusterManagerDeploymentQueueKeyFunc(clusterManagerLister operatorlister.ClusterManagerLister) factory.ObjectQueueKeyFunc

func DetermineReplicaByNodes

func DetermineReplicaByNodes(ctx context.Context, kubeClient kubernetes.Interface) int32

DetermineReplicaByNodes determines the replica of deployment based on: list master nodes in the cluster and return 1 if the number of master nodes is equal or less than 1. Return 3 otherwise.

func FindGenerationStatus

func FindGenerationStatus(generationStatuses []operatorapiv1.GenerationStatus, generation operatorapiv1.GenerationStatus) *operatorapiv1.GenerationStatus

func FindKlusterletByNamespace

func FindKlusterletByNamespace(klusterlets []*operatorapiv1.Klusterlet, namespace string) *operatorapiv1.Klusterlet

func KlusterletDeploymentQueueKeyFunc

func KlusterletDeploymentQueueKeyFunc(klusterletLister operatorlister.KlusterletLister) factory.ObjectQueueKeyFunc

func KlusterletSecretQueueKeyFunc

func KlusterletSecretQueueKeyFunc(klusterletLister operatorlister.KlusterletLister) factory.ObjectQueueKeyFunc

func LoadClientConfigFromSecret

func LoadClientConfigFromSecret(secret *corev1.Secret) (*restclient.Config, error)

LoadClientConfigFromSecret returns a client config loaded from the given secret

func NumOfUnavailablePod

func NumOfUnavailablePod(deployment *appsv1.Deployment) int32

NumOfUnavailablePod is to check if a deployment is in degraded state.

func SetGenerationStatuses

func SetGenerationStatuses(generationStatuses *[]operatorapiv1.GenerationStatus, newGenerationStatus operatorapiv1.GenerationStatus)

func UpdateKlusterletStatus

func UpdateKlusterletStatus(
	ctx context.Context,
	client operatorv1client.KlusterletInterface,
	klusterletName string,
	updateFuncs ...UpdateKlusterletStatusFunc) (*operatorapiv1.KlusterletStatus, bool, error)

Types

type UpdateClusterManagerStatusFunc

type UpdateClusterManagerStatusFunc func(status *operatorapiv1.ClusterManagerStatus) error

func UpdateClusterManagerConditionFn

func UpdateClusterManagerConditionFn(conds ...metav1.Condition) UpdateClusterManagerStatusFunc

func UpdateClusterManagerGenerationsFn

func UpdateClusterManagerGenerationsFn(generations ...operatorapiv1.GenerationStatus) UpdateClusterManagerStatusFunc

type UpdateKlusterletStatusFunc

type UpdateKlusterletStatusFunc func(status *operatorapiv1.KlusterletStatus) error

func UpdateKlusterletConditionFn

func UpdateKlusterletConditionFn(conds ...metav1.Condition) UpdateKlusterletStatusFunc

func UpdateKlusterletGenerationsFn

func UpdateKlusterletGenerationsFn(generations ...operatorapiv1.GenerationStatus) UpdateKlusterletStatusFunc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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