Documentation ¶
Index ¶
- Variables
- func Execute() error
- func FlagPassingHack()
- func GetCmdProperties(mgp metagraf.MGProperties) metagraf.MGProperties
- func MergeAndValidateProperties(base metagraf.MGProperties, merge metagraf.MGProperties, novalidate bool) metagraf.MGProperties
- func MgPropertyLineSplit(r rune) bool
- func PropertiesFromCmd(mgp metagraf.MGProperties) metagraf.MGProperties
- func PropertiesFromEnv(mgp metagraf.MGProperties) metagraf.MGProperties
- func ReadPropertiesFile(propfile string) metagraf.MGProperties
- func ValidateProperties(mgprops metagraf.MGProperties) bool
- type CmdCVars
- type CmdMessage
- type CmdVars
- type EnvVars
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Namespace string OName string // Flag for overriding application name. ConfigPath string // Viper config override ConfigFile string = "config" ConfigFormat string = "yaml" Verbose bool = false // Output flag, makes mg output generated kubernetes resources in json or yaml. Output bool = false Version string Dryrun bool = false // If true do not create Watch bool = false Keep bool = true Branch string BaseEnvs bool = false Defaults bool = false // Should we hydrate default values in declarative state. Format string Template string // Command line flag for setting template name Suffix string // Command line flag for setting mg create ref output file suffix Enforce bool = false // Boolean flag for articulating enforcement mode instead of inform ImageNS string // Image Namespace, used in overriding namespace in container image references Registry string // Flag for holding a custom container registry Tag string // Flag to specify tag to work on or target Context string // Flag for setting application context root. CreateGlobals bool = false // Flag for overriding default behaviour of skipping creation of global secrets. CVars []string // Slice of strings to hold overridden values. )
@todo: This should be moved to it's own package to avoid cyclic dependencies since both cmd and modules package use them.
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]) modules.Variables = GetCmdProperties(mg.GetProperties()) log.V(2).Info("Current MGProperties: ", modules.Variables) 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 InspectPropertiesCmd = &cobra.Command{ Use: "properties <metaGraf>", Short: "inspect a metaGraf specification against a properties file", Long: `inspect a metaGraf specification against a properties file.`, Run: func(cmd *cobra.Command, args []string) { if len(args) < 1 { log.Infof("Active project is: %v", viper.Get("namespace")) log.Errorf("Missing path to metaGraf specification") os.Exit(1) } if len(args) < 2 { log.Errorf("Missing path to properties file") os.Exit(1) } mg := metagraf.Parse(args[0]) params.PropertiesFile = args[1] modules.Variables = GetCmdProperties(mg.GetProperties()) if !ValidateProperties(modules.Variables) { os.Exit(1) } else { fmt.Printf("The %v configuration is valid for this metaGraf specification.\n", params.PropertiesFile) } }, }
View Source
var MGBanner string = "mg " + MGVersion
View Source
var MGVersion string
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 RootCmd = &cobra.Command{ Use: "mg", Short: "mg operates on collections of metaGraf's objects.", Long: MGBanner + `is a utility that understands the metaGraf datastructure and help you generate kubernetes primitives`, }
Functions ¶
func FlagPassingHack ¶
func FlagPassingHack()
func GetCmdProperties ¶ added in v0.1.0
func GetCmdProperties(mgp metagraf.MGProperties) metagraf.MGProperties
Process cmd parameters based on metagraf defined properties.
func MergeAndValidateProperties ¶ added in v0.1.0
func MergeAndValidateProperties(base metagraf.MGProperties, merge metagraf.MGProperties, novalidate bool) metagraf.MGProperties
func MgPropertyLineSplit ¶ added in v0.1.0
Used for splitting --cvfile .properties files with strings.FieldsFunc()
func PropertiesFromCmd ¶ added in v0.1.0
func PropertiesFromCmd(mgp metagraf.MGProperties) metagraf.MGProperties
Modifies a MGProperties map with values from --cvars argument. Only supports local environment variables for now.
func PropertiesFromEnv ¶ added in v0.1.0
func PropertiesFromEnv(mgp metagraf.MGProperties) metagraf.MGProperties
func ReadPropertiesFile ¶ added in v0.1.0
func ReadPropertiesFile(propfile string) metagraf.MGProperties
Reads a properties file and returns a metagraf.MGProperties structure
func ValidateProperties ¶ added in v0.1.0
func ValidateProperties(mgprops metagraf.MGProperties) bool
Check if all required MGProperty structs in MGProperties has a value. Returns true if they are valid, false if they are invalid.
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."
Source Files ¶
- argocd.go
- config.go
- create-application.go
- create-buildconfig.go
- create-deployment.go
- create-deploymentconfig.go
- create-imagestream.go
- create-pdb.go
- create-pipeline.go
- create-ref.go
- create-service.go
- create.go
- delete.go
- dev.go
- generate.go
- get.go
- init.go
- inject.go
- inspect.go
- istio.go
- kaniko.go
- knative.go
- oam.go
- project.go
- properties.go
- reuirements.go
- root.go
- types.go
- version.go
Click to show internal directories.
Click to hide internal directories.