Bugfix: Fix RFC-1123 hostname string validation for ensembler names #257
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR
Problem: Users create ensembler names with underscores -> Invalid Kaniko job names -> Invalid K8s jobs -> Router deployments fail
Solution: Add additional API checks to block usage of underscores -> Discovery of bug in existing
go-validator
validation tag to validate ensembler names -> Updatego-validator
-> DoneContext
Pyfunc ensemblers are built as a web service and containerised into a single image upon being deployed as part of a router deployment. This image building process takes place in Kaniko builders run as jobs on a Kubernetes cluster. The Turing API names these jobs automatically, in a way which incorporates the user-registered name of the ensemblers to be built:
where the method
generateBuilderName
is given by:Errors thus occur when users define their ensembler names with underscores (
_
) , because this causes the job names generated to similarly contain them, rendering the job names of the Kaniko builders invalid when run in a Kubernetes cluster, since Kubernetes requires the job names to fulfil standards defined in RFC 1123, i.e.Router deployments using ensemblers that have underscores in their names thus fail immediately since the image building jobs get rejected instantly.
Fix
The original intention of the fix was to introduce additional API checks to validate the ensembler names submitted by users and then return appropriate errors to prevent the above mentioned errors from occurring.
However, it was found that the existing
GenericEnsembler
struct that gets created when handling ensembler creation/update API calls already contains the necessarygo-playground
validatorhostname_rfc1123
validation for those RFC 1123 standards on theName
field:Clearly, there was an apparent bug with the
hostname_rfc1123
validation tag that led to the observed bug that this PR is trying to address. Upon further investigation, it was found that the existing version (v10.9.0
) of thego-playground
validator used by the Turing API does not contain the necessary bug fix for thehostname_rfc1123
validation tag.Fortunately, all that's needed is to update its version to
v10.11.0
, which includes the required bug fix (PR #912). And sincev10.11.1
is the newest release with an additional bug fix, why not just update the dependency to the latest version? 馃檭Miscellaneous
This PR also makes a tiny modification to an incorrect docstring mentioning Kaniko jobs as 'pods'.