-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Disallow outdated API versions #1741
Disallow outdated API versions #1741
Conversation
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>=
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks!
e616452
to
6aec9b3
Compare
LGTM we already say in the doc that swarm requires engine 1.6.0 or higher, let's enforce it in the API too. |
ping @dongluochen |
I think we should update samalba/dockerclient APIVersion first since it's still at 1.15. Later we can enforce it.
|
@dongluochen you are right, I moved it to the 1.2.0 milestone |
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
6aec9b3
to
10dce07
Compare
@dongluochen thanks for pointing that out. I'm looking into |
@nishanttotla Yes we should bump version in |
Adding dependency #1879 |
Closing this PR, it's outdated. |
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.