summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/ping.go4
-rw-r--r--pkg/api/handlers/compat/version.go8
-rw-r--r--pkg/api/handlers/utils/handler.go4
-rw-r--r--pkg/api/server/handler_api.go4
-rw-r--r--pkg/api/server/register_archive.go6
-rw-r--r--pkg/specgen/generate/container_create.go2
-rw-r--r--pkg/specgen/specgen.go3
7 files changed, 20 insertions, 11 deletions
diff --git a/pkg/api/handlers/compat/ping.go b/pkg/api/handlers/compat/ping.go
index eb7eed5b6..06150bb63 100644
--- a/pkg/api/handlers/compat/ping.go
+++ b/pkg/api/handlers/compat/ping.go
@@ -5,7 +5,6 @@ import (
"net/http"
"github.com/containers/buildah"
- "github.com/containers/podman/v2/pkg/api/handlers/utils"
)
// Ping returns headers to client about the service
@@ -14,13 +13,12 @@ import (
// Clients will use the Header availability to test which backend engine is in use.
// Note: Additionally handler supports GET and HEAD methods
func Ping(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("API-Version", utils.APIVersion[utils.CompatTree][utils.CurrentAPIVersion].String())
+ // Note API-Version and Libpod-API-Version are set in handler_api.go
w.Header().Set("BuildKit-Version", "")
w.Header().Set("Docker-Experimental", "true")
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Pragma", "no-cache")
- w.Header().Set("Libpod-API-Version", utils.APIVersion[utils.LibpodTree][utils.CurrentAPIVersion].String())
w.Header().Set("Libpod-Buildha-Version", buildah.Version)
w.WriteHeader(http.StatusOK)
diff --git a/pkg/api/handlers/compat/version.go b/pkg/api/handlers/compat/version.go
index e12c7cefa..92900b75d 100644
--- a/pkg/api/handlers/compat/version.go
+++ b/pkg/api/handlers/compat/version.go
@@ -30,6 +30,7 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "Failed to obtain system memory info"))
return
}
+
components := []docker.ComponentVersion{{
Name: "Podman Engine",
Version: versionInfo.Version,
@@ -46,6 +47,9 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) {
},
}}
+ apiVersion := utils.APIVersion[utils.CompatTree][utils.CurrentAPIVersion]
+ minVersion := utils.APIVersion[utils.CompatTree][utils.MinimalAPIVersion]
+
utils.WriteResponse(w, http.StatusOK, entities.ComponentVersion{
Version: docker.Version{
Platform: struct {
@@ -53,7 +57,7 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) {
}{
Name: fmt.Sprintf("%s/%s/%s-%s", goRuntime.GOOS, goRuntime.GOARCH, infoData.Host.Distribution.Distribution, infoData.Host.Distribution.Version),
},
- APIVersion: components[0].Details["APIVersion"],
+ APIVersion: fmt.Sprintf("%d.%d", apiVersion.Major, apiVersion.Minor),
Arch: components[0].Details["Arch"],
BuildTime: components[0].Details["BuildTime"],
Components: components,
@@ -61,7 +65,7 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) {
GitCommit: components[0].Details["GitCommit"],
GoVersion: components[0].Details["GoVersion"],
KernelVersion: components[0].Details["KernelVersion"],
- MinAPIVersion: components[0].Details["MinAPIVersion"],
+ MinAPIVersion: fmt.Sprintf("%d.%d", minVersion.Major, minVersion.Minor),
Os: components[0].Details["Os"],
Version: components[0].Version,
}})
diff --git a/pkg/api/handlers/utils/handler.go b/pkg/api/handlers/utils/handler.go
index 62fdc05dd..517dccad0 100644
--- a/pkg/api/handlers/utils/handler.go
+++ b/pkg/api/handlers/utils/handler.go
@@ -43,8 +43,8 @@ var (
// clients to shop for the Version they wish to support
APIVersion = map[VersionTree]map[VersionLevel]semver.Version{
LibpodTree: {
- CurrentAPIVersion: semver.MustParse("1.0.0"),
- MinimalAPIVersion: semver.MustParse("1.0.0"),
+ CurrentAPIVersion: semver.MustParse("2.0.0"),
+ MinimalAPIVersion: semver.MustParse("2.0.0"),
},
CompatTree: {
CurrentAPIVersion: semver.MustParse("1.40.0"),
diff --git a/pkg/api/server/handler_api.go b/pkg/api/server/handler_api.go
index e47b66bb4..f2ce0301b 100644
--- a/pkg/api/server/handler_api.go
+++ b/pkg/api/server/handler_api.go
@@ -40,6 +40,10 @@ func (s *APIServer) APIHandler(h http.HandlerFunc) http.HandlerFunc {
c = context.WithValue(c, "idletracker", s.idleTracker) //nolint
r = r.WithContext(c)
+ v := utils.APIVersion[utils.CompatTree][utils.CurrentAPIVersion]
+ w.Header().Set("API-Version", fmt.Sprintf("%d.%d", v.Major, v.Minor))
+ w.Header().Set("Libpod-API-Version", utils.APIVersion[utils.LibpodTree][utils.CurrentAPIVersion].String())
+
h(w, r)
}
fn(w, r)
diff --git a/pkg/api/server/register_archive.go b/pkg/api/server/register_archive.go
index 5931c2fc9..b2d2543c4 100644
--- a/pkg/api/server/register_archive.go
+++ b/pkg/api/server/register_archive.go
@@ -9,7 +9,7 @@ import (
)
func (s *APIServer) registerAchiveHandlers(r *mux.Router) error {
- // swagger:operation POST /containers/{name}/archive compat putArchive
+ // swagger:operation PUT /containers/{name}/archive compat putArchive
// ---
// summary: Put files into a container
// description: Put a tar archive of files into a container
@@ -84,9 +84,9 @@ func (s *APIServer) registerAchiveHandlers(r *mux.Router) error {
// $ref: "#/responses/NoSuchContainer"
// 500:
// $ref: "#/responses/InternalError"
- r.HandleFunc(VersionedPath("/containers/{name}/archive"), s.APIHandler(compat.Archive)).Methods(http.MethodGet, http.MethodPost)
+ r.HandleFunc(VersionedPath("/containers/{name}/archive"), s.APIHandler(compat.Archive)).Methods(http.MethodGet, http.MethodPut, http.MethodHead)
// Added non version path to URI to support docker non versioned paths
- r.HandleFunc("/containers/{name}/archive", s.APIHandler(compat.Archive)).Methods(http.MethodGet, http.MethodPost)
+ r.HandleFunc("/containers/{name}/archive", s.APIHandler(compat.Archive)).Methods(http.MethodGet, http.MethodPut, http.MethodHead)
/*
Libpod
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index fda4c098c..2ac3b376f 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -95,7 +95,7 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener
if len(names) > 0 {
imgName = names[0]
}
- options = append(options, libpod.WithRootFSFromImage(newImage.ID(), imgName, s.Image))
+ options = append(options, libpod.WithRootFSFromImage(newImage.ID(), imgName, s.RawImageName))
}
if err := s.Validate(); err != nil {
return nil, errors.Wrap(err, "invalid config provided")
diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go
index cca05eddb..b8f37ec7a 100644
--- a/pkg/specgen/specgen.go
+++ b/pkg/specgen/specgen.go
@@ -89,6 +89,9 @@ type ContainerBasicConfig struct {
// If not given, a default location will be used.
// Optional.
ConmonPidFile string `json:"conmon_pid_file,omitempty"`
+ // RawImageName is the user-specified and unprocessed input referring
+ // to a local or a remote image.
+ RawImageName string `json:"raw_image_name,omitempty"`
// RestartPolicy is the container's restart policy - an action which
// will be taken when the container exits.
// If not given, the default policy, which does nothing, will be used.