Skip to content

Commit eea98b6

Browse files
pidahTerje Torkelsen
authored and
Terje Torkelsen
committed
Validate k8s versions for PSP (Azure#2145)
1 parent 2ff3248 commit eea98b6

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

pkg/api/vlabs/validate.go

+22-3
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,28 @@ func (o *OrchestratorProfile) Validate(isUpdate bool) error {
111111
}
112112
}
113113
}
114-
if helpers.IsTrueBoolPointer(o.KubernetesConfig.EnablePodSecurityPolicy) &&
115-
!helpers.IsTrueBoolPointer(o.KubernetesConfig.EnableRbac) {
116-
return fmt.Errorf("enablePodSecurityPolicy requires the enableRbac feature as a prerequisite")
114+
if helpers.IsTrueBoolPointer(o.KubernetesConfig.EnablePodSecurityPolicy) {
115+
if !helpers.IsTrueBoolPointer(o.KubernetesConfig.EnableRbac) {
116+
return fmt.Errorf("enablePodSecurityPolicy requires the enableRbac feature as a prerequisite")
117+
}
118+
if o.OrchestratorVersion == common.KubernetesVersion1Dot5Dot7 ||
119+
o.OrchestratorVersion == common.KubernetesVersion1Dot5Dot8 ||
120+
o.OrchestratorVersion == common.KubernetesVersion1Dot6Dot6 ||
121+
o.OrchestratorVersion == common.KubernetesVersion1Dot6Dot9 ||
122+
o.OrchestratorVersion == common.KubernetesVersion1Dot6Dot11 ||
123+
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot0 ||
124+
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot1 ||
125+
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot2 ||
126+
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot4 ||
127+
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot5 ||
128+
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot7 ||
129+
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot9 ||
130+
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot10 ||
131+
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot12 {
132+
return fmt.Errorf("enablePodSecurityPolicy is only supported in acs-engine for Kubernetes version %s or greater; unable to validate for Kubernetes version %s",
133+
"1.8.0", o.OrchestratorVersion)
134+
}
135+
117136
}
118137
}
119138

0 commit comments

Comments
 (0)