secret

package
v0.77.0-dev-1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "pod",
	Short: "Wait for pod",
	Args:  cobra.NoArgs,
	Run: func(c *cobra.Command, args []string) {
		clientset, defaultNamespace, _ := k8s.KubernetesClient()

		namespace := defaultNamespace
		if CmdFlagNamespace != "" {
			namespace = CmdFlagNamespace
		}

		podClient := clientset.CoreV1().Pods(namespace)

		wait_for_utils.WaitFor(
			CmdFlagTimeout, 100*time.Millisecond,
			func() (bool, bool, string, error) {
				pod, err := podClient.Get(context.TODO(), CmdFlagName, metav1.GetOptions{})
				if err != nil {
					return wait_for_utils.WaitForResponseWaiting(err.Error())
				}

				if pod.Status.Phase == "Failed" {
					return wait_for_utils.WaitForResponseFailed("Failed")
				}

				if pod.Status.Phase == "Succeeded" {
					return wait_for_utils.WaitForResponseSucceeded("Succeeded")
				}

				return wait_for_utils.WaitForResponseWaiting("Running")
			},
		)

	},
}
View Source
var CmdFlagName string
View Source
var CmdFlagNamespace string
View Source
var CmdFlagTimeout int

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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