controllers

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: CC0-1.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterFinalizer                   string = "cluster.intent.automation.dcn.ssu.ac.kr"
	NAMESPACE_DEFAULT                  string = "default"
	STATUS_GENERATED                   string = "Generated"
	OPENSTACK_DEFAULT_CONFIG_FILE_PATH string = "/.l-kaas/config/openstack/openstack-config.yml"
	// CAPIDefaultFilePath      string = "/.l-kaas/config/capi/capictl.yml"
	CNIFlannelType string = "flannel"
	CNICalicoType  string = "calico"
	TEMP_PATH      string = "/home/ubuntu/l-kaas/L-KaaS/test"
)
View Source
const (
	// KubeconfigDataName is the key used to store a Kubeconfig in the secret's data field.
	KubeconfigDataName = "value"

	// TLSKeyDataName is the key used to store a TLS private key in the secret's data field.
	TLSKeyDataName = "tls.key"

	// TLSCrtDataName is the key used to store a TLS certificate in the secret's data field.
	TLSCrtDataName                         = "tls.crt"
	KubeConfigSecretSuffix                 = "kubeconfig"
	EMCOApplyFlag                          = "apply"
	EMCODeleteFlag                         = "delete"
	EMCOConfigPath                         = "/home/ubuntu/l-kaas/L-KaaS/pkg/emcoclient/.emco.yaml"
	EMCO_DEFAULT_CONFIG_FILE_PATH          = "/.l-kaas/config/emco/.emco.yaml"
	EMCO_RESOURCE_DEFAULT_CONFIG_FILE_PATH = "/.l-kaas/config/emco/emco-resource.yml"
)
View Source
const DEFAULT_CAPI_AWS_CONFIG_PATH string = "/.l-kaas/config/capi/capactl.yml"
View Source
const DEFAULT_CAPI_CONFIG_PATH string = "/.l-kaas/config/capi/capictl.yml"
View Source
const (
	LogicalClusterFinalizer string = "logicalcluster.intent.automation.dcn.ssu.ac.kr"
)
View Source
const OPENSTACK_PROVIDER_URL string = "https://github.com/kubernetes-sigs/cluster-api-provider-openstack/releases/download/v0.7.1/infrastructure-components.yaml"

CAPI Openstack provider url components

Variables

View Source
var (
	CAPIConfigFilePath              string
	CAPIAWSConfigFilePath           string
	OpenStackProviderConfigFilePath string
)
View Source
var (
	EMCOConfigFile = "/home/ubuntu/l-kaas/L-KaaS/pkg/emcoclient/.emco.yaml"

	// For Register Logical Cloud
	// Prerequisite Value => Prerequisite LC => Instatiate LC => Update LC
	EMCOConfigFilePath         string
	EMCOResourceConfigFilePath string

	UpdateLogicalClusterTemplateUrl = "https://raw.githubusercontent.com/ntnguyencse/L-KaaS/main/templates/emco/dcm/update-lc.yaml"
	// For Install Flannel CNI
	EmptyProfileForCompositeAppURL = "https://raw.githubusercontent.com/ntnguyencse/L-KaaS/main/templates/emco/vfw/vfw/profile.tar.gz"
	CompositeAppTemplateURL        = "https://raw.githubusercontent.com/ntnguyencse/L-KaaS/main/templates/emco/vfw/vfw/test-vfw.yaml"
	PrerequisiteCompositeAppURL    = "https://raw.githubusercontent.com/ntnguyencse/L-KaaS/main/templates/emco/vfw/vfw/prerequisites.yaml"
)
View Source
var KUBECONFIG string

Require export KUBECONFIG before running

Functions

func AddClusterToLogicalCluster

func AddClusterToLogicalCluster(flag string, emcoConfigPath string, AddTemplateclusterPath string, valuePath string) error

Add cluster to a prerequisite cluster emcoctl --config emco-cfg.yaml apply -f 1stcluster.yaml -v values.yaml https://github.com/ntnguyencse/L-KaaS/tree/main/templates/emco/dcm

func AddInfraConfigsFromClusterDescription

func AddInfraConfigsFromClusterDescription(clusterDes *intentv1.ClusterDescription, configs map[string]string) map[string]string

Add config from Infra Part of cluster Description TODO: Make it general for most of provider Current only support for OpenStack

func AddToConfigs

func AddToConfigs(config map[string]string, newConfigs map[string]string) map[string]string

func ApplyCommand

func ApplyCommand(ctx context.Context, flag string, fileApplyPath string, valueFilePath string, options []string) error

func ChooseKindCAPIResource

func ChooseKindCAPIResource(resource string)

func CleanUpCAPIResource

func CleanUpCAPIResource(filePath string) error

func CreateLogicalClusterPrerequisitesValueContent

