Documentation
¶
Overview ¶
Package upgrade provides functionality to upgrade the cluster and it's resources.
TODO: Remove this package in favour of adding splitting its functionality onto the kubernetes, helm, and terraform packages. There should be no additions to this package at the current time. If you need to make larger changes to existing code, consider refactoring and moving relevant code to the kubernetes, helm, or terraform packages.
Index ¶
- func CleanUpTerraformMigrations(upgradeWorkspace, upgradeID string, fileHandler file.Handler) error
- type IAMMigrateCmd
- func (c *IAMMigrateCmd) Apply(ctx context.Context, fileHandler file.Handler) error
- func (c *IAMMigrateCmd) CheckTerraformMigrations(file file.Handler) error
- func (c *IAMMigrateCmd) Plan(ctx context.Context, file file.Handler, outWriter io.Writer) (bool, error)
- func (c *IAMMigrateCmd) String() string
- func (c *IAMMigrateCmd) UpgradeID() string
- type TerraformUpgradeOptions
- type TerraformUpgrader
- func (u *TerraformUpgrader) ApplyTerraformMigrations(ctx context.Context, opts TerraformUpgradeOptions, upgradeID string) (terraform.ApplyOutput, error)
- func (u *TerraformUpgrader) CheckTerraformMigrations(upgradeWorkspace, upgradeID, upgradeSubDir string) error
- func (u *TerraformUpgrader) CleanUpTerraformMigrations(upgradeWorkspace, upgradeID string) error
- func (u *TerraformUpgrader) PlanTerraformMigrations(ctx context.Context, opts TerraformUpgradeOptions, upgradeID string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IAMMigrateCmd ¶ added in v2.10.0
type IAMMigrateCmd struct {
// contains filtered or unexported fields
}
IAMMigrateCmd is a terraform migration command for IAM. Which is used for the tfMigrationClient.
func NewIAMMigrateCmd ¶ added in v2.10.0
func NewIAMMigrateCmd(ctx context.Context, iamWorkspace, upgradeWorkspace, upgradeID string, csp cloudprovider.Provider, logLevel terraform.LogLevel) (*IAMMigrateCmd, error)
NewIAMMigrateCmd creates a new IAMMigrateCmd.
func (*IAMMigrateCmd) Apply ¶ added in v2.10.0
Apply applies the Terraform IAM migrations for the Constellation upgrade.
func (*IAMMigrateCmd) CheckTerraformMigrations ¶ added in v2.10.0
func (c *IAMMigrateCmd) CheckTerraformMigrations(file file.Handler) error
CheckTerraformMigrations checks whether Terraform migrations are possible in the current workspace.
func (*IAMMigrateCmd) Plan ¶ added in v2.10.0
func (c *IAMMigrateCmd) Plan(ctx context.Context, file file.Handler, outWriter io.Writer) (bool, error)
Plan prepares the upgrade workspace and plans the Terraform migrations for the Constellation upgrade, writing the plan to the outWriter.
func (*IAMMigrateCmd) String ¶ added in v2.10.0
func (c *IAMMigrateCmd) String() string
String returns the name of the command.
func (*IAMMigrateCmd) UpgradeID ¶ added in v2.10.0
func (c *IAMMigrateCmd) UpgradeID() string
UpgradeID returns the upgrade ID.
type TerraformUpgradeOptions ¶
type TerraformUpgradeOptions struct {
// LogLevel is the log level used for Terraform.
LogLevel terraform.LogLevel
// CSP is the cloud provider to perform the upgrade on.
CSP cloudprovider.Provider
// Vars are the Terraform variables used for the upgrade.
Vars terraform.Variables
TFWorkspace string
UpgradeWorkspace string
}
TerraformUpgradeOptions are the options used for the Terraform upgrade.
type TerraformUpgrader ¶
type TerraformUpgrader struct {
// contains filtered or unexported fields
}
TerraformUpgrader is responsible for performing Terraform migrations on cluster upgrades.
func NewTerraformUpgrader ¶
func NewTerraformUpgrader(tfClient tfResourceClient, outWriter io.Writer, fileHandler file.Handler) (*TerraformUpgrader, error)
NewTerraformUpgrader returns a new TerraformUpgrader.
func (*TerraformUpgrader) ApplyTerraformMigrations ¶
func (u *TerraformUpgrader) ApplyTerraformMigrations(ctx context.Context, opts TerraformUpgradeOptions, upgradeID string) (terraform.ApplyOutput, error)
ApplyTerraformMigrations applies the migrations planned by PlanTerraformMigrations. If PlanTerraformMigrations has not been executed before, it will return an error. In case of a successful upgrade, the output will be written to the specified file and the old Terraform directory is replaced By the new one.
func (*TerraformUpgrader) CheckTerraformMigrations ¶
func (u *TerraformUpgrader) CheckTerraformMigrations(upgradeWorkspace, upgradeID, upgradeSubDir string) error
CheckTerraformMigrations checks whether Terraform migrations are possible in the current workspace. If the files that will be written during the upgrade already exist, it returns an error.
func (*TerraformUpgrader) CleanUpTerraformMigrations ¶
func (u *TerraformUpgrader) CleanUpTerraformMigrations(upgradeWorkspace, upgradeID string) error
CleanUpTerraformMigrations cleans up the Terraform migration workspace, for example when an upgrade is aborted by the user.
func (*TerraformUpgrader) PlanTerraformMigrations ¶
func (u *TerraformUpgrader) PlanTerraformMigrations(ctx context.Context, opts TerraformUpgradeOptions, upgradeID string) (bool, error)
PlanTerraformMigrations prepares the upgrade workspace and plans the Terraform migrations for the Constellation upgrade. If a diff exists, it's being written to the upgrader's output writer. It also returns a bool indicating whether a diff exists.