Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Disallow outdated API versions #1741

Closed

Conversation

nishanttotla
Copy link
Contributor

Fixes #1733. Disallows outdated API versions using a MINAPIVERSION field that tracks the oldest engine version supported (in this case 1.18 corresponding to engine version 1.6.x). Also bumping up APIVERSION to 1.22 for the 1.1.0 release.

Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
@nishanttotla
Copy link
Contributor Author

ping @vieux @dongluochen

@@ -137,6 +139,15 @@ func NewPrimary(cluster cluster.Cluster, tlsConfig *tls.Config, status StatusHan
return r
}

func versionCheckMiddleware(c *context, w http.ResponseWriter, r *http.Request, handlerFunc handler) {
if c.apiVersion != "" && versionpkg.Version(c.apiVersion).LessThan(MINAPIVERSION) {
httpError(w, fmt.Sprintf("API Version %s is too old. Supported versions > %s.", c.apiVersion, MINAPIVERSION), http.StatusBadRequest)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>= ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks!

@nishanttotla nishanttotla force-pushed the 1733-UpdateAPIVersion branch 2 times, most recently from e616452 to 6aec9b3 Compare February 3, 2016 02:13
@vieux
Copy link
Contributor

vieux commented Feb 3, 2016

LGTM we already say in the doc that swarm requires engine 1.6.0 or higher, let's enforce it in the API too.

@vieux
Copy link
Contributor

vieux commented Feb 3, 2016

ping @dongluochen

@dongluochen
Copy link
Contributor

I think we should update samalba/dockerclient APIVersion first since it's still at 1.15. Later we can enforce it.

dchen@vm2:~/go/src/github.com/samalba/dockerclient$ grep -irnw . -e "apiversion" --include=\*.go
./dockerclient.go:20:   APIVersion = "v1.15"

@vieux vieux modified the milestones: 1.2.0, 1.1.0 Feb 3, 2016
@vieux
Copy link
Contributor

vieux commented Feb 3, 2016

@dongluochen you are right, I moved it to the 1.2.0 milestone

Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
@nishanttotla
Copy link
Contributor Author

@dongluochen thanks for pointing that out. I'm looking into samalba/dockerclient, and it seems like it's as simple as bumping up APIVersion. Whether or not this PR is merged before the release, shouldn't we have bump version in dockerclient too?

@dongluochen
Copy link
Contributor

@nishanttotla Yes we should bump version in samalba/dockerclient first, in case external users are using it. After some time we can set appropriate minimum API version in swarm.

@nishanttotla nishanttotla changed the title Disallow outdated API versions and update latest Disallow outdated API versions Feb 3, 2016
@nishanttotla
Copy link
Contributor Author

Adding dependency #1879

@dongluochen dongluochen modified the milestones: 1.3.0, 1.2.0 Mar 23, 2016
@dongluochen dongluochen modified the milestones: 1.2.6, 1.2.5 Aug 11, 2016
@nishanttotla nishanttotla modified the milestones: 1.2.7, 1.2.6 Nov 28, 2016
@nishanttotla
Copy link
Contributor Author

Closing this PR, it's outdated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants