mirror of
https://github.com/containers/podman.git
synced 2025-06-22 18:08:11 +08:00
[NO TESTS NEEDED] Shrink the size of podman-remote
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/containers/buildah/define"
|
||||
buildahDefine "github.com/containers/buildah/define"
|
||||
buildahCLI "github.com/containers/buildah/pkg/cli"
|
||||
"github.com/containers/buildah/pkg/parse"
|
||||
"github.com/containers/common/pkg/completion"
|
||||
@ -158,11 +158,11 @@ func buildFlags(cmd *cobra.Command) {
|
||||
flags.SetNormalizeFunc(buildahCLI.AliasFlags)
|
||||
if registry.IsRemote() {
|
||||
flag = flags.Lookup("isolation")
|
||||
buildOpts.Isolation = define.OCI
|
||||
if err := flag.Value.Set(define.OCI); err != nil {
|
||||
logrus.Errorf("unable to set --isolation to %v: %v", define.OCI, err)
|
||||
buildOpts.Isolation = buildahDefine.OCI
|
||||
if err := flag.Value.Set(buildahDefine.OCI); err != nil {
|
||||
logrus.Errorf("unable to set --isolation to %v: %v", buildahDefine.OCI, err)
|
||||
}
|
||||
flag.DefValue = define.OCI
|
||||
flag.DefValue = buildahDefine.OCI
|
||||
_ = flags.MarkHidden("disable-content-trust")
|
||||
_ = flags.MarkHidden("cache-from")
|
||||
_ = flags.MarkHidden("sign-by")
|
||||
@ -195,7 +195,7 @@ func build(cmd *cobra.Command, args []string) error {
|
||||
var contextDir string
|
||||
if len(args) > 0 {
|
||||
// The context directory could be a URL. Try to handle that.
|
||||
tempDir, subDir, err := define.TempDirForURL("", "buildah", args[0])
|
||||
tempDir, subDir, err := buildahDefine.TempDirForURL("", "buildah", args[0])
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "error prepping temporary context directory")
|
||||
}
|
||||
@ -318,16 +318,16 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
|
||||
return nil, errors.Errorf("can only set one of 'pull' or 'pull-always' or 'pull-never'")
|
||||
}
|
||||
|
||||
pullPolicy := define.PullIfMissing
|
||||
pullPolicy := buildahDefine.PullIfMissing
|
||||
if c.Flags().Changed("pull") && flags.Pull {
|
||||
pullPolicy = define.PullAlways
|
||||
pullPolicy = buildahDefine.PullAlways
|
||||
}
|
||||
if flags.PullAlways {
|
||||
pullPolicy = define.PullAlways
|
||||
pullPolicy = buildahDefine.PullAlways
|
||||
}
|
||||
|
||||
if flags.PullNever {
|
||||
pullPolicy = define.PullNever
|
||||
pullPolicy = buildahDefine.PullNever
|
||||
}
|
||||
|
||||
args := make(map[string]string)
|
||||
@ -402,9 +402,9 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
|
||||
flags.Layers = false
|
||||
}
|
||||
|
||||
compression := define.Gzip
|
||||
compression := buildahDefine.Gzip
|
||||
if flags.DisableCompression {
|
||||
compression = define.Uncompressed
|
||||
compression = buildahDefine.Uncompressed
|
||||
}
|
||||
|
||||
isolation, err := parse.IsolationOption(flags.Isolation)
|
||||
@ -426,10 +426,10 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
|
||||
format := ""
|
||||
flags.Format = strings.ToLower(flags.Format)
|
||||
switch {
|
||||
case strings.HasPrefix(flags.Format, define.OCI):
|
||||
format = define.OCIv1ImageManifest
|
||||
case strings.HasPrefix(flags.Format, define.DOCKER):
|
||||
format = define.Dockerv2ImageManifest
|
||||
case strings.HasPrefix(flags.Format, buildahDefine.OCI):
|
||||
format = buildahDefine.OCIv1ImageManifest
|
||||
case strings.HasPrefix(flags.Format, buildahDefine.DOCKER):
|
||||
format = buildahDefine.Dockerv2ImageManifest
|
||||
default:
|
||||
return nil, errors.Errorf("unrecognized image type %q", flags.Format)
|
||||
}
|
||||
@ -457,7 +457,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
|
||||
return nil, errors.Wrapf(err, "unable to obtain decrypt config")
|
||||
}
|
||||
|
||||
opts := define.BuildOptions{
|
||||
opts := buildahDefine.BuildOptions{
|
||||
AddCapabilities: flags.CapAdd,
|
||||
AdditionalTags: tags,
|
||||
Annotations: flags.Annotation,
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/containers/podman/v3/pkg/util"
|
||||
"github.com/containers/storage"
|
||||
"github.com/containers/storage/pkg/lockfile"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@ -20,7 +20,7 @@ type EventLogFile struct {
|
||||
// Writes to the log file
|
||||
func (e EventLogFile) Write(ee Event) error {
|
||||
// We need to lock events file
|
||||
lock, err := storage.GetLockfile(e.options.LogFilePath + ".lock")
|
||||
lock, err := lockfile.GetLockfile(e.options.LogFilePath + ".lock")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
buildahDefine "github.com/containers/buildah/define"
|
||||
"github.com/containers/buildah/imagebuildah"
|
||||
"github.com/containers/image/v5/directory"
|
||||
"github.com/containers/image/v5/docker/reference"
|
||||
@ -165,7 +166,7 @@ func (r *Runtime) newImageBuildCompleteEvent(idOrName string) {
|
||||
}
|
||||
|
||||
// Build adds the runtime to the imagebuildah call
|
||||
func (r *Runtime) Build(ctx context.Context, options imagebuildah.BuildOptions, dockerfiles ...string) (string, reference.Canonical, error) {
|
||||
func (r *Runtime) Build(ctx context.Context, options buildahDefine.BuildOptions, dockerfiles ...string) (string, reference.Canonical, error) {
|
||||
if options.Runtime == "" {
|
||||
// Make sure that build containers use the same runtime as Podman (see #9365).
|
||||
conf := util.DefaultContainerConfig()
|
||||
|
@ -13,8 +13,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/containers/buildah"
|
||||
"github.com/containers/buildah/define"
|
||||
"github.com/containers/buildah/imagebuildah"
|
||||
buildahDefine "github.com/containers/buildah/define"
|
||||
"github.com/containers/buildah/util"
|
||||
"github.com/containers/image/v5/types"
|
||||
"github.com/containers/podman/v3/libpod"
|
||||
@ -277,13 +276,13 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
||||
jobs = query.Jobs
|
||||
}
|
||||
|
||||
pullPolicy := define.PullIfMissing
|
||||
pullPolicy := buildahDefine.PullIfMissing
|
||||
if utils.IsLibpodRequest(r) {
|
||||
pullPolicy = define.PolicyMap[query.PullPolicy]
|
||||
pullPolicy = buildahDefine.PolicyMap[query.PullPolicy]
|
||||
} else {
|
||||
if _, found := r.URL.Query()["pull"]; found {
|
||||
if query.Pull {
|
||||
pullPolicy = define.PullAlways
|
||||
pullPolicy = buildahDefine.PullAlways
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -315,7 +314,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Decode()"))
|
||||
return
|
||||
}
|
||||
buildOptions := imagebuildah.BuildOptions{
|
||||
buildOptions := buildahDefine.BuildOptions{
|
||||
AddCapabilities: addCaps,
|
||||
AdditionalTags: additionalTags,
|
||||
Annotations: annotations,
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
"github.com/containers/podman/v3/libpod/define"
|
||||
"github.com/containers/podman/v3/pkg/api/handlers/utils"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities/types"
|
||||
"github.com/containers/podman/v3/version"
|
||||
docker "github.com/docker/docker/api/types"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@ -32,7 +32,7 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
components := []docker.ComponentVersion{{
|
||||
components := []types.ComponentVersion{{
|
||||
Name: "Podman Engine",
|
||||
Version: versionInfo.Version,
|
||||
Details: map[string]string{
|
||||
@ -52,7 +52,7 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) {
|
||||
minVersion := version.APIVersion[version.Compat][version.MinimalAPI]
|
||||
|
||||
utils.WriteResponse(w, http.StatusOK, entities.ComponentVersion{
|
||||
Version: docker.Version{
|
||||
Version: types.Version{
|
||||
Platform: struct {
|
||||
Name string
|
||||
}{
|
||||
|
@ -28,10 +28,6 @@ type ContainerConfig struct {
|
||||
dockerContainer.Config
|
||||
}
|
||||
|
||||
type LibpodImagesLoadReport struct {
|
||||
ID string `json:"id"`
|
||||
}
|
||||
|
||||
type LibpodImagesPullReport struct {
|
||||
entities.ImagePullReport
|
||||
}
|
||||
|
23
pkg/api/handlers/types/types.go
Normal file
23
pkg/api/handlers/types/types.go
Normal file
@ -0,0 +1,23 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
)
|
||||
|
||||
// LibpodImagesRemoveReport is the return type for image removal via the rest
|
||||
// api.
|
||||
type LibpodImagesRemoveReport struct {
|
||||
entities.ImageRemoveReport
|
||||
// Image removal requires is to return data and an error.
|
||||
Errors []string
|
||||
}
|
||||
|
||||
// HistoryResponse provides details on image layers
|
||||
type HistoryResponse struct {
|
||||
ID string `json:"Id"`
|
||||
Created int64
|
||||
CreatedBy string
|
||||
Tags []string
|
||||
Size int64
|
||||
Comment string
|
||||
}
|
@ -174,7 +174,6 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
|
||||
if len(platform) > 0 {
|
||||
params.Set("platform", platform)
|
||||
}
|
||||
|
||||
params.Set("pullpolicy", options.PullPolicy.String())
|
||||
|
||||
if options.Quiet {
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/containers/podman/v3/pkg/api/handlers"
|
||||
"github.com/containers/podman/v3/pkg/api/handlers/types"
|
||||
"github.com/containers/podman/v3/pkg/auth"
|
||||
"github.com/containers/podman/v3/pkg/bindings"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
@ -96,12 +96,12 @@ func Tree(ctx context.Context, nameOrID string, options *TreeOptions) (*entities
|
||||
}
|
||||
|
||||
// History returns the parent layers of an image.
|
||||
func History(ctx context.Context, nameOrID string, options *HistoryOptions) ([]*handlers.HistoryResponse, error) {
|
||||
func History(ctx context.Context, nameOrID string, options *HistoryOptions) ([]*types.HistoryResponse, error) {
|
||||
if options == nil {
|
||||
options = new(HistoryOptions)
|
||||
}
|
||||
_ = options
|
||||
var history []*handlers.HistoryResponse
|
||||
var history []*types.HistoryResponse
|
||||
conn, err := bindings.GetClient(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/containers/podman/v3/pkg/api/handlers"
|
||||
"github.com/containers/podman/v3/pkg/api/handlers/types"
|
||||
"github.com/containers/podman/v3/pkg/bindings"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/errorhandling"
|
||||
@ -19,7 +19,7 @@ func Remove(ctx context.Context, images []string, options *RemoveOptions) (*enti
|
||||
// FIXME - bindings tests are missing for this endpoint. Once the CI is
|
||||
// re-enabled for bindings, we need to add them. At the time of writing,
|
||||
// the tests don't compile.
|
||||
var report handlers.LibpodImagesRemoveReport
|
||||
var report types.LibpodImagesRemoveReport
|
||||
conn, err := bindings.GetClient(ctx)
|
||||
if err != nil {
|
||||
return nil, []error{err}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package images
|
||||
|
||||
import (
|
||||
"github.com/containers/buildah/imagebuildah"
|
||||
buildahDefine "github.com/containers/buildah/define"
|
||||
)
|
||||
|
||||
//go:generate go run ../generator/generator.go RemoveOptions
|
||||
@ -162,7 +162,7 @@ type PullOptions struct {
|
||||
|
||||
//BuildOptions are optional options for building images
|
||||
type BuildOptions struct {
|
||||
imagebuildah.BuildOptions
|
||||
buildahDefine.BuildOptions
|
||||
}
|
||||
|
||||
//go:generate go run ../generator/generator.go ExistsOptions
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"github.com/containers/image/v5/types"
|
||||
"github.com/containers/podman/v3/pkg/inspect"
|
||||
"github.com/containers/podman/v3/pkg/trust"
|
||||
docker "github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/opencontainers/go-digest"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
@ -32,9 +31,9 @@ type Image struct {
|
||||
OsVersion string `json:",omitempty"`
|
||||
Size int64 `json:",omitempty"`
|
||||
VirtualSize int64 `json:",omitempty"`
|
||||
GraphDriver docker.GraphDriverData `json:",omitempty"`
|
||||
RootFS docker.RootFS `json:",omitempty"`
|
||||
Metadata docker.ImageMetadata `json:",omitempty"`
|
||||
GraphDriver string `json:",omitempty"`
|
||||
RootFS string `json:",omitempty"`
|
||||
Metadata string `json:",omitempty"`
|
||||
|
||||
// Podman extensions
|
||||
Digest digest.Digest `json:",omitempty"`
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/containers/podman/v3/libpod/define"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities/reports"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities/types"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -3,7 +3,7 @@ package entities
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/containers/buildah/imagebuildah"
|
||||
buildahDefine "github.com/containers/buildah/define"
|
||||
"github.com/containers/podman/v3/libpod/events"
|
||||
"github.com/containers/podman/v3/pkg/specgen"
|
||||
"github.com/containers/storage/pkg/archive"
|
||||
@ -91,7 +91,7 @@ type ContainerCreateResponse struct {
|
||||
|
||||
// BuildOptions describe the options for building container images.
|
||||
type BuildOptions struct {
|
||||
imagebuildah.BuildOptions
|
||||
buildahDefine.BuildOptions
|
||||
}
|
||||
|
||||
// BuildReport is the image-build report.
|
||||
|
22
pkg/domain/entities/types/auth.go
Normal file
22
pkg/domain/entities/types/auth.go
Normal file
@ -0,0 +1,22 @@
|
||||
package types // import "github.com/docker/docker/api/types"
|
||||
|
||||
// AuthConfig contains authorization information for connecting to a Registry
|
||||
type AuthConfig struct {
|
||||
Username string `json:"username,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
Auth string `json:"auth,omitempty"`
|
||||
|
||||
// Email is an optional value associated with the username.
|
||||
// This field is deprecated and will be removed in a later
|
||||
// version of docker.
|
||||
Email string `json:"email,omitempty"`
|
||||
|
||||
ServerAddress string `json:"serveraddress,omitempty"`
|
||||
|
||||
// IdentityToken is used to authenticate the user and get
|
||||
// an access token for the registry.
|
||||
IdentityToken string `json:"identitytoken,omitempty"`
|
||||
|
||||
// RegistryToken is a bearer token to be sent to a registry
|
||||
RegistryToken string `json:"registrytoken,omitempty"`
|
||||
}
|
28
pkg/domain/entities/types/types.go
Normal file
28
pkg/domain/entities/types/types.go
Normal file
@ -0,0 +1,28 @@
|
||||
package types // import "github.com/docker/docker/api/types"
|
||||
|
||||
// ComponentVersion describes the version information for a specific component.
|
||||
type ComponentVersion struct {
|
||||
Name string
|
||||
Version string
|
||||
Details map[string]string `json:",omitempty"`
|
||||
}
|
||||
|
||||
// Version contains response of Engine API:
|
||||
// GET "/version"
|
||||
type Version struct {
|
||||
Platform struct{ Name string } `json:",omitempty"`
|
||||
Components []ComponentVersion `json:",omitempty"`
|
||||
|
||||
// The following fields are deprecated, they relate to the Engine component and are kept for backwards compatibility
|
||||
|
||||
Version string
|
||||
APIVersion string `json:"ApiVersion"`
|
||||
MinAPIVersion string `json:"MinAPIVersion,omitempty"`
|
||||
GitCommit string
|
||||
GoVersion string
|
||||
Os string
|
||||
Arch string
|
||||
KernelVersion string `json:",omitempty"`
|
||||
Experimental bool `json:",omitempty"`
|
||||
BuildTime string `json:",omitempty"`
|
||||
}
|
@ -4,10 +4,72 @@ import (
|
||||
"net/url"
|
||||
|
||||
"github.com/containers/podman/v3/libpod/define"
|
||||
docker_api_types "github.com/docker/docker/api/types"
|
||||
docker_api_types_volume "github.com/docker/docker/api/types/volume"
|
||||
)
|
||||
|
||||
// Volume volume
|
||||
// swagger:model Volume
|
||||
type volume struct {
|
||||
|
||||
// Date/Time the volume was created.
|
||||
CreatedAt string `json:"CreatedAt,omitempty"`
|
||||
|
||||
// Name of the volume driver used by the volume.
|
||||
// Required: true
|
||||
Driver string `json:"Driver"`
|
||||
|
||||
// User-defined key/value metadata.
|
||||
// Required: true
|
||||
Labels map[string]string `json:"Labels"`
|
||||
|
||||
// Mount path of the volume on the host.
|
||||
// Required: true
|
||||
Mountpoint string `json:"Mountpoint"`
|
||||
|
||||
// Name of the volume.
|
||||
// Required: true
|
||||
Name string `json:"Name"`
|
||||
|
||||
// The driver specific options used when creating the volume.
|
||||
//
|
||||
// Required: true
|
||||
Options map[string]string `json:"Options"`
|
||||
|
||||
// The level at which the volume exists. Either `global` for cluster-wide,
|
||||
// or `local` for machine level.
|
||||
//
|
||||
// Required: true
|
||||
Scope string `json:"Scope"`
|
||||
|
||||
// Low-level details about the volume, provided by the volume driver.
|
||||
// Details are returned as a map with key/value pairs:
|
||||
// `{"key":"value","key2":"value2"}`.
|
||||
//
|
||||
// The `Status` field is optional, and is omitted if the volume driver
|
||||
// does not support this feature.
|
||||
//
|
||||
Status map[string]interface{} `json:"Status,omitempty"`
|
||||
|
||||
// usage data
|
||||
UsageData *VolumeUsageData `json:"UsageData,omitempty"`
|
||||
}
|
||||
|
||||
type VolumeUsageData struct {
|
||||
|
||||
// The number of containers referencing this volume. This field
|
||||
// is set to `-1` if the reference-count is not available.
|
||||
//
|
||||
// Required: true
|
||||
RefCount int64 `json:"RefCount"`
|
||||
|
||||
// Amount of disk space used by the volume (in bytes). This information
|
||||
// is only available for volumes created with the `"local"` volume
|
||||
// driver. For volumes created with other volume drivers, this field
|
||||
// is set to `-1` ("not available")
|
||||
//
|
||||
// Required: true
|
||||
Size int64 `json:"Size"`
|
||||
}
|
||||
|
||||
// swagger:model VolumeCreate
|
||||
type VolumeCreateOptions struct {
|
||||
// New volume's name. Can be left blank
|
||||
@ -113,14 +175,14 @@ type SwagVolumeListResponse struct {
|
||||
*/
|
||||
|
||||
// swagger:model DockerVolumeCreate
|
||||
type DockerVolumeCreate docker_api_types_volume.VolumeCreateBody
|
||||
type DockerVolumeCreate VolumeCreateBody
|
||||
|
||||
// This response definition is used for both the create and inspect endpoints
|
||||
// swagger:response DockerVolumeInfoResponse
|
||||
type SwagDockerVolumeInfoResponse struct {
|
||||
// in:body
|
||||
Body struct {
|
||||
docker_api_types.Volume
|
||||
volume
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,6 +191,30 @@ type SwagDockerVolumeInfoResponse struct {
|
||||
type SwagDockerVolumePruneResponse struct {
|
||||
// in:body
|
||||
Body struct {
|
||||
docker_api_types.VolumesPruneReport
|
||||
// docker_api_types.VolumesPruneReport
|
||||
}
|
||||
}
|
||||
|
||||
// VolumeCreateBody Volume configuration
|
||||
// swagger:model VolumeCreateBody
|
||||
type VolumeCreateBody struct {
|
||||
|
||||
// Name of the volume driver to use.
|
||||
// Required: true
|
||||
Driver string `json:"Driver"`
|
||||
|
||||
// A mapping of driver options and values. These options are
|
||||
// passed directly to the driver and are driver specific.
|
||||
//
|
||||
// Required: true
|
||||
DriverOpts map[string]string `json:"DriverOpts"`
|
||||
|
||||
// User-defined key/value metadata.
|
||||
// Required: true
|
||||
Labels map[string]string `json:"Labels"`
|
||||
|
||||
// The new volume's name. If not specified, Docker generates a name.
|
||||
//
|
||||
// Required: true
|
||||
Name string `json:"Name"`
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ import (
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/namespaces"
|
||||
"github.com/containers/podman/v3/pkg/rootless"
|
||||
"github.com/containers/storage"
|
||||
"github.com/containers/storage/pkg/idtools"
|
||||
"github.com/containers/storage/types"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
flag "github.com/spf13/pflag"
|
||||
@ -100,7 +100,7 @@ func GetRuntimeNoStore(ctx context.Context, fs *flag.FlagSet, cfg *entities.Podm
|
||||
|
||||
func getRuntime(ctx context.Context, fs *flag.FlagSet, opts *engineOpts) (*libpod.Runtime, error) {
|
||||
options := []libpod.RuntimeOption{}
|
||||
storageOpts := storage.StoreOptions{}
|
||||
storageOpts := types.StoreOptions{}
|
||||
cfg := opts.config
|
||||
|
||||
storageSet := false
|
||||
@ -237,8 +237,8 @@ func getRuntime(ctx context.Context, fs *flag.FlagSet, opts *engineOpts) (*libpo
|
||||
}
|
||||
|
||||
// ParseIDMapping takes idmappings and subuid and subgid maps and returns a storage mapping
|
||||
func ParseIDMapping(mode namespaces.UsernsMode, uidMapSlice, gidMapSlice []string, subUIDMap, subGIDMap string) (*storage.IDMappingOptions, error) {
|
||||
options := storage.IDMappingOptions{
|
||||
func ParseIDMapping(mode namespaces.UsernsMode, uidMapSlice, gidMapSlice []string, subUIDMap, subGIDMap string) (*types.IDMappingOptions, error) {
|
||||
options := types.IDMappingOptions{
|
||||
HostUIDMapping: true,
|
||||
HostGIDMapping: true,
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/containers/storage"
|
||||
"github.com/containers/storage/types"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -109,12 +109,12 @@ func (n UsernsMode) IsDefaultValue() bool {
|
||||
|
||||
// GetAutoOptions returns a AutoUserNsOptions with the settings to setup automatically
|
||||
// a user namespace.
|
||||
func (n UsernsMode) GetAutoOptions() (*storage.AutoUserNsOptions, error) {
|
||||
func (n UsernsMode) GetAutoOptions() (*types.AutoUserNsOptions, error) {
|
||||
parts := strings.SplitN(string(n), ":", 2)
|
||||
if parts[0] != "auto" {
|
||||
return nil, fmt.Errorf("wrong user namespace mode")
|
||||
}
|
||||
options := storage.AutoUserNsOptions{}
|
||||
options := types.AutoUserNsOptions{}
|
||||
if len(parts) == 1 {
|
||||
return &options, nil
|
||||
}
|
||||
@ -131,13 +131,13 @@ func (n UsernsMode) GetAutoOptions() (*storage.AutoUserNsOptions, error) {
|
||||
}
|
||||
options.Size = uint32(s)
|
||||
case "uidmapping":
|
||||
mapping, err := storage.ParseIDMapping([]string{v[1]}, nil, "", "")
|
||||
mapping, err := types.ParseIDMapping([]string{v[1]}, nil, "", "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
options.AdditionalUIDMappings = append(options.AdditionalUIDMappings, mapping.UIDMap...)
|
||||
case "gidmapping":
|
||||
mapping, err := storage.ParseIDMapping(nil, []string{v[1]}, "", "")
|
||||
mapping, err := types.ParseIDMapping(nil, []string{v[1]}, "", "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"github.com/containers/storage"
|
||||
"github.com/containers/storage/pkg/lockfile"
|
||||
"github.com/opencontainers/runc/libcontainer/user"
|
||||
spec "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
@ -25,7 +25,7 @@ func TryJoinPauseProcess(pausePidPath string) (bool, int, error) {
|
||||
}
|
||||
|
||||
// It could not join the pause process, let's lock the file before trying to delete it.
|
||||
pidFileLock, err := storage.GetLockfile(pausePidPath)
|
||||
pidFileLock, err := lockfile.GetLockfile(pausePidPath)
|
||||
if err != nil {
|
||||
// The file was deleted by another process.
|
||||
if os.IsNotExist(err) {
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"github.com/containers/podman/v3/libpod/image"
|
||||
"github.com/containers/podman/v3/pkg/specgen"
|
||||
"github.com/containers/podman/v3/pkg/util"
|
||||
"github.com/containers/storage"
|
||||
"github.com/containers/storage/types"
|
||||
"github.com/opencontainers/selinux/go-selinux/label"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -367,7 +367,7 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen.
|
||||
return options, nil
|
||||
}
|
||||
|
||||
func CreateExitCommandArgs(storageConfig storage.StoreOptions, config *config.Config, syslog, rm, exec bool) ([]string, error) {
|
||||
func CreateExitCommandArgs(storageConfig types.StoreOptions, config *config.Config, syslog, rm, exec bool) ([]string, error) {
|
||||
// We need a cleanup process for containers in the current model.
|
||||
// But we can't assume that the caller is Podman - it could be another
|
||||
// user of the API.
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"syscall"
|
||||
|
||||
"github.com/containers/image/v5/manifest"
|
||||
"github.com/containers/storage"
|
||||
"github.com/containers/storage/types"
|
||||
spec "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@ -302,7 +302,7 @@ type ContainerSecurityConfig struct {
|
||||
// IDMappings are UID and GID mappings that will be used by user
|
||||
// namespaces.
|
||||
// Required if UserNS is private.
|
||||
IDMappings *storage.IDMappingOptions `json:"idmappings,omitempty"`
|
||||
IDMappings *types.IDMappingOptions `json:"idmappings,omitempty"`
|
||||
// ReadOnlyFilesystem indicates that everything will be mounted
|
||||
// as read-only
|
||||
ReadOnlyFilesystem bool `json:"read_only_filesystem,omitempty"`
|
||||
|
@ -20,8 +20,8 @@ import (
|
||||
"github.com/containers/podman/v3/pkg/namespaces"
|
||||
"github.com/containers/podman/v3/pkg/rootless"
|
||||
"github.com/containers/podman/v3/pkg/signal"
|
||||
"github.com/containers/storage"
|
||||
"github.com/containers/storage/pkg/idtools"
|
||||
stypes "github.com/containers/storage/types"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
@ -344,8 +344,8 @@ func ParseSignal(rawSignal string) (syscall.Signal, error) {
|
||||
}
|
||||
|
||||
// GetKeepIDMapping returns the mappings and the user to use when keep-id is used
|
||||
func GetKeepIDMapping() (*storage.IDMappingOptions, int, int, error) {
|
||||
options := storage.IDMappingOptions{
|
||||
func GetKeepIDMapping() (*stypes.IDMappingOptions, int, int, error) {
|
||||
options := stypes.IDMappingOptions{
|
||||
HostUIDMapping: true,
|
||||
HostGIDMapping: true,
|
||||
}
|
||||
@ -395,8 +395,8 @@ func GetKeepIDMapping() (*storage.IDMappingOptions, int, int, error) {
|
||||
}
|
||||
|
||||
// ParseIDMapping takes idmappings and subuid and subgid maps and returns a storage mapping
|
||||
func ParseIDMapping(mode namespaces.UsernsMode, uidMapSlice, gidMapSlice []string, subUIDMap, subGIDMap string) (*storage.IDMappingOptions, error) {
|
||||
options := storage.IDMappingOptions{
|
||||
func ParseIDMapping(mode namespaces.UsernsMode, uidMapSlice, gidMapSlice []string, subUIDMap, subGIDMap string) (*stypes.IDMappingOptions, error) {
|
||||
options := stypes.IDMappingOptions{
|
||||
HostUIDMapping: true,
|
||||
HostGIDMapping: true,
|
||||
}
|
||||
@ -479,7 +479,7 @@ type tomlConfig struct {
|
||||
} `toml:"storage"`
|
||||
}
|
||||
|
||||
func getTomlStorage(storeOptions *storage.StoreOptions) *tomlConfig {
|
||||
func getTomlStorage(storeOptions *stypes.StoreOptions) *tomlConfig {
|
||||
config := new(tomlConfig)
|
||||
|
||||
config.Storage.Driver = storeOptions.GraphDriverName
|
||||
@ -496,7 +496,7 @@ func getTomlStorage(storeOptions *storage.StoreOptions) *tomlConfig {
|
||||
}
|
||||
|
||||
// WriteStorageConfigFile writes the configuration to a file
|
||||
func WriteStorageConfigFile(storageOpts *storage.StoreOptions, storageConf string) error {
|
||||
func WriteStorageConfigFile(storageOpts *stypes.StoreOptions, storageConf string) error {
|
||||
if err := os.MkdirAll(filepath.Dir(storageConf), 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user