provisioner

package
v0.87.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// SkipAMIUpdateLabelKey is the label key that can be applied to a kops instance
	// group to indicate to the provisioner that it should skip updating the AMI.
	// The label value can be any string.
	SkipAMIUpdateLabelKey string = "mattermost/cloud-provisioner-ami-skip"
	// AMISuffixLabelKey is the label key that can be applied to a kops instance
	// group to indicate to the provisioner that it should use a different AMI.
	// The label value will be applied as a suffix to whatever AMI value is
	// passed in for the update.
	// Example:
	//   Cluster AMI is "custom-ubuntu"
	//   Instance group label is set to "mattermost/cloud-provisioner-ami-suffix=-arm64"
	//   Final AMI for that instance group is "custom-ubuntu-arm64"
	AMISuffixLabelKey string = "mattermost/cloud-provisioner-ami-suffix"
)
View Source
const EKSProvisionerType = "eks"

EKSProvisionerType is provisioner type for EKS clusters.

View Source
const ExternalProvisionerType = "external"

ExternalProvisionerType is provisioner type for external clusters.

View Source
const KopsProvisionerType = "kops"

KopsProvisionerType is provisioner type for Kops clusters.

Variables

This section is empty.

Functions

func ModifyAMISuffix added in v0.84.0

func ModifyAMISuffix(ami, archLabel string) string

ModifyAMISuffix updates the AMI name based on the provided architecture label. If the AMI is in "ami-*" format, it returns it unmodified. If the AMI does not include an architecture suffix, it adds the default "amd64" or the provided arch label. If the AMI includes a different architecture suffix than the label, it replaces the suffix with the label.

Types

type BackupOperator added in v0.44.0

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

BackupOperator provides methods to run, check and cleanup backup jobs.

func NewBackupOperator added in v0.44.0

func NewBackupOperator(image, region string, jobTTLSeconds int32) *BackupOperator

NewBackupOperator creates new BackupOperator.

func (BackupOperator) CheckBackupStatus added in v0.44.0

func (o BackupOperator) CheckBackupStatus(jobsClient v1.JobInterface, backup *model.InstallationBackup, logger log.FieldLogger) (int64, error)

CheckBackupStatus checks status of backup job, returns job start time, when the job finished or -1 if it is still running.

func (BackupOperator) CheckRestoreStatus added in v0.45.0

func (o BackupOperator) CheckRestoreStatus(jobsClient v1.JobInterface, backup *model.InstallationBackup, logger log.FieldLogger) (int64, error)

CheckRestoreStatus checks status of restore job, returns job start time, when the job finished or -1 if it is still running.

func (BackupOperator) CleanupBackupJob added in v0.44.0

func (o BackupOperator) CleanupBackupJob(jobsClient v1.JobInterface, backup *model.InstallationBackup, logger log.FieldLogger) error

CleanupBackupJob removes backup job from the cluster if it exists.

func (BackupOperator) CleanupRestoreJob added in v0.45.0

func (o BackupOperator) CleanupRestoreJob(jobsClient v1.JobInterface, backup *model.InstallationBackup, logger log.FieldLogger) error

CleanupRestoreJob removes restore job from the cluster if it exists.

func (BackupOperator) TriggerBackup added in v0.44.0

func (o BackupOperator) TriggerBackup(
	jobsClient v1.JobInterface,
	backup *model.InstallationBackup,
	installation *model.Installation,
	fileStoreCfg *model.FilestoreConfig,
	dbSecret string,
	logger log.FieldLogger) (*model.S3DataResidence, error)

TriggerBackup creates new backup job and waits for it to start.

func (BackupOperator) TriggerRestore added in v0.45.0

func (o BackupOperator) TriggerRestore(
	jobsClient v1.JobInterface,
	backup *model.InstallationBackup,
	installation *model.Installation,
	fileStoreCfg *model.FilestoreConfig,
	dbSecret string,
	logger log.FieldLogger) error

TriggerRestore creates new restore job and waits for it to start.

type ClusterProvisionerOption added in v0.71.0

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

func (ClusterProvisionerOption) GetClusterProvisioner added in v0.71.0

func (c ClusterProvisionerOption) GetClusterProvisioner(provisioner string) supervisor.ClusterProvisioner

type ClusterRegister added in v0.81.3

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

func NewClusterRegisterHandle added in v0.81.3

func NewClusterRegisterHandle(cluster *model.Cluster, gitClient git.Client, cloudEnvironmentName, tempDir string, logger log.FieldLogger) (*ClusterRegister, error)

NewClusterRegisterHandle returns a new ClusterRegister for register cluster into argocd