func CreateLogicalClusterPrerequisitesValueContent(lCluster *intentv1.LogicalCluster, capoCluster *capiv1alpha4.Cluster, kubePath string) (string, error)

Create Value File for Prerequisites

func DownloadZipFile

func DownloadZipFile(fileName, URL string) string

func FindMemberStatusCorresspondToClusterName

func FindMemberStatusCorresspondToClusterName(memberStatus *[]intentv1.ClusterMemberStatus, clusterName string) (int, intentv1.ClusterMemberStatus, error)

func FindProfileWithName

func FindProfileWithName(listProfiles *intentv1.ProfileList, name string) (intentv1.Profile, error)

func GetConfigForAWS

func GetConfigForAWS() intentv1.ProviderConfig

func GetConfigForOpenStack

func GetConfigForOpenStack() intentv1.ProviderConfig

func GetOpenStackConfigPath

func GetOpenStackConfigPath(systemConfigPath string) (string, error)

func GetTemplateFile

func GetTemplateFile(url string) (string, error)

Get Template File

func InstallCalioCNI

func InstallCalioCNI(installer *Installer, clusterName string, components ...InstallComponent)

Install Calico

func InstansiateLogicalCluster

func InstansiateLogicalCluster(flag string, emcoConfigPath string, InstansiteLogicalClusterPath string, valuePath string) error

Instansiate Logical Cluster emcoctl --config emco-cfg.yaml apply -f instantiate-lc.yaml -v values.yaml https://github.com/ntnguyencse/L-KaaS/tree/main/templates/emco/dcm

func Name

func Name(cluster string, suffix string) string

Name returns the name of the secret for a cluster.

func PrerequisitesLogicalCluster

func PrerequisitesLogicalCluster(flag string, emcoConfigPath string, prerequisitePath string, valuePath string) error

Prerequisites Logical Cluster emcoctl --config emco-cfg.yaml apply -f prerequisites.yaml -v values.yaml https://github.com/ntnguyencse/L-KaaS/tree/main/templates/emco/dcm

func SetLogicalClusterPhase

func SetLogicalClusterPhase()

func SplitYAML

func SplitYAML(resources []byte) ([][]byte, error)

func TranslateFromClusterDescritionToCAPI

func TranslateFromClusterDescritionToCAPI(clusterDes *intentv1.ClusterDescription, configForProvider intentv1.ProviderConfig, configForCluster map[string]string) (string, error)

Transform to CAPI Resource Remember export KUBECONFIG

func UpdateLogicalCluster

func UpdateLogicalCluster(flag string, emcoConfigPath string, UpdateLogicalClusterPath string, valuePath string) error

Update cluster after add a new cluster to EMCO // emcoctl --config emco-cfg.yaml apply -f update-lc.yaml -v values.yaml https://github.com/ntnguyencse/L-KaaS/tree/main/templates/emco/dcm

Types

type BlueprintReconciler

type BlueprintReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

BlueprintReconciler reconciles a Blueprint object

