Back to godoc.org

Package cluster

v0.0.0 (bd4055e)
Latest Go to latest
Published: Aug 3, 2020 | License: Apache-2.0 | Module: github.com/banzaicloud/pipeline

Index

Package Files

Constants

const (
	ExternalBaseURLKey         = contextKey("ExternalBaseURL")
	ExternalBaseURLInsecureKey = contextKey("ExternalBaseURLInsecure")
)
const (
	AzureVirtualMachineScaleSet = "vmss"
)
const CreateClusterWorkflowName = "create-cluster-legacy"
const DownloadK8sConfigActivityName = "download-k8s-config-legacy"
const EKSCreateClusterWorkflowName = "eks-create-cluster"
const EKSDeleteClusterWorkflowName = "eks-delete-cluster"
const EKSUpdateClusterWorkflowName = "eks-update-cluster"
const LabelNodesWithNodepoolNameActivityName = "label-nodes-with-nodepool-name-legacy"
const RBAC_API_VERSION = "rbac.authorization.k8s.io"
const RunPostHookActivityName = "run-posthook"
const RunPostHooksWorkflowName = "run-posthooks"
const SetupPrivilegesActivityName = "setup-privileges-legacy"
const (
	StorageAccountContributor = "Storage Account Contributor"
)

Storage Account Contributor role constant

const UpdateClusterStatusActivityName = "update-cluster-status"

Variables

var (
	ErrSecretNotFound                = stderrors.New("secret not found")
	ErrKubernetesSecretNotFound      = stderrors.New("kubernetes secret not found")
	ErrKubernetesSecretAlreadyExists = stderrors.New("kubernetes secret already exists")
)
var BasePostHookFunctions = []string{
	pkgCluster.InstallIngressControllerPostHook,
	pkgCluster.InstallKubernetesDashboardPostHook,
	pkgCluster.InstallClusterAutoscalerPostHook,
	pkgCluster.InstallHorizontalPodAutoscalerPostHook,
	pkgCluster.InitSpotConfig,
	pkgCluster.DeployInstanceTerminationHandler,
}

BasePostHookFunctions default posthook functions after cluster create nolint: gochecknoglobals

var ErrAlreadyExists = stderrors.New("cluster already exists with this name")
var ErrConfigNotExists = fmt.Errorf("Kubernetes config is not available for the cluster")

