controllers

package
v0.5.1-b3f3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// upgrade template
	CAPI_VSPHERE_UPGRADE_TEMPLATE = "capi-vsphere-upgrade-template"

	// machine을 구분하기 위한 label key
	CAPI_CLUSTER_LABEL_KEY      = "cluster.x-k8s.io/cluster-name"
	CAPI_CONTROLPLANE_LABEL_KEY = "cluster.x-k8s.io/control-plane"
	CAPI_WORKER_LABEL_KEY       = "cluster.x-k8s.io/deployment-name"
)
View Source
const (
	// Cluster Parameter
	CLUSTER_PARAM_NAMESPACE          = "NAMESPACE"
	CLUSTER_PARAM_CLUSTER_NAME       = "CLUSTER_NAME"
	CLUSTER_PARAM_MASTER_NUM         = "CONTROL_PLANE_MACHINE_COUNT"
	CLUSTER_PARAM_WORKER_NUM         = "WORKER_MACHINE_COUNT"
	CLUSTER_PARAM_OWNER              = "OWNER"
	CLUSTER_PARAM_KUBERNETES_VERSION = "KUBERNETES_VERSION"

	// Aws Parameter
	AWS_PARAM_AWS_SSH_KEY_NAME               = "AWS_SSH_KEY_NAME"
	AWS_PARAM_AWS_REGION                     = "AWS_REGION"
	AWS_PARAM_AWS_CONTROL_PLANE_MACHINE_TYPE = "AWS_CONTROL_PLANE_MACHINE_TYPE"
	AWS_PARAM_AWS_NODE_MACHINE_TYPE          = "AWS_NODE_MACHINE_TYPE"
	AWS_PARAM_MASTER_DISK_SIZE               = "MASTER_DISK_SIZE"
	AWS_PARAM_WORKER_DISK_SIZE               = "WORKER_DISK_SIZE"

	// Vsphere Parameter
	VSPHERE_PARAM_POD_CIDR                  = "POD_CIDR"
	VSPHERE_PARAM_VSPHERE_SERVER            = "VSPHERE_SERVER"
	VSPHERE_PARAM_VSPHERE_USERNAME          = "VSPHERE_USERNAME"
	VSPHERE_PARAM_VSPHERE_PASSWORD          = "VSPHERE_PASSWORD"
	VSPHERE_PARAM_VSPHERE_TLS_THUMBPRINT    = "VSPHERE_TLS_THUMBPRINT"
	VSPHERE_PARAM_VSPHERE_NETWORK           = "VSPHERE_NETWORK"
	VSPHERE_PARAM_VSPHERE_DATACENTER        = "VSPHERE_DATACENTER"
	VSPHERE_PARAM_VSPHERE_DATASTORE         = "VSPHERE_DATASTORE"
	VSPHERE_PARAM_VSPHERE_FOLDER            = "VSPHERE_FOLDER"
	VSPHERE_PARAM_VSPHERE_RESOURCE_POOL     = "VSPHERE_RESOURCE_POOL"
	VSPHERE_PARAM_MASTER_CPU_NUM            = "MASTER_CPU_NUM"
	VSPHERE_PARAM_MASTER_MEM_SIZE           = "MASTER_MEM_SIZE"
	VSPHERE_PARAM_MASTER_DISK_SIZE          = "MASTER_DISK_SIZE"
	VSPHERE_PARAM_WORKER_CPU_NUM            = "WORKER_CPU_NUM"
	VSPHERE_PARAM_WORKER_MEM_SIZE           = "WORKER_MEM_SIZE"
	VSPHERE_PARAM_WORKER_DISK_SIZE          = "WORKER_DISK_SIZE"
	VSPHERE_PARAM_VSPHERE_TEMPLATE          = "VSPHERE_TEMPLATE"
	VSPHERE_PARAM_VM_PASSWORD               = "VM_PASSWORD"
	VSPHERE_PARAM_CONTROL_PLANE_ENDPOINT_IP = "CONTROL_PLANE_ENDPOINT_IP"

	// Vsphere UpgradeParameter
	VSPHERE_UPGRADE_PARAM_NAMESPACE              = "NAMESPACE"
	VSPHERE_UPGRADE_PARAM_UPGRADE_TEMPLATE_NAME  = "UPGRADE_TEMPLATE_NAME"
	VSPHERE_UPGRADE_PARAM_VSPHERE_SERVER         = "VSPHERE_SERVER"
	VSPHERE_UPGRADE_PARAM_VSPHERE_TLS_THUMBPRINT = "VSPHERE_TLS_THUMBPRINT"
	VSPHERE_UPGRADE_PARAM_VSPHERE_NETWORK        = "VSPHERE_NETWORK"
	VSPHERE_UPGRADE_PARAM_VSPHERE_DATACENTER     = "VSPHERE_DATACENTER"
	VSPHERE_UPGRADE_PARAM_VSPHERE_DATASTORE      = "VSPHERE_DATASTORE"
	VSPHERE_UPGRADE_PARAM_VSPHERE_FOLDER         = "VSPHERE_FOLDER"
	VSPHERE_UPGRADE_PARAM_VSPHERE_RESOURCE_POOL  = "VSPHERE_RESOURCE_POOL"
	VSPHERE_UPGRADE_PARAM_CPU_NUM                = "CPU_NUM"
	VSPHERE_UPGRADE_PARAM_MEM_SIZE               = "MEM_SIZE"
	VSPHERE_UPGRADE_PARAM_DISK_SIZE              = "DISK_SIZE"
	VSPHERE_UPGRADE_PARAM_VSPHERE_TEMPLATE       = "VSPHERE_TEMPLATE"
	VSPHERE_UPGRADE_PARAM_KUBERNETES_VERSION     = "KUBERNETES_VERSION"
)

