Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Validate k8s versions for PSP #2145

Merged
merged 1 commit into from
Jan 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions pkg/api/vlabs/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,28 @@ func (o *OrchestratorProfile) Validate(isUpdate bool) error {
}
}
}
if helpers.IsTrueBoolPointer(o.KubernetesConfig.EnablePodSecurityPolicy) &&
!helpers.IsTrueBoolPointer(o.KubernetesConfig.EnableRbac) {
return fmt.Errorf("enablePodSecurityPolicy requires the enableRbac feature as a prerequisite")
if helpers.IsTrueBoolPointer(o.KubernetesConfig.EnablePodSecurityPolicy) {
if !helpers.IsTrueBoolPointer(o.KubernetesConfig.EnableRbac) {
return fmt.Errorf("enablePodSecurityPolicy requires the enableRbac feature as a prerequisite")
}
if o.OrchestratorVersion == common.KubernetesVersion1Dot5Dot7 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot5Dot8 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot6Dot6 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot6Dot9 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot6Dot11 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot0 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot1 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot2 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot4 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot5 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot7 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot9 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot10 ||
o.OrchestratorVersion == common.KubernetesVersion1Dot7Dot12 {
return fmt.Errorf("enablePodSecurityPolicy is only supported in acs-engine for Kubernetes version %s or greater; unable to validate for Kubernetes version %s",
"1.8.0", o.OrchestratorVersion)
}

}
}

Expand Down