framework

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckClusterManagerStatus

func CheckClusterManagerStatus(cm *operatorapiv1.ClusterManager) error

func CheckDeploymentReady

func CheckDeploymentReady(ctx context.Context, kubeClient kubernetes.Interface, namespace, name string) error

func CleanKlusterletRelatedResources

func CleanKlusterletRelatedResources(
	hub *Hub, spoke *Spoke,
	klusterletName, managedClusterName string)

CleanKlusterletRelatedResources needs both hub side and spoke side operations

func CreateAndApproveKlusterlet

func CreateAndApproveKlusterlet(
	hub *Hub, spoke *Spoke,
	klusterletName, managedClusterName, klusterletNamespace string,
	mode operatorapiv1.InstallMode,
	bootstrapHubKubeConfigSecret *corev1.Secret,
	images Images,
)

CreateAndApproveKlusterlet requires operations on both hub side and spoke side

Types

type Hub

type Hub struct {
	*OCMClients
	ClusterManagerName      string
	ClusterManagerNamespace string
	ClusterCfg              *rest.Config
}

Hub represents a hub cluster, it holds: * the clients to interact with the hub cluster * the metadata of the hub * the runtime data of the hub

func NewHub

func NewHub(kubeconfig string) (*Hub, error)

func (*Hub) AcceptManageCluster

func (hub *Hub) AcceptManageCluster(clusterName string) error

func (*Hub) ApproveManagedClusterCSR

func (hub *Hub) ApproveManagedClusterCSR(clusterName string) error

func (*Hub) BuildClusterClient

func (hub *Hub) BuildClusterClient(saNamespace, saName string, clusterPolicyRules, policyRules []rbacv1.PolicyRule) (clusterclient.Interface, error)

func (*Hub) CheckHubReady

func (hub *Hub) CheckHubReady() error

func (*Hub) CheckManagedClusterAddOnStatus

func (hub *Hub) CheckManagedClusterAddOnStatus(managedClusterNamespace, addOnName string) error

func (*Hub) CheckManagedClusterStatus

func (hub *Hub) CheckManagedClusterStatus(clusterName string) error

func (*Hub) CheckManagedClusterStatusConditions

func (hub *Hub) CheckManagedClusterStatusConditions(clusterName string,
	expectedConditions map[string]metav1.ConditionStatus) error

func (*Hub) CleanManifestWorks

func (hub *Hub) CleanManifestWorks(clusterName, workName string) error

func (*Hub) CleanupClusterClient

func (hub *Hub) CleanupClusterClient(saNamespace, saName string) error

func (*Hub) CreateManagedClusterAddOn

func (hub *Hub) CreateManagedClusterAddOn(managedClusterNamespace, addOnName, installNamespace string) error

func (*Hub) CreateManagedClusterAddOnLease

func (hub *Hub) CreateManagedClusterAddOnLease(addOnInstallNamespace, addOnName string) error

func (*Hub) DeleteManageClusterAndRelatedNamespace

func (hub *Hub) DeleteManageClusterAndRelatedNamespace(clusterName string) error

func (*Hub) EnableAutoApprove

func (hub *Hub) EnableAutoApprove(users []string) error

func (*Hub) EnableHubWorkFeature

func (hub *Hub) EnableHubWorkFeature(feature string) error

func (*Hub) GetCluserManager

func (hub *Hub) GetCluserManager() (*operatorapiv1.ClusterManager, error)

func (*Hub) GetManagedCluster

func (hub *Hub) GetManagedCluster(clusterName string) (*clusterv1.ManagedCluster, error)

func (*Hub) RemoveHubWorkFeature

func (hub *Hub) RemoveHubWorkFeature(feature string) error

func (*Hub) SetHubAcceptsClient

func (hub *Hub) SetHubAcceptsClient(clusterName string, hubAcceptClient bool) error

func (*Hub) SetLeaseDurationSeconds

func (hub *Hub) SetLeaseDurationSeconds(clusterName string, leaseDurationSeconds int32) error

type Images

type Images struct {
	RegistrationImage string
	WorkImage         string
	SingletonImage    string
}

type OCMClients

type OCMClients struct {
	KubeClient          kubernetes.Interface
	APIExtensionsClient apiextensionsclient.Interface
	OperatorClient      operatorclient.Interface
	ClusterClient       clusterclient.Interface
	WorkClient          workv1client.Interface
	AddonClient         addonclient.Interface
	DynamicClient       dynamic.Interface
	RestMapper          meta.RESTMapper
}

OCMClients contains every kind of client that we need to interact with ocm components

func NewOCMClients

func NewOCMClients(clusterCfg *rest.Config) (*OCMClients, error)

type Spoke

type Spoke struct {
	*OCMClients
	// Note: this is the namespace and name where the KlusterletOperator deployment is created, which
	// is different from the klusterlet namespace and name.
	KlusterletOperatorNamespace string
	KlusterletOperator          string
}

Spoke represents a spoke cluster, it holds: * the clients to interact with the spoke cluster * the metadata of the spoke * the runtime data of the spoke

func NewSpoke

func NewSpoke(kubeconfig string) (*Spoke, error)

func (*Spoke) CheckKlusterletStatus

func (spoke *Spoke) CheckKlusterletStatus(klusterletName, condType, reason string, status metav1.ConditionStatus) error

func (*Spoke) CreateFakeExternalKubeconfigSecret

func (spoke *Spoke) CreateFakeExternalKubeconfigSecret(klusterlet *operatorapiv1.Klusterlet) error

func (*Spoke) CreateKlusterlet

func (spoke *Spoke) CreateKlusterlet(
	name, clusterName, klusterletNamespace string,
	mode operatorapiv1.InstallMode,
	bootstrapHubKubeConfigSecret *corev1.Secret,
	images Images) (*operatorapiv1.Klusterlet, error)

func (*Spoke) CreatePureHostedKlusterlet

func (spoke *Spoke) CreatePureHostedKlusterlet(name, clusterName string) (*operatorapiv1.Klusterlet, error)

func (*Spoke) DeleteExternalKubeconfigSecret

func (spoke *Spoke) DeleteExternalKubeconfigSecret(klusterlet *operatorapiv1.Klusterlet) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