for template instance

View Source
const (
	LabelKeyControlplaneNode   = "node-role.kubernetes.io/master"
	LabelValueControlplaneNode = ""
)
View Source
const (
	LabelKeyCAPIClusterName = "cluster.x-k8s.io/cluster-name"
)

Variables

This section is empty.

Functions

func ConstructClusterManagerByRegistration

func ConstructClusterManagerByRegistration(clusterRegistration *clusterV1alpha1.ClusterRegistration) *clusterV1alpha1.ClusterManager

func ConstructMonitoringIngressRoute

func ConstructMonitoringIngressRoute() traefikV1alpha1.IngressRoute

func ConstructTemplateInstance

func ConstructTemplateInstance(clusterManager *clusterV1alpha1.ClusterManager,
	templateInstanceName string,
	parameters []tmaxv1.ParamSpec,
	upgrade bool) (*tmaxv1.TemplateInstance, error)

ConstructTemplateInstance는 clusterManager를 이용하여 templateInstance를 생성한다.

func GetRegWorkloadClusterEndpoint

func GetRegWorkloadClusterEndpoint(kubeconfig string) (string, error)
func SetArgocdApplicationLink(manager *clusterV1alpha1.ClusterManager, subdomain string)

Types

type ClusterManagerReconciler

type ClusterManagerReconciler struct {
	client.Client
	Log    logr.Logger
	Scheme *runtime.Scheme
}

ClusterManagerReconciler reconciles a ClusterManager object

func (*ClusterManagerReconciler) CheckApplicationRemains

func (r *ClusterManagerReconciler) CheckApplicationRemains(clm *clusterV1alpha1.ClusterManager) error

root application이 삭제되면 하위의 모든 application이 삭제되므로 root의 경우에 대해서만 검사한다.

func (*ClusterManagerReconciler) CreateApplication

func (r *ClusterManagerReconciler) CreateApplication(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) CreateArgocdResources