ErrConfigNotExists means that a cluster has no kubeconfig stored in vault (probably didn't successfully start yet)

var ErrInvalidClusterInstance = errors.New("invalid cluster instance")
var ErrNoInfrastructureRG = errors.New("no infrastructure resource group found")
var HookMap = map[string]PostFunctioner{
	pkgCluster.InstallIngressControllerPostHook: &IngressControllerPostHook{
		ErrorHandler: ErrorHandler{},
	},
	pkgCluster.InstallKubernetesDashboardPostHook: &KubernetesDashboardPostHook{
		ErrorHandler: ErrorHandler{},
	},
	pkgCluster.InstallClusterAutoscalerPostHook: &ClusterAutoscalerPostHook{
		ErrorHandler: ErrorHandler{},
	},
	pkgCluster.InstallHorizontalPodAutoscalerPostHook: &HorizontalPodAutoscalerPostHook{
		ErrorHandler: ErrorHandler{},
	},
	pkgCluster.RestoreFromBackup: &RestoreFromBackupPosthook{
		ErrorHandler: ErrorHandler{},
	},
	pkgCluster.InitSpotConfig: &InitSpotConfigPostHook{
		ErrorHandler: ErrorHandler{},
	},
	pkgCluster.DeployInstanceTerminationHandler: &InstanceTerminationHandlerPostHook{
		ErrorHandler: ErrorHandler{},
	},
}

HookMap for api hook endpoints nolint: gochecknoglobals

func CreateClusterWorkflow

func CreateClusterWorkflow(ctx workflow.Context, input CreateClusterWorkflowInput) error

func CreateOrUpdateResourceGroup

func CreateOrUpdateResourceGroup(orgID uint, secretID string, resourceGroupName, location string) error

CreateOrUpdateResourceGroup creates or updates a resource group

func DeployClusterAutoscaler

func DeployClusterAutoscaler(cluster CommonCluster, helmService HelmService) error

DeployClusterAutoscaler post hook only for AWS & EKS & Azure for now

func EKSCreateClusterWorkflow

func EKSCreateClusterWorkflow(ctx workflow.Context, input EKSCreateClusterWorkflowInput) error

CreateClusterWorkflow executes the Cadence workflow responsible for creating and configuring an EKS cluster

func EKSDeleteClusterWorkflow

func EKSDeleteClusterWorkflow(ctx workflow.Context, input EKSDeleteClusterWorkflowInput) error

DeleteClusterWorkflow executes the Cadence workflow responsible for deleting an EKS cluster

func EKSUpdateClusterWorkflow

func EKSUpdateClusterWorkflow(ctx workflow.Context, input EKSUpdateClusterstructureWorkflowInput) error

UpdateClusterstructureWorkflow executes the Cadence workflow responsible for updating EKS worker nodes

func GetAKSNodePools

func GetAKSNodePools(cluster CommonCluster) ([]*azureadapter.AKSNodePoolModel, error)

GetAKSNodePools returns AKS node pools from a common cluster.

func GetAKSResourceGroup

func GetAKSResourceGroup(cluster CommonCluster) (string, error)

GetAKSResourceGroup returns AKS resource group from a common cluster.

func GetDesiredLabelsForCluster

func GetDesiredLabelsForCluster(ctx context.Context, cluster CommonCluster, nodePoolLabels []NodePoolLabels) (map[string]map[string]string, error)

GetDesiredLabelsForCluster returns desired set of labels for each node pool name, adding reserved labels like: head node, ondemand labels + cloudinfo to user defined labels in specified nodePools map. All user labels are deleted in case Label map is empty in NodePoolLabels, however in case Label map is nil no labels are returned to avoid overriding already exisisting user specified labels.

func GetEKSNodePools

func GetEKSNodePools(cluster CommonCluster) ([]*eksmodel.AmazonNodePoolsModel, error)

GetEKSNodePools returns EKS node pools from a common cluster.

func GetKubernetesVersion

func GetKubernetesVersion(orgID uint, secretID string, location string) ([]string, error)

GetKubernetesVersion returns a list of supported kubernetes version in the specified subscription

func GetLocations

func GetLocations(orgID uint, secretID string) (locations []string, err error)

GetLocations returns all the locations that are available for resource providers

func GetMachineTypes

func GetMachineTypes(orgID uint, secretID string, location string) (pkgCluster.MachineTypes, error)

GetMachineTypes lists all available virtual machine sizes for a subscription in a location

func InstallSecret

func InstallSecret(cc interface {
	GetK8sConfig() ([]byte, error)
	GetOrganizationId() uint
}, secretName string, req InstallSecretRequest) (string, error)

InstallSecret installs a new secret under the name into namespace of a Kubernetes cluster. It returns the installed secret name and meta about how to mount it.

func InstallSecretByK8SConfig

func InstallSecretByK8SConfig(kubeConfig []byte, orgID uint, secretName string, req InstallSecretRequest) (string, error)

InstallSecretByK8SConfig is the same as InstallSecret but use this if you already have a K8S config at hand.

func InstallSecrets

func InstallSecrets(ctx context.Context, cc CommonCluster, query *secret.ListSecretsQuery, namespace string) ([]string, error)

InstallSecrets installs or updates secrets that matches the query under the name into namespace of a Kubernetes cluster. It returns the list of installed secret names and meta about how to mount them.

func InstallSecretsByK8SConfig

func InstallSecretsByK8SConfig(ctx context.Context, kubeConfig []byte, orgID uint, query *secret.ListSecretsQuery, namespace string) ([]string, error)

InstallSecretsByK8SConfig is the same as InstallSecrets but use this if you already have a K8S config at hand.

func ListResourceGroups

func ListResourceGroups(orgID uint, secretID string) (res []string, err error)

ListResourceGroups returns all resource group

func MergeSecret

func MergeSecret(ctx context.Context, cc CommonCluster, secretName string, req InstallSecretRequest) (string, error)

MergeSecret merges a secret with an already existing one in a Kubernetes cluster. It returns the installed secret name and meta about how to mount it.

func MergeSecretByK8SConfig

func MergeSecretByK8SConfig(ctx context.Context, kubeConfig []byte, orgID uint, secretName string, req InstallSecretRequest) (string, error)

MergeSecretByK8SConfig is the same as MergeSecret but use this if you already have a K8S config at hand.

func NewClusterCheckMiddleware

func NewClusterCheckMiddleware(manager *Manager, errorHandler emperror.Handler) gin.HandlerFunc

NewClusterCheckMiddleware returns a new gin middleware that checks cluster is exists in the current org.

func NewClusterCreator

func NewClusterCreator(request *pkgCluster.CreateClusterRequest, cluster CommonCluster, workflowClient client.Client) clusterCreator

NewClusterCreator returns a new PKE or Common cluster creator instance depending on the cluster.

func NewClusterEvents

func NewClusterEvents(eb eventBus) *clusterEventBus

func NewCommonClusterCreator

func NewCommonClusterCreator(request *pkgCluster.CreateClusterRequest, cluster CommonCluster) *commonCreator

NewCommonClusterCreator returns a new cluster creator instance.

func NewCommonClusterUpdater

func NewCommonClusterUpdater(
	request *cluster.UpdateClusterRequest,
	clientFactory DynamicClientFactory,
	cluster CommonCluster,
	userID uint,
	workflowClient client.Client,
	externalBaseURL string,
	externalBaseURLInsecure bool,
	helmService HelmService,
) *commonUpdater

NewCommonClusterUpdater returns a new cluster creator instance.

func NewCommonNodepoolUpdater

func NewCommonNodepoolUpdater(request *cluster.UpdateNodePoolsRequest, cluster CommonCluster, userID uint) *commonNodepoolUpdater

NewCommonNodepoolUpdater returns a new cluster creator instance.

func NewCreatorBaseFields

func NewCreatorBaseFields(createdAt time.Time, createdBy uint) *pkgCommon.CreatorBaseFields

NewCreatorBaseFields creates a new CreatorBaseFields instance from createdAt and createdBy

func NewExporter

func NewExporter() *pipelineMetrics

func NewLogurLogger

func NewLogurLogger(fl logrus.FieldLogger) logur.Logger

func NewNopClusterEvents

func NewNopClusterEvents() *nopClusterEvents

func RunPostHooksWorkflow

func RunPostHooksWorkflow(ctx workflow.Context, input RunPostHooksWorkflowInput) error

func StoreKubernetesConfig

func StoreKubernetesConfig(cluster CommonCluster, config []byte) error

StoreKubernetesConfig stores the given K8S config in vault

type ACKCluster

type ACKCluster struct {
	APIEndpoint string

	CommonClusterBase
	// contains filtered or unexported fields
}

func CreateACKClusterFromModel

func CreateACKClusterFromModel(clusterModel *model.ClusterModel) (*ACKCluster, error)

CreateACKClusterFromModel creates ClusterModel struct from the Alibaba model

func CreateACKClusterFromRequest

func CreateACKClusterFromRequest(request *pkgCluster.CreateClusterRequest, orgId uint, userId uint) (*ACKCluster, error)

func (*ACKCluster) AddDefaultsToUpdate

func (c *ACKCluster) AddDefaultsToUpdate(r *pkgCluster.UpdateClusterRequest)

func (*ACKCluster) CheckEqualityToUpdate

func (c *ACKCluster) CheckEqualityToUpdate(r *pkgCluster.UpdateClusterRequest) error

func (*ACKCluster) CreateCluster

func (c *ACKCluster) CreateCluster() error

func (*ACKCluster) DeleteCluster

func (c *ACKCluster) DeleteCluster() error

func (*ACKCluster) DeleteFromDatabase

func (c *ACKCluster) DeleteFromDatabase() error

func (*ACKCluster) DownloadK8sConfig

func (c *ACKCluster) DownloadK8sConfig() ([]byte, error)

func (*ACKCluster) GetAPIEndpoint

func (c *ACKCluster) GetAPIEndpoint() (string, error)

func (*ACKCluster) GetAlibabaCSClient

func (c *ACKCluster) GetAlibabaCSClient(cfg *sdk.Config) (*cs.Client, error)

GetAlibabaCSClient creates an Alibaba Container Service client with the credentials

func (*ACKCluster) GetAlibabaECSClient

func (c *ACKCluster) GetAlibabaECSClient(cfg *sdk.Config) (*ecs.Client, error)

GetAlibabaECSClient creates an Alibaba Elastic Compute Service client with the credentials

func (*ACKCluster) GetAlibabaESSClient

func (c *ACKCluster) GetAlibabaESSClient(cfg *sdk.Config) (*ess.Client, error)

GetAlibabaESSClient creates an Alibaba Auto Scaling Service client with credentials

func (*ACKCluster) GetAlibabaVPCClient

func (c *ACKCluster) GetAlibabaVPCClient(cfg *sdk.Config) (*vpc.Client, error)

GetAlibabaVPCClient creates an Alibaba Virtual Private Cloud client with credentials

func (*ACKCluster) GetCloud

func (c *ACKCluster) GetCloud() string

GetCloud returns the cloud type of the cluster

func (*ACKCluster) GetConfigSecretId

func (c *ACKCluster) GetConfigSecretId() string

func (*ACKCluster) GetDistribution

func (c *ACKCluster) GetDistribution() string

GetDistribution returns the distribution type of the cluster

func (*ACKCluster) GetID

func (c *ACKCluster) GetID() uint

func (*ACKCluster) GetK8sConfig

func (c *ACKCluster) GetK8sConfig() ([]byte, error)

func (*ACKCluster) GetK8sUserConfig

func (c *ACKCluster) GetK8sUserConfig() ([]byte, error)

func (*ACKCluster) GetLocation

func (c *ACKCluster) GetLocation() string

GetLocation gets where the cluster is.

func (*ACKCluster) GetModel

func (c *ACKCluster) GetModel() *model.ClusterModel

func (*ACKCluster) GetName

func (c *ACKCluster) GetName() string

func (*ACKCluster) GetOrganizationId

func (c *ACKCluster) GetOrganizationId() uint

func (*ACKCluster) GetScaleOptions

func (c *ACKCluster) GetScaleOptions() *pkgCluster.ScaleOptions

getScaleOptionsFromModelV1 returns scale options for the cluster

func (*ACKCluster) GetSecretId

func (c *ACKCluster) GetSecretId() string

func (*ACKCluster) GetSecretWithValidation

func (c *ACKCluster) GetSecretWithValidation() (*secret.SecretItemResponse, error)

func (*ACKCluster) GetSshSecretId

func (c *ACKCluster) GetSshSecretId() string

func (*ACKCluster) GetStatus

func (c *ACKCluster) GetStatus() (*pkgCluster.GetClusterStatusResponse, error)

func (*ACKCluster) GetType

func (c *ACKCluster) GetType() string

func (*ACKCluster) GetUID

func (c *ACKCluster) GetUID() string

func (*ACKCluster) IsReady

func (c *ACKCluster) IsReady() (bool, error)

IsReady checks if the cluster is running according to the cloud provider.

func (*ACKCluster) ListNodeNames

func (c *ACKCluster) ListNodeNames() (map[string][]string, error)

func (*ACKCluster) NodePoolExists

func (c *ACKCluster) NodePoolExists(nodePoolName string) bool

NodePoolExists returns true if node pool with nodePoolName exists

func (*ACKCluster) Persist

func (c *ACKCluster) Persist() error

Persist Deprecated: Do not use.

func (*ACKCluster) RbacEnabled

func (c *ACKCluster) RbacEnabled() bool

func (*ACKCluster) RequiresSshPublicKey

func (*ACKCluster) RequiresSshPublicKey() bool

func (*ACKCluster) SaveConfigSecretId

func (c *ACKCluster) SaveConfigSecretId(configSecretId string) error

func (*ACKCluster) SaveSshSecretId

func (c *ACKCluster) SaveSshSecretId(sshSecretId string) error

func (*ACKCluster) SetScaleOptions

func (c *ACKCluster) SetScaleOptions(scaleOptions *pkgCluster.ScaleOptions)

SetScaleOptions sets scale options for the cluster

func (*ACKCluster) SetStatus

func (c *ACKCluster) SetStatus(status, statusMessage string) error

SetStatus sets the cluster's status

func (*ACKCluster) UpdateCluster

func (c *ACKCluster) UpdateCluster(request *pkgCluster.UpdateClusterRequest, userId uint) error

func (*ACKCluster) UpdateNodePools

func (c *ACKCluster) UpdateNodePools(request *pkgCluster.UpdateNodePoolsRequest, userId uint) error

UpdateNodePools updates nodes pools of a cluster

func (*ACKCluster) ValidateCreationFields

func (c *ACKCluster) ValidateCreationFields(r *pkgCluster.CreateClusterRequest) error

type AKSCluster

type AKSCluster struct {
	CommonClusterBase
	// contains filtered or unexported fields
}

AKSCluster represents an AKS cluster

func CreateAKSClusterFromModel

func CreateAKSClusterFromModel(clusterModel *model.ClusterModel) *AKSCluster

CreateAKSClusterFromModel creates ClusterModel struct from model

func CreateAKSClusterFromRequest

func CreateAKSClusterFromRequest(request *pkgCluster.CreateClusterRequest, orgID uint, userID uint) (*AKSCluster, error)

CreateAKSClusterFromRequest returns an AKS cluster instance created from the specified request

func (*AKSCluster) AddDefaultsToUpdate

func (c *AKSCluster) AddDefaultsToUpdate(r *pkgCluster.UpdateClusterRequest)

AddDefaultsToUpdate adds defaults to update request

func (*AKSCluster) CheckEqualityToUpdate

func (c *AKSCluster) CheckEqualityToUpdate(r *pkgCluster.UpdateClusterRequest) error

CheckEqualityToUpdate validates the update request

func (*AKSCluster) CreateCluster

func (c *AKSCluster) CreateCluster() error

CreateCluster creates a new cluster

func (*AKSCluster) DeleteCluster

func (c *AKSCluster) DeleteCluster() error

DeleteCluster deletes the cluster from AKS

func (*AKSCluster) DeleteFromDatabase

func (c *AKSCluster) DeleteFromDatabase() error

DeleteFromDatabase deletes model from the database

func (*AKSCluster) DownloadK8sConfig

func (c *AKSCluster) DownloadK8sConfig() ([]byte, error)

DownloadK8sConfig returns the kubeconfig file's contents from AKS

func (*AKSCluster) GetAPIEndpoint

func (c *AKSCluster) GetAPIEndpoint() (string, error)

GetAPIEndpoint returns the Kubernetes API endpoint

func (*AKSCluster) GetCloud

func (c *AKSCluster) GetCloud() string

GetCloud returns the cloud type of the cluster

func (*AKSCluster) GetConfigSecretId

func (c *AKSCluster) GetConfigSecretId() string

GetConfigSecretId returns the cluster's config secret ID

func (*AKSCluster) GetDistribution

func (c *AKSCluster) GetDistribution() string

GetDistribution returns the distribution type of the cluster

func (*AKSCluster) GetID

func (c *AKSCluster) GetID() uint

GetID returns the cluster's ID

func (*AKSCluster) GetK8sConfig

func (c *AKSCluster) GetK8sConfig() ([]byte, error)

GetK8sConfig returns the Kubernetes config

func (*AKSCluster) GetK8sUserConfig

func (c *AKSCluster) GetK8sUserConfig() ([]byte, error)

GetK8sUserConfig returns the Kubernetes config for external users

func (*AKSCluster) GetKubernetesVersion

func (c *AKSCluster) GetKubernetesVersion() (string, error)

func (*AKSCluster) GetLocation

func (c *AKSCluster) GetLocation() string

GetLocation returns the location of the cluster

func (*AKSCluster) GetModel

func (c *AKSCluster) GetModel() *model.ClusterModel

GetModel returns the cluster's model

func (*AKSCluster) GetName

func (c *AKSCluster) GetName() string

GetName returns the name of the cluster

func (*AKSCluster) GetOrganizationId

func (c *AKSCluster) GetOrganizationId() uint

GetOrganizationId returns the ID of the organization where the cluster belongs to

func (*AKSCluster) GetResourceGroupName

func (c *AKSCluster) GetResourceGroupName() string

GetResourceGroupName return the resource group's name the cluster belongs in

func (*AKSCluster) GetScaleOptions

func (c *AKSCluster) GetScaleOptions() *pkgCluster.ScaleOptions

GetScaleOptions returns scale options for the cluster

func (*AKSCluster) GetSecretId

func (c *AKSCluster) GetSecretId() string

GetSecretId returns the cluster secret's ID

func (*AKSCluster) GetSecretWithValidation

func (c *AKSCluster) GetSecretWithValidation() (*secret.SecretItemResponse, error)

GetSecretWithValidation returns secret from vault

func (*AKSCluster) GetSshSecretId

func (c *AKSCluster) GetSshSecretId() string

GetSSHSecretID returns the cluster's SSH secret ID

func (*AKSCluster) GetStatus

func (c *AKSCluster) GetStatus() (*pkgCluster.GetClusterStatusResponse, error)

GetStatus returns the cluster's status

func (*AKSCluster) GetUID

func (c *AKSCluster) GetUID() string

GetUID returns the cluster's UID

func (*AKSCluster) IsReady

func (c *AKSCluster) IsReady() (bool, error)

IsReady checks if the cluster is running according to the cloud provider

func (*AKSCluster) NodePoolExists

func (c *AKSCluster) NodePoolExists(nodePoolName string) bool

NodePoolExists returns true if node pool with nodePoolName exists

func (*AKSCluster) Persist

func (c *AKSCluster) Persist() error

Persist saves the cluster model Deprecated: Do not use.

func (*AKSCluster) RbacEnabled

func (c *AKSCluster) RbacEnabled() bool

RbacEnabled returns true if rbac enabled on the cluster

func (*AKSCluster) RequiresSshPublicKey

func (c *AKSCluster) RequiresSshPublicKey() bool

RequiresSshPublicKey returns true if a public SSH key is needed for bootstrapping the cluster

func (*AKSCluster) SaveConfigSecretId

func (c *AKSCluster) SaveConfigSecretId(configSecretID string) error

SaveConfigSecretId saves the config secret ID in database

func (*AKSCluster) SaveSshSecretId

func (c *AKSCluster) SaveSshSecretId(sshSecretID string) error

SaveSshSecretId saves the SSH secret ID to database

func (*AKSCluster) SetScaleOptions

func (c *AKSCluster) SetScaleOptions(scaleOptions *pkgCluster.ScaleOptions)

SetScaleOptions sets scale options for the cluster

func (*AKSCluster) SetStatus

func (c *AKSCluster) SetStatus(status, statusMessage string) error

SetStatus sets the cluster's status

func (*AKSCluster) UpdateCluster

func (c *AKSCluster) UpdateCluster(request *pkgCluster.UpdateClusterRequest, userID uint) error

UpdateCluster updates the cluster in AKS

func (*AKSCluster) UpdateNodePools

func (c *AKSCluster) UpdateNodePools(request *pkgCluster.UpdateNodePoolsRequest, userID uint) error

UpdateNodePools updates nodes pools of a cluster

func (*AKSCluster) ValidateCreationFields

func (c *AKSCluster) ValidateCreationFields(r *pkgCluster.CreateClusterRequest) error

ValidateCreationFields validates all field

type ClientFactory

type ClientFactory interface {
	// FromSecret creates a Kubernetes client for a cluster from a secret.
	FromSecret(ctx context.Context, secretID string) (kubernetes.Interface, error)
}

ClientFactory returns a Kubernetes client.

type ClusterAutoscalerPostHook

type ClusterAutoscalerPostHook struct {
	Priority
	ErrorHandler
	// contains filtered or unexported fields
}

func (*ClusterAutoscalerPostHook) Do

func (ph *ClusterAutoscalerPostHook) Do(cluster CommonCluster) error

InstallClusterAutoscalerPostHook post hook only for AWS & Azure for now

func (*ClusterAutoscalerPostHook) InjectHelmService

func (h *ClusterAutoscalerPostHook) InjectHelmService(helmService HelmService)

InjectHelmService injects the service to be used by the "parent" struct

type CommonCluster

type CommonCluster interface {
	// Entity properties
	GetID() uint
	GetUID() string
	GetOrganizationId() uint
	GetName() string
	GetCloud() string
	GetDistribution() string
	GetLocation() string

	// Secrets
	GetSecretId() string
	GetSshSecretId() string
	SaveSshSecretId(string) error
	SaveConfigSecretId(string) error
	GetConfigSecretId() string
	GetSecretWithValidation() (*secret.SecretItemResponse, error)

	// Persistence
	Persist() error
	DeleteFromDatabase() error

	// Cluster management
	CreateCluster() error
	ValidateCreationFields(r *pkgCluster.CreateClusterRequest) error
	UpdateCluster(*pkgCluster.UpdateClusterRequest, uint) error
	UpdateNodePools(*pkgCluster.UpdateNodePoolsRequest, uint) error
	CheckEqualityToUpdate(*pkgCluster.UpdateClusterRequest) error
	AddDefaultsToUpdate(*pkgCluster.UpdateClusterRequest)
	DeleteCluster() error
	GetScaleOptions() *pkgCluster.ScaleOptions
	SetScaleOptions(*pkgCluster.ScaleOptions)

	// Kubernetes
	GetAPIEndpoint() (string, error)
	GetK8sConfig() ([]byte, error)
	GetK8sUserConfig() ([]byte, error)
	RequiresSshPublicKey() bool
	RbacEnabled() bool

	// Cluster info
	GetStatus() (*pkgCluster.GetClusterStatusResponse, error)
	IsReady() (bool, error)
	NodePoolExists(nodePoolName string) bool

	SetStatus(status, statusMessage string) error
}

CommonCluster interface for clusters.

func CreateCommonClusterFromRequest

func CreateCommonClusterFromRequest(createClusterRequest *pkgCluster.CreateClusterRequest, orgId uint, userId uint) (CommonCluster, error)

CreateCommonClusterFromRequest creates a CommonCluster from a request

func GetCommonClusterFromModel

func GetCommonClusterFromModel(modelCluster *model.ClusterModel) (CommonCluster, error)

GetCommonClusterFromModel extracts CommonCluster from a ClusterModel

type CommonClusterBase

type CommonClusterBase struct {
	// contains filtered or unexported fields
}

CommonClusterBase holds the fields that is common to all cluster types also provides default implementation for common interface methods.

func (*CommonClusterBase) RequiresSshPublicKey

func (c *CommonClusterBase) RequiresSshPublicKey() bool

RequiresSshPublicKey returns true if an ssh public key is needed for the cluster for bootstrapping it. The default is false.

type CreateClusterWorkflowInput

type CreateClusterWorkflowInput struct {
	ClusterID        uint
	ClusterUID       string
	ClusterName      string
	OrganizationID   uint
	OrganizationName string
	Distribution     string
	NodePoolLabels   map[string]map[string]string
}

type CreationContext

type CreationContext struct {
	OrganizationID          uint
	UserID                  uint
	ExternalBaseURL         string
	ExternalBaseURLInsecure bool
	Name                    string
	Provider                string
	SecretID                string
	SecretIDs               []string
	PostHooks               pkgCluster.PostHooks
}

CreationContext represents the data necessary to do generic cluster creation steps/checks.

type DownloadK8sConfigActivity

type DownloadK8sConfigActivity struct {
	// contains filtered or unexported fields
}

func NewDownloadK8sConfigActivity

func NewDownloadK8sConfigActivity(manager *Manager) DownloadK8sConfigActivity

func (DownloadK8sConfigActivity) Execute

func (a DownloadK8sConfigActivity) Execute(ctx context.Context, input DownloadK8sConfigActivityInput) (string, error)

type DownloadK8sConfigActivityInput

type DownloadK8sConfigActivityInput struct {
	ClusterID uint
}

type DynamicClientFactory

type DynamicClientFactory interface {
	// FromSecret creates a Kubernetes client for a cluster from a secret.
	FromSecret(ctx context.Context, secretID string) (dynamic.Interface, error)
}

DynamicClientFactory returns a dynamic Kubernetes client.

type EC2ClusterPKE

type EC2ClusterPKE struct {

	// amazonCluster *ec2.EC2 //Don't use this directly
	APIEndpoint string

	CommonClusterBase
	// contains filtered or unexported fields
}

func CreateEC2ClusterPKEFromModel

func CreateEC2ClusterPKEFromModel(modelCluster *model.ClusterModel) (*EC2ClusterPKE, error)

func CreateEC2ClusterPKEFromRequest

func CreateEC2ClusterPKEFromRequest(request *pkgCluster.CreateClusterRequest, orgId uint, userId uint) (*EC2ClusterPKE, error)

func (*EC2ClusterPKE) AddDefaultsToUpdate

func (c *EC2ClusterPKE) AddDefaultsToUpdate(*pkgCluster.UpdateClusterRequest)

func (*EC2ClusterPKE) CheckEqualityToUpdate

func (c *EC2ClusterPKE) CheckEqualityToUpdate(*pkgCluster.UpdateClusterRequest) error

func (*EC2ClusterPKE) CreateCluster

func (c *EC2ClusterPKE) CreateCluster() error

func (*EC2ClusterPKE) CreatePKECluster

func (c *EC2ClusterPKE) CreatePKECluster(tokenGenerator TokenGenerator, externalBaseURL string) error

func (*EC2ClusterPKE) DeleteCluster

func (c *EC2ClusterPKE) DeleteCluster() error

func (*EC2ClusterPKE) DeleteFromDatabase

func (c *EC2ClusterPKE) DeleteFromDatabase() error

DeleteFromDatabase deletes the distribution related entities from the database

func (*EC2ClusterPKE) DeletePKECluster

func (c *EC2ClusterPKE) DeletePKECluster(ctx context.Context, workflowClient client.Client) error

func (*EC2ClusterPKE) GetAPIEndpoint

func (c *EC2ClusterPKE) GetAPIEndpoint() (string, error)

func (*EC2ClusterPKE) GetAWSClient

func (c *EC2ClusterPKE) GetAWSClient() (*session.Session, error)

func (*EC2ClusterPKE) GetBootstrapCommand

func (c *EC2ClusterPKE) GetBootstrapCommand(nodePoolName, url string, urlInsecure bool, token string) (string, error)

GetBootstrapCommand returns a command line to use to install a node in the given nodepool

func (*EC2ClusterPKE) GetCAHash

func (c *EC2ClusterPKE) GetCAHash() (string, error)

func (*EC2ClusterPKE) GetCloud

func (c *EC2ClusterPKE) GetCloud() string

func (*EC2ClusterPKE) GetConfigSecretId

func (c *EC2ClusterPKE) GetConfigSecretId() string

func (*EC2ClusterPKE) GetCurrentWorkflowID

func (c *EC2ClusterPKE) GetCurrentWorkflowID() string

func (*EC2ClusterPKE) GetDistribution

func (c *EC2ClusterPKE) GetDistribution() string

func (*EC2ClusterPKE) GetID

func (c *EC2ClusterPKE) GetID() uint

func (*EC2ClusterPKE) GetK8sConfig

func (c *EC2ClusterPKE) GetK8sConfig() ([]byte, error)

func (*EC2ClusterPKE) GetK8sUserConfig

func (c *EC2ClusterPKE) GetK8sUserConfig() ([]byte, error)

func (*EC2ClusterPKE) GetKubernetesContainerRuntime

func (c *EC2ClusterPKE) GetKubernetesContainerRuntime() (string, error)

func (*EC2ClusterPKE) GetKubernetesNetworkProvider

func (c *EC2ClusterPKE) GetKubernetesNetworkProvider() (string, error)

func (*EC2ClusterPKE) GetKubernetesVersion

func (c *EC2ClusterPKE) GetKubernetesVersion() (string, error)

func (*EC2ClusterPKE) GetLocation

func (c *EC2ClusterPKE) GetLocation() string

func (*EC2ClusterPKE) GetName

func (c *EC2ClusterPKE) GetName() string

func (*EC2ClusterPKE) GetNetworkApiServerAddress

func (c *EC2ClusterPKE) GetNetworkApiServerAddress() (host, port string, err error)

GetNetworkApiServerAddress returns Kubernetes API Server host and port.

func (*EC2ClusterPKE) GetNetworkCloudProvider

func (c *EC2ClusterPKE) GetNetworkCloudProvider() (cloudProvider, vpcID string, subnets []string, err error)

GetNetworkCloudProvider return cloud provider specific network information.

func (*EC2ClusterPKE) GetNodePools

func (c *EC2ClusterPKE) GetNodePools() []PKENodePool

func (*EC2ClusterPKE) GetOrganizationId

func (c *EC2ClusterPKE) GetOrganizationId() uint

func (*EC2ClusterPKE) GetPipelineToken

func (c *EC2ClusterPKE) GetPipelineToken(tokenGenerator interface{}) (string, error)

GetPipelineToken returns a lazily generated token for Pipeline

func (*EC2ClusterPKE) GetScaleOptions

func (c *EC2ClusterPKE) GetScaleOptions() *pkgCluster.ScaleOptions

GetScaleOptions returns scale options for the cluster

func (*EC2ClusterPKE) GetSecretId

func (c *EC2ClusterPKE) GetSecretId() string

func (*EC2ClusterPKE) GetSecretWithValidation

func (c *EC2ClusterPKE) GetSecretWithValidation() (*secret.SecretItemResponse, error)

func (*EC2ClusterPKE) GetSshPublicKey

func (c *EC2ClusterPKE) GetSshPublicKey() (string, error)

func (*EC2ClusterPKE) GetSshSecretId

func (c *EC2ClusterPKE) GetSshSecretId() string

func (*EC2ClusterPKE) GetStatus

func (c *EC2ClusterPKE) GetStatus() (*pkgCluster.GetClusterStatusResponse, error)

func (*EC2ClusterPKE) GetUID

func (c *EC2ClusterPKE) GetUID() string

func (*EC2ClusterPKE) HasK8sConfig

func (c *EC2ClusterPKE) HasK8sConfig() (bool, error)

HasK8sConfig returns true if the cluster's k8s config is available

func (*EC2ClusterPKE) IsMasterReady

func (c *EC2ClusterPKE) IsMasterReady() (bool, error)

IsMasterReady returns true when the master node has been reported as ready

func (*EC2ClusterPKE) IsReady

func (c *EC2ClusterPKE) IsReady() (bool, error)

IsReady checks if the cluster is running according to the cloud provider.

func (*EC2ClusterPKE) ListNodePools

func (c *EC2ClusterPKE) ListNodePools() ([]string, error)

ListNodePools returns node pool names.

func (*EC2ClusterPKE) NodePoolExists

func (c *EC2ClusterPKE) NodePoolExists(nodePoolName string) bool

func (*EC2ClusterPKE) Persist

func (c *EC2ClusterPKE) Persist() error

func (*EC2ClusterPKE) RbacEnabled

func (c *EC2ClusterPKE) RbacEnabled() bool

func (*EC2ClusterPKE) RegisterNode

func (c *EC2ClusterPKE) RegisterNode(name, nodePoolName, ip string, master, worker bool) error

RegisterNode adds a Node to the DB

func (*EC2ClusterPKE) RequiresSshPublicKey

func (c *EC2ClusterPKE) RequiresSshPublicKey() bool

RequiresSshPublicKey returns true as a public ssh key is needed for bootstrapping the cluster

func (*EC2ClusterPKE) SaveConfigSecretId

func (c *EC2ClusterPKE) SaveConfigSecretId(configSecretId string) error

func (*EC2ClusterPKE) SaveNetworkApiServerAddress

func (c *EC2ClusterPKE) SaveNetworkApiServerAddress(host, port string) error

SaveNetworkApiServerAddress stores Kubernetes API Server host and port.

func (*EC2ClusterPKE) SaveNetworkCloudProvider

func (c *EC2ClusterPKE) SaveNetworkCloudProvider(cloudProvider, vpcID string, subnets []string) error

SaveNetworkCloudProvider saves cloud provider specific network information.

func (*EC2ClusterPKE) SaveSshSecretId

func (c *EC2ClusterPKE) SaveSshSecretId(sshSecretId string) error

func (*EC2ClusterPKE) SetCurrentWorkflowID

func (c *EC2ClusterPKE) SetCurrentWorkflowID(workflowID string) error

func (*EC2ClusterPKE) SetScaleOptions

func (c *EC2ClusterPKE) SetScaleOptions(scaleOptions *pkgCluster.ScaleOptions)

SetScaleOptions sets scale options for the cluster

func (*EC2ClusterPKE) SetStatus

func (c *EC2ClusterPKE) SetStatus(status, statusMessage string) error

SetStatus sets the cluster's status

func (*EC2ClusterPKE) UpdateCluster

func (c *EC2ClusterPKE) UpdateCluster(*pkgCluster.UpdateClusterRequest, uint) error

func (*EC2ClusterPKE) UpdateNodePools

func (c *EC2ClusterPKE) UpdateNodePools(*pkgCluster.UpdateNodePoolsRequest, uint) error

func (*EC2ClusterPKE) UpdatePKECluster

func (c *EC2ClusterPKE) UpdatePKECluster(ctx context.Context, request *pkgCluster.UpdateClusterRequest, userID uint, workflowClient client.Client, externalBaseURL string, externalBaseURLInsecure bool) error

func (*EC2ClusterPKE) ValidateCreationFields

func (c *EC2ClusterPKE) ValidateCreationFields(r *pkgCluster.CreateClusterRequest) error

type EKSCluster

type EKSCluster struct {

	// maps node pools to subnets. The subnets identified by the "default" key represent the subnets provided in
	// request.Properties.CreateClusterEKS.Subnets
	SubnetMapping map[string][]*pkgEks.Subnet

	CommonClusterBase
	// contains filtered or unexported fields
}

EKSCluster struct for EKS cluster

func CreateEKSClusterFromModel

func CreateEKSClusterFromModel(clusterModel *model.ClusterModel) (*EKSCluster, error)

CreateEKSClusterFromModel creates ClusterModel struct from the model

func CreateEKSClusterFromRequest

func CreateEKSClusterFromRequest(request *pkgCluster.CreateClusterRequest, orgId uint, userId uint) (*EKSCluster, error)

CreateEKSClusterFromRequest creates ClusterModel struct from the request

func (*EKSCluster) AddDefaultsToUpdate

func (c *EKSCluster) AddDefaultsToUpdate(r *pkgCluster.UpdateClusterRequest)

AddDefaultsToUpdate adds defaults to update request

func (*EKSCluster) CheckEqualityToUpdate

func (c *EKSCluster) CheckEqualityToUpdate(r *pkgCluster.UpdateClusterRequest) error

CheckEqualityToUpdate validates the update request

func (*EKSCluster) CreateCluster

func (c *EKSCluster) CreateCluster() error

func (*EKSCluster) DeleteCluster

func (c *EKSCluster) DeleteCluster() error

func (*EKSCluster) DeleteFromDatabase

func (c *EKSCluster) DeleteFromDatabase() error

DeleteFromDatabase deletes model from the database

func (*EKSCluster) GetAPIEndpoint

func (c *EKSCluster) GetAPIEndpoint() (string, error)

GetAPIEndpoint returns the Kubernetes Api endpoint

func (*EKSCluster) GetCloud

func (c *EKSCluster) GetCloud() string

GetCloud returns the cloud type of the cluster

func (*EKSCluster) GetConfigSecretId

func (c *EKSCluster) GetConfigSecretId() string

GetConfigSecretId returns config secret id

func (*EKSCluster) GetDistribution

func (c *EKSCluster) GetDistribution() string

GetDistribution returns the distribution type of the cluster

func (*EKSCluster) GetID

func (c *EKSCluster) GetID() uint

GetID returns the DB ID of this cluster

func (*EKSCluster) GetK8sConfig

func (c *EKSCluster) GetK8sConfig() ([]byte, error)

GetK8sConfig returns the Kubernetes config for internal use

func (*EKSCluster) GetK8sUserConfig

func (c *EKSCluster) GetK8sUserConfig() ([]byte, error)

GetK8sUserConfig returns the Kubernetes config for external users

func (*EKSCluster) GetKubernetesVersion

func (c *EKSCluster) GetKubernetesVersion() (string, error)

func (*EKSCluster) GetLocation

func (c *EKSCluster) GetLocation() string

GetLocation gets where the cluster is.

func (*EKSCluster) GetModel

func (c *EKSCluster) GetModel() *eksmodel.EKSClusterModel

GetModel returns the DB model of this cluster

func (*EKSCluster) GetName

func (c *EKSCluster) GetName() string

GetName returns the name of the cluster

func (*EKSCluster) GetOrganizationId

func (c *EKSCluster) GetOrganizationId() uint

GetOrganizationId gets org where the cluster belongs

func (*EKSCluster) GetScaleOptions

func (c *EKSCluster) GetScaleOptions() *pkgCluster.ScaleOptions

GetScaleOptions returns scale options for the cluster

func (*EKSCluster) GetSecretId

func (c *EKSCluster) GetSecretId() string

GetSecretId retrieves the secret id

func (*EKSCluster) GetSecretWithValidation

func (c *EKSCluster) GetSecretWithValidation() (*secret.SecretItemResponse, error)

GetSecretWithValidation returns secret from vault

func (*EKSCluster) GetSshSecretId

func (c *EKSCluster) GetSshSecretId() string

GetSshSecretId retrieves the secret id

func (*EKSCluster) GetStatus

func (c *EKSCluster) GetStatus() (*pkgCluster.GetClusterStatusResponse, error)

GetStatus describes the status of this EKS cluster.

func (*EKSCluster) GetSubnetMapping

func (c *EKSCluster) GetSubnetMapping() map[string][]*pkgEks.Subnet

func (*EKSCluster) GetUID

func (c *EKSCluster) GetUID() string

func (*EKSCluster) IsReady

func (c *EKSCluster) IsReady() (bool, error)

IsReady checks if the cluster is running according to the cloud provider.

func (*EKSCluster) IsSSHGenerated

func (c *EKSCluster) IsSSHGenerated() bool

func (*EKSCluster) NodePoolExists

func (c *EKSCluster) NodePoolExists(nodePoolName string) bool

NodePoolExists returns true if node pool with nodePoolName exists

func (*EKSCluster) Persist

func (c *EKSCluster) Persist() error

Persist saves the cluster model Deprecated: Do not use.

func (*EKSCluster) PersistSSHGenerate

func (c *EKSCluster) PersistSSHGenerate(sshGenerated bool) error

func (*EKSCluster) RbacEnabled

func (c *EKSCluster) RbacEnabled() bool

RbacEnabled returns true if rbac enabled on the cluster

func (*EKSCluster) RequiresSshPublicKey

func (c *EKSCluster) RequiresSshPublicKey() bool

RequiresSshPublicKey returns true as a public ssh key is needed for bootstrapping the cluster

func (*EKSCluster) SaveConfigSecretId

func (c *EKSCluster) SaveConfigSecretId(configSecretId string) error

SaveConfigSecretId saves the config secret id in database

func (*EKSCluster) SaveSshSecretId

func (c *EKSCluster) SaveSshSecretId(sshSecretId string) error

SaveSshSecretId saves the ssh secret id to database

func (*EKSCluster) SetCurrentWorkflowID

func (c *EKSCluster) SetCurrentWorkflowID(workflowID string) error

func (*EKSCluster) SetScaleOptions

func (c *EKSCluster) SetScaleOptions(scaleOptions *pkgCluster.ScaleOptions)

SetScaleOptions sets scale options for the cluster

func (*EKSCluster) SetStatus

func (c *EKSCluster) SetStatus(status string, statusMessage string) error

SetStatus sets the cluster's status

func (*EKSCluster) UpdateCluster

func (c *EKSCluster) UpdateCluster(*pkgCluster.UpdateClusterRequest, uint) error

Deprecated: UpdateCluster updates EKS cluster in cloud

func (*EKSCluster) UpdateNodePools

func (c *EKSCluster) UpdateNodePools(request *pkgCluster.UpdateNodePoolsRequest, userId uint) error

UpdateNodePools updates nodes pools of a cluster

This will become obsolete once we have the Node Pool API ready

func (*EKSCluster) ValidateCreationFields

func (c *EKSCluster) ValidateCreationFields(*pkgCluster.CreateClusterRequest) error

type EKSClusterRepository

type EKSClusterRepository interface {
	DeleteClusterModel(model *clustermodel.ClusterModel) error
	DeleteModel(model *eksmodel.EKSClusterModel) error
	DeleteNodePool(model *eksmodel.AmazonNodePoolsModel) error
	DeleteSubnet(model *eksmodel.EKSSubnetModel) error
	SaveModel(model *eksmodel.EKSClusterModel) error
	SaveStatusHistory(model *clustermodel.StatusHistoryModel) error
}

EKSClusterRepository describes a EKS cluster's persistent storage repository

func NewDBEKSClusterRepository

func NewDBEKSClusterRepository(db *gorm.DB) (EKSClusterRepository, error)

NewDBEKSClusterRepository returns a new EKSClusterRepository backed by a GORM DB

type EKSCreateClusterWorkflowInput

type EKSCreateClusterWorkflowInput struct {
	eksWorkflow.CreateInfrastructureWorkflowInput

	OrganizationName string
	PostHooks        pkgCluster.PostHooks
	NodePoolLabels   map[string]map[string]string
}

CreateClusterWorkflowInput holds data needed by the create cluster workflow

type EKSDeleteClusterWorkflowInput

type EKSDeleteClusterWorkflowInput struct {
	OrganizationID uint
	SecretID       string
	Region         string

	ClusterName   string
	NodePoolNames []string

	ClusterID  uint
	ClusterUID string

	// the identifier of the kubeconfig secret of the cluster
	K8sSecretID string
	DefaultUser bool

	// force delete
	Forced bool

	GeneratedSSHKeyUsed bool
}

DeleteClusterWorkflowInput holds data needed by the delete cluster workflow

type EKSUpdateClusterstructureWorkflowInput

type EKSUpdateClusterstructureWorkflowInput struct {
	Region         string
	OrganizationID uint
	SecretID       string
	ConfigSecretID string

	ClusterID    uint
	ClusterUID   string
	ClusterName  string
	ScaleEnabled bool
	Tags         map[string]string

	Subnets          []eksWorkflow.Subnet
	ASGSubnetMapping map[string][]eksWorkflow.Subnet

	NodeInstanceRoleID string
	AsgList            []eksWorkflow.AutoscaleGroup
	NodePoolLabels     map[string]map[string]string

	UseGeneratedSSHKey bool
}

EKSUpdateClusterstructureWorkflowInput holds data needed to update EKS cluster worker node pools

type ErrorHandler

type ErrorHandler struct {
}

ErrorHandler is the common struct which implement Error function

func (*ErrorHandler) Error

func (*ErrorHandler) Error(c CommonCluster, err error)

type GKECluster

type GKECluster struct {
	APIEndpoint string

	CommonClusterBase
	// contains filtered or unexported fields
}

GKECluster struct for GKE cluster

func CreateGKEClusterFromModel

func CreateGKEClusterFromModel(clusterModel *model.ClusterModel) (*GKECluster, error)

CreateGKEClusterFromModel creates ClusterModel struct from model

func CreateGKEClusterFromRequest

func CreateGKEClusterFromRequest(request *pkgCluster.CreateClusterRequest, orgID uint, userID uint) (*GKECluster, error)

CreateGKEClusterFromRequest creates ClusterModel struct from the request

func (*GKECluster) AddDefaultsToUpdate

func (c *GKECluster) AddDefaultsToUpdate(r *pkgCluster.UpdateClusterRequest)

AddDefaultsToUpdate adds defaults to update request

func (*GKECluster) CheckEqualityToUpdate

func (c *GKECluster) CheckEqualityToUpdate(r *pkgCluster.UpdateClusterRequest) error

CheckEqualityToUpdate validates the update request

func (*GKECluster) CreateCluster

func (c *GKECluster) CreateCluster() error

CreateCluster creates a new cluster

func (*GKECluster) DeleteCluster

func (c *GKECluster) DeleteCluster() error

DeleteCluster deletes cluster from google

func (*GKECluster) DeleteFromDatabase

func (c *GKECluster) DeleteFromDatabase() error

DeleteFromDatabase deletes model from the database

func (*GKECluster) DownloadK8sConfig

func (c *GKECluster) DownloadK8sConfig() ([]byte, error)

DownloadK8sConfig downloads the kubeconfig file from cloud

func (*GKECluster) GetAPIEndpoint

func (c *GKECluster) GetAPIEndpoint() (string, error)

GetAPIEndpoint returns the Kubernetes Api endpoint

func (*GKECluster) GetAllMachineTypes

func (c *GKECluster) GetAllMachineTypes() (map[string]pkgCluster.MachineTypes, error)

GetAllMachineTypes lists all supported machine types

func (*GKECluster) GetAllMachineTypesByZone

func (c *GKECluster) GetAllMachineTypesByZone(zone string) (map[string]pkgCluster.MachineTypes, error)

GetAllMachineTypesByZone lists supported machine types by zone

func (*GKECluster) GetCloud

func (c *GKECluster) GetCloud() string

GetCloud returns the cloud type of the cluster

func (*GKECluster) GetConfigSecretId

func (c *GKECluster) GetConfigSecretId() string

GetConfigSecretId return config secret id

func (*GKECluster) GetDistribution

func (c *GKECluster) GetDistribution() string

GetDistribution returns the distribution type of the cluster

func (*GKECluster) GetGkeServerConfig

func (c *GKECluster) GetGkeServerConfig(zone string) (*gke.ServerConfig, error)

GetGkeServerConfig returns configuration info about the Kubernetes Engine service.

func (*GKECluster) GetGoogleCluster

func (c *GKECluster) GetGoogleCluster() (*gke.Cluster, error)

GetGoogleCluster returns with a Cluster from GKE

func (*GKECluster) GetID

func (c *GKECluster) GetID() uint

GetID returns the specified cluster id

func (*GKECluster) GetK8sConfig

func (c *GKECluster) GetK8sConfig() ([]byte, error)

GetK8sConfig returns the Kubernetes config

func (*GKECluster) GetK8sUserConfig

func (c *GKECluster) GetK8sUserConfig() ([]byte, error)

GetK8sUserConfig returns the Kubernetes config

func (*GKECluster) GetLocation

func (c *GKECluster) GetLocation() string

GetLocation gets where the cluster is.

func (*GKECluster) GetName

func (c *GKECluster) GetName() string

GetName returns the name of the cluster

func (*GKECluster) GetOrganizationId

func (c *GKECluster) GetOrganizationId() uint

GetOrganizationId gets org where the cluster belongs

func (*GKECluster) GetProjectId

func (c *GKECluster) GetProjectId() (string, error)

GetProjectId returns with project id from secret

func (*GKECluster) GetScaleOptions

func (c *GKECluster) GetScaleOptions() *pkgCluster.ScaleOptions

GetScaleOptions returns scale options for the cluster

func (*GKECluster) GetSecretId

func (c *GKECluster) GetSecretId() string

GetSecretId retrieves the secret id

func (*GKECluster) GetSecretWithValidation

func (c *GKECluster) GetSecretWithValidation() (*secret.SecretItemResponse, error)

GetSecretWithValidation returns secret from vault

func (*GKECluster) GetSshSecretId

func (c *GKECluster) GetSshSecretId() string

GetSshSecretId retrieves the secret id

func (*GKECluster) GetStatus

func (c *GKECluster) GetStatus() (*pkgCluster.GetClusterStatusResponse, error)

GetStatus gets cluster status

func (*GKECluster) GetUID

func (c *GKECluster) GetUID() string

func (*GKECluster) GetZones

func (c *GKECluster) GetZones() ([]string, error)

GetZones lists supported zones

func (*GKECluster) IsReady

func (c *GKECluster) IsReady() (bool, error)

IsReady checks if the cluster is running according to the cloud provider.

func (*GKECluster) NodePoolExists

func (c *GKECluster) NodePoolExists(nodePoolName string) bool

NodePoolExists returns true if node pool with nodePoolName exists

func (*GKECluster) Persist

func (c *GKECluster) Persist() error

Persist save the cluster model

func (*GKECluster) RbacEnabled

func (c *GKECluster) RbacEnabled() bool

RbacEnabled returns true if rbac enabled on the cluster

func (*GKECluster) SaveConfigSecretId

func (c *GKECluster) SaveConfigSecretId(configSecretId string) error

SaveConfigSecretId saves the config secret id in database

func (*GKECluster) SaveSshSecretId

func (c *GKECluster) SaveSshSecretId(sshSecretId string) error

SaveSshSecretId saves the ssh secret id to database

func (*GKECluster) SetScaleOptions

func (c *GKECluster) SetScaleOptions(scaleOptions *pkgCluster.ScaleOptions)

SetScaleOptions sets scale options for the cluster

func (*GKECluster) SetStatus

func (c *GKECluster) SetStatus(status, statusMessage string) error

SetStatus sets the cluster's status

func (*GKECluster) UpdateCluster

func (c *GKECluster) UpdateCluster(updateRequest *pkgCluster.UpdateClusterRequest, userId uint) error

UpdateCluster updates GKE cluster in cloud

func (*GKECluster) UpdateNodePools

func (c *GKECluster) UpdateNodePools(request *pkgCluster.UpdateNodePoolsRequest, userId uint) error

UpdateNodePools updates nodes pools of a cluster

func (*GKECluster) ValidateCreationFields

func (c *GKECluster) ValidateCreationFields(r *pkgCluster.CreateClusterRequest) error

ValidateCreationFields validates all field

type GKEClusterRepository

type GKEClusterRepository interface {
	DeleteClusterModel(model *clustermodel.ClusterModel) error
	DeleteModel(model *google.GKEClusterModel) error
	DeleteNodePool(model *google.GKENodePoolModel) error
	SaveModel(model *google.GKEClusterModel) error
	SaveStatusHistory(model *clustermodel.StatusHistoryModel) error
}

GKEClusterRepository describes a GKE cluster's persistent storage repository

func NewDBGKEClusterRepository

func NewDBGKEClusterRepository(db *gorm.DB) (GKEClusterRepository, error)

NewDBGKEClusterRepository returns a new GKEClusterRepository backed by a GORM DB

type HelmService

type HelmService interface {
	ApplyDeployment(
		ctx context.Context,
		clusterID uint,
		namespace string,
		chartName string,
		releaseName string,
		values []byte,
		chartVersion string,
	) error

	InstallDeployment(
		ctx context.Context,
		clusterID uint,
		namespace string,
		chartName string,
		releaseName string,
		values []byte,
		chartVersion string,
		wait bool,
	) error

	// DeleteDeployment deletes a deployment from a specific cluster.
	DeleteDeployment(ctx context.Context, clusterID uint, releaseName, namespace string) error

	// GetDeployment gets a deployment by release name from a specific cluster.
	GetDeployment(ctx context.Context, clusterID uint, releaseName, namespace string) (*pkgHelm.GetDeploymentResponse, error)
}

A generic interface for using Helm for hooks

type HelmServiceInjector

type HelmServiceInjector interface {
	InjectHelmService(HelmService)
}

type HookWithParamsFactory

type HookWithParamsFactory interface {
	Create(pkgCluster.PostHookParam) PostFunctioner
}

type HorizontalPodAutoscalerPostHook

type HorizontalPodAutoscalerPostHook struct {
	Priority
	ErrorHandler
	// contains filtered or unexported fields
}

func (*HorizontalPodAutoscalerPostHook) Do

func (hpa *HorizontalPodAutoscalerPostHook) Do(cluster CommonCluster) error

func (*HorizontalPodAutoscalerPostHook) InjectHelmService

func (h *HorizontalPodAutoscalerPostHook) InjectHelmService(helmService HelmService)

InjectHelmService injects the service to be used by the "parent" struct

type IngressControllerPostHook

type IngressControllerPostHook struct {
	Priority
	ErrorHandler
	// contains filtered or unexported fields
}

func (*IngressControllerPostHook) Do

func (i *IngressControllerPostHook) Do(cluster CommonCluster) error

func (*IngressControllerPostHook) InjectHelmService

func (h *IngressControllerPostHook) InjectHelmService(helmService HelmService)

InjectHelmService injects the service to be used by the "parent" struct

type InitSpotConfigPostHook

type InitSpotConfigPostHook struct {
	Priority
	ErrorHandler
	// contains filtered or unexported fields
}

func (*InitSpotConfigPostHook) Do

func (ph *InitSpotConfigPostHook) Do(cluster CommonCluster) error

InitSpotConfig creates a ConfigMap to store spot related config and installs the scheduler and the spot webhook charts

func (*InitSpotConfigPostHook) InjectHelmService

func (h *InitSpotConfigPostHook) InjectHelmService(helmService HelmService)

InjectHelmService injects the service to be used by the "parent" struct

type InstallSecretRequest

type InstallSecretRequest struct {
	SourceSecretName string
	Namespace        string
	Spec             map[string]InstallSecretRequestSpecItem
	Update           bool
}

type InstallSecretRequestSpecItem

type InstallSecretRequestSpecItem struct {
	Source    string
	SourceMap map[string]string
	Value     string
}

type InstanceTerminationHandlerPostHook

type InstanceTerminationHandlerPostHook struct {
	Priority
	ErrorHandler
	// contains filtered or unexported fields
}

func (InstanceTerminationHandlerPostHook) Do

func (ith InstanceTerminationHandlerPostHook) Do(cluster CommonCluster) error

func (*InstanceTerminationHandlerPostHook) InjectHelmService

func (h *InstanceTerminationHandlerPostHook) InjectHelmService(helmService HelmService)

InjectHelmService injects the service to be used by the "parent" struct

type K8sConfigDownloader

type K8sConfigDownloader interface {
	DownloadK8sConfig() ([]byte, error)
}

K8sConfigDownloader can download a cluster config.

type KubeAPIProxy

type KubeAPIProxy struct {
	Handler gin.HandlerFunc
}

func NewKubeAPIProxy

func NewKubeAPIProxy(requestSchema string, requestHost string, apiProxyPrefix string, cluster CommonCluster, keepalive time.Duration) (*KubeAPIProxy, error)

NewKubeAPIProxy creates a new Kubernetes API Server Proxy to the given cluster with a well-defined keep-alive timeout.

type KubeCluster

type KubeCluster struct {
	APIEndpoint string

	CommonClusterBase
	// contains filtered or unexported fields
}

KubeCluster struct for Build your own cluster

func CreateKubernetesClusterFromModel

func CreateKubernetesClusterFromModel(clusterModel *model.ClusterModel) (*KubeCluster, error)

CreateKubernetesClusterFromModel converts ClusterModel to KubeCluster

func CreateKubernetesClusterFromRequest

func CreateKubernetesClusterFromRequest(request *pkgCluster.CreateClusterRequest, orgId uint, userId uint) (*KubeCluster, error)

CreateKubernetesClusterFromRequest creates ClusterModel struct from the request

func (*KubeCluster) AddDefaultsToUpdate

func (c *KubeCluster) AddDefaultsToUpdate(*pkgCluster.UpdateClusterRequest)

AddDefaultsToUpdate adds defaults to update request, in this case no update function

func (*KubeCluster) CheckEqualityToUpdate

func (c *KubeCluster) CheckEqualityToUpdate(*pkgCluster.UpdateClusterRequest) error

CheckEqualityToUpdate validates the update request, in this case no update function

func (*KubeCluster) CreateCluster

func (c *KubeCluster) CreateCluster() error

CreateCluster creates a new cluster

func (*KubeCluster) DeleteCluster

func (c *KubeCluster) DeleteCluster() error

DeleteCluster deletes cluster from cloud, in this case no delete function

func (*KubeCluster) DeleteFromDatabase

func (c *KubeCluster) DeleteFromDatabase() error

DeleteFromDatabase deletes model from the database

func (*KubeCluster) DownloadK8sConfig

func (c *KubeCluster) DownloadK8sConfig() ([]byte, error)

DownloadK8sConfig downloads the kubeconfig file from cloud

func (*KubeCluster) GetAPIEndpoint

func (c *KubeCluster) GetAPIEndpoint() (string, error)

GetAPIEndpoint returns the Kubernetes Api endpoint

func (*KubeCluster) GetCloud

func (c *KubeCluster) GetCloud() string

GetCloud returns the cloud type of the cluster

func (*KubeCluster) GetConfigSecretId

func (c *KubeCluster) GetConfigSecretId() string

GetConfigSecretId return config secret id

func (*KubeCluster) GetDistribution

func (c *KubeCluster) GetDistribution() string

GetDistribution returns the distribution type of the cluster

func (*KubeCluster) GetID

func (c *KubeCluster) GetID() uint

GetID returns the specified cluster id

func (*KubeCluster) GetK8sConfig

func (c *KubeCluster) GetK8sConfig() ([]byte, error)

GetK8sConfig returns the Kubernetes config

func (*KubeCluster) GetK8sUserConfig

func (c *KubeCluster) GetK8sUserConfig() ([]byte, error)

GetK8sUserConfig returns the Kubernetes config

func (*KubeCluster) GetLocation

func (c *KubeCluster) GetLocation() string

GetLocation gets where the cluster is.

func (*KubeCluster) GetModel

func (c *KubeCluster) GetModel() *model.ClusterModel

GetModel returns the whole clusterModel

func (*KubeCluster) GetName

func (c *KubeCluster) GetName() string

GetName returns the name of the cluster

func (*KubeCluster) GetOrganizationId

func (c *KubeCluster) GetOrganizationId() uint

GetOrganizationId returns the specified organization id

func (*KubeCluster) GetScaleOptions

func (c *KubeCluster) GetScaleOptions() *pkgCluster.ScaleOptions

getScaleOptionsFromModelV1 returns scale options for the cluster

func (*KubeCluster) GetSecretId

func (c *KubeCluster) GetSecretId() string

GetSecretId returns the specified secret id

func (*KubeCluster) GetSecretWithValidation

func (c *KubeCluster) GetSecretWithValidation() (*secret.SecretItemResponse, error)

GetSecretWithValidation returns secret from vault

func (*KubeCluster) GetSshSecretId

func (c *KubeCluster) GetSshSecretId() string

GetSshSecretId returns the specified ssh secret id

func (*KubeCluster) GetStatus

func (c *KubeCluster) GetStatus() (*pkgCluster.GetClusterStatusResponse, error)

GetStatus gets cluster status

func (*KubeCluster) GetUID

func (c *KubeCluster) GetUID() string

func (*KubeCluster) IsReady

func (c *KubeCluster) IsReady() (bool, error)

IsReady checks if the cluster is running according to the cloud provider.

func (*KubeCluster) NodePoolExists

func (c *KubeCluster) NodePoolExists(nodePoolName string) bool

NodePoolExists returns true if node pool with nodePoolName exists

func (*KubeCluster) Persist

func (c *KubeCluster) Persist() error

Persist save the cluster model Deprecated: Do not use.

func (*KubeCluster) RbacEnabled

func (c *KubeCluster) RbacEnabled() bool

RbacEnabled returns true if rbac enabled on the cluster

func (*KubeCluster) SaveConfigSecretId

func (c *KubeCluster) SaveConfigSecretId(configSecretId string) error

SaveConfigSecretId saves the config secret id in database

func (*KubeCluster) SaveSshSecretId

func (c *KubeCluster) SaveSshSecretId(sshSecretId string) error

SaveSshSecretId saves the ssh secret id to database

func (*KubeCluster) SetScaleOptions

func (c *KubeCluster) SetScaleOptions(scaleOptions *pkgCluster.ScaleOptions)

SetScaleOptions sets scale options for the cluster

func (*KubeCluster) SetStatus

func (c *KubeCluster) SetStatus(status, statusMessage string) error

SetStatus sets the cluster's status

func (*KubeCluster) UpdateCluster

func (c *KubeCluster) UpdateCluster(updateRequest *pkgCluster.UpdateClusterRequest, _ uint) error

UpdateCluster updates cluster in cloud, in this case no update function

func (*KubeCluster) UpdateNodePools

func (c *KubeCluster) UpdateNodePools(request *pkgCluster.UpdateNodePoolsRequest, userId uint) error

UpdateNodePools updates nodes pools of a cluster

func (*KubeCluster) ValidateCreationFields

func (c *KubeCluster) ValidateCreationFields(r *pkgCluster.CreateClusterRequest) error

ValidateCreationFields validates all field

type KubeProxyCache

type KubeProxyCache interface {
	Get(clusterUID string) (*KubeAPIProxy, bool)
	Put(clusterUID string, proxy *KubeAPIProxy)
	Delete(clusterUID string)
}

type KubernetesDashboardPostHook

type KubernetesDashboardPostHook struct {
	Priority
	ErrorHandler
	// contains filtered or unexported fields
}

func (*KubernetesDashboardPostHook) Do

func (ph *KubernetesDashboardPostHook) Do(cluster CommonCluster) error

func (*KubernetesDashboardPostHook) InjectHelmService

func (h *KubernetesDashboardPostHook) InjectHelmService(helmService HelmService)

InjectHelmService injects the service to be used by the "parent" struct

type LabelNodesWithNodepoolNameActivity

type LabelNodesWithNodepoolNameActivity struct {
	// contains filtered or unexported fields
}

func NewLabelNodesWithNodepoolNameActivity

func NewLabelNodesWithNodepoolNameActivity(clientFactory ClientFactory, manager *Manager) LabelNodesWithNodepoolNameActivity

func (LabelNodesWithNodepoolNameActivity) Execute

func (a LabelNodesWithNodepoolNameActivity) Execute(ctx context.Context, input LabelNodesWithNodepoolNameActivityInput) error

type LabelNodesWithNodepoolNameActivityInput

type LabelNodesWithNodepoolNameActivityInput struct {
	ClusterID uint
	SecretID  string
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(
	clusters clusterRepository,
	secrets secretValidator,
	events clusterEvents,
	statusChangeDurationMetric metrics.ClusterStatusChangeDurationMetric,
	clusterTotalMetric *prometheus.CounterVec,
	workflowClient client.Client,
	logger logrus.FieldLogger,
	errorHandler emperror.Handler,
	clusterStore interface {
		SetStatus(ctx context.Context, id uint, status, message string) error
	},
	releaseDeleter interface {
		DeleteReleases(ctx context.Context, orgID uint, kubeConfig []byte, namespaces []string) error
	},
) *Manager

func (*Manager) CreateCluster

func (m *Manager) CreateCluster(
	ctx context.Context,
	creationCtx CreationContext,
	creator clusterCreator,
) (CommonCluster, error)

CreateCluster creates a new cluster in the background.

func (*Manager) DeleteCluster

func (m *Manager) DeleteCluster(ctx context.Context, cluster CommonCluster, force bool) error

DeleteCluster deletes a cluster.

func (*Manager) DeleteKubeProxy

func (m *Manager) DeleteKubeProxy(commonCluster CommonCluster)

func (*Manager) GetAllClusters

func (m *Manager) GetAllClusters(ctx context.Context) ([]CommonCluster, error)

GetAllClusters returns all cluster instances.

func (*Manager) GetClusterByID

func (m *Manager) GetClusterByID(ctx context.Context, organizationID uint, clusterID uint) (CommonCluster, error)

GetClusterByID returns the cluster instance for an organization ID by cluster ID.

func (*Manager) GetClusterByIDOnly

func (m *Manager) GetClusterByIDOnly(ctx context.Context, clusterID uint) (CommonCluster, error)

GetClusterByIDOnly returns the cluster instance by cluster ID.

func (*Manager) GetClusterByName

func (m *Manager) GetClusterByName(ctx context.Context, organizationID uint, clusterName string) (CommonCluster, error)

GetClusterByName returns the cluster instance for an organization ID by cluster name.

func (*Manager) GetClusterStatus

func (m *Manager) GetClusterStatus(ctx context.Context, clusterID uint) (string, error)

GetClusterStatus returns the status of the cluster with the specified ID

func (*Manager) GetClusters

func (m *Manager) GetClusters(ctx context.Context, organizationID uint) ([]CommonCluster, error)

GetClusters returns the cluster instances for an organization ID.

func (*Manager) GetClustersBySecretID

func (m *Manager) GetClustersBySecretID(ctx context.Context, organizationID uint, secretID string) ([]CommonCluster, error)

GetClustersBySecretID returns the cluster instance for an organization ID by secret ID.

func (*Manager) GetKubeProxy

func (m *Manager) GetKubeProxy(requestSchema string, requestHost string, apiProxyPrefix string, commonCluster CommonCluster) (*KubeAPIProxy, error)

func (*Manager) GetKubeProxyCache

func (m *Manager) GetKubeProxyCache() KubeProxyCache

func (*Manager) KubeConfigFunc

func (m *Manager) KubeConfigFunc() func(ctx context.Context, clusterID uint) ([]byte, error)

func (*Manager) UpdateCluster

func (m *Manager) UpdateCluster(ctx context.Context, updateCtx UpdateContext, updater clusterUpdater) error

UpdateCluster updates a cluster.

type NodePoolLabels

type NodePoolLabels struct {
	NodePoolName string
	Existing     bool
	InstanceType string            `json:"instanceType,omitempty"`
	SpotPrice    string            `json:"spotPrice,omitempty"`
	Preemptible  bool              `json:"preemptible,omitempty"`
	CustomLabels map[string]string `json:"labels,omitempty"`
}

func (NodePoolLabels) GetInstanceType

func (n NodePoolLabels) GetInstanceType() string

GetInstanceType returns the node pool instance type.

func (NodePoolLabels) GetLabels

func (n NodePoolLabels) GetLabels() map[string]string

GetLabels returns labels that are/should be applied to every node in the pool.

func (NodePoolLabels) GetName

func (n NodePoolLabels) GetName() string

GetName returns the node pool name.

func (NodePoolLabels) IsOnDemand

func (n NodePoolLabels) IsOnDemand() bool

IsOnDemand determines whether the machines in the node pool are on demand or spot/preemtible instances.

type OKECluster

type OKECluster struct {
	APIEndpoint string
	CommonClusterBase
	// contains filtered or unexported fields
}

OKECluster struct for OKE cluster

func CreateOKEClusterFromModel

func CreateOKEClusterFromModel(clusterModel *model.ClusterModel) (*OKECluster, error)

CreateOKEClusterFromModel creates ClusterModel struct from model

func CreateOKEClusterFromRequest

func CreateOKEClusterFromRequest(request *pkgCluster.CreateClusterRequest, orgId uint, userId uint) (*OKECluster, error)

CreateOKEClusterFromRequest creates ClusterModel struct from the request

func (*OKECluster) AddDefaultsToUpdate

func (o *OKECluster) AddDefaultsToUpdate(r *pkgCluster.UpdateClusterRequest)

AddDefaultsToUpdate adds defaults to update request

func (*OKECluster) CheckEqualityToUpdate

func (o *OKECluster) CheckEqualityToUpdate(r *pkgCluster.UpdateClusterRequest) error

CheckEqualityToUpdate validates the update request

func (*OKECluster) CreateCluster

func (o *OKECluster) CreateCluster() error

CreateCluster creates a new cluster

func (*OKECluster) CreatePreconfiguredVCN

func (o *OKECluster) CreatePreconfiguredVCN(name string) (VCNID string, err error)

CreatePreconfiguredVCN creates a preconfigured VCN with the given name

func (*OKECluster) DeleteCluster

func (o *OKECluster) DeleteCluster() error

DeleteCluster deletes cluster

func (*OKECluster) DeleteFromDatabase

func (o *OKECluster) DeleteFromDatabase() error

DeleteFromDatabase deletes model from the database

func (*OKECluster) DeletePreconfiguredVCN

func (o *OKECluster) DeletePreconfiguredVCN(VCNID string) (err error)

DeletePreconfiguredVCN deletes a preconfigured VCN by id

func (*OKECluster) DownloadK8sConfig

func (o *OKECluster) DownloadK8sConfig() ([]byte, error)

DownloadK8sConfig downloads the kubeconfig file from cloud

func (*OKECluster) GetAPIEndpoint

func (o *OKECluster) GetAPIEndpoint() (string, error)

GetAPIEndpoint returns the Kubernetes Api endpoint

func (*OKECluster) GetCloud

func (o *OKECluster) GetCloud() string

GetCloud returns the cloud type of the cluster

func (*OKECluster) GetCluster

func (o *OKECluster) GetCluster() (cluster containerengine.Cluster, err error)

GetCluster returns the Kubernetes cluster

func (*OKECluster) GetClusterManager

func (o *OKECluster) GetClusterManager() (manager *oracleClusterManager.ClusterManager, err error)

GetClusterManager creates a new oracleClusterManager.ClusterManager

func (*OKECluster) GetConfigSecretId

func (o *OKECluster) GetConfigSecretId() string

GetConfigSecretId return config secret id

func (*OKECluster) GetDistribution

func (o *OKECluster) GetDistribution() string

GetDistribution returns the distribution type of the cluster

func (*OKECluster) GetID

func (o *OKECluster) GetID() uint

GetID returns the specified cluster id

func (*OKECluster) GetK8sConfig

func (o *OKECluster) GetK8sConfig() ([]byte, error)

GetK8sConfig returns the Kubernetes config

func (*OKECluster) GetK8sUserConfig

func (o *OKECluster) GetK8sUserConfig() ([]byte, error)

GetK8sUserConfig returns the Kubernetes config

func (*OKECluster) GetKubernetesUserName

func (o *OKECluster) GetKubernetesUserName() (string, error)

GetKubernetesUserName returns the user ID which needed to create a cluster role binding which gives admin rights to the user

func (*OKECluster) GetLocation

func (o *OKECluster) GetLocation() string

GetLocation gets where the cluster is.

func (*OKECluster) GetModel

func (o *OKECluster) GetModel() *model.ClusterModel

GetModel returns the whole clusterModel

func (*OKECluster) GetName

func (o *OKECluster) GetName() string

GetName returns the name of the cluster

func (*OKECluster) GetOCI

func (o *OKECluster) GetOCI() (OCI *oci.OCI, err error)

GetOCI creates a new oci.OCI

func (*OKECluster) GetOCIWithRegion

func (o *OKECluster) GetOCIWithRegion(region string) (OCI *oci.OCI, err error)

GetOCIWithRegion creates a new oci.OCI with the given region

func (*OKECluster) GetOrganizationId

func (o *OKECluster) GetOrganizationId() uint

GetOrganizationId gets org where the cluster belongs

func (*OKECluster) GetPoolQuantityValues

func (o *OKECluster) GetPoolQuantityValues(count uint, networkValues network.NetworkValues) (qps uint, subnetIDS []string)

GetPoolQuantityValues calculates quantityPerSubnet and SubnetIDS for the given instance count

func (*OKECluster) GetScaleOptions

func (o *OKECluster) GetScaleOptions() *pkgCluster.ScaleOptions

getScaleOptionsFromModelV1 returns scale options for the cluster

func (*OKECluster) GetSecretId

func (o *OKECluster) GetSecretId() string

GetSecretId retrieves the secret id

func (*OKECluster) GetSecretWithValidation

func (o *OKECluster) GetSecretWithValidation() (*secret.SecretItemResponse, error)

GetSecretWithValidation returns secret from vault

func (*OKECluster) GetSshSecretId

func (o *OKECluster) GetSshSecretId() string

GetSshSecretId retrieves the ssh secret id

func (*OKECluster) GetStatus

func (o *OKECluster) GetStatus() (*pkgCluster.GetClusterStatusResponse, error)

GetStatus gets cluster status

func (*OKECluster) GetUID

func (o *OKECluster) GetUID() string

func (*OKECluster) IsReady

func (o *OKECluster) IsReady() (bool, error)

IsReady checks if the cluster is running according to the cloud provider.

func (*OKECluster) NodePoolExists

func (o *OKECluster) NodePoolExists(nodePoolName string) bool

NodePoolExists returns true if node pool with nodePoolName exists

func (*OKECluster) Persist

func (o *OKECluster) Persist() error

Persist save the cluster model Deprecated: Do not use.

func (*OKECluster) PopulateNetworkValues

func (o *OKECluster) PopulateNetworkValues(r *oracle.Cluster, VCNID string) (*oracle.Cluster, error)

PopulateNetworkValues fills network related values in the request object

func (*OKECluster) RbacEnabled

func (o *OKECluster) RbacEnabled() bool

RbacEnabled returns true if rbac enabled on the cluster

func (*OKECluster) RequiresSshPublicKey

func (o *OKECluster) RequiresSshPublicKey() bool

RequiresSshPublicKey returns true if an ssh public key is needed for the cluster for bootstrapping it.

func (*OKECluster) SaveConfigSecretId

func (o *OKECluster) SaveConfigSecretId(configSecretId string) error

SaveConfigSecretId saves the config secret id in database

func (*OKECluster) SaveSshSecretId

func (o *OKECluster) SaveSshSecretId(sshSecretId string) error

SaveSshSecretId saves the ssh secret id to database

func (*OKECluster) SetScaleOptions

func (o *OKECluster) SetScaleOptions(scaleOptions *pkgCluster.ScaleOptions)

SetScaleOptions sets scale options for the cluster

func (*OKECluster) SetStatus

func (o *OKECluster) SetStatus(status, statusMessage string) error

SetStatus sets the cluster's status

func (*OKECluster) UpdateCluster

func (o *OKECluster) UpdateCluster(r *pkgCluster.UpdateClusterRequest, userId uint) error

UpdateCluster updates the cluster

func (*OKECluster) UpdateNodePools

func (o *OKECluster) UpdateNodePools(request *pkgCluster.UpdateNodePoolsRequest, userId uint) error

UpdateNodePools updates nodes pools of a cluster

func (*OKECluster) ValidateCreationFields

func (o *OKECluster) ValidateCreationFields(r *pkgCluster.CreateClusterRequest) error

ValidateCreationFields validates all field

type PKENodePool

type PKENodePool struct {
	Name              string
	MinCount          int
	MaxCount          int
	Count             int
	Autoscaling       bool
	Master            bool
	Worker            bool
	InstanceType      string
	AvailabilityZones []string
	ImageID           string
	SpotPrice         string
	Subnets           []string
}

type PostFunctioner

type PostFunctioner interface {
	Do(CommonCluster) error
	GetPriority() int
	Error(CommonCluster, error)
}

PostFunctioner manages posthook functions

type Priority

type Priority struct {
	// contains filtered or unexported fields
}

Priority can be used to run post hooks in a specific order

func (*Priority) GetPriority

func (p *Priority) GetPriority() int

Priority returns the priority value of a posthook - the lower the value, the sooner the posthook will run

type RestoreFromBackupPosthook

type RestoreFromBackupPosthook struct {
	Priority
	ErrorHandler
	// contains filtered or unexported fields
}

func (*RestoreFromBackupPosthook) Create

func (ph *RestoreFromBackupPosthook) Create(params pkgCluster.PostHookParam) PostFunctioner

func (*RestoreFromBackupPosthook) Do

func (ph *RestoreFromBackupPosthook) Do(cluster CommonCluster) error

RestoreFromBackup restores an ARK backup

func (*RestoreFromBackupPosthook) InjectHelmService

func (h *RestoreFromBackupPosthook) InjectHelmService(helmService HelmService)

InjectHelmService injects the service to be used by the "parent" struct

type RunPostHookActivity

type RunPostHookActivity struct {
	// contains filtered or unexported fields
}

func NewRunPostHookActivity

func NewRunPostHookActivity(manager *Manager, helmService HelmService) *RunPostHookActivity

func (*RunPostHookActivity) Execute

func (a *RunPostHookActivity) Execute(ctx context.Context, input RunPostHookActivityInput) error

type RunPostHookActivityInput

type RunPostHookActivityInput struct {
	ClusterID uint
	HookName  string
	HookParam interface{}
	Status    string
}

type RunPostHooksWorkflowInput

type RunPostHooksWorkflowInput struct {
	ClusterID uint
	PostHooks []RunPostHooksWorkflowInputPostHook
}

type RunPostHooksWorkflowInputPostHook

type RunPostHooksWorkflowInputPostHook struct {
	Name  string
	Param interface{}
}

func BuildWorkflowPostHookFunctions

func BuildWorkflowPostHookFunctions(postHooks pkgCluster.PostHooks, alwaysIncludeBasePostHooks bool) []RunPostHooksWorkflowInputPostHook

BuildWorkflowPostHookFunctions builds posthook workflow input.

type SetupPrivilegesActivity

type SetupPrivilegesActivity struct {
	// contains filtered or unexported fields
}

func NewSetupPrivilegesActivity

func NewSetupPrivilegesActivity(clientFactory ClientFactory, manager *Manager) SetupPrivilegesActivity

func (SetupPrivilegesActivity) Execute

func (a SetupPrivilegesActivity) Execute(ctx context.Context, input SetupPrivilegesActivityInput) error

type SetupPrivilegesActivityInput

type SetupPrivilegesActivityInput struct {
	ClusterID uint
	SecretID  string
}

type TokenGenerator

type TokenGenerator interface {
	GenerateClusterToken(orgID uint, clusterID uint) (string, string, error)
}

type UpdateClusterStatusActivity

type UpdateClusterStatusActivity struct {
	// contains filtered or unexported fields
}

func NewUpdateClusterStatusActivity

func NewUpdateClusterStatusActivity(manager *Manager) *UpdateClusterStatusActivity

func (*UpdateClusterStatusActivity) Execute

func (a *UpdateClusterStatusActivity) Execute(ctx context.Context, input UpdateClusterStatusActivityInput) error

type UpdateClusterStatusActivityInput

type UpdateClusterStatusActivityInput struct {
	ClusterID     uint
	Status        string
	StatusMessage string
}

type UpdateContext

type UpdateContext struct {
	OrganizationID uint
	UserID         uint
	ClusterID      uint
}

UpdateContext represents the data necessary to do generic cluster update steps/checks.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier