forked from Azure/acs-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
validate.go
39 lines (36 loc) · 1.02 KB
/
validate.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package v20170930
import (
"fmt"
"strings"
)
// Validate implements APIObject
func (o *OrchestratorVersionProfile) Validate() error {
switch {
case strings.EqualFold(o.OrchestratorType, Kubernetes):
o.OrchestratorType = Kubernetes
case strings.EqualFold(o.OrchestratorType, DCOS):
o.OrchestratorType = DCOS
case strings.EqualFold(o.OrchestratorType, Swarm):
o.OrchestratorType = Swarm
case strings.EqualFold(o.OrchestratorType, DockerCE):
o.OrchestratorType = DockerCE
default:
return fmt.Errorf("Unsupported orchestrator '%s'", o.OrchestratorType)
}
return nil
}
// ValidateForUpgrade validates upgrade input data
func (o *OrchestratorProfile) ValidateForUpgrade() error {
switch o.OrchestratorType {
case DCOS, DockerCE, Swarm:
return fmt.Errorf("Upgrade is not supported for orchestrator %s", o.OrchestratorType)
case Kubernetes:
switch o.OrchestratorVersion {
case "1.6.13":
case "1.7.14":
default:
return fmt.Errorf("Upgrade to Kubernetes %s is not supported", o.OrchestratorVersion)
}
}
return nil
}