Documentation
¶
Overview ¶
Package cmd is where the commands for cargoship
Index ¶
- Constants
- Variables
- func AnsibleModule(ctx context.Context, argv []string) (int, bool)
- func Distro(s string) (distrocfg.Distro, error)
- func Execute(ctx context.Context) error
- func ExecuteArgs(ctx context.Context, args []string) error
- func GetStringSlice(v *viper.Viper, key string) []string
- func NewCargoshipCommand() *cobra.Command
- func ParseRegistryOverrides(overrides []string) ([]images.RegistryOverride, error)
- func PrintFindings(ctx context.Context, lintErr *lint.LintError)
- func PrintViperConfigUsed(ctx context.Context) error
- type InstallCommon
Constants ¶
const ( // InstallEngineConfigSyncConfig flag InstallEngineConfigSyncConfig = "config" // InstallEngineConfigSyncConfirm flag InstallEngineConfigSyncConfirm = "confirm" // InstallEngineConfigSyncConcurrency flag InstallEngineConfigSyncConcurrency = "concurrency" // InstallEngineConfigSyncWorkConcurrency flag InstallEngineConfigSyncWorkConcurrency = "work-concurrency" )
const ( // InstallKubeConfig flag InstallKubeConfig = "config" // InstallKubeConfirm flag InstallKubeConfirm = "confirm" // InstallKubeDistro flag InstallKubeDistro = "distro" )
const ( // InstallResetConfig flag InstallResetConfig = "config" // InstallResetConfirm flag InstallResetConfirm = "confirm" // InstallResetDistro flag InstallResetDistro = "distro" // InstallResetConcurrency flag InstallResetConcurrency = "concurrency" // InstallResetWorkConcurrency flag InstallResetWorkConcurrency = "work-concurrency" // InstallResetUpdateHost flag InstallResetUpdateHost = "hosts" // InstallResetUpdateFirewall flag InstallResetUpdateFirewall = "firewall" // InstallResetUpdateFAPolicyD flag InstallResetUpdateFAPolicyD = "fapolicyd" )
const ( // CmdInventoryOutput flag CmdInventoryOutput = "output" // CmdInventoryName flag CmdInventoryName = "name" // CmdInventoryLoadBalancer flag CmdInventoryLoadBalancer = "loadbalancer" )
const ( // FlagAgeIdentityFile names the flag holding an age identity file, which decrypts FlagAgeIdentityFile = "age-identity-file" // FlagAgeRecipient names the flag holding an age public key, which encrypts FlagAgeRecipient = "age-recipient" // FlagAgeRecipientsFile names the flag holding a file of age public keys, which encrypt FlagAgeRecipientsFile = "age-recipients-file" )
const ( // MiscSchemaOutput flag MiscSchemaOutput = "output" // MiscSchemaPackage flag MiscSchemaPackage = "package" )
const ( // MiscValidateKind flag MiscValidateKind = "kind" // MiscValidatePackage flag MiscValidatePackage = "package" )
const ( // MiscVaultKeygenOutput flag MiscVaultKeygenOutput = "output" // MiscVaultKeygenPublicKey flag MiscVaultKeygenPublicKey = "public-key" )
const ( // RootLoggingLevel command flag log level RootLoggingLevel = "log-level" // RootLoggingFormat command flag log format RootLoggingFormat = "log-format" // RootTimeout command flag timeout RootTimeout = "timeout" // RootZarfCache command flag zarf-cache RootZarfCache = "zarf-cache" // RootArchitecture command flag architecture RootArchitecture = "architecture" // RootPlainHTTP command flag plain-http RootPlainHTTP = "plain_http" // RootInsecureSkipTLSVerify command flag insecure-skip-tls-verify RootInsecureSkipTLSVerify = "insecure_skip_tls_verify" )
const ( // InstallConfig flag InstallConfig = "config" // InstallConfirm flag InstallConfirm = "confirm" // InstallDryRun flag InstallDryRun = "dry-run" // InstallConcurrency flag InstallConcurrency = "concurrency" // InstallWorkConcurrency flag InstallWorkConcurrency = "work-concurrency" // InstallUpdateHost flag InstallUpdateHost = "hosts" // InstallUpdateFirewall flag InstallUpdateFirewall = "firewall" // InstallUpdateFAPolicyD flag InstallUpdateFAPolicyD = "fapolicyd" // InstallLabelNodes flag InstallLabelNodes = "label-nodes" // InstallAllowUnmanagedNodes flag InstallAllowUnmanagedNodes = "allow-unmanaged-nodes" // InstallUpdateKubeConfig flag InstallUpdateKubeConfig = "update-kubeconfig" // InstallKubeConfigPath flag InstallKubeConfigPath = "kubeconfig" // InstallVaultPasswordFile flag InstallVaultPasswordFile = "vault-password-file" // InstallValues flag InstallValues = "values" )
const ( // PackageOCIConcurrency flag PackageOCIConcurrency = "oci-concurrency" // PackageTag flag PackageTag = "tag" )
const (
// MiscOutput flag
MiscOutput = "output"
)
const MiscVaultForce = "force"
MiscVaultForce flag
const MiscVaultNewPasswordFile = "new-vault-password-file"
MiscVaultNewPasswordFile flag
const MiscVaultPasswordFile = "vault-password-file"
MiscVaultPasswordFile flag
Variables ¶
var ( // IsColorDisabled whether to show the colored output IsColorDisabled bool // LogFormat format of the log output LogFormat string // LogLevelCLI log level LogLevelCLI string // LogFile enables always writing a full-verbosity debug log to a file LogFile bool // Timeout for how long a task runs Timeout string )
var ( // OutputWriter provides a default writer to Stdout for user-facing command output OutputWriter = os.Stdout )
Functions ¶
func AnsibleModule ¶
AnsibleModule runs the binary as an Ansible module when it was invoked as one, and reports whether it was.
It lives here rather than in main because src/internal is only importable from inside src/, and because this is where the argument vector a module renders is executed. The caller exits with the status returned; a module always exits 0 and reports failure inside its JSON result.
func ExecuteArgs ¶
ExecuteArgs runs the root command against an explicit argument vector instead of os.Args.
It exists for the Ansible module mode in internal/ansiblemod, which turns a module's JSON parameters into the flags an operator would have typed and then runs the ordinary command. Building an argument vector rather than calling into src/pkg/action directly is the point of the arrangement: keyring resolution, timeout parsing, package loading, and phase construction stay on one path, so what a playbook does and what an operator does cannot drift apart.
func GetStringSlice ¶
GetStringSlice returns a string slice from viper it consistently returns expected results across flags and environment variables https://github.com/spf13/viper/issues/380
func NewCargoshipCommand ¶
NewCargoshipCommand is the root command
func ParseRegistryOverrides ¶
func ParseRegistryOverrides(overrides []string) ([]images.RegistryOverride, error)
ParseRegistryOverrides converts registry overrides to a structured type. The result is sorted in descending order by Source, which guarantees the longest prefix will be sorted toward the beginning -- so that e.g. docker.io/library overrides win over a broader docker.io override.
Input is of the following form: []string{"docker.io/library=docker.example.com", "docker.io=docker.example.com"}
func PrintFindings ¶
PrintFindings prints the findings in the LintError as a table.
func PrintViperConfigUsed ¶
PrintViperConfigUsed informs users when Zarf has detected a config file.
Types ¶
type InstallCommon ¶
type InstallCommon struct {
LogFormat string
// contains filtered or unexported fields
}
InstallCommon common args
Source Files
¶
- ansible.go
- common.go
- common_schema.go
- common_verify.go
- flag.go
- install_apply.go
- install_engine_config_sync.go
- install_kube-config.go
- install_prepare.go
- install_reset.go
- inventory.go
- inventory_from_ansible.go
- keyring.go
- misc_schema.go
- misc_sha.go
- misc_validate.go
- misc_vault_decrypt.go
- misc_vault_decrypt_file.go
- misc_vault_decrypt_path.go
- misc_vault_encrypt.go
- misc_vault_encrypt_file.go
- misc_vault_encrypt_path.go
- misc_vault_keygen.go
- misc_vault_rekey.go
- misc_version.go
- package_create.go
- package_publish.go
- package_pull.go
- package_sign.go
- root.go
- table.go
- vault.go
- viper.go