Documentation ¶
Index ¶
- func ExecuteCommandWithArgs(command *cobra.Command, args ...string) error
- func ExecuteCommandWithArgsOut(command *cobra.Command, args ...string) (string, error)
- func GetTestSettings() *v1.Settings
- func Glooctl(argStr string) error
- func GlooctlOut(argStr string) (string, error)
- func Make(dir, args string) error
- type GlooCli
- func (c *GlooCli) Check(ctx context.Context, extraArgs ...string) (string, error)
- func (c *GlooCli) CheckCrds(ctx context.Context, extraArgs ...string) error
- func (c *GlooCli) DebugLogs(ctx context.Context, extraArgs ...string) error
- func (c *GlooCli) Execute(ctx context.Context, argStr string) error
- func (c *GlooCli) ExecuteOut(ctx context.Context, argStr string) (string, error)
- func (c *GlooCli) GetProxy(ctx context.Context, extraArgs ...string) (string, error)
- func (c *GlooCli) IstioInject(ctx context.Context, installNamespace, kubeContext string, extraArgs ...string) (string, error)
- func (c *GlooCli) IstioUninject(ctx context.Context, installNamespace, kubeContext string, extraArgs ...string) (string, error)
- func (c *GlooCli) NewCommand(ctx context.Context) *cobra.Command
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteCommandWithArgs ¶ added in v1.17.0
ExecuteCommandWithArgs executes the provided cobra.Command with the defined arguments If an error was encountered it will be returned, nil otherwise
func ExecuteCommandWithArgsOut ¶ added in v1.17.0
ExecuteCommandWithArgsOut executes the provided cobra.Command with the defined arguments Any output to Stdout or Stderr will be returned in a string, and if an error was encountered an error will be returned optionally
NOTE:
cobra.Command's support configuring an alternative to using stdout and stderr However, glooctl does not rely on this functionality and uses os.Stdout directly We opt to bake this complexity directly into this tool, instead of forcing developers to be aware of it. As a result, we do the following: 1. Capture the stdout and stderr Files 2. Update them to point to a writer of our choosing 3. Execute the command 4. Undo the change to stdout and stderr 5. Return the output string
Update May 7th: @sam-heilbron tried to call this function within a struct following our cmdutils.Cmd interface. However, even with no functional changes, it was triggering a data-race when updating os.Stdout
func GetTestSettings ¶ added in v0.18.42
func Glooctl ¶
Glooctl executes a glooctl command, passing the provided string as the arguments No output is expected or returned, and if an error was encountered, it will be returned otherwise nill will be returned
Example:
argStr = "install gateway --dry-run" This will result in the following command being executed: `glooctl install gateway --dry-run`
func GlooctlOut ¶
GlooctlOut executes a glooctl command, passing the provided string as the arguments Any output to Stdout or Stderr will be returned in a string, and if an error was encountered an error will be returned optionally
Example:
argStr = "install gateway --dry-run" This will result in the following command being executed: `glooctl install gateway --dry-run`
Types ¶
type GlooCli ¶ added in v1.17.0
type GlooCli struct{}
GlooCli is way to execute glooctl commands consistently It has the benefit of invoking the underlying *cobra.Command directly, meaning that we do not rely on any generating binaries
func NewGlooCli ¶ added in v1.17.0
func NewGlooCli() *GlooCli
NewGlooCli returns an implementation of the GlooCli
func (*GlooCli) Check ¶ added in v1.17.0
Check attempts to check the installation It returns a string containing the output that a user would see if they invoked `glooctl check` It optionally returns an error if one was encountered
func (*GlooCli) CheckCrds ¶ added in v1.17.0
CheckCrds attempts to check the CRDs in the cluster, and returns an error if one was encountered
func (*GlooCli) DebugLogs ¶ added in v1.17.0
DebugLogs attempts to output the logs to a specified file, and returns an error if one was encountered
func (*GlooCli) ExecuteOut ¶ added in v1.17.0
ExecuteOut executes an arbitrary glooctl command It returns a string containing the output that is piped to stdout and stdrr It optionally returns an error if one was encountered
func (*GlooCli) GetProxy ¶ added in v1.17.0
GetProxy attempts to get a proxy or list of proxies with the given args. It returns a string containing the output that a user would see if they invoked `glooctl get proxy <args>`. It optionally returns an error if one was encountered.
func (*GlooCli) IstioInject ¶ added in v1.17.0
func (c *GlooCli) IstioInject(ctx context.Context, installNamespace, kubeContext string, extraArgs ...string) (string, error)
IstioInject inject istio-proxy and sds