Documentation ¶
Index ¶
- Constants
- Variables
- func Execute()
- func GenerateBashCompletion(w io.Writer, cmd *cobra.Command) error
- func GenerateZshCompletion(out io.Writer, cmd *cobra.Command) error
- func IsOpenShiftRunning(driver drivers.Driver) bool
- type DockerShellConfig
- type OcShellConfig
- type Status
- type StatusWithRegistration
- type UpdateMarker
Constants ¶
View Source
const ( StorageDisk = "/mnt/?da1" StorageDiskForGeneric = "/" GithubAddress = "https://github.com" )
View Source
const (
SshCommunicationError = "exit status 255"
)
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "minishift", Short: "Minishift is a tool for application development in local OpenShift clusters.", Long: `Minishift is a command-line tool that provisions and manages single-node OpenShift clusters optimized for development workflows.`, PersistentPreRun: func(cmd *cobra.Command, args []string) { var ( err error isAddonInstallRequired bool ) if constants.ProfileName != constants.DefaultProfileName { checkForValidProfileOrExit(cmd) } constants.MachineName = constants.ProfileName constants.Minipath = constants.GetProfileHomeDir(constants.ProfileName) state.InstanceDirs = state.GetMinishiftDirsStructure(constants.Minipath) constants.KubeConfigPath = filepath.Join(state.InstanceDirs.Machines, constants.MachineName+"_kubeconfig") if !filehelper.Exists(state.InstanceDirs.Addons) { isAddonInstallRequired = true } createMinishiftDirs(state.InstanceDirs) ensureConfigFileExists(constants.GlobalConfigFile) ensureConfigFileExists(constants.ConfigFile) cfg, err := minishiftConfig.ReadViperConfig(constants.ConfigFile) if err != nil { atexit.ExitWithMessage(1, err.Error()) } cacheImages := cmdImage.GetConfiguredCachedImages(cfg) addonConfig := cmdAddon.GetAddOnConfiguration() if minishiftConfig.AllInstancesConfig == nil { ensureAllInstanceConfigPath(constants.AllInstanceConfigPath) minishiftConfig.AllInstancesConfig, err = minishiftConfig.NewAllInstancesConfig(constants.AllInstanceConfigPath) if err != nil { atexit.ExitWithMessage(1, fmt.Sprintf("Error creating all instance config: %s", err.Error())) } } _, err = os.Stat(minishiftConstants.GetInstanceStateConfigOldPath()) if err == nil { if err := os.Rename(minishiftConstants.GetInstanceStateConfigOldPath(), minishiftConstants.GetInstanceStateConfigPath()); err != nil { atexit.ExitWithMessage(1, fmt.Sprintf("Error moving old state config to new one: %s", err.Error())) } } minishiftConfig.InstanceStateConfig, err = minishiftConfig.NewInstanceStateConfig(minishiftConstants.GetInstanceStateConfigPath()) if err != nil { atexit.ExitWithMessage(1, fmt.Sprintf("Error creating config for VM: %s", err.Error())) } minishiftConfig.InstanceConfig, err = minishiftConfig.NewInstanceConfig(minishiftConstants.GetInstanceConfigPath()) if err != nil { atexit.ExitWithMessage(1, fmt.Sprintf("Error creating config for VM: %s", err.Error())) } hostfolder := minishiftConfig.InstanceStateConfig.HostFolders if len(hostfolder) != 0 { minishiftConfig.InstanceConfig.HostFolders = hostfolder if err != minishiftConfig.InstanceConfig.Write() { atexit.ExitWithMessage(1, fmt.Sprintf("Error coping existing hostfolder to new instance config: %s", err.Error())) } } if len(cacheImages) != 0 { minishiftConfig.InstanceConfig.CacheImages = cacheImages if err != minishiftConfig.InstanceConfig.Write() { atexit.ExitWithMessage(1, fmt.Sprintf("Error coping existing cache images to new instance config: %s", err.Error())) } delete(cfg, "cache-images") if err != minishiftConfig.WriteViperConfig(constants.ConfigFile, cfg) { atexit.ExitWithMessage(1, fmt.Sprintf("Error removing the cache-images entry from older config %s: %s", constants.ConfigFile, err.Error())) } } if len(addonConfig) != 0 { minishiftConfig.InstanceConfig.AddonConfig = addonConfig if err != minishiftConfig.InstanceConfig.Write() { atexit.ExitWithMessage(1, fmt.Sprintf("Error coping existing addon config to new instance config: %s", err.Error())) } delete(cfg, "addons") if err != minishiftConfig.WriteViperConfig(constants.ConfigFile, cfg) { atexit.ExitWithMessage(1, fmt.Sprintf("Error removing the addon config entry from older config %s: %s", constants.ConfigFile, err.Error())) } } if isAddonInstallRequired { if err := cmdUtil.UnpackAddons(state.InstanceDirs.Addons); err != nil { atexit.ExitWithMessage(1, fmt.Sprintf("Error installing default add-ons : %s", err)) } } if filehelper.Exists(filepath.Join(constants.Minipath, constants.UpdateMarkerFileName)) { if err := performPostUpdateExecution(filepath.Join(constants.Minipath, constants.UpdateMarkerFileName)); err != nil { atexit.ExitWithMessage(1, fmt.Sprintf("Error in performing post update exeuction: %s", err)) } } if minishiftConfig.EnableExperimental { glog.Info("Experimental features are enabled") } shouldShowLibmachineLogs := viper.GetBool(showLibmachineLogs) if glog.V(3) { log.SetDebug(true) } if !shouldShowLibmachineLogs { log.SetOutWriter(ioutil.Discard) log.SetErrWriter(ioutil.Discard) } setDefaultActiveProfile() if glog.V(2) { fmt.Println(fmt.Sprintf("-- minishift version: v%s+%s", version.GetMinishiftVersion(), version.GetCommitSha())) } }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func GenerateBashCompletion ¶ added in v1.13.0
func GenerateZshCompletion ¶ added in v1.13.0
func IsOpenShiftRunning ¶ added in v1.2.0
Types ¶
type DockerShellConfig ¶
type OcShellConfig ¶
type StatusWithRegistration ¶ added in v1.21.0
type UpdateMarker ¶ added in v1.2.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.