mirror of
https://github.com/containers/podman.git
synced 2025-07-04 01:48:28 +08:00
Remove containers/common/pkg/config from pkg/util
Probably has to wait for V6 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -3,7 +3,6 @@ package containers
|
|||||||
import (
|
import (
|
||||||
"github.com/containers/podman/v5/cmd/podman/registry"
|
"github.com/containers/podman/v5/cmd/podman/registry"
|
||||||
"github.com/containers/podman/v5/cmd/podman/validate"
|
"github.com/containers/podman/v5/cmd/podman/validate"
|
||||||
"github.com/containers/podman/v5/pkg/util"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ var (
|
|||||||
RunE: validate.SubCommandExists,
|
RunE: validate.SubCommandExists,
|
||||||
}
|
}
|
||||||
|
|
||||||
containerConfig = util.DefaultContainerConfig()
|
containerConfig = registry.PodmanConfig().ContainersConfDefaultsRO
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -3,7 +3,6 @@ package generate
|
|||||||
import (
|
import (
|
||||||
"github.com/containers/podman/v5/cmd/podman/registry"
|
"github.com/containers/podman/v5/cmd/podman/registry"
|
||||||
"github.com/containers/podman/v5/cmd/podman/validate"
|
"github.com/containers/podman/v5/cmd/podman/validate"
|
||||||
"github.com/containers/podman/v5/pkg/util"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -15,7 +14,7 @@ var (
|
|||||||
Long: "Generate structured data (e.g., Kubernetes YAML or systemd units) based on containers, pods or volumes.",
|
Long: "Generate structured data (e.g., Kubernetes YAML or systemd units) based on containers, pods or volumes.",
|
||||||
RunE: validate.SubCommandExists,
|
RunE: validate.SubCommandExists,
|
||||||
}
|
}
|
||||||
containerConfig = util.DefaultContainerConfig()
|
containerConfig = registry.PodmanConfig().ContainersConfDefaultsRO
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -74,7 +74,7 @@ func load(cmd *cobra.Command, args []string) error {
|
|||||||
if len(loadOpts.Input) > 0 {
|
if len(loadOpts.Input) > 0 {
|
||||||
// Download the input file if needed.
|
// Download the input file if needed.
|
||||||
if strings.HasPrefix(loadOpts.Input, "https://") || strings.HasPrefix(loadOpts.Input, "http://") {
|
if strings.HasPrefix(loadOpts.Input, "https://") || strings.HasPrefix(loadOpts.Input, "http://") {
|
||||||
tmpdir, err := util.DefaultContainerConfig().ImageCopyTmpDir()
|
tmpdir, err := registry.PodmanConfig().ContainersConfDefaultsRO.ImageCopyTmpDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package network
|
|||||||
import (
|
import (
|
||||||
"github.com/containers/podman/v5/cmd/podman/registry"
|
"github.com/containers/podman/v5/cmd/podman/registry"
|
||||||
"github.com/containers/podman/v5/cmd/podman/validate"
|
"github.com/containers/podman/v5/cmd/podman/validate"
|
||||||
"github.com/containers/podman/v5/pkg/util"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ var (
|
|||||||
Long: "Manage networks",
|
Long: "Manage networks",
|
||||||
RunE: validate.SubCommandExists,
|
RunE: validate.SubCommandExists,
|
||||||
}
|
}
|
||||||
containerConfig = util.DefaultContainerConfig()
|
containerConfig = registry.PodmanConfig().ContainersConfDefaultsRO
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -3,7 +3,6 @@ package pods
|
|||||||
import (
|
import (
|
||||||
"github.com/containers/podman/v5/cmd/podman/registry"
|
"github.com/containers/podman/v5/cmd/podman/registry"
|
||||||
"github.com/containers/podman/v5/cmd/podman/validate"
|
"github.com/containers/podman/v5/cmd/podman/validate"
|
||||||
"github.com/containers/podman/v5/pkg/util"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ var (
|
|||||||
Long: "Pods are a group of one or more containers sharing the same network, pid and ipc namespaces.",
|
Long: "Pods are a group of one or more containers sharing the same network, pid and ipc namespaces.",
|
||||||
RunE: validate.SubCommandExists,
|
RunE: validate.SubCommandExists,
|
||||||
}
|
}
|
||||||
containerConfig = util.DefaultContainerConfig()
|
containerConfig = registry.PodmanConfig().ContainersConfDefaultsRO
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -3,7 +3,6 @@ package volumes
|
|||||||
import (
|
import (
|
||||||
"github.com/containers/podman/v5/cmd/podman/registry"
|
"github.com/containers/podman/v5/cmd/podman/registry"
|
||||||
"github.com/containers/podman/v5/cmd/podman/validate"
|
"github.com/containers/podman/v5/cmd/podman/validate"
|
||||||
"github.com/containers/podman/v5/pkg/util"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ var (
|
|||||||
Long: "Volumes are created in and can be shared between containers",
|
Long: "Volumes are created in and can be shared between containers",
|
||||||
RunE: validate.SubCommandExists,
|
RunE: validate.SubCommandExists,
|
||||||
}
|
}
|
||||||
containerConfig = util.DefaultContainerConfig()
|
containerConfig = registry.PodmanConfig().ContainersConfDefaultsRO
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -507,6 +507,11 @@ func (p *Pod) podWithContainers(ctx context.Context, containers []*Container, po
|
|||||||
stopTimeout *uint
|
stopTimeout *uint
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cfg, err := config.Default()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// Let's sort the containers in order of created time
|
// Let's sort the containers in order of created time
|
||||||
// This will ensure that the init containers are defined in the correct order in the kube yaml
|
// This will ensure that the init containers are defined in the correct order in the kube yaml
|
||||||
sort.Slice(containers, func(i, j int) bool { return containers[i].CreatedTime().Before(containers[j].CreatedTime()) })
|
sort.Slice(containers, func(i, j int) bool { return containers[i].CreatedTime().Before(containers[j].CreatedTime()) })
|
||||||
@ -560,7 +565,7 @@ func (p *Pod) podWithContainers(ctx context.Context, containers []*Container, po
|
|||||||
|
|
||||||
// Pick the first container that has a stop-timeout set and use that value
|
// Pick the first container that has a stop-timeout set and use that value
|
||||||
// Ignore podman's default
|
// Ignore podman's default
|
||||||
if ctr.config.StopTimeout != util.DefaultContainerConfig().Engine.StopTimeout && stopTimeout == nil {
|
if ctr.config.StopTimeout != cfg.Engine.StopTimeout && stopTimeout == nil {
|
||||||
stopTimeout = &ctr.config.StopTimeout
|
stopTimeout = &ctr.config.StopTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -666,6 +671,11 @@ func newPodObject(podName string, annotations map[string]string, initCtrs, conta
|
|||||||
// simplePodWithV1Containers is a function used by inspect when kube yaml needs to be generated
|
// simplePodWithV1Containers is a function used by inspect when kube yaml needs to be generated
|
||||||
// for a single container. we "insert" that container description in a pod.
|
// for a single container. we "insert" that container description in a pod.
|
||||||
func simplePodWithV1Containers(ctx context.Context, ctrs []*Container, getService, podmanOnly bool) (*v1.Pod, error) {
|
func simplePodWithV1Containers(ctx context.Context, ctrs []*Container, getService, podmanOnly bool) (*v1.Pod, error) {
|
||||||
|
cfg, err := config.Default()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
kubeCtrs := make([]v1.Container, 0, len(ctrs))
|
kubeCtrs := make([]v1.Container, 0, len(ctrs))
|
||||||
kubeInitCtrs := []v1.Container{}
|
kubeInitCtrs := []v1.Container{}
|
||||||
kubeVolumes := make([]v1.Volume, 0)
|
kubeVolumes := make([]v1.Volume, 0)
|
||||||
@ -705,7 +715,7 @@ func simplePodWithV1Containers(ctx context.Context, ctrs []*Container, getServic
|
|||||||
|
|
||||||
// Pick the first container that has a stop-timeout set and use that value
|
// Pick the first container that has a stop-timeout set and use that value
|
||||||
// Ignore podman's default
|
// Ignore podman's default
|
||||||
if ctr.config.StopTimeout != util.DefaultContainerConfig().Engine.StopTimeout && stopTimeout == nil {
|
if ctr.config.StopTimeout != cfg.Engine.StopTimeout && stopTimeout == nil {
|
||||||
stopTimeout = &ctr.config.StopTimeout
|
stopTimeout = &ctr.config.StopTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -716,7 +726,7 @@ func simplePodWithV1Containers(ctx context.Context, ctrs []*Container, getServic
|
|||||||
|
|
||||||
if ctr.config.Spec.Process != nil {
|
if ctr.config.Spec.Process != nil {
|
||||||
var ulimitArr []string
|
var ulimitArr []string
|
||||||
defaultUlimits := util.DefaultContainerConfig().Ulimits()
|
defaultUlimits := cfg.Ulimits()
|
||||||
for _, ulimit := range ctr.config.Spec.Process.Rlimits {
|
for _, ulimit := range ctr.config.Spec.Process.Rlimits {
|
||||||
finalUlimit := strings.ToLower(strings.ReplaceAll(ulimit.Type, "RLIMIT_", "")) + "=" + strconv.Itoa(int(ulimit.Soft)) + ":" + strconv.Itoa(int(ulimit.Hard))
|
finalUlimit := strings.ToLower(strings.ReplaceAll(ulimit.Type, "RLIMIT_", "")) + "=" + strconv.Itoa(int(ulimit.Soft)) + ":" + strconv.Itoa(int(ulimit.Hard))
|
||||||
// compare ulimit with default list so we don't add it twice
|
// compare ulimit with default list so we don't add it twice
|
||||||
|
@ -643,7 +643,10 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
|||||||
AuthFilePath: authfile,
|
AuthFilePath: authfile,
|
||||||
DockerAuthConfig: creds,
|
DockerAuthConfig: creds,
|
||||||
}
|
}
|
||||||
utils.PossiblyEnforceDockerHub(r, systemContext)
|
if err := utils.PossiblyEnforceDockerHub(r, systemContext); err != nil {
|
||||||
|
utils.Error(w, http.StatusInternalServerError, fmt.Errorf("checking to enforce DockerHub: %w", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if _, found := r.URL.Query()["tlsVerify"]; found {
|
if _, found := r.URL.Query()["tlsVerify"]; found {
|
||||||
systemContext.DockerInsecureSkipTLSVerify = types.NewOptionalBool(!query.TLSVerify)
|
systemContext.DockerInsecureSkipTLSVerify = types.NewOptionalBool(!query.TLSVerify)
|
||||||
|
@ -6,18 +6,24 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/containers/common/pkg/config"
|
||||||
"github.com/containers/podman/v5/libpod"
|
"github.com/containers/podman/v5/libpod"
|
||||||
"github.com/containers/podman/v5/pkg/api/handlers/utils"
|
"github.com/containers/podman/v5/pkg/api/handlers/utils"
|
||||||
api "github.com/containers/podman/v5/pkg/api/types"
|
api "github.com/containers/podman/v5/pkg/api/types"
|
||||||
"github.com/containers/podman/v5/pkg/domain/entities"
|
"github.com/containers/podman/v5/pkg/domain/entities"
|
||||||
"github.com/containers/podman/v5/pkg/domain/infra/abi"
|
"github.com/containers/podman/v5/pkg/domain/infra/abi"
|
||||||
"github.com/containers/podman/v5/pkg/util"
|
|
||||||
"github.com/gorilla/schema"
|
"github.com/gorilla/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GenerateSystemd(w http.ResponseWriter, r *http.Request) {
|
func GenerateSystemd(w http.ResponseWriter, r *http.Request) {
|
||||||
runtime := r.Context().Value(api.RuntimeKey).(*libpod.Runtime)
|
runtime := r.Context().Value(api.RuntimeKey).(*libpod.Runtime)
|
||||||
decoder := r.Context().Value(api.DecoderKey).(*schema.Decoder)
|
decoder := r.Context().Value(api.DecoderKey).(*schema.Decoder)
|
||||||
|
cfg, err := config.Default()
|
||||||
|
if err != nil {
|
||||||
|
utils.Error(w, http.StatusInternalServerError, fmt.Errorf("reading containers.conf: %w", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
query := struct {
|
query := struct {
|
||||||
Name bool `schema:"useName"`
|
Name bool `schema:"useName"`
|
||||||
New bool `schema:"new"`
|
New bool `schema:"new"`
|
||||||
@ -36,7 +42,7 @@ func GenerateSystemd(w http.ResponseWriter, r *http.Request) {
|
|||||||
AdditionalEnvVariables []string `schema:"additionalEnvVariables"`
|
AdditionalEnvVariables []string `schema:"additionalEnvVariables"`
|
||||||
}{
|
}{
|
||||||
StartTimeout: 0,
|
StartTimeout: 0,
|
||||||
StopTimeout: util.DefaultContainerConfig().Engine.StopTimeout,
|
StopTimeout: cfg.Engine.StopTimeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||||
|
@ -19,7 +19,6 @@ import (
|
|||||||
"github.com/containers/podman/v5/libpod"
|
"github.com/containers/podman/v5/libpod"
|
||||||
api "github.com/containers/podman/v5/pkg/api/types"
|
api "github.com/containers/podman/v5/pkg/api/types"
|
||||||
"github.com/containers/podman/v5/pkg/errorhandling"
|
"github.com/containers/podman/v5/pkg/errorhandling"
|
||||||
"github.com/containers/podman/v5/pkg/util"
|
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/docker/distribution/registry/api/errcode"
|
"github.com/docker/distribution/registry/api/errcode"
|
||||||
"github.com/docker/docker/pkg/jsonmessage"
|
"github.com/docker/docker/pkg/jsonmessage"
|
||||||
@ -30,7 +29,11 @@ import (
|
|||||||
// request is for the compat API and if containers.conf set the specific mode.
|
// request is for the compat API and if containers.conf set the specific mode.
|
||||||
// If nameOrID is a (short) ID for a local image, the full ID will be returned.
|
// If nameOrID is a (short) ID for a local image, the full ID will be returned.
|
||||||
func NormalizeToDockerHub(r *http.Request, nameOrID string) (string, error) {
|
func NormalizeToDockerHub(r *http.Request, nameOrID string) (string, error) {
|
||||||
if IsLibpodRequest(r) || !util.DefaultContainerConfig().Engine.CompatAPIEnforceDockerHub {
|
cfg, err := config.Default()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
if IsLibpodRequest(r) || !cfg.Engine.CompatAPIEnforceDockerHub {
|
||||||
return nameOrID, nil
|
return nameOrID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,11 +65,16 @@ func NormalizeToDockerHub(r *http.Request, nameOrID string) (string, error) {
|
|||||||
// PossiblyEnforceDockerHub sets fields in the system context to enforce
|
// PossiblyEnforceDockerHub sets fields in the system context to enforce
|
||||||
// resolving short names to Docker Hub if the request is for the compat API and
|
// resolving short names to Docker Hub if the request is for the compat API and
|
||||||
// if containers.conf set the specific mode.
|
// if containers.conf set the specific mode.
|
||||||
func PossiblyEnforceDockerHub(r *http.Request, sys *types.SystemContext) {
|
func PossiblyEnforceDockerHub(r *http.Request, sys *types.SystemContext) error {
|
||||||
if IsLibpodRequest(r) || !util.DefaultContainerConfig().Engine.CompatAPIEnforceDockerHub {
|
cfg, err := config.Default()
|
||||||
return
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if IsLibpodRequest(r) || !cfg.Engine.CompatAPIEnforceDockerHub {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
sys.PodmanOnlyShortNamesIgnoreRegistriesConfAndForceDockerHub = true
|
sys.PodmanOnlyShortNamesIgnoreRegistriesConfAndForceDockerHub = true
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsRegistryReference checks if the specified name points to the "docker://"
|
// IsRegistryReference checks if the specified name points to the "docker://"
|
||||||
|
@ -550,6 +550,11 @@ func (ic *ContainerEngine) playKubeDeployment(ctx context.Context, deploymentYAM
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podYAML *v1.PodTemplateSpec, options entities.PlayKubeOptions, ipIndex *int, annotations map[string]string, configMaps []v1.ConfigMap, serviceContainer *libpod.Container) (*entities.PlayKubeReport, []*notifyproxy.NotifyProxy, error) {
|
func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podYAML *v1.PodTemplateSpec, options entities.PlayKubeOptions, ipIndex *int, annotations map[string]string, configMaps []v1.ConfigMap, serviceContainer *libpod.Container) (*entities.PlayKubeReport, []*notifyproxy.NotifyProxy, error) {
|
||||||
|
cfg, err := ic.Libpod.GetConfigNoCopy()
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
writer io.Writer
|
writer io.Writer
|
||||||
playKubePod entities.PlayKubePod
|
playKubePod entities.PlayKubePod
|
||||||
@ -777,7 +782,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
|
|||||||
}
|
}
|
||||||
|
|
||||||
if podOpt.Infra {
|
if podOpt.Infra {
|
||||||
infraImage := util.DefaultContainerConfig().Engine.InfraImage
|
infraImage := cfg.Engine.InfraImage
|
||||||
infraOptions := entities.NewInfraContainerCreateOptions()
|
infraOptions := entities.NewInfraContainerCreateOptions()
|
||||||
infraOptions.Hostname = podSpec.PodSpecGen.PodBasicConfig.Hostname
|
infraOptions.Hostname = podSpec.PodSpecGen.PodBasicConfig.Hostname
|
||||||
infraOptions.ReadOnly = true
|
infraOptions.ReadOnly = true
|
||||||
@ -850,11 +855,6 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg, err := ic.Libpod.GetConfigNoCopy()
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var readOnly types.OptionalBool
|
var readOnly types.OptionalBool
|
||||||
if cfg.Containers.ReadOnly {
|
if cfg.Containers.ReadOnly {
|
||||||
readOnly = types.NewOptionalBool(cfg.Containers.ReadOnly)
|
readOnly = types.NewOptionalBool(cfg.Containers.ReadOnly)
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containers/common/libnetwork/types"
|
"github.com/containers/common/libnetwork/types"
|
||||||
"github.com/containers/common/pkg/cgroups"
|
"github.com/containers/common/pkg/cgroups"
|
||||||
|
"github.com/containers/common/pkg/config"
|
||||||
"github.com/containers/podman/v5/libpod/define"
|
"github.com/containers/podman/v5/libpod/define"
|
||||||
"github.com/containers/podman/v5/pkg/namespaces"
|
"github.com/containers/podman/v5/pkg/namespaces"
|
||||||
"github.com/containers/podman/v5/pkg/rootless"
|
"github.com/containers/podman/v5/pkg/rootless"
|
||||||
@ -328,14 +329,18 @@ func ParseUserNamespace(ns string) (Namespace, error) {
|
|||||||
// If the input is nil or empty it will use the default setting from containers.conf
|
// If the input is nil or empty it will use the default setting from containers.conf
|
||||||
func ParseNetworkFlag(networks []string) (Namespace, map[string]types.PerNetworkOptions, map[string][]string, error) {
|
func ParseNetworkFlag(networks []string) (Namespace, map[string]types.PerNetworkOptions, map[string][]string, error) {
|
||||||
var networkOptions map[string][]string
|
var networkOptions map[string][]string
|
||||||
|
toReturn := Namespace{}
|
||||||
// by default we try to use the containers.conf setting
|
// by default we try to use the containers.conf setting
|
||||||
// if we get at least one value use this instead
|
// if we get at least one value use this instead
|
||||||
ns := containerConfig.Containers.NetNS
|
cfg, err := config.Default()
|
||||||
|
if err != nil {
|
||||||
|
return toReturn, nil, nil, err
|
||||||
|
}
|
||||||
|
ns := cfg.Containers.NetNS
|
||||||
if len(networks) > 0 {
|
if len(networks) > 0 {
|
||||||
ns = networks[0]
|
ns = networks[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
toReturn := Namespace{}
|
|
||||||
podmanNetworks := make(map[string]types.PerNetworkOptions)
|
podmanNetworks := make(map[string]types.PerNetworkOptions)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
@ -3,15 +3,12 @@ package specgen
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/containers/podman/v5/pkg/util"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// ErrInvalidPodSpecConfig describes an error given when the podspecgenerator is invalid
|
// ErrInvalidPodSpecConfig describes an error given when the podspecgenerator is invalid
|
||||||
ErrInvalidPodSpecConfig = errors.New("invalid pod spec")
|
ErrInvalidPodSpecConfig = errors.New("invalid pod spec")
|
||||||
// containerConfig has the default configurations defined in containers.conf
|
// containerConfig has the default configurations defined in containers.conf
|
||||||
containerConfig = util.DefaultContainerConfig()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func exclusivePodOptions(opt1, opt2 string) error {
|
func exclusivePodOptions(opt1, opt2 string) error {
|
||||||
|
@ -17,7 +17,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
"github.com/containers/common/pkg/config"
|
|
||||||
"github.com/containers/image/v5/types"
|
"github.com/containers/image/v5/types"
|
||||||
"github.com/containers/podman/v5/libpod/define"
|
"github.com/containers/podman/v5/libpod/define"
|
||||||
"github.com/containers/podman/v5/pkg/errorhandling"
|
"github.com/containers/podman/v5/pkg/errorhandling"
|
||||||
@ -43,17 +42,6 @@ type idMapFlags struct {
|
|||||||
GroupMap bool // The "g" flag
|
GroupMap bool // The "g" flag
|
||||||
}
|
}
|
||||||
|
|
||||||
var containerConfig *config.Config
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
var err error
|
|
||||||
containerConfig, err = config.Default()
|
|
||||||
if err != nil {
|
|
||||||
logrus.Error(err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to determine the username/password passed
|
// Helper function to determine the username/password passed
|
||||||
// in the creds string. It could be either or both.
|
// in the creds string. It could be either or both.
|
||||||
func parseCreds(creds string) (string, string) {
|
func parseCreds(creds string) (string, string) {
|
||||||
@ -1225,10 +1213,6 @@ func ValidateSysctls(strSlice []string) (map[string]string, error) {
|
|||||||
return sysctl, nil
|
return sysctl, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func DefaultContainerConfig() *config.Config {
|
|
||||||
return containerConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreateIDFile(path string, id string) error {
|
func CreateIDFile(path string, id string) error {
|
||||||
idFile, err := os.Create(path)
|
idFile, err := os.Create(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user