Documentation
¶
Index ¶
- Variables
- func AwsGetEksToken(ctx context.Context, name string, region string) error
- func Banner()
- func ByCommandName(a, b *cli.Command) int
- func Check(ctx context.Context, p *CommandParams)
- func Clean(ctx context.Context, refresh bool, p *CommandParams) error
- func Cleanup(ctx context.Context, p *CommandParams) error
- func ClusterInfo(ctx context.Context, p *CommandParams) error
- func ClusterLogin(ctx context.Context, path string, p *CommandParams) error
- func Confirm(ctx context.Context, msg string, p *CommandParams) error
- func Export(ctx context.Context, p *CommandParams) error
- func ForceCleanup(ctx context.Context, p *CommandParams) error
- func Install(ctx context.Context, p *CommandParams) error
- func NewCliCommand(deps CliDependencies, p AppServiceParams) *cli.Command
- func PrepareAccount(ctx context.Context, p *CommandParams) error
- func RefreshSecrets(ctx context.Context, p *CommandParams) error
- func Render(ctx context.Context, path string, p *CommandParams) error
- func Restart(ctx context.Context, res string, ns string, name string, p *CommandParams) error
- func RunAppService(p AppServiceParams)
- func TfApply(ctx context.Context, stage string, p *CommandParams) error
- func TfCreateBackend(ctx context.Context, p *CommandParams) error
- func TfDestroy(ctx context.Context, stage string, p *CommandParams) error
- func TfDestroyBackend(ctx context.Context, p *CommandParams) error
- func TfFormat(ctx context.Context, stage string, p *CommandParams) error
- func TfFormatAll(ctx context.Context, p *CommandParams) error
- func TfInit(ctx context.Context, stage string, p *CommandParams) error
- func TfInitAll(ctx context.Context, p *CommandParams) error
- func TfOutput(ctx context.Context, stage string, p *CommandParams) error
- func TfPlan(ctx context.Context, stage string, p *CommandParams) error
- func TfRefresh(ctx context.Context, stage string, p *CommandParams) error
- func TfRefreshAll(ctx context.Context, p *CommandParams) error
- func TfValidate(ctx context.Context, stage string, p *CommandParams) (int, error)
- func TfVersion(ctx context.Context, p *CommandParams) error
- func Version(version string, buildDate string)
- type AppService
- type AppServiceParams
- type AwsCommandParams
- type AwsCommandResult
- type CliDependencies
- type CommandParams
- type RootCommandParams
- type RootCommandResult
- func NewRootAwsCommand(cmds AwsCommandParams) RootCommandResult
- func NewRootCheckCommand(p *CommandParams) RootCommandResult
- func NewRootCleanCommand(p *CommandParams) RootCommandResult
- func NewRootExportCommand(p *CommandParams) RootCommandResult
- func NewRootInfoCommand(p *CommandParams) RootCommandResult
- func NewRootInstallCommand(p *CommandParams) RootCommandResult
- func NewRootInternalCommand(p *CommandParams) RootCommandResult
- func NewRootLoginCommand(p *CommandParams) RootCommandResult
- func NewRootRefreshSecretsCommand(p *CommandParams) RootCommandResult
- func NewRootRenderCommand(p *CommandParams) RootCommandResult
- func NewRootRestartCommand(p *CommandParams) RootCommandResult
- func NewRootTerraformCommand(cmds TfCommandParams, p *CommandParams) RootCommandResult
- type TfCommandParams
- type TfCommandResult
- func NewTfApplyCommand(p *CommandParams) TfCommandResult
- func NewTfDestroyCommand(p *CommandParams) TfCommandResult
- func NewTfFormatAllCommand(p *CommandParams) TfCommandResult
- func NewTfFormatCommand(p *CommandParams) TfCommandResult
- func NewTfInitAllCommand(p *CommandParams) TfCommandResult
- func NewTfInitCommand(p *CommandParams) TfCommandResult
- func NewTfOutputCommand(p *CommandParams) TfCommandResult
- func NewTfPlanCommand(p *CommandParams) TfCommandResult
- func NewTfRefreshAllCommand(p *CommandParams) TfCommandResult
- func NewTfRefreshCommand(p *CommandParams) TfCommandResult
- func NewTfValidateCommand(p *CommandParams) TfCommandResult
- func NewTfVersionCommand(p *CommandParams) TfCommandResult
Constants ¶
This section is empty.
Variables ¶
var RootCommandsModule = fx.Module("rootCmds", fx.Provide( func() *CommandParams { return NewCommandParams(time.Now()) }, NewRootInstallCommand, NewRootCleanCommand, NewRootLoginCommand, NewRootInfoCommand, NewRootCheckCommand, NewRootRenderCommand, NewRootRefreshSecretsCommand, NewRootExportCommand, NewRootRestartCommand, NewRootTerraformCommand, NewRootAwsCommand, NewRootInternalCommand, ), tfCommandsModule, awsCommandsModule, )
RootCommandsModule defines the root commands module for dependency injection. It provides all root-level commands and their dependencies.
Functions ¶
func AwsGetEksToken ¶
AwsGetEksToken retrieves an authentication token for an EKS cluster. This function is used by kubeconfig exec to request the token, similar to `aws eks get-token`.
Parameters:
- ctx: The context for the operation.
- name: The name of the EKS cluster.
- region: The AWS region where the EKS cluster is located.
Returns:
- error: An error if the token retrieval fails, otherwise nil.
func ByCommandName ¶
ByCommandName compares two CLI commands by their names.
Parameters:
- a: The first CLI command.
- b: The second CLI command.
Returns:
- int: A negative number if a.Name < b.Name, zero if a.Name == b.Name, or a positive number if a.Name > b.Name.
func Check ¶
func Check(ctx context.Context, p *CommandParams)
Check verifies the dependencies required for Quartz installation.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
func Clean ¶
func Clean(ctx context.Context, refresh bool, p *CommandParams) error
Clean tears down the Quartz environment, including all managed resources and data. This includes refreshing Terraform states, destroying resources, and cleaning up.
Parameters:
- ctx: The context for the operation.
- refresh: A boolean indicating whether to refresh the Terraform state before destruction.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if the cleanup fails, otherwise nil.
func Cleanup ¶
func Cleanup(ctx context.Context, p *CommandParams) error
Cleanup removes temporary files created by the installer.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if cleanup fails, otherwise nil.
func ClusterInfo ¶
func ClusterInfo(ctx context.Context, p *CommandParams) error
ClusterInfo retrieves and displays information about the Quartz cluster.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if retrieving cluster information fails, otherwise nil.
func ClusterLogin ¶
func ClusterLogin(ctx context.Context, path string, p *CommandParams) error
ClusterLogin generates a kubeconfig file for the Quartz environment.
Parameters:
- ctx: The context for the operation.
- path: The file path where the kubeconfig will be written.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if generating the kubeconfig fails, otherwise nil.
func Confirm ¶
func Confirm(ctx context.Context, msg string, p *CommandParams) error
Confirm prompts the user for confirmation before proceeding with an operation.
Parameters:
- ctx: The context for the operation.
- msg: The confirmation message to display.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if the user does not confirm, otherwise nil.
func Export ¶
func Export(ctx context.Context, p *CommandParams) error
Export saves the configured Kubernetes resources to YAML files.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if exporting resources fails, otherwise nil.
func ForceCleanup ¶
func ForceCleanup(ctx context.Context, p *CommandParams) error
ForceCleanup performs post-delete cleanup, including removing temporary files and destroying the Terraform state bucket.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if the cleanup fails, otherwise nil.
func Install ¶
func Install(ctx context.Context, p *CommandParams) error
Install sets up the Quartz environment by initializing and applying all stages. This includes preparing the account, creating the Terraform backend, and applying configurations.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if the installation fails, otherwise nil.
func NewCliCommand ¶
func NewCliCommand(deps CliDependencies, p AppServiceParams) *cli.Command
NewCliCommand creates a new CLI command with the provided dependencies.
Parameters:
- deps: CliDependencies containing the required dependencies.
Returns:
- *cli.Command: The root CLI command for the Quartz tool.
func PrepareAccount ¶
func PrepareAccount(ctx context.Context, p *CommandParams) error
PrepareAccount prepares the cloud account for Quartz operations.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if preparing the account fails, otherwise nil.
func RefreshSecrets ¶
func RefreshSecrets(ctx context.Context, p *CommandParams) error
RefreshSecrets triggers an immediate refresh of all external secrets.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if refreshing secrets fails, otherwise nil.
func Render ¶
func Render(ctx context.Context, path string, p *CommandParams) error
Render writes the full configuration to the specified file path.
Parameters:
- ctx: The context for the operation.
- path: The file path where the configuration will be written.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if the rendering fails, otherwise nil.
func Restart ¶
Restart restarts a Kubernetes resource in the specified namespace.
Parameters:
- ctx: The context for the operation.
- res: The resource type to restart (e.g., deployment, daemonset).
- ns: The namespace of the resource.
- name: The name of the resource.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if restarting the resource fails, otherwise nil.
func RunAppService ¶
func RunAppService(p AppServiceParams)
RunAppService initializes and runs the application service using Uber's Fx framework. It sets up dependency injection, logging, and lifecycle hooks for the application.
func TfApply ¶
func TfApply(ctx context.Context, stage string, p *CommandParams) error
TfApply runs `terraform apply` for a specific stage.
func TfCreateBackend ¶
func TfCreateBackend(ctx context.Context, p *CommandParams) error
TfCreateBackend creates the Terraform state backend.
func TfDestroy ¶
func TfDestroy(ctx context.Context, stage string, p *CommandParams) error
TfDestroy runs `terraform destroy` for a specific stage.
func TfDestroyBackend ¶
func TfDestroyBackend(ctx context.Context, p *CommandParams) error
TfDestroyBackend destroys the Terraform state backend.
func TfFormat ¶
func TfFormat(ctx context.Context, stage string, p *CommandParams) error
TfFormat runs `terraform fmt` for a specific stage.
func TfFormatAll ¶
func TfFormatAll(ctx context.Context, p *CommandParams) error
TfFormatAll runs `terraform fmt` for all stages.
func TfInit ¶
func TfInit(ctx context.Context, stage string, p *CommandParams) error
TfInit runs `terraform init` for a specific stage.
func TfInitAll ¶
func TfInitAll(ctx context.Context, p *CommandParams) error
TfInitAll runs `terraform init` for all stages.
func TfOutput ¶
func TfOutput(ctx context.Context, stage string, p *CommandParams) error
TfOutput retrieves the Terraform output for a specific stage.
func TfPlan ¶
func TfPlan(ctx context.Context, stage string, p *CommandParams) error
TfPlan runs `terraform plan` for a specific stage.
func TfRefresh ¶
func TfRefresh(ctx context.Context, stage string, p *CommandParams) error
TfRefresh runs `terraform refresh` for a specific stage.
func TfRefreshAll ¶
func TfRefreshAll(ctx context.Context, p *CommandParams) error
TfRefreshAll runs `terraform refresh` for all stages.
func TfValidate ¶
TfValidate runs `terraform validate` for a specific stage.
Types ¶
type AppService ¶
type AppService struct {
// contains filtered or unexported fields
}
AppService represents the main application service that manages the CLI command execution and the lifecycle of the application.
func NewAppService ¶
func NewAppService(app *cli.Command, sd fx.Shutdowner) *AppService
NewAppService creates a new instance of AppService with the provided CLI command and shutdowner.
func (*AppService) Start ¶
func (svc *AppService) Start(args []string) error
Start begins the execution of the CLI application. It manages the lifecycle of the application and listens for shutdown signals or errors during execution.
func (*AppService) Stop ¶
func (svc *AppService) Stop() error
Stop waits for all goroutines to finish and returns any error encountered during execution.
type AppServiceParams ¶
type AwsCommandParams ¶
AwsCommandParams represents the input parameters for AWS-related commands. It is used to group AWS commands for dependency injection.
type AwsCommandResult ¶
AwsCommandResult represents the output result for an AWS command. It is used to group AWS commands for dependency injection.
func NewGetEksTokenCommand ¶
func NewGetEksTokenCommand() AwsCommandResult
NewGetEksTokenCommand creates a CLI command for retrieving an EKS authentication token.
Returns:
- AwsCommandResult containing the CLI command for retrieving the token.
type CliDependencies ¶
type CliDependencies struct {
fx.In
Params *CommandParams
Root RootCommandParams
}
CliDependencies contains the dependencies required to initialize the CLI. It is used to inject parameters, root commands, and build metadata.
Fields:
- Params: CommandParams for managing CLI configuration and secrets.
- Root: RootCommandParams containing the list of root-level commands.
- Version: The version of the CLI.
- BuildDate: The build date of the CLI.
type CommandParams ¶
type CommandParams struct {
// contains filtered or unexported fields
}
CommandParams holds the configuration and runtime parameters for CLI commands.
Fields:
- configFile: Path to the configuration file.
- secretsFile: Path to the secrets file.
- startTime: The time when the command execution started.
- settings: Lazy-loaded settings from the configuration file.
- provider: Lazy-loaded provider factory for managing resources.
func NewCommandParams ¶
func NewCommandParams(startTime time.Time) *CommandParams
NewCommandParams creates a new instance of CommandParams.
Parameters:
- startTime: The time when the command execution started.
Returns:
- *CommandParams: A new instance of CommandParams.
func (*CommandParams) Provider ¶
func (p *CommandParams) Provider() *provider.ProviderFactory
Provider lazy loads the provider factory.
Returns:
- *provider.ProviderFactory: The provider factory for managing resources.
func (*CommandParams) SetConfig ¶
func (p *CommandParams) SetConfig(configFile string)
SetConfig sets the configuration file path for the command parameters.
Parameters:
- configFile: The path to the configuration file.
func (*CommandParams) SetSecrets ¶
func (p *CommandParams) SetSecrets(secretsFile string)
SetSecrets sets the secrets file path for the command parameters.
Parameters:
- secretsFile: The path to the secrets file.
func (*CommandParams) Settings ¶
func (p *CommandParams) Settings() *config.Settings
Settings lazy loads the settings from the configuration file.
Returns:
- *config.Settings: The loaded settings from the configuration file.
type RootCommandParams ¶
RootCommandParams represents the input parameters for root-level commands. It is used to group root commands for dependency injection.
type RootCommandResult ¶
RootCommandResult represents the output result for a root-level command. It is used to group root commands for dependency injection.
func NewRootAwsCommand ¶
func NewRootAwsCommand(cmds AwsCommandParams) RootCommandResult
NewRootAwsCommand creates the root AWS CLI command. It organizes and returns all AWS-related subcommands.
Parameters:
- cmds: AwsCommandParams containing the list of AWS subcommands.
Returns:
- RootCommandResult containing the root AWS CLI command.
func NewRootCheckCommand ¶
func NewRootCheckCommand(p *CommandParams) RootCommandResult
func NewRootCleanCommand ¶
func NewRootCleanCommand(p *CommandParams) RootCommandResult
NewRootCleanCommand creates the "clean" root command for the CLI. This command performs a full cleanup or teardown of the Quartz system.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- RootCommandResult containing the "clean" CLI command.
func NewRootExportCommand ¶
func NewRootExportCommand(p *CommandParams) RootCommandResult
func NewRootInfoCommand ¶
func NewRootInfoCommand(p *CommandParams) RootCommandResult
func NewRootInstallCommand ¶
func NewRootInstallCommand(p *CommandParams) RootCommandResult
NewRootInstallCommand creates the "install" root command for the CLI. This command performs a full installation or update of the Quartz system.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- RootCommandResult containing the "install" CLI command.
func NewRootInternalCommand ¶
func NewRootInternalCommand(p *CommandParams) RootCommandResult
NewRootInternalCommand creates the "internal" root command for the CLI. This command is hidden and is used for internal operations such as force cleanup.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- RootCommandResult containing the "internal" CLI command.
func NewRootLoginCommand ¶
func NewRootLoginCommand(p *CommandParams) RootCommandResult
func NewRootRefreshSecretsCommand ¶
func NewRootRefreshSecretsCommand(p *CommandParams) RootCommandResult
func NewRootRenderCommand ¶
func NewRootRenderCommand(p *CommandParams) RootCommandResult
func NewRootRestartCommand ¶
func NewRootRestartCommand(p *CommandParams) RootCommandResult
func NewRootTerraformCommand ¶
func NewRootTerraformCommand(cmds TfCommandParams, p *CommandParams) RootCommandResult
NewRootTerraformCommand creates the "terraform" root command for the CLI. This command provides subcommands for managing Terraform stages.
Parameters:
- cmds: TfCommandParams containing the list of Terraform subcommands.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- RootCommandResult containing the "terraform" CLI command.
type TfCommandParams ¶
TfCommandParams represents the input parameters for Terraform-related commands. It is used to group Terraform commands for dependency injection.
type TfCommandResult ¶
TfCommandResult represents the output result for a Terraform command. It is used to group Terraform commands for dependency injection.
func NewTfApplyCommand ¶
func NewTfApplyCommand(p *CommandParams) TfCommandResult
NewTfApplyCommand creates a CLI command for running `terraform apply` on a specific stage.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- TfCommandResult containing the "apply" CLI command.
func NewTfDestroyCommand ¶
func NewTfDestroyCommand(p *CommandParams) TfCommandResult
NewTfDestroyCommand creates a CLI command for running `terraform destroy` on a specific stage.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- TfCommandResult containing the "destroy" CLI command.
func NewTfFormatAllCommand ¶
func NewTfFormatAllCommand(p *CommandParams) TfCommandResult
NewTfFormatAllCommand creates a CLI command for running `terraform fmt` on all stages.
func NewTfFormatCommand ¶
func NewTfFormatCommand(p *CommandParams) TfCommandResult
NewTfFormatCommand creates a CLI command for running `terraform fmt` on a specific stage.
func NewTfInitAllCommand ¶
func NewTfInitAllCommand(p *CommandParams) TfCommandResult
NewTfInitAllCommand creates a CLI command for running `terraform init` on all stages.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- TfCommandResult containing the "init-all" CLI command.
func NewTfInitCommand ¶
func NewTfInitCommand(p *CommandParams) TfCommandResult
NewTfInitCommand creates a CLI command for running `terraform init` on a specific stage.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- TfCommandResult containing the "init" CLI command.
func NewTfOutputCommand ¶
func NewTfOutputCommand(p *CommandParams) TfCommandResult
NewTfOutputCommand creates a CLI command for retrieving Terraform output for a specific stage.
func NewTfPlanCommand ¶
func NewTfPlanCommand(p *CommandParams) TfCommandResult
NewTfPlanCommand creates a CLI command for running `terraform plan` on a specific stage.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- TfCommandResult containing the "plan" CLI command.
func NewTfRefreshAllCommand ¶
func NewTfRefreshAllCommand(p *CommandParams) TfCommandResult
NewTfRefreshAllCommand creates a CLI command for running `terraform refresh` on all stages.
func NewTfRefreshCommand ¶
func NewTfRefreshCommand(p *CommandParams) TfCommandResult
NewTfRefreshCommand creates a CLI command for running `terraform refresh` on a specific stage.
func NewTfValidateCommand ¶
func NewTfValidateCommand(p *CommandParams) TfCommandResult
NewTfValidateCommand creates a CLI command for running `terraform validate` on a specific stage.
func NewTfVersionCommand ¶
func NewTfVersionCommand(p *CommandParams) TfCommandResult
NewTfVersionCommand creates a CLI command for checking and displaying the Terraform version.