utils

package
v0.0.0-...-8f6edbe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CfgInitialized = ConfigInit()

Initialize config file NOTE: This MUST run before the package init() functions

View Source
var RepoCfg *viper.Viper

Functions

func ConfigGetDefaultPath

func ConfigGetDefaultPath() (path string)

ConfigGetDefaultPath get default config file path

func ConfigIPValid

func ConfigIPValid(ipAddr string) (valid bool, reason string)

ConfigIPValid validates IP address

func ConfigInit

func ConfigInit() bool

ConfigInit initializes the meep configuration

func ConfigIsIpv4

func ConfigIsIpv4(host string) bool

ConfigIsIpv4 checks if IP address is IPV4

func ConfigPathValid

func ConfigPathValid(path string) (valid bool, reason string)

ConfigPathValid validates IP address

func ConfigReadFile

func ConfigReadFile(cfg *Config, filePath string) (err error)

ConfigReadFile read the configuration file

func ConfigSetDefaultValues

func ConfigSetDefaultValues(cfg *Config) bool

func ConfigValidate

func ConfigValidate(filePath string) (valid bool)

ConfigValidate validates config file

func ConfigWriteFile

func ConfigWriteFile(cfg *Config, filePath string) (err error)

ConfigWriteFile writes the configuration file

func ExecuteCmd

func ExecuteCmd(cmd *exec.Cmd, cobraCmd *cobra.Command) (output string, err error)

ExecuteCmd wraps exec.Command.CombinedOutput with verbosity

func FormatResult

func FormatResult(result string, elapsed time.Duration, cobraCmd *cobra.Command) string

FormatResult consistent formatting for results to be displayed

func GetDockerTag

func GetDockerTag(name string, cobraCmd *cobra.Command) (tag string, err error)

GetDockerTag Returns image tag

func GetProcess

func GetProcess(name string, cobraCmd *cobra.Command) (string, error)

GetProcess get a running process ID by name

func GetResourcePrerequisites

func GetResourcePrerequisites(group string) ([]string, []string)

GetResourcePrerequisites retreives the keys based on group and operation type

func GetTargets

func GetTargets(group string, operation string) []string

GetTargets retreives the keys based on group and operation type

operation == "" returns the whole group

func HelmDelete

func HelmDelete(name string, cobraCmd *cobra.Command) (err error)

HelmDelete Deletes specified release

func HelmFlags

func HelmFlags(flagsIn [][]string, flag string, value string) (flagsOut [][]string)

HelmFlags Takes helm flag & value pair and formats it into an array of flag value pair

func HelmInstall

func HelmInstall(name string, chart string, flags [][]string, cobraCmd *cobra.Command) (err error)

HelmInstall Install specified releases

func InterruptProcess

func InterruptProcess(pid string, cobraCmd *cobra.Command)

InterruptProcess SIGINT a process by PID

func IsDockerImage

func IsDockerImage(name string, cobraCmd *cobra.Command) (exist bool, err error)

IsDockerImage Returns true if a Docker image exists

func IsHelmRelease

func IsHelmRelease(name string, cobraCmd *cobra.Command) (exist bool, err error)

IsHelmRelease Returns true if a Helm release exists

func KillProcess

func KillProcess(pid string, cobraCmd *cobra.Command)

KillProcess kill a process by PID

func PullDockerImage

func PullDockerImage(repo string, cobraCmd *cobra.Command) (err error)

PullDockerImage Pulls a docker image

func PushDockerImage

func PushDockerImage(newRepo string, cobraCmd *cobra.Command) (err error)

PushDockerImage Push a docker image

func TagDockerImage

func TagDockerImage(localRepo string, newRepo string, cobraCmd *cobra.Command) (err error)

TagDockerImage Tag a docker image

func WaitProcess

func WaitProcess(pid string, timeout string, cobraCmd *cobra.Command) error

WaitProcess get a running process ID by name

Types

type Config

type Config struct {
	Node Node `json:"ip,omitempty"`
	Meep Meep `json:"meep,omitempty"`
}

Platform Config

var Cfg *Config

type Meep

type Meep struct {
	Gitdir   string `json:"gitdir,omitempty"`
	Workdir  string `json:"workdir,omitempty"`
	Registry string `json:"registry,omitempty"`
}

Meep Config

type Node

type Node struct {
	IP string `json:"ip,omitempty"`
}

Node Config

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL