mirror of
https://github.com/containers/podman.git
synced 2025-07-27 10:22:49 +08:00
bindings: play uses entities/types
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
pkg
bindings
domain
@ -12,11 +12,11 @@ import (
|
|||||||
"github.com/containers/podman/v4/pkg/auth"
|
"github.com/containers/podman/v4/pkg/auth"
|
||||||
"github.com/containers/podman/v4/pkg/bindings"
|
"github.com/containers/podman/v4/pkg/bindings"
|
||||||
"github.com/containers/podman/v4/pkg/bindings/generate"
|
"github.com/containers/podman/v4/pkg/bindings/generate"
|
||||||
"github.com/containers/podman/v4/pkg/domain/entities"
|
entitiesTypes "github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Play(ctx context.Context, path string, options *PlayOptions) (*entities.KubePlayReport, error) {
|
func Play(ctx context.Context, path string, options *PlayOptions) (*entitiesTypes.KubePlayReport, error) {
|
||||||
f, err := os.Open(path)
|
f, err := os.Open(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -26,8 +26,8 @@ func Play(ctx context.Context, path string, options *PlayOptions) (*entities.Kub
|
|||||||
return PlayWithBody(ctx, f, options)
|
return PlayWithBody(ctx, f, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PlayWithBody(ctx context.Context, body io.Reader, options *PlayOptions) (*entities.KubePlayReport, error) {
|
func PlayWithBody(ctx context.Context, body io.Reader, options *PlayOptions) (*entitiesTypes.KubePlayReport, error) {
|
||||||
var report entities.KubePlayReport
|
var report entitiesTypes.KubePlayReport
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = new(PlayOptions)
|
options = new(PlayOptions)
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ func PlayWithBody(ctx context.Context, body io.Reader, options *PlayOptions) (*e
|
|||||||
return &report, nil
|
return &report, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Down(ctx context.Context, path string, options DownOptions) (*entities.KubePlayReport, error) {
|
func Down(ctx context.Context, path string, options DownOptions) (*entitiesTypes.KubePlayReport, error) {
|
||||||
f, err := os.Open(path)
|
f, err := os.Open(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -102,8 +102,8 @@ func Down(ctx context.Context, path string, options DownOptions) (*entities.Kube
|
|||||||
return DownWithBody(ctx, f, options)
|
return DownWithBody(ctx, f, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
func DownWithBody(ctx context.Context, body io.Reader, options DownOptions) (*entities.KubePlayReport, error) {
|
func DownWithBody(ctx context.Context, body io.Reader, options DownOptions) (*entitiesTypes.KubePlayReport, error) {
|
||||||
var report entities.KubePlayReport
|
var report entitiesTypes.KubePlayReport
|
||||||
conn, err := bindings.GetClient(ctx)
|
conn, err := bindings.GetClient(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -125,7 +125,7 @@ func DownWithBody(ctx context.Context, body io.Reader, options DownOptions) (*en
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Kube generate Kubernetes YAML (v1 specification)
|
// Kube generate Kubernetes YAML (v1 specification)
|
||||||
func Generate(ctx context.Context, nameOrIDs []string, options generate.KubeOptions) (*entities.GenerateKubeReport, error) {
|
func Generate(ctx context.Context, nameOrIDs []string, options generate.KubeOptions) (*entitiesTypes.GenerateKubeReport, error) {
|
||||||
return generate.Kube(ctx, nameOrIDs, &options)
|
return generate.Kube(ctx, nameOrIDs, &options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,23 +5,23 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/containers/podman/v4/pkg/bindings/kube"
|
"github.com/containers/podman/v4/pkg/bindings/kube"
|
||||||
"github.com/containers/podman/v4/pkg/domain/entities"
|
"github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KubeOptions = kube.PlayOptions
|
type KubeOptions = kube.PlayOptions
|
||||||
|
|
||||||
func Kube(ctx context.Context, path string, options *KubeOptions) (*entities.PlayKubeReport, error) {
|
func Kube(ctx context.Context, path string, options *KubeOptions) (*types.PlayKubeReport, error) {
|
||||||
return kube.Play(ctx, path, options)
|
return kube.Play(ctx, path, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
func KubeWithBody(ctx context.Context, body io.Reader, options *KubeOptions) (*entities.PlayKubeReport, error) {
|
func KubeWithBody(ctx context.Context, body io.Reader, options *KubeOptions) (*types.PlayKubeReport, error) {
|
||||||
return kube.PlayWithBody(ctx, body, options)
|
return kube.PlayWithBody(ctx, body, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Down(ctx context.Context, path string, options kube.DownOptions) (*entities.PlayKubeReport, error) {
|
func Down(ctx context.Context, path string, options kube.DownOptions) (*types.PlayKubeReport, error) {
|
||||||
return kube.Down(ctx, path, options)
|
return kube.Down(ctx, path, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
func DownWithBody(ctx context.Context, body io.Reader, options kube.DownOptions) (*entities.PlayKubeReport, error) {
|
func DownWithBody(ctx context.Context, body io.Reader, options kube.DownOptions) (*types.PlayKubeReport, error) {
|
||||||
return kube.DownWithBody(ctx, body, options)
|
return kube.DownWithBody(ctx, body, options)
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/containers/image/v5/types"
|
"github.com/containers/image/v5/types"
|
||||||
|
entitiesTypes "github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PlayKubeOptions controls playing kube YAML files.
|
// PlayKubeOptions controls playing kube YAML files.
|
||||||
@ -80,42 +81,14 @@ type PlayKubeOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PlayKubePod represents a single pod and associated containers created by play kube
|
// PlayKubePod represents a single pod and associated containers created by play kube
|
||||||
type PlayKubePod struct {
|
type PlayKubePod = entitiesTypes.PlayKubePod
|
||||||
// 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
|
|
||||||
// InitContainers - the IDs of the init containers to be run in the created pod.
|
|
||||||
InitContainers []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
|
|
||||||
}
|
|
||||||
|
|
||||||
// PlayKubeVolume represents a single volume created by play kube.
|
// PlayKubeVolume represents a single volume created by play kube.
|
||||||
type PlayKubeVolume struct {
|
type PlayKubeVolume entitiesTypes.PlayKubeVolume
|
||||||
// Name - Name of the volume created by play kube.
|
|
||||||
Name string
|
|
||||||
}
|
|
||||||
|
|
||||||
// PlayKubeReport contains the results of running play kube.
|
// PlayKubeReport contains the results of running play kube.
|
||||||
type PlayKubeReport struct {
|
type PlayKubeReport = entitiesTypes.PlayKubeReport
|
||||||
// Pods - pods created by play kube.
|
type KubePlayReport = entitiesTypes.KubePlayReport
|
||||||
Pods []PlayKubePod
|
|
||||||
// Volumes - volumes created by play kube.
|
|
||||||
Volumes []PlayKubeVolume
|
|
||||||
PlayKubeTeardown
|
|
||||||
// Secrets - secrets created by play kube
|
|
||||||
Secrets []PlaySecret
|
|
||||||
// ServiceContainerID - ID of the service container if one is created
|
|
||||||
ServiceContainerID string
|
|
||||||
// If set, exit with the specified exit code.
|
|
||||||
ExitCode *int32
|
|
||||||
}
|
|
||||||
|
|
||||||
type KubePlayReport = PlayKubeReport
|
|
||||||
|
|
||||||
// PlayKubeDownOptions are options for tearing down pods
|
// PlayKubeDownOptions are options for tearing down pods
|
||||||
type PlayKubeDownOptions struct {
|
type PlayKubeDownOptions struct {
|
||||||
@ -124,13 +97,6 @@ type PlayKubeDownOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PlayKubeDownReport contains the results of tearing down play kube
|
// PlayKubeDownReport contains the results of tearing down play kube
|
||||||
type PlayKubeTeardown struct {
|
type PlayKubeTeardown = entitiesTypes.PlayKubeTeardown
|
||||||
StopReport []*PodStopReport
|
|
||||||
RmReport []*PodRmReport
|
|
||||||
VolumeRmReport []*VolumeRmReport
|
|
||||||
SecretRmReport []*SecretRmReport
|
|
||||||
}
|
|
||||||
|
|
||||||
type PlaySecret struct {
|
type PlaySecret = entitiesTypes.PlaySecret
|
||||||
CreateReport *SecretCreateReport
|
|
||||||
}
|
|
||||||
|
@ -50,20 +50,14 @@ type PodPauseOptions struct {
|
|||||||
Latest bool
|
Latest bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type PodPauseReport struct {
|
type PodPauseReport = types.PodPauseReport
|
||||||
Errs []error
|
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
}
|
|
||||||
|
|
||||||
type PodunpauseOptions struct {
|
type PodunpauseOptions struct {
|
||||||
All bool
|
All bool
|
||||||
Latest bool
|
Latest bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type PodUnpauseReport struct {
|
type PodUnpauseReport = types.PodUnpauseReport
|
||||||
Errs []error
|
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
}
|
|
||||||
|
|
||||||
type PodStopOptions struct {
|
type PodStopOptions struct {
|
||||||
All bool
|
All bool
|
||||||
@ -72,30 +66,20 @@ type PodStopOptions struct {
|
|||||||
Timeout int
|
Timeout int
|
||||||
}
|
}
|
||||||
|
|
||||||
type PodStopReport struct {
|
type PodStopReport = types.PodStopReport
|
||||||
Errs []error
|
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
}
|
|
||||||
|
|
||||||
type PodRestartOptions struct {
|
type PodRestartOptions struct {
|
||||||
All bool
|
All bool
|
||||||
Latest bool
|
Latest bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type PodRestartReport struct {
|
type PodRestartReport = types.PodRestartReport
|
||||||
Errs []error
|
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
}
|
|
||||||
|
|
||||||
type PodStartOptions struct {
|
type PodStartOptions struct {
|
||||||
All bool
|
All bool
|
||||||
Latest bool
|
Latest bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type PodStartReport struct {
|
type PodStartReport = types.PodStartReport
|
||||||
Errs []error
|
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
}
|
|
||||||
|
|
||||||
type PodRmOptions struct {
|
type PodRmOptions struct {
|
||||||
All bool
|
All bool
|
||||||
@ -105,11 +89,7 @@ type PodRmOptions struct {
|
|||||||
Timeout *uint
|
Timeout *uint
|
||||||
}
|
}
|
||||||
|
|
||||||
type PodRmReport struct {
|
type PodRmReport = types.PodRmReport
|
||||||
RemovedCtrs map[string]error
|
|
||||||
Err error
|
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
}
|
|
||||||
|
|
||||||
// PddSpec is an abstracted version of PodSpecGen designed to eventually accept options
|
// PddSpec is an abstracted version of PodSpecGen designed to eventually accept options
|
||||||
// not meant to be in a specgen
|
// not meant to be in a specgen
|
||||||
@ -322,13 +302,9 @@ func NewInfraContainerCreateOptions() ContainerCreateOptions {
|
|||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
type PodCreateReport struct {
|
type PodCreateReport = types.PodCreateReport
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
}
|
|
||||||
|
|
||||||
type PodCloneReport struct {
|
type PodCloneReport = types.PodCloneReport
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PodCreateOptions) CPULimits() *specs.LinuxCPU {
|
func (p *PodCreateOptions) CPULimits() *specs.LinuxCPU {
|
||||||
cpu := &specs.LinuxCPU{}
|
cpu := &specs.LinuxCPU{}
|
||||||
@ -484,35 +460,7 @@ type PodStatsOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PodStatsReport includes pod-resource statistics data.
|
// PodStatsReport includes pod-resource statistics data.
|
||||||
type PodStatsReport struct {
|
type PodStatsReport = types.PodStatsReport
|
||||||
// Percentage of CPU utilized by pod
|
|
||||||
// example: 75.5%
|
|
||||||
CPU string
|
|
||||||
// Humanized Memory usage and maximum
|
|
||||||
// example: 12mb / 24mb
|
|
||||||
MemUsage string
|
|
||||||
// Memory usage and maximum in bytes
|
|
||||||
// example: 1,000,000 / 4,000,000
|
|
||||||
MemUsageBytes string
|
|
||||||
// Percentage of Memory utilized by pod
|
|
||||||
// example: 50.5%
|
|
||||||
Mem string
|
|
||||||
// Network usage inbound + outbound
|
|
||||||
NetIO string
|
|
||||||
// Humanized disk usage read + write
|
|
||||||
BlockIO string
|
|
||||||
// Container PID
|
|
||||||
PIDS string
|
|
||||||
// Pod ID
|
|
||||||
// example: 62310217a19e
|
|
||||||
Pod string
|
|
||||||
// Container ID
|
|
||||||
// example: e43534f89a7d
|
|
||||||
CID string
|
|
||||||
// Pod Name
|
|
||||||
// example: elastic_pascal
|
|
||||||
Name string
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidatePodStatsOptions validates the specified slice and options. Allows
|
// ValidatePodStatsOptions validates the specified slice and options. Allows
|
||||||
// for sharing code in the front- and the back-end.
|
// for sharing code in the front- and the back-end.
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
package entities
|
package entities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
|
|
||||||
"github.com/containers/podman/v4/pkg/errorhandling"
|
"github.com/containers/podman/v4/pkg/errorhandling"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SecretCreateReport struct {
|
type SecretCreateReport = types.SecretCreateReport
|
||||||
ID string
|
|
||||||
}
|
|
||||||
|
|
||||||
type SecretCreateOptions struct {
|
type SecretCreateOptions struct {
|
||||||
Driver string
|
Driver string
|
||||||
@ -25,51 +22,24 @@ type SecretListRequest struct {
|
|||||||
Filters map[string][]string
|
Filters map[string][]string
|
||||||
}
|
}
|
||||||
|
|
||||||
type SecretListReport struct {
|
type SecretListReport = types.SecretListReport
|
||||||
ID string
|
|
||||||
Name string
|
|
||||||
Driver string
|
|
||||||
CreatedAt string
|
|
||||||
UpdatedAt string
|
|
||||||
}
|
|
||||||
|
|
||||||
type SecretRmOptions struct {
|
type SecretRmOptions struct {
|
||||||
All bool
|
All bool
|
||||||
Ignore bool
|
Ignore bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type SecretRmReport struct {
|
type SecretRmReport = types.SecretRmReport
|
||||||
ID string
|
|
||||||
Err error
|
|
||||||
}
|
|
||||||
|
|
||||||
type SecretInfoReport struct {
|
type SecretInfoReport = types.SecretInfoReport
|
||||||
ID string
|
|
||||||
CreatedAt time.Time
|
|
||||||
UpdatedAt time.Time
|
|
||||||
Spec SecretSpec
|
|
||||||
SecretData string `json:"SecretData,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SecretInfoReportCompat struct {
|
type SecretInfoReportCompat = types.SecretInfoReportCompat
|
||||||
SecretInfoReport
|
|
||||||
Version SecretVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
type SecretVersion struct {
|
type SecretVersion = types.SecretVersion
|
||||||
Index int
|
|
||||||
}
|
|
||||||
|
|
||||||
type SecretSpec struct {
|
type SecretSpec = types.SecretSpec
|
||||||
Name string
|
|
||||||
Driver SecretDriverSpec
|
|
||||||
Labels map[string]string
|
|
||||||
}
|
|
||||||
|
|
||||||
type SecretDriverSpec struct {
|
type SecretDriverSpec = types.SecretDriverSpec
|
||||||
Name string
|
|
||||||
Options map[string]string
|
|
||||||
}
|
|
||||||
|
|
||||||
// swagger:model SecretCreate
|
// swagger:model SecretCreate
|
||||||
type SecretCreateRequest struct {
|
type SecretCreateRequest struct {
|
||||||
|
48
pkg/domain/entities/types/play.go
Normal file
48
pkg/domain/entities/types/play.go
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
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
|
||||||
|
// InitContainers - the IDs of the init containers to be run in the created pod.
|
||||||
|
InitContainers []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
|
||||||
|
}
|
||||||
|
|
||||||
|
type PlayKubeVolume struct {
|
||||||
|
// Name - Name of the volume created by play kube.
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
|
type PlayKubeReport struct {
|
||||||
|
// Pods - pods created by play kube.
|
||||||
|
Pods []PlayKubePod
|
||||||
|
// Volumes - volumes created by play kube.
|
||||||
|
Volumes []PlayKubeVolume
|
||||||
|
PlayKubeTeardown
|
||||||
|
// Secrets - secrets created by play kube
|
||||||
|
Secrets []PlaySecret
|
||||||
|
// ServiceContainerID - ID of the service container if one is created
|
||||||
|
ServiceContainerID string
|
||||||
|
// If set, exit with the specified exit code.
|
||||||
|
ExitCode *int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type KubePlayReport = PlayKubeReport
|
||||||
|
|
||||||
|
// PlayKubeDownReport contains the results of tearing down play kube
|
||||||
|
type PlayKubeTeardown struct {
|
||||||
|
StopReport []*PodStopReport
|
||||||
|
RmReport []*PodRmReport
|
||||||
|
VolumeRmReport []*VolumeRmReport
|
||||||
|
SecretRmReport []*SecretRmReport
|
||||||
|
}
|
||||||
|
|
||||||
|
type PlaySecret struct {
|
||||||
|
CreateReport *SecretCreateReport
|
||||||
|
}
|
@ -4,3 +4,72 @@ type PodPruneReport struct {
|
|||||||
Err error
|
Err error
|
||||||
Id string //nolint:revive,stylecheck
|
Id string //nolint:revive,stylecheck
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PodPauseReport struct {
|
||||||
|
Errs []error
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
}
|
||||||
|
type PodUnpauseReport struct {
|
||||||
|
Errs []error
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
}
|
||||||
|
|
||||||
|
type PodStopReport struct {
|
||||||
|
Errs []error
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
}
|
||||||
|
|
||||||
|
type PodRestartReport struct {
|
||||||
|
Errs []error
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
}
|
||||||
|
|
||||||
|
type PodStartReport struct {
|
||||||
|
Errs []error
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
}
|
||||||
|
|
||||||
|
type PodRmReport struct {
|
||||||
|
RemovedCtrs map[string]error
|
||||||
|
Err error
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
}
|
||||||
|
|
||||||
|
type PodCreateReport struct {
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
}
|
||||||
|
|
||||||
|
type PodCloneReport struct {
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
}
|
||||||
|
|
||||||
|
// PodStatsReport includes pod-resource statistics data.
|
||||||
|
type PodStatsReport struct {
|
||||||
|
// Percentage of CPU utilized by pod
|
||||||
|
// example: 75.5%
|
||||||
|
CPU string
|
||||||
|
// Humanized Memory usage and maximum
|
||||||
|
// example: 12mb / 24mb
|
||||||
|
MemUsage string
|
||||||
|
// Memory usage and maximum in bytes
|
||||||
|
// example: 1,000,000 / 4,000,000
|
||||||
|
MemUsageBytes string
|
||||||
|
// Percentage of Memory utilized by pod
|
||||||
|
// example: 50.5%
|
||||||
|
Mem string
|
||||||
|
// Network usage inbound + outbound
|
||||||
|
NetIO string
|
||||||
|
// Humanized disk usage read + write
|
||||||
|
BlockIO string
|
||||||
|
// Container PID
|
||||||
|
PIDS string
|
||||||
|
// Pod ID
|
||||||
|
// example: 62310217a19e
|
||||||
|
Pod string
|
||||||
|
// Container ID
|
||||||
|
// example: e43534f89a7d
|
||||||
|
CID string
|
||||||
|
// Pod Name
|
||||||
|
// example: elastic_pascal
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
50
pkg/domain/entities/types/secrets.go
Normal file
50
pkg/domain/entities/types/secrets.go
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SecretSpec struct {
|
||||||
|
Name string
|
||||||
|
Driver SecretDriverSpec
|
||||||
|
Labels map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
type SecretVersion struct {
|
||||||
|
Index int
|
||||||
|
}
|
||||||
|
|
||||||
|
type SecretDriverSpec struct {
|
||||||
|
Name string
|
||||||
|
Options map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
type SecretCreateReport struct {
|
||||||
|
ID string
|
||||||
|
}
|
||||||
|
|
||||||
|
type SecretListReport struct {
|
||||||
|
ID string
|
||||||
|
Name string
|
||||||
|
Driver string
|
||||||
|
CreatedAt string
|
||||||
|
UpdatedAt string
|
||||||
|
}
|
||||||
|
|
||||||
|
type SecretRmReport struct {
|
||||||
|
ID string
|
||||||
|
Err error
|
||||||
|
}
|
||||||
|
|
||||||
|
type SecretInfoReport struct {
|
||||||
|
ID string
|
||||||
|
CreatedAt time.Time
|
||||||
|
UpdatedAt time.Time
|
||||||
|
Spec SecretSpec
|
||||||
|
SecretData string `json:"SecretData,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SecretInfoReportCompat struct {
|
||||||
|
SecretInfoReport
|
||||||
|
Version SecretVersion
|
||||||
|
}
|
37
pkg/domain/entities/types/volumes.go
Normal file
37
pkg/domain/entities/types/volumes.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/containers/podman/v4/libpod/define"
|
||||||
|
)
|
||||||
|
|
||||||
|
type VolumeRmReport struct {
|
||||||
|
Err error
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
}
|
||||||
|
type VolumeInspectReport struct {
|
||||||
|
*VolumeConfigResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
type VolumeListReport struct {
|
||||||
|
VolumeConfigResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
type VolumeReloadReport struct {
|
||||||
|
define.VolumeReload
|
||||||
|
}
|
||||||
|
|
||||||
|
type VolumeMountReport struct {
|
||||||
|
Err error
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
Name string
|
||||||
|
Path string
|
||||||
|
}
|
||||||
|
|
||||||
|
type VolumeUnmountReport struct {
|
||||||
|
Err error
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
}
|
||||||
|
|
||||||
|
type VolumeConfigResponse struct {
|
||||||
|
define.InspectVolumeData
|
||||||
|
}
|
@ -3,7 +3,7 @@ package entities
|
|||||||
import (
|
import (
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/containers/podman/v4/libpod/define"
|
"github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VolumeCreateOptions provides details for creating volumes
|
// VolumeCreateOptions provides details for creating volumes
|
||||||
@ -23,9 +23,7 @@ type VolumeCreateOptions struct {
|
|||||||
IgnoreIfExists bool `schema:"ignoreIfExist"`
|
IgnoreIfExists bool `schema:"ignoreIfExist"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type VolumeConfigResponse struct {
|
type VolumeConfigResponse = types.VolumeConfigResponse
|
||||||
define.InspectVolumeData
|
|
||||||
}
|
|
||||||
|
|
||||||
type VolumeRmOptions struct {
|
type VolumeRmOptions struct {
|
||||||
All bool
|
All bool
|
||||||
@ -34,14 +32,9 @@ type VolumeRmOptions struct {
|
|||||||
Timeout *uint
|
Timeout *uint
|
||||||
}
|
}
|
||||||
|
|
||||||
type VolumeRmReport struct {
|
type VolumeRmReport = types.VolumeRmReport
|
||||||
Err error
|
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
}
|
|
||||||
|
|
||||||
type VolumeInspectReport struct {
|
type VolumeInspectReport = types.VolumeInspectReport
|
||||||
*VolumeConfigResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumePruneOptions describes the options needed
|
// VolumePruneOptions describes the options needed
|
||||||
// to prune a volume from the CLI
|
// to prune a volume from the CLI
|
||||||
@ -53,29 +46,17 @@ type VolumeListOptions struct {
|
|||||||
Filter map[string][]string
|
Filter map[string][]string
|
||||||
}
|
}
|
||||||
|
|
||||||
type VolumeListReport struct {
|
type VolumeListReport = types.VolumeListReport
|
||||||
VolumeConfigResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeReloadReport describes the response from reload volume plugins
|
// VolumeReloadReport describes the response from reload volume plugins
|
||||||
type VolumeReloadReport struct {
|
type VolumeReloadReport = types.VolumeReloadReport
|
||||||
define.VolumeReload
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Docker API compatibility types
|
* Docker API compatibility types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// VolumeMountReport describes the response from volume mount
|
// VolumeMountReport describes the response from volume mount
|
||||||
type VolumeMountReport struct {
|
type VolumeMountReport = types.VolumeMountReport
|
||||||
Err error
|
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
Name string
|
|
||||||
Path string
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeUnmountReport describes the response from umounting a volume
|
// VolumeUnmountReport describes the response from umounting a volume
|
||||||
type VolumeUnmountReport struct {
|
type VolumeUnmountReport = types.VolumeUnmountReport
|
||||||
Err error
|
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
}
|
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"github.com/containers/podman/v4/libpod"
|
"github.com/containers/podman/v4/libpod"
|
||||||
"github.com/containers/podman/v4/libpod/define"
|
"github.com/containers/podman/v4/libpod/define"
|
||||||
"github.com/containers/podman/v4/pkg/domain/entities"
|
"github.com/containers/podman/v4/pkg/domain/entities"
|
||||||
|
entitiesTypes "github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
v1apps "github.com/containers/podman/v4/pkg/k8s.io/api/apps/v1"
|
v1apps "github.com/containers/podman/v4/pkg/k8s.io/api/apps/v1"
|
||||||
v1 "github.com/containers/podman/v4/pkg/k8s.io/api/core/v1"
|
v1 "github.com/containers/podman/v4/pkg/k8s.io/api/core/v1"
|
||||||
metav1 "github.com/containers/podman/v4/pkg/k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "github.com/containers/podman/v4/pkg/k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -1184,7 +1185,7 @@ func (ic *ContainerEngine) playKubePVC(ctx context.Context, mountLabel string, p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
report.Volumes = append(report.Volumes, entities.PlayKubeVolume{
|
report.Volumes = append(report.Volumes, entitiesTypes.PlayKubeVolume{
|
||||||
Name: vol.Name(),
|
Name: vol.Name(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user