Documentation ¶
Overview ¶
Package utils provides CLI utility functions and structs
Index ¶
- func ConvertMapOfBytesToMapOfStrings(contentMap map[string][]byte) map[string]string
- func CreateDirectory(dirPath string, mode fs.FileMode)
- func CreateKubernetesClient(contextName string) (client.Client, error)
- func CreateKubernetesClientOrDie(contextName string) client.Client
- func CreateROrDie(env *ENV, obj client.Object)
- func DeleteAllOfOrDie(env *ENV, obj client.Object, opts ...client.DeleteAllOfOption)
- func DeleteOrDie(env *ENV, obj client.Object, opts ...client.DeleteOption) bool
- func EnsureNamespaceOrDie(env *ENV, name string)
- func EnsureServiceAccountOrDie(env *ENV, name string)
- func ExecuteKubectlClient(ns string, podName string, containerName string, executeCommand string)
- func GetCRUDSubcommands() (*cobra.Command, *cobra.Command, *cobra.Command)
- func GetClientset(kubeContext string) (*rest.Config, *kubernetes.Clientset)
- func GetFileContent(filePath string) ([]byte, error)
- func GetKubectlPath() string
- func GetM(env *ENV, name string, obj client.Object) (bool, error)
- func GetMOrDie(env *ENV, name string, obj client.Object) bool
- func ReadYAMLToMapOrDie(filePath string) map[string]interface{}
- func RunCmdOrDie(cmd string, args ...string) string
- func RunCmdWithEnvOrDie(environ []string, cmd string, args ...string) string
- func RunRemoteCmd(kubeContext string, namespace string, podName string, containerName string, ...) *bytes.Buffer
- func SetLogger(command *cobra.Command)
- func UpdateROrDie(env *ENV, obj client.Object)
- func VarListToMap(varsList []string) map[string]string
- func WriteContentToFile(filePath string, content []byte, mode fs.FileMode)
- type ENV
- type SoftwareFactoryConfig
- type SoftwareFactoryConfigContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertMapOfBytesToMapOfStrings ¶ added in v0.0.26
func CreateDirectory ¶ added in v0.0.26
func CreateKubernetesClient ¶
func CreateROrDie ¶
func DeleteAllOfOrDie ¶
func DeleteAllOfOrDie(env *ENV, obj client.Object, opts ...client.DeleteAllOfOption)
func DeleteOrDie ¶
func EnsureNamespaceOrDie ¶ added in v0.0.24
func EnsureServiceAccountOrDie ¶ added in v0.0.24
func ExecuteKubectlClient ¶ added in v0.0.28
func GetCRUDSubcommands ¶
func GetClientset ¶ added in v0.0.26
func GetClientset(kubeContext string) (*rest.Config, *kubernetes.Clientset)
func GetFileContent ¶
func GetKubectlPath ¶ added in v0.0.28
func GetKubectlPath() string
func ReadYAMLToMapOrDie ¶ added in v0.0.28
func RunCmdOrDie ¶ added in v0.0.23
func RunCmdWithEnvOrDie ¶ added in v0.0.23
func RunRemoteCmd ¶ added in v0.0.26
func SetLogger ¶ added in v0.0.32
SetLogger enables the DEBUG LogLevel in the Logger when the debug flag is set
func UpdateROrDie ¶
func VarListToMap ¶ added in v0.0.24
Types ¶
type SoftwareFactoryConfig ¶
type SoftwareFactoryConfig struct { Contexts map[string]SoftwareFactoryConfigContext `json:"contexts" mapstructure:"contexts"` Default string `json:"default-context" mapstructure:"default-context"` }
type SoftwareFactoryConfigContext ¶
type SoftwareFactoryConfigContext struct { ConfigRepository string `json:"config-repository-path" mapstructure:"config-repository-path"` Manifest string `json:"manifest-file" mapstructure:"manifest-file"` IsStandalone bool `json:"standalone" mapstructure:"standalone"` Namespace string `json:"namespace" mapstructure:"namespace"` KubeContext string `json:"kube-context" mapstructure:"kube-context"` FQDN string `json:"fqdn" mapstructure:"fqdn"` Dev struct { AnsibleMicroshiftRolePath string `json:"ansible-microshift-role-path" mapstructure:"ansible-microshift-role-path"` SFOperatorRepositoryPath string `json:"sf-operator-repository-path" mapstructure:"sf-operator-repository-path"` Microshift struct { Host string `json:"host" mapstructure:"host"` User string `json:"user" mapstructure:"user"` OpenshiftPullSecret string `json:"openshift-pull-secret" mapstructure:"openshift-pull-secret"` DiskFileSize string `json:"disk-file-size" mapstructure:"disk-file-size"` ETCDOnRAMDisk bool `json:"etcd-on-ramdisk" mapstructure:"etcd-on-ramdisk"` } `json:"microshift" mapstructure:"microshift"` Tests struct { DemoReposPath string `json:"demo-repos-path" mapstructure:"demo-repos-path"` ExtraVars map[string]string `json:"extra-vars" mapstructure:"extra-vars"` } `json:"tests" mapstructure:"tests"` } `json:"development" mapstructure:"development"` Components struct { Nodepool struct { CloudsFile string `json:"clouds-file" mapstructure:"clouds-file"` KubeFile string `json:"kube-file" mapstructure:"kube-file"` } `json:"nodepool" mapstructure:"nodepool"` } `json:"components" mapstructure:"components"` }
CLI config struct
func GetCLIContext ¶
func GetCLIContext(command *cobra.Command) (SoftwareFactoryConfigContext, error)
func GetCLIctxOrDie ¶
func GetCLIctxOrDie(kmd *cobra.Command, args []string, allowedArgs []string) SoftwareFactoryConfigContext
Click to show internal directories.
Click to hide internal directories.