cluster-api: Index | Files | Directories

package cmd

import ""


Package Files

alpha.go completion.go config.go config_cluster.go config_provider.go config_repositories.go delete.go describe.go describe_cluster.go generate.go generate_yaml.go get.go get_kubeconfig.go init.go move.go rollout.go root.go upgrade.go upgrade_apply.go upgrade_plan.go version.go version_checker.go


const (
    // ComponentsOutputYaml is an option used to print the components in yaml format.
    ComponentsOutputYaml = "yaml"
    // ComponentsOutputText is an option used to print the components in text format.
    ComponentsOutputText = "text"
const (
    // RepositoriesOutputYaml is an option used to print the repository list in yaml format.
    RepositoriesOutputYaml = "yaml"
    // RepositoriesOutputText is an option used to print the repository list in text format.
    RepositoriesOutputText = "text"
const Indentation = `  `


var (
    // ComponentsOutputs is a list of valid components outputs.
    ComponentsOutputs = []string{ComponentsOutputText, ComponentsOutputYaml}
var (
    // RepositoriesOutputs is a list of valid repository list outputs.
    RepositoriesOutputs = []string{RepositoriesOutputYaml, RepositoriesOutputText}
var RootCmd = &cobra.Command{
    Use:          "clusterctl",
    SilenceUsage: true,
    Short:        "clusterctl controls the lifecyle of a Cluster API management cluster",
    Long: LongDesc("" /* 151 byte string literal not displayed */,
    PersistentPreRunE: func(cmd *cobra.Command, args []string) error {

        configFolderPath := filepath.Join(homedir.HomeDir(), config.ConfigFolder)
        if _, err := os.Stat(configFolderPath); os.IsNotExist(err) {
            if err := os.MkdirAll(filepath.Dir(configFolderPath), os.ModePerm); err != nil {
                return errors.Wrapf(err, "failed to create the clusterctl config directory: %s", configFolderPath)
        return nil
    PersistentPostRunE: func(cmd *cobra.Command, args []string) error {

        configClient, err := config.New(cfgFile)
        if err != nil {
            return err
        output, err := newVersionChecker(configClient.Variables()).Check()
        if err != nil {
            return errors.Wrap(err, "unable to verify clusterctl version")
        if len(output) != 0 {

            fmt.Fprintf(os.Stderr, "\033[33m%s\033[0m", output)

        downloadConfigFile := filepath.Join(homedir.HomeDir(), config.ConfigFolder, config.DownloadConfigFile)
        if _, err := os.Stat(downloadConfigFile); err == nil {
            if verbosity != nil && *verbosity >= 5 {
                fmt.Fprintf(os.Stdout, "Removing downloaded clusterctl config file: %s\n", config.DownloadConfigFile)
            _ = os.Remove(downloadConfigFile)

        return nil

func Examples Uses

func Examples(s string) string

Examples normalizes a command's examples to follow the conventions.

func Execute Uses

func Execute()

func GetSupportedShells Uses

func GetSupportedShells() []string

GetSupportedShells returns a list of supported shells

func LongDesc Uses

func LongDesc(s string) string

LongDesc normalizes a command's long description to follow the conventions.

type ReleaseInfo Uses

type ReleaseInfo struct {
    Version string
    URL     string

ReleaseInfo stores information about the release.

type Version Uses

type Version struct {
    ClientVersion *version.Info `json:"clusterctl"`

Version provides the version information of clusterctl

type VersionState Uses

type VersionState struct {
    LastCheck     time.Time
    LatestRelease ReleaseInfo

VersionState stores the release info and the last time it was updated.



Package cmd imports 36 packages (graph) and is imported by 10 packages. Updated 2021-01-27. Refresh now. Tools for package owners.