client: fix panic from 0.8 -> 0.10 upgrade

makeAllocTaskServices did not do a nil check on AllocatedResources
which causes a panic when upgrading directly from 0.8 to 0.10. While
skipping 0.9 is not supported we intend to fix serious crashers caused
by such upgrades to prevent cluster outages.

I did a quick audit of the client package and everywhere else that
accesses AllocatedResources appears to be properly guarded by a nil
check.
This commit is contained in:
Michael Schurter
2019-11-01 07:15:11 -07:00
parent 20bb9f04d5
commit 0fcb0d4016
4 changed files with 94 additions and 4 deletions

View File

@@ -301,7 +301,7 @@ func NewTaskRunner(config *Config) (*TaskRunner, error) {
}
tr.taskResources = tres
} else {
// COMPAT(0.10): Upgrade from old resources to new resources
// COMPAT(0.11): Upgrade from 0.8 resources to 0.9+ resources
// Grab the old task resources
oldTr, ok := tr.alloc.TaskResources[tr.taskName]
if !ok {