secret

package
v0.81.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

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

		jobsClient := clientset.BatchV1().Jobs(namespace)

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

				if job.Status.Failed == 1 {
					return wait_for_utils.WaitForResponseFailed("Failed")
				}

				if job.Status.Succeeded == 1 {
					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