mirror of
https://github.com/containers/podman.git
synced 2025-07-04 10:10:32 +08:00
Add podman farm subcommand
Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
This commit is contained in:
49
cmd/podman/farm/farm.go
Normal file
49
cmd/podman/farm/farm.go
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package farm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/containers/podman/v4/cmd/podman/registry"
|
||||||
|
"github.com/containers/podman/v4/cmd/podman/validate"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Command: podman _farm_
|
||||||
|
farmCmd = &cobra.Command{
|
||||||
|
Use: "farm",
|
||||||
|
Short: "Farm out builds to remote machines",
|
||||||
|
Long: "Farm out builds to remote machines that podman can connect to via podman system connection",
|
||||||
|
RunE: validate.SubCommandExists,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Temporary struct to hold cli values.
|
||||||
|
farmOpts = struct {
|
||||||
|
Farm string
|
||||||
|
Local bool
|
||||||
|
}{}
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||||
|
Command: farmCmd,
|
||||||
|
})
|
||||||
|
farmCmd.Hidden = true
|
||||||
|
|
||||||
|
flags := farmCmd.Flags()
|
||||||
|
podmanConfig := registry.PodmanConfig()
|
||||||
|
|
||||||
|
farmFlagName := "farm"
|
||||||
|
// If remote, don't read the client's containers.conf file
|
||||||
|
defaultFarm := ""
|
||||||
|
if !registry.IsRemote() {
|
||||||
|
defaultFarm = podmanConfig.ContainersConfDefaultsRO.Farms.Default
|
||||||
|
}
|
||||||
|
flags.StringVarP(&farmOpts.Farm, farmFlagName, "f", defaultFarm, "Farm to use for builds")
|
||||||
|
|
||||||
|
localFlagName := "local"
|
||||||
|
// Default for local is true and hide this flag for the remote use case
|
||||||
|
if !registry.IsRemote() {
|
||||||
|
flags.BoolVarP(&farmOpts.Local, localFlagName, "l", true, "Build image on local machine including on farm nodes")
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
_ "github.com/containers/podman/v4/cmd/podman/completion"
|
_ "github.com/containers/podman/v4/cmd/podman/completion"
|
||||||
|
_ "github.com/containers/podman/v4/cmd/podman/farm"
|
||||||
_ "github.com/containers/podman/v4/cmd/podman/generate"
|
_ "github.com/containers/podman/v4/cmd/podman/generate"
|
||||||
_ "github.com/containers/podman/v4/cmd/podman/healthcheck"
|
_ "github.com/containers/podman/v4/cmd/podman/healthcheck"
|
||||||
_ "github.com/containers/podman/v4/cmd/podman/images"
|
_ "github.com/containers/podman/v4/cmd/podman/images"
|
||||||
|
27
docs/source/markdown/podman-farm.1.md
Normal file
27
docs/source/markdown/podman-farm.1.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
% podman-farm 1
|
||||||
|
|
||||||
|
## NAME
|
||||||
|
podman\-farm - Farm out builds to machines running podman for different architectures
|
||||||
|
|
||||||
|
## SYNOPSIS
|
||||||
|
**podman farm** *subcommand*
|
||||||
|
|
||||||
|
## DESCRIPTION
|
||||||
|
Farm out builds to machines running podman for different architectures.
|
||||||
|
|
||||||
|
Manage farms by creating, updating, and removing them.
|
||||||
|
|
||||||
|
## COMMANDS
|
||||||
|
|
||||||
|
| Command | Man Page | Description |
|
||||||
|
| -------- | ------------------------------------------------------------- | ------------------------ |
|
||||||
|
| create | [podman-farm\-create(1)](podman-farm-create.1.md) | Create a new farm |
|
||||||
|
| list | [podman-farm\-list(1)](podman-farm-list.1.md) | List the existing farms |
|
||||||
|
| remove | [podman-farm\-remove(1)](podman-farm-remove.1.md) | Delete one or more farms |
|
||||||
|
| update | [podman-farm\-update(1)](podman-farm-update.1.md) | Update an existing farm |
|
||||||
|
|
||||||
|
## SEE ALSO
|
||||||
|
**[podman(1)](podman.1.md)**
|
||||||
|
|
||||||
|
## HISTORY
|
||||||
|
July 2023, Originally compiled by Urvashi Mohnani (umohnani at redhat dot com)
|
@ -313,6 +313,7 @@ the exit codes follow the `chroot` standard, see below:
|
|||||||
| [podman-attach(1)](podman-attach.1.md) | Attach to a running container. |
|
| [podman-attach(1)](podman-attach.1.md) | Attach to a running container. |
|
||||||
| [podman-auto-update(1)](podman-auto-update.1.md) | Auto update containers according to their auto-update policy |
|
| [podman-auto-update(1)](podman-auto-update.1.md) | Auto update containers according to their auto-update policy |
|
||||||
| [podman-build(1)](podman-build.1.md) | Build a container image using a Containerfile. |
|
| [podman-build(1)](podman-build.1.md) | Build a container image using a Containerfile. |
|
||||||
|
| [podman-farm(1)](podman-farm.1.md) | Farm out builds to machines running podman for different architectures |
|
||||||
| [podman-commit(1)](podman-commit.1.md) | Create new image based on the changed container. |
|
| [podman-commit(1)](podman-commit.1.md) | Create new image based on the changed container. |
|
||||||
| [podman-completion(1)](podman-completion.1.md) | Generate shell completion scripts |
|
| [podman-completion(1)](podman-completion.1.md) | Generate shell completion scripts |
|
||||||
| [podman-compose(1)](podman-compose.1.md) | Run Compose workloads via an external compose provider. |
|
| [podman-compose(1)](podman-compose.1.md) | Run Compose workloads via an external compose provider. |
|
||||||
|
@ -107,6 +107,7 @@ my %Skip_Subcommand = map { $_ => 1 } (
|
|||||||
"help", # has no man page
|
"help", # has no man page
|
||||||
"completion", # internal (hidden) subcommand
|
"completion", # internal (hidden) subcommand
|
||||||
"compose", # external tool, outside of our control
|
"compose", # external tool, outside of our control
|
||||||
|
"farm", # hidden subcommand till it is fully implemented - remove this once done
|
||||||
);
|
);
|
||||||
|
|
||||||
# END user-customizable section
|
# END user-customizable section
|
||||||
|
Reference in New Issue
Block a user