type EKSProvisioner added in v0.64.0

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

EKSProvisioner provisions clusters using AWS EKS.

func NewEKSProvisioner added in v0.64.0

func NewEKSProvisioner(
	params ProvisioningParams,
	awsClient aws.AWS,
	store *store.SQLStore,
	logger log.FieldLogger,
) *EKSProvisioner

NewEKSProvisioner creates new EKSProvisioner.

func (*EKSProvisioner) CheckClusterCreated added in v0.64.0

func (provisioner *EKSProvisioner) CheckClusterCreated(cluster *model.Cluster) (bool, error)

CheckClusterCreated checks if cluster creation finished.

func (*EKSProvisioner) CheckNodegroupsCreated added in v0.72.0

func (provisioner *EKSProvisioner) CheckNodegroupsCreated(cluster *model.Cluster) (bool, error)

CheckNodegroupsCreated checks if the EKS nodegroups are created.

func (*EKSProvisioner) CreateCluster added in v0.64.0

func (provisioner *EKSProvisioner) CreateCluster(cluster *model.Cluster) error

CreateCluster creates the EKS cluster.

func (*EKSProvisioner) CreateNodegroups added in v0.72.0

func (provisioner *EKSProvisioner) CreateNodegroups(cluster *model.Cluster) error

CreateNodegroups creates the EKS nodegroups.

func (*EKSProvisioner) DeleteCluster added in v0.64.0

func (provisioner *EKSProvisioner) DeleteCluster(cluster *model.Cluster) (bool, error)

DeleteCluster deletes EKS cluster.

func (*EKSProvisioner) DeleteNodegroups added in v0.72.0

func (provisioner *EKSProvisioner) DeleteNodegroups(cluster *model.Cluster) error

DeleteNodegroups deletes the EKS nodegroup.

func (*EKSProvisioner) PrepareCluster added in v0.64.0

func (provisioner *EKSProvisioner) PrepareCluster(cluster *model.Cluster) bool

PrepareCluster prepares metadata for EKSProvisioner.

func (*EKSProvisioner) ProvisionCluster added in v0.64.0

func (provisioner *EKSProvisioner) ProvisionCluster(cluster *model.Cluster) error

ProvisionCluster provisions EKS cluster.

func (*EKSProvisioner) RefreshClusterMetadata added in v0.71.0

func (provisioner *EKSProvisioner) RefreshClusterMetadata(cluster *model.Cluster) error

func (*EKSProvisioner) ResizeCluster added in v0.64.0

func (provisioner *EKSProvisioner) ResizeCluster(cluster *model.Cluster) error

ResizeCluster resizes cluster - not implemented.

func (*EKSProvisioner) RotateClusterNodes added in v0.64.0

func (provisioner *EKSProvisioner) RotateClusterNodes(cluster *model.Cluster) error

RotateClusterNodes rotates cluster nodes - not implemented.

func (*EKSProvisioner) UpgradeCluster added in v0.64.0

func (provisioner *EKSProvisioner) UpgradeCluster(cluster *model.Cluster) error

UpgradeCluster upgrades EKS cluster - not implemented.

type ExternalProvisioner added in v0.87.0

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

EKSProvisioner provisions clusters using AWS EKS.

func NewExternalProvisioner added in v0.87.0

func NewExternalProvisioner(
	params ProvisioningParams,
	awsClient aws.AWS,
	store *store.SQLStore,
	logger log.FieldLogger,
) *ExternalProvisioner

NewExternalProvisioner creates new ExternalProvisioner.

func (*ExternalProvisioner) CheckClusterCreated added in v0.87.0

func (provisioner *ExternalProvisioner) CheckClusterCreated(cluster *model.Cluster) (bool, error)

CheckClusterCreated is no-op for external clusters.

func (*ExternalProvisioner) CheckNodegroupsCreated added in v0.87.0

func (provisioner *ExternalProvisioner) CheckNodegroupsCreated(cluster *model.Cluster) (bool, error)

CheckNodegroupsCreated is no-op for external clusters.

func (*ExternalProvisioner) CreateCluster added in v0.87.0

func (provisioner *ExternalProvisioner) CreateCluster(cluster *model.Cluster) error

CreateCluster manages VPC claiming for external clusters.

func (*ExternalProvisioner) CreateNodegroups added in v0.87.0

func (provisioner *ExternalProvisioner) CreateNodegroups(cluster *model.Cluster) error

CreateNodegroups is no-op for external clusters.

func (*ExternalProvisioner) DeleteCluster added in v0.87.0

