controllers

package
v0.5.1-b2f0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 40 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"
)

Variables

This section is empty.

Functions

func ConstructClusterManagerByRegistration

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

func ConstructMonitoringIngressRoute

func ConstructMonitoringIngressRoute() traefikV1alpha1.IngressRoute

func ConstructServiceInstance

func ConstructServiceInstance(clusterManager *clusterV1alpha1.ClusterManager, serviceInstanceName string, json []byte, upgrade bool) (*servicecatalogv1beta1.ServiceInstance, error)

func GetRegWorkloadClusterEndpoint

func GetRegWorkloadClusterEndpoint(kubeconfig string) (string, error)

func Marshaling

func Marshaling(parameter Parameters, clusterManager clusterV1alpha1.ClusterManager) ([]byte, error)

parameter에 clustermanager spec 값을 넣어 marshaling해서 리턴하는 메서드

func ParseK8SVersion

func ParseK8SVersion(clusterManager *clusterV1alpha1.ClusterManager) (int, int, error)
func SetApplicationLink(c *clusterV1alpha1.ClusterManager, subdomain string)

Types

type AwsParameter

type AwsParameter struct {
	SshKey         string `json:"AWS_SSH_KEY_NAME"`
	Region         string `json:"AWS_REGION"`
	MasterType     string `json:"AWS_CONTROL_PLANE_MACHINE_TYPE"`
	WorkerType     string `json:"AWS_NODE_MACHINE_TYPE"`
	MasterDiskSize int    `json:"MASTER_DISK_SIZE"`
	WorkerDiskSize int    `json:"WORKER_DISK_SIZE"`
}

func (*AwsParameter) SetParameter

func (p *AwsParameter) SetParameter(clusterManager clusterV1alpha1.ClusterManager)

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) CreateServiceInstance

func (r *ClusterManagerReconciler) CreateServiceInstance(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) CreateUpgradeServiceInstance

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

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) FetchMgmtK8SVersion

func (r *ClusterManagerReconciler) FetchMgmtK8SVersion() (string, error)

kubeadm-config configmap에서 k8s version을 parsing한다.

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)

func (*ClusterManagerReconciler) MachineDeploymentUpdate

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

func (*ClusterManagerReconciler) ReadyReconcilePhase

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

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)

cluster를 upgrade한다. vsphere의 경우, serviceinstance 생성이 필요하다.

type ClusterParameter

type ClusterParameter struct {
	Namespace         string `json:"NAMESPACE"`
	ClusterName       string `json:"CLUSTER_NAME"`
	MasterNum         int    `json:"CONTROL_PLANE_MACHINE_COUNT"`
	WorkerNum         int    `json:"WORKER_MACHINE_COUNT"`
	Owner             string `json:"OWNER"`
	KubernetesVersion string `json:"KUBERNETES_VERSION"`
}

func (*ClusterParameter) SetParameter

func (p *ClusterParameter) SetParameter(clusterManager clusterV1alpha1.ClusterManager)

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)

type Parameters

type Parameters interface {
	SetParameter(clusterV1alpha1.ClusterManager)
}

type VsphereParameter

type VsphereParameter struct {
	PodCidr             string `json:"POD_CIDR"`
	VcenterIp           string `json:"VSPHERE_SERVER"`
	VcenterId           string `json:"VSPHERE_USERNAME"`
	VcenterPassword     string `json:"VSPHERE_PASSWORD"`
	VcenterThumbprint   string `json:"VSPHERE_TLS_THUMBPRINT"`
	VcenterNetwork      string `json:"VSPHERE_NETWORK"`
	VcenterDataCenter   string `json:"VSPHERE_DATACENTER"`
	VcenterDataStore    string `json:"VSPHERE_DATASTORE"`
	VcenterFolder       string `json:"VSPHERE_FOLDER"`
	VcenterResourcePool string `json:"VSPHERE_RESOURCE_POOL"`
	VcenterKcpIp        string `json:"CONTROL_PLANE_ENDPOINT_IP"`
	MasterCpuNum        int    `json:"MASTER_CPU_NUM"`
	MasterMemSize       int    `json:"MASTER_MEM_SIZE"`
	MasterDiskSize      int    `json:"MASTER_DISK_SIZE"`
	WorkerCpuNum        int    `json:"WORKER_CPU_NUM"`
	WorkerMemSize       int    `json:"WORKER_MEM_SIZE"`
	WorkerDiskSize      int    `json:"WORKER_DISK_SIZE"`
	VcenterTemplate     string `json:"VSPHERE_TEMPLATE"`
	VMPassword          string `json:"VM_PASSWORD"`
}

func (*VsphereParameter) SetParameter

func (p *VsphereParameter) SetParameter(clusterManager clusterV1alpha1.ClusterManager)

type VsphereUpgradeParameter

type VsphereUpgradeParameter struct {
	Namespace           string `json:"NAMESPACE"`
	UpgradeTemplateName string `json:"UPGRADE_TEMPLATE_NAME"`
	VcenterIp           string `json:"VSPHERE_SERVER"`
	VcenterThumbprint   string `json:"VSPHERE_TLS_THUMBPRINT"`
	VcenterNetwork      string `json:"VSPHERE_NETWORK"`
	VcenterDataCenter   string `json:"VSPHERE_DATACENTER"`
	VcenterDataStore    string `json:"VSPHERE_DATASTORE"`
	VcenterFolder       string `json:"VSPHERE_FOLDER"`
	VcenterResourcePool string `json:"VSPHERE_RESOURCE_POOL"`
	VcenterCpuNum       int    `json:"CPU_NUM"`
	VcenterMemSize      int    `json:"MEM_SIZE"`
	VcenterDiskSize     int    `json:"DISK_SIZE"`
	VcenterTemplate     string `json:"VSPHERE_TEMPLATE"`
	KubernetesVersion   string `json:"KUBERNETES_VERSION"`
	// contains filtered or unexported fields
}

func (*VsphereUpgradeParameter) SetParameter

func (p *VsphereUpgradeParameter) SetParameter(clusterManager clusterV1alpha1.ClusterManager)

Jump to

Keyboard shortcuts

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