Files
podman/pkg/domain/entities/play.go
Matthew Heon 7e3fb33be8 Ensure that podman play kube actually reports errors
In 2.2.x, we moved `play kube` to use the Start() API for pods,
which reported errors in a different way (all containers are
started in parallel, and then results reported as a block). The
migration attempted to preserve compatibility by returning only
one error, but that's not really a viable option as it can
obscure the real reason that a pod is failing. Further, the code
was not correctly handling the API's errors - Pod Start() will,
on any container error, return a map of container ID to error
populated for all container errors *and* return ErrPodPartialFail
for overall error - the existing code did not handle the partial
failure error and thus would never return container errors.

Refactor the `play kube` API to include a set of errors for
containers in each pod, so we can return all errors that occurred
to the frontend and print them for the user, and correct the
backend code so container errors are actually forwarded.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-01-11 09:30:35 -05:00

53 lines
1.7 KiB
Go

package entities
import "github.com/containers/image/v5/types"
// PlayKubeOptions controls playing kube YAML files.
type PlayKubeOptions struct {
// Authfile - path to an authentication file.
Authfile string
// CertDir - to a directory containing TLS certifications and keys.
CertDir string
// Username for authenticating against the registry.
Username string
// Password for authenticating against the registry.
Password string
// Network - name of the CNI network to connect to.
Network string
// Quiet - suppress output when pulling images.
Quiet bool
// SignaturePolicy - path to a signature-policy file.
SignaturePolicy string
// SkipTLSVerify - skip https and certificate validation when
// contacting container registries.
SkipTLSVerify types.OptionalBool
// SeccompProfileRoot - path to a directory containing seccomp
// profiles.
SeccompProfileRoot string
// ConfigMaps - slice of pathnames to kubernetes configmap YAMLs.
ConfigMaps []string
// LogDriver for the container. For example: journald
LogDriver string
// Start - don't start the pod if false
Start types.OptionalBool
}
// PlayKubePod represents a single pod and associated containers created by play kube
type PlayKubePod struct {
// ID - ID of the pod created as a result of play kube.
ID string
// Containers - the IDs of the containers running in the created pod.
Containers []string
// Logs - non-fatal errors and log messages while processing.
Logs []string
// ContainerErrors - any errors that occurred while starting containers
// in the pod.
ContainerErrors []string
}
// PlayKubeReport contains the results of running play kube.
type PlayKubeReport struct {
// Pods - pods created by play kube.
Pods []PlayKubePod
}