func (r *ClusterManagerReconciler) CreateArgocdResources(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (ctrl.Result, error)

func (*ClusterManagerReconciler) CreateCertificate

func (r *ClusterManagerReconciler) CreateCertificate(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) CreateExternalNameService

func (r *ClusterManagerReconciler) CreateExternalNameService(clusterManager *clusterV1alpha1.ClusterManager, annotationKey string) error

func (*ClusterManagerReconciler) CreateGatewayResources

func (r *ClusterManagerReconciler) CreateGatewayResources(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (reconcile.Result, error)

master cluster에서 single cluster로 가기위한 ExternalNameService 생성

func (*ClusterManagerReconciler) CreateHyperAuthResources

func (r *ClusterManagerReconciler) CreateHyperAuthResources(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (reconcile.Result, error)

func (*ClusterManagerReconciler) CreateIngress

func (r *ClusterManagerReconciler) CreateIngress(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) CreateMiddleware

func (r *ClusterManagerReconciler) CreateMiddleware(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) CreateServiceAccountSecret

func (r *ClusterManagerReconciler) CreateServiceAccountSecret(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) CreateTemplateInstance

func (r *ClusterManagerReconciler) CreateTemplateInstance(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (ctrl.Result, error)

func (*ClusterManagerReconciler) CreateTraefikResources

func (r *ClusterManagerReconciler) CreateTraefikResources(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (ctrl.Result, error)

func (*ClusterManagerReconciler) CreateUpgradeTemplateInstance

func (r *ClusterManagerReconciler) CreateUpgradeTemplateInstance(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (ctrl.Result, error)

CreateUpgradeTemplateInstance는 클러스터 업그레이드를 위한 템플릿 인스턴스를 생성한다.

func (*ClusterManagerReconciler) DeleteApplicationRemains

func (r *ClusterManagerReconciler) DeleteApplicationRemains(clm *clusterV1alpha1.ClusterManager) error

root application을 삭제한다. 하위의 application도 함께 삭제될 수 있도록 필요한 세팅을 추가한다.

func (*ClusterManagerReconciler) DeleteCertSecret

func (r *ClusterManagerReconciler) DeleteCertSecret(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) DeleteCertificate

func (r *ClusterManagerReconciler) DeleteCertificate(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) DeleteDeprecatedPrometheusResources

func (r *ClusterManagerReconciler) DeleteDeprecatedPrometheusResources(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) DeleteDeprecatedTraefikResources

func (r *ClusterManagerReconciler) DeleteDeprecatedTraefikResources(clusterManager *clusterV1alpha1.ClusterManager) (bool, error)

func (*ClusterManagerReconciler) DeleteEndpoint

func (r *ClusterManagerReconciler) DeleteEndpoint(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) DeleteGatewayEndpoint

func (r *ClusterManagerReconciler) DeleteGatewayEndpoint(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) DeleteGatewayService

func (r *ClusterManagerReconciler) DeleteGatewayService(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) DeleteHyperAuthResources

func (r *ClusterManagerReconciler) DeleteHyperAuthResources(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) DeleteIngress

func (r *ClusterManagerReconciler) DeleteIngress(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) DeleteIngressRoute

func (r *ClusterManagerReconciler) DeleteIngressRoute(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) DeleteLoadBalancerServices

func (r *ClusterManagerReconciler) DeleteLoadBalancerServices(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) DeleteMiddleware

func (r *ClusterManagerReconciler) DeleteMiddleware(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) DeleteService

func (r *ClusterManagerReconciler) DeleteService(clusterManager *clusterV1alpha1.ClusterManager) error

func (*ClusterManagerReconciler) FetchApplications

func (*ClusterManagerReconciler) GetControlplaneMachineList

func (r *ClusterManagerReconciler) GetControlplaneMachineList(clusterManager *clusterV1alpha1.ClusterManager) ([]capiV1alpha3.Machine, error)

controlplane machine list를 반환

func (*ClusterManagerReconciler) GetKubeconfigSecret

func (r *ClusterManagerReconciler) GetKubeconfigSecret(clusterManager *clusterV1alpha1.ClusterManager) (*coreV1.Secret, error)

func (*ClusterManagerReconciler) GetMachineList

func (r *ClusterManagerReconciler) GetMachineList(clusterManager *clusterV1alpha1.ClusterManager, controlplane bool) ([]capiV1alpha3.Machine, error)

controlplane, worker에 따른 machine list를 반환한다.

func (*ClusterManagerReconciler) GetUpgradeControlplaneMachines

func (r *ClusterManagerReconciler) GetUpgradeControlplaneMachines(clusterManager *clusterV1alpha1.ClusterManager) (MachineUpgradeList, error)

controlplane machine들의 MachineUpgradeList를 반환

func (*ClusterManagerReconciler) GetUpgradeMachinesInfo

func (r *ClusterManagerReconciler) GetUpgradeMachinesInfo(clusterManager *clusterV1alpha1.ClusterManager, machines []capiV1alpha3.Machine) (MachineUpgradeList, error)

func (*ClusterManagerReconciler) GetUpgradeWorkerMachines

func (r *ClusterManagerReconciler) GetUpgradeWorkerMachines(clusterManager *clusterV1alpha1.ClusterManager) (MachineUpgradeList, error)

worker machine들의 MachineUpgradeList를 반환

func (*ClusterManagerReconciler) GetWorkerMachineList

func (r *ClusterManagerReconciler) GetWorkerMachineList(clusterManager *clusterV1alpha1.ClusterManager) ([]capiV1alpha3.Machine, error)

worker machine list를 반환

func (*ClusterManagerReconciler) KubeadmControlPlaneUpdate

func (r *ClusterManagerReconciler) KubeadmControlPlaneUpdate(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (ctrl.Result, error)

KubeadmControlPlaneUpdate는 cluster manager의 master num와 kubeadmcontrolplane의 replicas를 비교하여 kubeadmcontrolplane의 replicas를 cluster manager의 master num으로 업데이트한다.

func (*ClusterManagerReconciler) MachineDeploymentUpdate

func (r *ClusterManagerReconciler) MachineDeploymentUpdate(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (ctrl.Result, error)

MachineDeploymentUpdate는 cluster manager의 worker num와 machinedeployment의 replicas를 비교하여 machinedeployment의 replicas를 cluster manager의 worker num으로 업데이트한다.

func (*ClusterManagerReconciler) ReadyReconcilePhase

func (r *ClusterManagerReconciler) ReadyReconcilePhase(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (ctrl.Result, error)

ReadyReconcilePhase는 reconcile시작 전에 수행되는 phase reconcile 시작 전 필요한 동작들을 수행한다.

func (*ClusterManagerReconciler) Reconcile

func (r *ClusterManagerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error)

func (*ClusterManagerReconciler) ScaleControlplane

func (r *ClusterManagerReconciler) ScaleControlplane(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (ctrl.Result, error)

controlplane을 scaling한다.

func (*ClusterManagerReconciler) ScaleWorker

func (r *ClusterManagerReconciler) ScaleWorker(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (ctrl.Result, error)

worker를 scaling한다.

func (*ClusterManagerReconciler) SetEndpoint

func (r *ClusterManagerReconciler) SetEndpoint(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (ctrl.Result, error)

func (*ClusterManagerReconciler) SetupWithManager

func (r *ClusterManagerReconciler) SetupWithManager(mgr ctrl.Manager) error

func (*ClusterManagerReconciler) UpdateClusterManagerStatus

func (r *ClusterManagerReconciler) UpdateClusterManagerStatus(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (ctrl.Result, error)

func (*ClusterManagerReconciler) UpgradeCluster

func (r *ClusterManagerReconciler) UpgradeCluster(ctx context.Context, clusterManager *clusterV1alpha1.ClusterManager) (ctrl.Result, error)

UpgradeCluster는 controlplane, worker순으로 진행된다. controlplane upgrade가 완료되면, worker upgrade를 진행한다.

type ClusterRegistrationReconciler

type ClusterRegistrationReconciler struct {
	client.Client
	Log    logr.Logger
	Scheme *runtime.Scheme
}

ClusterRegistrationReconciler reconciles a ClusterRegistration object

func (*ClusterRegistrationReconciler) CheckValidation

func (r *ClusterRegistrationReconciler) CheckValidation(ctx context.Context, ClusterRegistration *clusterV1alpha1.ClusterRegistration) (ctrl.Result, error)

func (*ClusterRegistrationReconciler) CreateClusterManager

func (r *ClusterRegistrationReconciler) CreateClusterManager(ctx context.Context, clusterRegistration *clusterV1alpha1.ClusterRegistration) (ctrl.Result, error)

func (*ClusterRegistrationReconciler) CreateKubeconfigSecret

func (r *ClusterRegistrationReconciler) CreateKubeconfigSecret(ctx context.Context, ClusterRegistration *clusterV1alpha1.ClusterRegistration) (ctrl.Result, error)

func (*ClusterRegistrationReconciler) Reconcile

func (r *ClusterRegistrationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error)

func (*ClusterRegistrationReconciler) SetupWithManager

func (r *ClusterRegistrationReconciler) SetupWithManager(mgr ctrl.Manager) error

type MachineUpgradeList

type MachineUpgradeList struct {
	// 새로운 version의 머신 이름 리스트
	NewMachineList []string
	// 이전 version의 머신 이름 리스트
	OldMachineList []string
	// Running 상태의 새로운 Version 머신 이름 리스트
	NewMachineRunningList []string
}

func (*MachineUpgradeList) SetMachines

func (m *MachineUpgradeList) SetMachines(new []string, old []string, newRunning []string)

Jump to

Keyboard shortcuts

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