Documentation ¶
Index ¶
- Constants
- Variables
- func Execute() error
- func FlagPassingHack()
- func MergeVars(base metagraf.MGVars, override map[string]string) metagraf.MGVars
- func OverrideVars(mgv metagraf.MGVars, cvars CmdVars) map[string]string
- func VarsFromCmd(mgv metagraf.MGVars, cvars CmdVars) map[string]string
- type CmdCVars
- type CmdMessage
- type CmdVars
- type EnvVars
Constants ¶
View Source
const Banner string = "mg (metaGraf) - "
Variables ¶
View Source
var BaseEnvs bool = false
View Source
var Branch string
View Source
var CVars []string
Slice of strings to hold overridden values
View Source
var Config string // Viper config override
Flags
View Source
var Dryrun bool = false // If true do not create
View Source
var InspectCmd = &cobra.Command{ Use: "inspect <metaGraf>", Short: "inspect a metaGraf specification", Long: `inspect a metaGraf specification and list objects that will be created or patched.`, Run: func(cmd *cobra.Command, args []string) { if len(args) < 1 { fmt.Println("Active project is:", viper.Get("namespace")) fmt.Println("Missing path to metaGraf specification") return } if len(Namespace) == 0 { Namespace = viper.GetString("namespace") if len(Namespace) == 0 { fmt.Println("Namespace must be supplied") os.Exit(1) } } mg := metagraf.Parse(args[0]) if modules.Variables == nil { vars := MergeVars( mg.GetVars(), OverrideVars(mg.GetVars(), CmdCVars(CVars).Parse())) modules.Variables = vars } name := modules.Name(&mg) for k, v := range modules.Variables { fmt.Println(name, "Variable:", k, v) } modules.InspectSecrets(&mg) modules.InspectConfigMaps(&mg) }, }
View Source
var (
Namespace string
)
View Source
var Output bool = false
View Source
var ProjectCmd = &cobra.Command{ Use: "project <name>", Short: "set active project / namespace", Long: `sets the `, Run: func(cmd *cobra.Command, args []string) { if len(args) < 1 { fmt.Println("Active project is:", viper.Get("namespace")) return } name := args[0] viper.Set("namespace", name) err := viper.WriteConfig() if err != nil { fmt.Println("ERROR:", err) return } fmt.Printf("Active namespace is now %v\n", name) }, }
View Source
var Replicas int = 1 // Default replica value is 0
View Source
var RootCmd = &cobra.Command{ Use: "mg", Short: "mg operates on collections of metaGraf's objects.", Long: Banner + `is a utility that understands the metaGraf datastructure and help you generate kubernetes primitives`, }
View Source
var Verbose bool = false
View Source
var Version string
Functions ¶
func FlagPassingHack ¶
func FlagPassingHack()
func OverrideVars ¶
Returns a list of variables from command line or environment where command line is the most significant.
Types ¶
type CmdMessage ¶
type CmdMessage string
var StrActiveProject CmdMessage = "Active project is:"
var StrMalformedVar CmdMessage = "Malformed key=value pair supplied through --cvars :"
var StrMissingCollection CmdMessage = "Missing path to collection of metaGraf specifications."
var StrMissingMetaGraf CmdMessage = "Missing path to metaGraf specification."
var StrMissingNamespace CmdMessage = "Namespace must be supplied or configured."
Click to show internal directories.
Click to hide internal directories.