func (provisioner *ExternalProvisioner) DeleteCluster(cluster *model.Cluster) (bool, error)

DeleteCluster manages VPC releasing for external clusters.

func (*ExternalProvisioner) DeleteNodegroups added in v0.87.0

func (provisioner *ExternalProvisioner) DeleteNodegroups(cluster *model.Cluster) error

DeleteNodegroups is no-op for external clusters.

func (*ExternalProvisioner) PrepareCluster added in v0.87.0

func (provisioner *ExternalProvisioner) PrepareCluster(cluster *model.Cluster) bool

PrepareCluster prepares metadata for ExternalProvisioner.

func (*ExternalProvisioner) ProvisionCluster added in v0.87.0

func (provisioner *ExternalProvisioner) ProvisionCluster(cluster *model.Cluster) error

ProvisionCluster runs provisioning tasks for external clusters.

func (*ExternalProvisioner) RefreshClusterMetadata added in v0.87.0

func (provisioner *ExternalProvisioner) RefreshClusterMetadata(cluster *model.Cluster) error

func (*ExternalProvisioner) ResizeCluster added in v0.87.0

func (provisioner *ExternalProvisioner) ResizeCluster(cluster *model.Cluster) error

ResizeCluster is no-op for external clusters.

func (*ExternalProvisioner) RotateClusterNodes added in v0.87.0

func (provisioner *ExternalProvisioner) RotateClusterNodes(cluster *model.Cluster) error

RotateClusterNodes is no-op for external clusters.

func (*ExternalProvisioner) UpgradeCluster added in v0.87.0

func (provisioner *ExternalProvisioner) UpgradeCluster(cluster *model.Cluster) error

UpgradeCluster is no-op for external clusters.

type KopsProvisioner

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

KopsProvisioner provisions clusters using kops+terraform.

func NewKopsProvisioner

func NewKopsProvisioner(
	params ProvisioningParams,
	awsClient aws.AWS,
	store model.InstallationDatabaseStoreInterface,
	logger log.FieldLogger,
	gitlabOAuthToken string,
	argocdApiToken string,
) *KopsProvisioner

NewKopsProvisioner creates a new KopsProvisioner.

func (*KopsProvisioner) CheckClusterCreated added in v0.64.0

func (provisioner *KopsProvisioner) CheckClusterCreated(cluster *model.Cluster) (bool, error)

CheckClusterCreated is a noop for KopsProvisioner.

func (*KopsProvisioner) CheckNodegroupsCreated added in v0.72.0

func (provisioner *KopsProvisioner) CheckNodegroupsCreated(cluster *model.Cluster) (bool, error)

CheckNodegroupsCreated is a noop for KopsProvisioner.

func (*KopsProvisioner) CreateCluster

func (provisioner *KopsProvisioner) CreateCluster(cluster *model.Cluster) error

CreateCluster creates a cluster using kops and terraform.

func (*KopsProvisioner) CreateNodegroups added in v0.72.0

func (provisioner *KopsProvisioner) CreateNodegroups(cluster *model.Cluster) error

CreateNodegroups is a noop for KopsProvisioner.

func (*KopsProvisioner) DeleteCluster

func (provisioner *KopsProvisioner) DeleteCluster(cluster *model.Cluster) (bool, error)

DeleteCluster deletes a previously created cluster using kops and terraform.

func (*KopsProvisioner) DeleteNodegroups added in v0.72.0

func (provisioner *KopsProvisioner) DeleteNodegroups(cluster *model.Cluster) error

DeleteNodegroups is a noop for KopsProvisioner.

func (*KopsProvisioner) PrepareCluster

func (provisioner *KopsProvisioner) PrepareCluster(cluster *model.Cluster) bool

PrepareCluster ensures a cluster object is ready for provisioning.

func (*KopsProvisioner) ProvisionCluster

func (provisioner *KopsProvisioner) ProvisionCluster(cluster *model.Cluster) error

ProvisionCluster installs all the baseline kubernetes resources needed for managing installations. This can be called on an already-provisioned cluster to re-provision with the newest version of the resources.

func (*KopsProvisioner) RefreshClusterMetadata added in v0.71.0

func (provisioner *KopsProvisioner) RefreshClusterMetadata(cluster *model.Cluster) error

func (*KopsProvisioner) ResizeCluster added in v0.19.0

func (provisioner *KopsProvisioner) ResizeCluster(cluster *model.Cluster) error

ResizeCluster resizes a cluster.

func (*KopsProvisioner) RotateClusterNodes added in v0.43.0

func (provisioner *KopsProvisioner) RotateClusterNodes(cluster *model.Cluster) error