func (*BlueprintReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the Blueprint object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.1/pkg/reconcile

func (*BlueprintReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type ClusterCatalogReconciler

type ClusterCatalogReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

ClusterCatalogReconciler reconciles a ClusterCatalog object

func (*ClusterCatalogReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the ClusterCatalog object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.1/pkg/reconcile

func (*ClusterCatalogReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type ClusterDescriptionReconciler

type ClusterDescriptionReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

ClusterDescriptionReconciler reconciles a ClusterDescription object

func (*ClusterDescriptionReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the ClusterDescription object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.1/pkg/reconcile

func (*ClusterDescriptionReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type ClusterReconciler

type ClusterReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

ClusterReconciler reconciles a Cluster object

func (*ClusterReconciler) ApplyCAPIResourceToKubernertes

func (r *ClusterReconciler) ApplyCAPIResourceToKubernertes(clusterName, CAPIRes string) error

func (*ClusterReconciler) CalicoInstaller

func (r *ClusterReconciler) CalicoInstaller(kubeConfigPath, version, podCIDR string) (*Installer, error)

Install Calico CNI

func (*ClusterReconciler) FlannelInstaller

func (r *ClusterReconciler) FlannelInstaller(kubeConfigPath, version, podCIDR string) (*Installer, error)

Install Flannel CNI

func (*ClusterReconciler) GetOrCreateCluster

func (r *ClusterReconciler) GetOrCreateCluster(ctx context.Context, clusterNameSpace string, cluster *intentv1.Cluster) (intentv1.ClusterDescription, error)

func (*ClusterReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the Cluster object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.1/pkg/reconcile

func (*ClusterReconciler) ReconcileClusterPhase

func (r *ClusterReconciler) ReconcileClusterPhase(ctx context.Context, cluster *intentv1.Cluster)

Update/ Reconcile Phase of cluster

func (*ClusterReconciler) ReconcileDelete

func (r *ClusterReconciler) ReconcileDelete(ctx context.Context, cluster *intentv1.Cluster) (ctrl.Result, error)

func (*ClusterReconciler) ReconcileInstallSoftware

func (r *ClusterReconciler) ReconcileInstallSoftware(ctx context.Context, request ctrl.Request, cluster *intentv1.Cluster) error

Reconcile when cluster provisioned and setting up software components

func (*ClusterReconciler) ReconcileNormal

func (r *ClusterReconciler) ReconcileNormal(ctx context.Context, cluster *intentv1.Cluster) (ctrl.Result, error)

Reconcile Normal

func (*ClusterReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

func (*ClusterReconciler) TransformClusterToClusterDescription

func (r *ClusterReconciler) TransformClusterToClusterDescription(ctx context.Context, clusterCR intentv1.Cluster, clusterNameSpace string, listBluePrint []intentv1.Profile) (intentv1.ClusterDescription, error)

Read the Cluster Description Find the profile corresponding and replace value Add value to Cluster descripton

type InstallComponent

type InstallComponent struct {
	Version         string
	Name            string
	URL             string
	TargetNamespace string
	KubeConfigPath  string
}

func CreateInstallerComponent

func CreateInstallerComponent(Name, Version, URL, TargetNamespace, KubeconfigPath string) InstallComponent

type InstallOptions

type InstallOptions struct {
	WaitProviders       bool
	WaitProviderTimeout time.Duration
}

type Installer

type Installer struct {
	Client     client.Client
	Components []InstallComponent
	Func       func() error
}

func SetUpInstaller

func SetUpInstaller(client client.Client) Installer

Install middle ware

func (*Installer) AddInstallComponent

func (i *Installer) AddInstallComponent(item InstallComponent)

func (*Installer) Install

func (i *Installer) Install(clusterName string) error

type LogicalClusterControlPlaneProviderReconciler

type LogicalClusterControlPlaneProviderReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

LogicalClusterControlPlaneProviderReconciler reconciles a LogicalClusterControlPlaneProvider object

func (*LogicalClusterControlPlaneProviderReconciler) AddClusterToLogicalCluster

func (r *LogicalClusterControlPlaneProviderReconciler) AddClusterToLogicalCluster(ctx context.Context, flag string, cluster intentv1.Cluster) error

func (*LogicalClusterControlPlaneProviderReconciler) CalicoInstaller

func (r *LogicalClusterControlPlaneProviderReconciler) CalicoInstaller(kubeConfigPath, version, podCIDR string) (*Installer, error)

func (*LogicalClusterControlPlaneProviderReconciler) CreateLogicalCluster

func (r *LogicalClusterControlPlaneProviderReconciler) CreateLogicalCluster(ctx context.Context, flag string, logicalCluster intentv1.LogicalCluster) error

Flag: "apply" "delete"

func (*LogicalClusterControlPlaneProviderReconciler) FlannelEMCOInstaller

func (r *LogicalClusterControlPlaneProviderReconciler) FlannelEMCOInstaller(kubeConfigPath, version, podCIDR string) error

func (*LogicalClusterControlPlaneProviderReconciler) FlannelInstaller

func (r *LogicalClusterControlPlaneProviderReconciler) FlannelInstaller(kubeConfigPath, version, podCIDR string) (*Installer, error)

func (*LogicalClusterControlPlaneProviderReconciler) GetClusterOwnerObject

func (*LogicalClusterControlPlaneProviderReconciler) GetListProfile

func (*LogicalClusterControlPlaneProviderReconciler) GetLogicalClusterOwnerObject

func (*LogicalClusterControlPlaneProviderReconciler) InstantiateCompositeApplication

func (r *LogicalClusterControlPlaneProviderReconciler) InstantiateCompositeApplication(ctx context.Context, flag string, cluster intentv1.Cluster) error

func (*LogicalClusterControlPlaneProviderReconciler) InstantiateLogicalCluster

func (r *LogicalClusterControlPlaneProviderReconciler) InstantiateLogicalCluster(ctx context.Context, flag string, logicalCluster intentv1.LogicalCluster) error

func (*LogicalClusterControlPlaneProviderReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the LogicalClusterControlPlaneProvider object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.1/pkg/reconcile

func (*LogicalClusterControlPlaneProviderReconciler) ReconcileClusterPhase

func (r *LogicalClusterControlPlaneProviderReconciler) ReconcileClusterPhase(ctx context.Context, logicalCluster *intentv1.LogicalCluster, capiCluster *capiv1alpha4.ClusterList) error

func (*LogicalClusterControlPlaneProviderReconciler) ReconcileInstallSoftware

func (r *LogicalClusterControlPlaneProviderReconciler) ReconcileInstallSoftware(ctx context.Context, req ctrl.Request, kubePath string, cluster *intentv1.Cluster, CAPICluster *capiv1alpha4.Cluster) error

func (*LogicalClusterControlPlaneProviderReconciler) RegisterLogicalCLusterToEMCO

func (r *LogicalClusterControlPlaneProviderReconciler) RegisterLogicalCLusterToEMCO(ctx context.Context, flag string, logicalCluster intentv1.LogicalCluster) error

func (*LogicalClusterControlPlaneProviderReconciler) SetupWithManager

SetupWithManager sets up the controller with the Manager.

func (*LogicalClusterControlPlaneProviderReconciler) UpdateClusterToLogicalCluster

func (r *LogicalClusterControlPlaneProviderReconciler) UpdateClusterToLogicalCluster(ctx context.Context, flag string, cluster intentv1.Cluster) error

type LogicalClusterReconciler

type LogicalClusterReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

LogicalClusterReconciler reconciles a LogicalCluster object

func (*LogicalClusterReconciler) BuildClusterObjectFromCatalog

func (r *LogicalClusterReconciler) BuildClusterObjectFromCatalog(ctx context.Context, lcluster *intentv1.LogicalCluster, clusterMember *intentv1.ClusterMember, clusterCatalog *intentv1.ClusterCatalog) (intentv1.Cluster, error)

func (*LogicalClusterReconciler) BuildClusterObjectFromProfile

func (r *LogicalClusterReconciler) BuildClusterObjectFromProfile(ctx context.Context, lcluster *intentv1.LogicalCluster, clusterMember *intentv1.ClusterMember, clusterCatalog *intentv1.ClusterCatalog) (intentv1.Cluster, error)

func (*LogicalClusterReconciler) CreateClusterFromClusterCatalog

func (r *LogicalClusterReconciler) CreateClusterFromClusterCatalog(ctx context.Context, lcluster *intentv1.LogicalCluster, clusterSpec *intentv1.ClusterMember) (intentv1.Cluster, error)

Create Cluster from Cluster Catalog

func (*LogicalClusterReconciler) CreateClusterFromClusterProfile

func (r *LogicalClusterReconciler) CreateClusterFromClusterProfile(ctx context.Context, lcluster *intentv1.LogicalCluster, clusterSpec *intentv1.ClusterMember) (intentv1.Cluster, error)

Create Cluster from Cluster Profile

func (*LogicalClusterReconciler) GetOrCreateCluster

func (r *LogicalClusterReconciler) GetOrCreateCluster(ctx context.Context, lcluster *intentv1.LogicalCluster, clusterMember *intentv1.ClusterMember) (intentv1.Cluster, error)

func (*LogicalClusterReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the LogicalCluster object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.1/pkg/reconcile

func (*LogicalClusterReconciler) ReconcileClusterPhase

func (r *LogicalClusterReconciler) ReconcileClusterPhase(ctx context.Context, cluster *intentv1.LogicalCluster) error

Update Phase of Logical Cluster

func (*LogicalClusterReconciler) ReconcileCreate

func (r *LogicalClusterReconciler) ReconcileCreate(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*LogicalClusterReconciler) ReconcileDelete

func (r *LogicalClusterReconciler) ReconcileDelete(ctx context.Context, cluster *intentv1.LogicalCluster) (ctrl.Result, error)

func (*LogicalClusterReconciler) ReconcileNormal

func (r *LogicalClusterReconciler) ReconcileNormal(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*LogicalClusterReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type ProfileReconciler

type ProfileReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

ProfileReconciler reconciles a Profile object

func (*ProfileReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the Profile object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.1/pkg/reconcile

func (*ProfileReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type SoftwareInstallationReconciler

type SoftwareInstallationReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

SoftwareInstallationReconciler reconciles a SoftwareInstallation object

func (*SoftwareInstallationReconciler) GetClusterOwnerObject

func (r *SoftwareInstallationReconciler) GetClusterOwnerObject(ctx context.Context, req ctrl.Request, ownerRef *metav1.OwnerReference) (intentv1.Cluster, error)

func (*SoftwareInstallationReconciler) GetListProfile

func (*SoftwareInstallationReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the SoftwareInstallation object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.1/pkg/reconcile

func (*SoftwareInstallationReconciler) ReconcileInstallSoftware

func (r *SoftwareInstallationReconciler) ReconcileInstallSoftware(ctx context.Context, req ctrl.Request, kubePath string, cluster *intentv1.Cluster, CAPICluster *capiv1alpha4.Cluster) error

func (*SoftwareInstallationReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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