helpers

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: UPL-1.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const VpoSimpleLogFormatRegexp = `"level":"(.*?)","@timestamp":"(.*?)",(.*?)"message":"(.*?)",`

Variables

View Source
var DeleteFunc deleteLeftoverPlatformOperatorSig = deleteLeftoverPlatformOperator

DeleteFunc is the default deleteLeftoverPlatformOperator function

Functions

func AddManifestsFlags added in v1.5.4

func AddManifestsFlags(cmd *cobra.Command)

AddManifestsFlags adds flags related to providing manifests (including the deprecated operator-file flag as an alias for the manifests flag)

func ApplyPlatformOperatorYaml

func ApplyPlatformOperatorYaml(cmd *cobra.Command, client clipkg.Client, vzHelper helpers.VZHelper, version string) error

ApplyPlatformOperatorYaml applies a given version of the platform operator yaml file

func ConfirmWithUser added in v1.5.4

func ConfirmWithUser(vzHelper helpers.VZHelper, questionText string, skipQuestion bool) (bool, error)

ConfirmWithUser asks the user a yes/no question and returns true if the user answered yes, false otherwise.

func FakeDeleteFunc

func FakeDeleteFunc(client clipkg.Client) error

func GenerateYAMLForSetFlags added in v1.7.0

func GenerateYAMLForSetFlags(pvs map[string]string) (string, error)

GenerateYAMLForSetFlags creates a YAML string from a map of property value pairs representing --set flags specified on the install command

func GetExistingVPODeployment added in v1.5.4

func GetExistingVPODeployment(client clipkg.Client) (*appsv1.Deployment, error)

GetExistingVPODeployment - get existing Verrazzano Platform operator Deployment from the cluster

func GetExistingVPOWebhookDeployment added in v1.5.4

func GetExistingVPOWebhookDeployment(client clipkg.Client) (*appsv1.Deployment, error)

GetExistingVPOWebhookDeployment - get existing Verrazzano Platform operator webhook deployment from the cluster

func GetSetArguments added in v1.7.0

func GetSetArguments(cmd *cobra.Command, vzHelper helpers.VZHelper) (map[string]string, error)

GetSetArguments gets all the set arguments and returns a map of property/value

func GetVerrazzanoPlatformOperatorPodName

func GetVerrazzanoPlatformOperatorPodName(client clipkg.Client) (string, error)

GetVerrazzanoPlatformOperatorPodName returns the VPO pod name

func GetVersion

func GetVersion(cmd *cobra.Command, vzHelper helpers.VZHelper) (string, error)

GetVersion returns the version of Verrazzano to install/upgrade

func GetVpoLogStream

func GetVpoLogStream(kubeClient kubernetes.Interface, vpoPodName string) (io.ReadCloser, error)

GetVpoLogStream returns the stream to the verrazzano-platform-operator log file

func GetWaitTimeout

func GetWaitTimeout(cmd *cobra.Command, timeoutFlag string) (time.Duration, error)

GetWaitTimeout returns the time to wait for a command to complete

func ManifestsFlagChanged added in v1.5.4

func ManifestsFlagChanged(cmd *cobra.Command) bool

ManifestsFlagChanged returns whether the manifests flag (or deprecated operator-file flag) is specified.

func MergeSetFlags

func MergeSetFlags(gv schema.GroupVersion, vz clipkg.Object, overlayYAML string) (clipkg.Object, *unstructured.Unstructured, error)

MergeSetFlags merges yaml representing a set flag passed on the command line with a verrazano install resource. A merged verrazzano install resource is returned.

func MergeSetFlagsUpgrade added in v1.7.0

func MergeSetFlagsUpgrade(gv schema.GroupVersion, vz *v1beta1.Verrazzano, overlayYAML string) (clipkg.Object, *unstructured.Unstructured, error)

MergeSetFlagsUpgrade takes the existing Verrazzano resource and merges yaml representing a set flag passed on the command line with a A merged verrazzano install resource is returned.

func MergeYAMLFiles

func MergeYAMLFiles(filenames []string, stdinReader io.Reader) (*unstructured.Unstructured, error)

MergeYAMLFiles parses the given slice of filenames containing yaml and merges them into a single verrazzano yaml and then returned as a vz resource.

func NewCommand

func NewCommand(vzHelper helpers.VZHelper, use string, short string, long string) *cobra.Command

NewCommand - utility method to create cobra commands

func PrintSimpleLogFormat

func PrintSimpleLogFormat(sc *bufio.Scanner, outputStream io.Writer, regexp *regexp.Regexp)

PrintSimpleLogFormat display a VPO log message with the simple log format