RotateClusterNodes rotates k8s cluster nodes using the Mattermost node rotator

func (*KopsProvisioner) Teardown added in v0.37.0

func (provisioner *KopsProvisioner) Teardown()

Teardown cleans up cached kops provisioner data.

func (*KopsProvisioner) UpgradeCluster

func (provisioner *KopsProvisioner) UpgradeCluster(cluster *model.Cluster) error

UpgradeCluster upgrades a cluster to the latest recommended production ready k8s version.

type Provisioner added in v0.71.0

type Provisioner struct {
	ClusterProvisionerOption
	// contains filtered or unexported fields
}

func NewProvisioner added in v0.71.0

func NewProvisioner(
	kopsProvisioner *KopsProvisioner,
	eksProvisioner *EKSProvisioner,
	externalProvisioner *ExternalProvisioner,
	params ProvisioningParams,
	awsClient aws.AWS,
	resourceUtil *utils.ResourceUtil,
	backupOperator *BackupOperator,
	sqlStore *store.SQLStore,
	logger log.FieldLogger,
) Provisioner

func (Provisioner) CheckBackupStatus added in v0.71.0

func (provisioner Provisioner) CheckBackupStatus(backup *model.InstallationBackup, cluster *model.Cluster) (int64, error)

CheckBackupStatus checks status of running backup job, returns job start time, when the job finished or -1 if it is still running.

func (Provisioner) CheckRestoreStatus added in v0.71.0

func (provisioner Provisioner) CheckRestoreStatus(backup *model.InstallationBackup, cluster *model.Cluster) (int64, error)

CheckRestoreStatus checks status of running backup job, returns job completion time, when the job finished or -1 if it is still running.

func (Provisioner) CleanupBackupJob added in v0.71.0

func (provisioner Provisioner) CleanupBackupJob(backup *model.InstallationBackup, cluster *model.Cluster) error

CleanupBackupJob deletes backup job from the cluster if it exists.

func (Provisioner) CleanupRestoreJob added in v0.71.0

func (provisioner Provisioner) CleanupRestoreJob(backup *model.InstallationBackup, cluster *model.Cluster) error

CleanupRestoreJob deletes restore job from the cluster if it exists.

func (Provisioner) ClusterInstallationProvisioner added in v0.71.0

func (provisioner Provisioner) ClusterInstallationProvisioner(version string) supervisor.ClusterInstallationProvisioner

ClusterInstallationProvisioner function returns an implementation of ClusterInstallationProvisioner interface based on specified Custom Resource version.

func (Provisioner) CreateClusterInstallation added in v0.71.0

func (provisioner Provisioner) CreateClusterInstallation(cluster *model.Cluster, installation *model.Installation, installationDNS []*model.InstallationDNS, clusterInstallation *model.ClusterInstallation) error

CreateClusterInstallation creates a Mattermost installation within the given cluster.

func (Provisioner) DeleteClusterInstallation added in v0.71.0

func (provisioner Provisioner) DeleteClusterInstallation(cluster *model.Cluster, installation *model.Installation, clusterInstallation *model.ClusterInstallation) error

DeleteClusterInstallation deletes a Mattermost installation within the given cluster.

func (Provisioner) DeleteOldClusterInstallationLicenseSecrets added in v0.71.0

func (provisioner Provisioner) DeleteOldClusterInstallationLicenseSecrets(cluster *model.Cluster, installation *model.Installation, clusterInstallation *model.ClusterInstallation) error

DeleteOldClusterInstallationLicenseSecrets removes k8s secrets found matching the license naming scheme that are not the current license used by the installation.

func (Provisioner) EnsureCRMigrated added in v0.71.0

func (provisioner Provisioner) EnsureCRMigrated(cluster *model.Cluster, clusterInstallation *model.ClusterInstallation) (bool, error)

func (Provisioner) ExecClusterInstallationCLI added in v0.71.0

func (provisioner Provisioner) ExecClusterInstallationCLI(cluster *model.Cluster, clusterInstallation *model.ClusterInstallation, args ...string) ([]byte, error, error)

ExecClusterInstallationCLI execs the provided command on the defined cluster installation and returns both exec preparation errors as well as errors from the exec command itself.

func (Provisioner) ExecClusterInstallationJob added in v0.71.0

func (provisioner Provisioner) ExecClusterInstallationJob(cluster *model.Cluster, clusterInstallation *model.ClusterInstallation, args ...string) error

ExecClusterInstallationJob creates job executing command on cluster installation.

func (Provisioner) ExecClusterInstallationPPROF added in v0.87.0

