criocli

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CheckCommand = &cli.Command{
	Name:   "check",
	Usage:  usageText,
	Action: crioCheck,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "age",
			Aliases: []string{"a"},
			Value:   "24h",
			Usage:   "Maximum allowed age for unreferenced layers",
		},
		&cli.BoolFlag{
			Name:    "force",
			Aliases: []string{"f"},
			Usage:   "Remove damaged containers",
		},
		&cli.BoolFlag{
			Name:    "repair",
			Aliases: []string{"r"},
			Usage:   "Remove damaged images and layers",
		},
		&cli.BoolFlag{
			Name:    "quick",
			Aliases: []string{"q"},
			Usage:   "Perform only quick checks",
		},
		&cli.BoolFlag{
			Name:    "wipe",
			Aliases: []string{"w"},
			Usage:   "Wipe storage directory on repair failure",
		},
	},
}
View Source
var ConfigCommand = &cli.Command{
	Name: "config",
	Usage: `Outputs a commented version of the configuration file that could be used
by CRI-O. This allows you to save you current configuration setup and then load
it later with **--config**. Global options will modify the output.`,
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:  "default",
			Usage: "Output the default configuration (without taking into account any configuration options).",
		},
	},
	Action: func(c *cli.Context) error {
		logrus.SetFormatter(&logrus.TextFormatter{
			DisableTimestamp: true,
		})
		logrus.SetLevel(logrus.InfoLevel)

		conf, err := GetConfigFromContext(c)
		if err != nil {
			return err
		}

		if c.Bool("default") {
			conf, err = config.DefaultConfig()
			if err != nil {
				return err
			}
		}

		if err = conf.Validate(false); err != nil {
			return err
		}

		return conf.WriteTemplate(c.Bool("default"), os.Stdout)
	},
}
View Source
var DefaultCommands = []*cli.Command{
	completion(),
	man(),
	markdown(),
}

DefaultCommands are the flags commands can be added to every binary.

View Source
var PublishCommand = &cli.Command{
	Name:  "publish",
	Usage: "receive shimv2 events",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:   "topic",
			Hidden: true,
		},
		&cli.StringFlag{
			Name:   "namespace",
			Hidden: true,
		},
	},
	HideHelp: true,
	Hidden:   true,
	Action: func(c *cli.Context) error {
		return nil
	},
}
View Source
var StatusCommand = &cli.Command{
	Name:  "status",
	Usage: "Display status information",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:      socketArg,
			Aliases:   []string{"s"},
			Usage:     "absolute path to the unix socket",
			Value:     defaultSocket,
			TakesFile: true,
		},
	},
	OnUsageError: func(c *cli.Context, e error, b bool) error { return e },
	Subcommands: []*cli.Command{{
		Action:  configSubCommand,
		Aliases: []string{"c"},
		Name:    "config",
		Usage:   "Show the configuration of CRI-O as a TOML string.",
	}, {
		Action:  containers,
		Aliases: []string{"container", "cs", "s"},
		Flags: []cli.Flag{&cli.StringFlag{
			Name:    idArg,
			Aliases: []string{"i"},
			Usage:   "the container ID",
		}},
		Name:  "containers",
		Usage: "Display detailed information about the provided container ID.",
	}, {
		Action:  info,
		Aliases: []string{"i"},
		Name:    "info",
		Usage:   "Retrieve generic information about CRI-O, such as the cgroup and storage driver.",
	}, {
		Action:  goroutines,
		Aliases: []string{"g"},
		Name:    "goroutines",
		Usage:   "Display the goroutine stack.",
	}, {
		Action:  heap,
		Aliases: []string{"hp"},
		Name:    "heap",
		Usage:   "Write the heap dump to a temp file and print its location on disk.",
		Flags: []cli.Flag{
			&cli.StringFlag{
				Name:      "file",
				Aliases:   []string{"f"},
				Usage:     "Output file of the heap dump.",
				TakesFile: true,
			},
		},
	}},
}
View Source
var VersionCommand = &cli.Command{
	Name:  "version",
	Usage: "display detailed version information",
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    jsonFlag,
			Aliases: []string{"j"},
			Usage:   "print JSON instead of text",
		},
		&cli.BoolFlag{
			Name:    verboseFlag,
			Aliases: []string{"v"},
			Usage:   "print verbose information (for example all golang dependencies)",
		},
	},
	Action: func(c *cli.Context) error {
		verbose := c.Bool(verboseFlag)
		v, err := version.Get(verbose)
		if err != nil {
			logrus.Fatal(err)
		}
		res := v.String()
		if c.Bool(jsonFlag) {
			j, err := v.JSONString()
			if err != nil {
				return fmt.Errorf("unable to generate JSON from version info: %w", err)
			}
			res = j

		}
		fmt.Print(res)
		return nil
	},
}
View Source
var WipeCommand = &cli.Command{
	Name:   "wipe",
	Usage:  "wipe CRI-O's container and image storage",
	Action: crioWipe,
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    "force",
			Aliases: []string{"f"},
			Usage:   "force wipe by skipping the version check",
		},
	},
}

Functions

func GetAndMergeConfigFromContext added in v1.18.2

func GetAndMergeConfigFromContext(c *cli.Context) (*libconfig.Config, error)

func GetConfigFromContext

func GetConfigFromContext(c *cli.Context) (*libconfig.Config, error)

func GetFlagsAndMetadata

func GetFlagsAndMetadata() ([]cli.Flag, map[string]any, error)

func StringSliceTrySplit added in v1.18.1

func StringSliceTrySplit(ctx *cli.Context, name string) []string

StringSliceTrySplit parses the string slice from the CLI context. If the parsing returns just a single item, then we try to parse them by `,` to allow users to provide their flags comma separated.

func Timestamp added in v1.32.0

func Timestamp() string

Timestamp returns a string timestamp representation.

Types

type ContainerStore added in v1.28.0

type ContainerStore struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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