func SetApplyYAMLFunc added in v1.7.0

func SetApplyYAMLFunc(f applyYAMLSig)

func SetDefaultApplyYAMLFunc added in v1.7.0

func SetDefaultApplyYAMLFunc()

func SetDefaultDeleteFunc

func SetDefaultDeleteFunc()

func SetDefaultVPOIsReadyFunc added in v1.5.4

func SetDefaultVPOIsReadyFunc()

func SetDeleteFunc

func SetDeleteFunc(f deleteLeftoverPlatformOperatorSig)

func SetVPOIsReadyFunc added in v1.5.4

func SetVPOIsReadyFunc(f vpoIsReadySig)

func UsePlatformOperatorUninstallJob

func UsePlatformOperatorUninstallJob(client clipkg.Client) (bool, error)

UsePlatformOperatorUninstallJob determines whether the version of the platform operator is using an uninstall job. The uninstall job was removed with Verrazzano 1.4.0.

func ValidatePrivateRegistry added in v1.5.4

func ValidatePrivateRegistry(cmd *cobra.Command, client clipkg.Client) error

ValidatePrivateRegistry - Validate private registry settings in command against those in existing VPO deployment, if any

func WaitForOperationToComplete

func WaitForOperationToComplete(client clipkg.Client, kubeClient kubernetes.Interface, vzHelper helpers.VZHelper, namespacedName types.NamespacedName, timeout time.Duration, vpoTimeout time.Duration, logFormat LogFormat, condType v1beta1.ConditionType) error

WaitForOperationToComplete waits for the Verrazzano install/upgrade to complete and shows the logs of the ongoing Verrazzano install/upgrade.

func WaitForPlatformOperator

func WaitForPlatformOperator(client clipkg.Client, vzHelper helpers.VZHelper, condType v1beta1.ConditionType, timeout time.Duration) (string, error)

WaitForPlatformOperator waits for the verrazzano-platform-operator to be ready

Types

type LogFormat

type LogFormat string
const (
	LogFormatSimple LogFormat = "simple"
	LogFormatJSON   LogFormat = "json"
)

func GetLogFormat

func GetLogFormat(cmd *cobra.Command) (LogFormat, error)

GetLogFormat returns the format type for streaming log output

func (*LogFormat) Set

func (lf *LogFormat) Set(value string) error

Set must have pointer receiver so it doesn't change the value of a copy

func (*LogFormat) String

func (lf *LogFormat) String() string

func (*LogFormat) Type

func (lf *LogFormat) Type() string

Type is only used in help text

type RootCmdContext

type RootCmdContext struct {
	genericclioptions.IOStreams
}

func NewRootCmdContext

func NewRootCmdContext(streams genericclioptions.IOStreams) *RootCmdContext

NewRootCmdContext - create the root command context object

func (*RootCmdContext) GetClient

func (rc *RootCmdContext) GetClient(cmd *cobra.Command) (client.Client, error)

GetClient - return a Kubernetes controller runtime client that supports the schemes used by the CLI

func (*RootCmdContext) GetDiscoveryClient added in v1.5.6

func (rc *RootCmdContext) GetDiscoveryClient(cmd *cobra.Command) (discovery.DiscoveryInterface, error)

func (*RootCmdContext) GetDynamicClient

func (rc *RootCmdContext) GetDynamicClient(cmd *cobra.Command) (dynamic.Interface, error)

GetDynamicClient - return a dynamic clientset for use with the go-client

func (*RootCmdContext) GetErrorStream

func (rc *RootCmdContext) GetErrorStream() io.Writer

GetErrorStream - return the error stream

func (*RootCmdContext) GetHTTPClient

func (rc *RootCmdContext) GetHTTPClient() *http.Client

GetHTTPClient - return an HTTP client

func (*RootCmdContext) GetInputStream

func (rc *RootCmdContext) GetInputStream() io.Reader

GetInputStream - return the input stream

func (*RootCmdContext) GetKubeClient

func (rc *RootCmdContext) GetKubeClient(cmd *cobra.Command) (kubernetes.Interface, error)

GetKubeClient - return a Kubernetes clientset for use with the go-client

func (*RootCmdContext) GetOutputStream

func (rc *RootCmdContext) GetOutputStream() io.Writer

GetOutputStream - return the output stream

func (*RootCmdContext) VerifyCLIArgsNil added in v1.7.0

func (rc *RootCmdContext) VerifyCLIArgsNil(cmd *cobra.Command) error

VerifyCLIArgsNil checks that command args are not set at the creation of the command

Jump to

Keyboard shortcuts

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