func (provisioner Provisioner) ExecClusterInstallationPPROF(cluster *model.Cluster, clusterInstallation *model.ClusterInstallation) (model.ClusterInstallationDebugData, error, error)

func (Provisioner) ExecMMCTL added in v0.71.0

func (provisioner Provisioner) ExecMMCTL(cluster *model.Cluster, clusterInstallation *model.ClusterInstallation, args ...string) ([]byte, error)

ExecMMCTL runs the given MMCTL command against the given cluster installation. Setup and exec errors both result in a single return error.

func (Provisioner) ExecMattermostCLI added in v0.71.0

func (provisioner Provisioner) ExecMattermostCLI(cluster *model.Cluster, clusterInstallation *model.ClusterInstallation, args ...string) ([]byte, error)

ExecMattermostCLI invokes the Mattermost CLI for the given cluster installation with the given args. Setup and exec errors both result in a single return error.

func (Provisioner) GetClusterInstallationStatus added in v0.71.0

func (provisioner Provisioner) GetClusterInstallationStatus(cluster *model.Cluster, clusterInstallation *model.ClusterInstallation) (*model.ClusterInstallationStatus, error)

func (Provisioner) GetClusterResources added in v0.71.0

func (provisioner Provisioner) GetClusterResources(cluster *model.Cluster, onlySchedulable bool, logger log.FieldLogger) (*k8s.ClusterResources, error)

GetClusterResources returns a snapshot of resources of a given cluster.

func (Provisioner) GetPublicLoadBalancerEndpoint added in v0.71.0

func (provisioner Provisioner) GetPublicLoadBalancerEndpoint(cluster *model.Cluster, namespace string) (string, error)

GetPublicLoadBalancerEndpoint returns the public load balancer endpoint of the NGINX service.

func (Provisioner) HibernateClusterInstallation added in v0.71.0

func (provisioner Provisioner) HibernateClusterInstallation(cluster *model.Cluster, installation *model.Installation, clusterInstallation *model.ClusterInstallation) error

HibernateClusterInstallation updates a cluster installation to consume fewer resources.

func (Provisioner) IsResourceReadyAndStable added in v0.71.0

func (provisioner Provisioner) IsResourceReadyAndStable(cluster *model.Cluster, clusterInstallation *model.ClusterInstallation) (bool, bool, error)

IsResourceReadyAndStable checks if the ClusterInstallation Custom Resource is both ready and stable on the cluster.

func (Provisioner) PrepareClusterUtilities added in v0.71.0

func (provisioner Provisioner) PrepareClusterUtilities(cluster *model.Cluster, installation *model.Installation, store model.ClusterUtilityDatabaseStoreInterface) error

PrepareClusterUtilities performs any updates to cluster utilities that may be needed for clusterinstallations to function correctly.

func (Provisioner) RefreshSecrets added in v0.71.0

func (provisioner Provisioner) RefreshSecrets(cluster *model.Cluster, installation *model.Installation, clusterInstallation *model.ClusterInstallation) error

RefreshSecrets deletes old secrets for database and file store and replaces them with new ones.

func (Provisioner) TriggerBackup added in v0.71.0

func (provisioner Provisioner) TriggerBackup(backup *model.InstallationBackup, cluster *model.Cluster, installation *model.Installation) (*model.S3DataResidence, error)

TriggerBackup triggers backup job for specific installation on the cluster.

func (Provisioner) TriggerRestore added in v0.71.0

func (provisioner Provisioner) TriggerRestore(installation *model.Installation, backup *model.InstallationBackup, cluster *model.Cluster) error

TriggerRestore triggers restoration job for specific installation on the cluster.

func (Provisioner) UpdateClusterInstallation added in v0.71.0

func (provisioner Provisioner) UpdateClusterInstallation(cluster *model.Cluster, installation *model.Installation, installationDNS []*model.InstallationDNS, clusterInstallation *model.ClusterInstallation) error

UpdateClusterInstallation updates the cluster installation spec to match the installation specification.

type ProvisioningParams added in v0.44.0

type ProvisioningParams struct {
	S3StateStore              string
	AllowCIDRRangeList        []string
	VpnCIDRList               []string
	Owner                     string
	UseExistingAWSResources   bool
	DeployMysqlOperator       bool
	DeployMinioOperator       bool
	MattermostOperatorHelmDir string
	NdotsValue                string
	InternalIPRanges          []string
	SLOInstallationGroups     []string
	SLOEnterpriseGroups       []string
	EtcdManagerEnv            map[string]string
}

ProvisioningParams represent configuration used during various provisioning operations.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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