From c2fa09c78a402b2f172376b7d95feb8887da4662 Mon Sep 17 00:00:00 2001 From: Murali Paluru Date: Thu, 12 Dec 2019 14:14:43 -0800 Subject: [PATCH] cis: modify skip, conditions --- .../v3/cluster_scan_types.go | 11 +++++++--- condition/constants.go | 21 +++++++++++++++++++ status/status.go | 1 + 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 condition/constants.go diff --git a/apis/management.cattle.io/v3/cluster_scan_types.go b/apis/management.cattle.io/v3/cluster_scan_types.go index 584e4a94..d016853e 100644 --- a/apis/management.cattle.io/v3/cluster_scan_types.go +++ b/apis/management.cattle.io/v3/cluster_scan_types.go @@ -3,14 +3,17 @@ package v3 import ( "github.com/rancher/norman/condition" "github.com/rancher/norman/types" + typescond "github.com/rancher/types/condition" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) const ( - ClusterScanConditionCreated condition.Cond = "Created" - ClusterScanConditionCompleted condition.Cond = "Completed" + ClusterScanConditionCreated condition.Cond = typescond.Created + ClusterScanConditionRunCompleted condition.Cond = typescond.RunCompleted + ClusterScanConditionCompleted condition.Cond = typescond.Completed + ClusterScanConditionFailed condition.Cond = typescond.Failed ClusterScanTypeCis = "cis" DefaultNamespaceForCis = "security-scan" @@ -24,7 +27,9 @@ const ( type CisScanConfig struct { // IDs of the checks that need to be skipped in the final report - Skip []string `json:"skip"` + Skip string `json:"skip,omitempty"` + // Override the CIS benchmark version to use for the scan (instead of latest) + OverrideBenchmarkVersion string `json:"overrideBenchmarkVersion,omitempty"` // Internal flag for debugging master component of the scan DebugMaster bool `json:"debugMaster"` // Internal flag for debugging worker component of the scan diff --git a/condition/constants.go b/condition/constants.go new file mode 100644 index 00000000..f0d94bd6 --- /dev/null +++ b/condition/constants.go @@ -0,0 +1,21 @@ +package condition + +import ( + cond "github.com/rancher/norman/condition" +) + +const ( + // transition type + + Created cond.Cond = "Created" + RunCompleted cond.Cond = "RunCompleted" + + // done type + + Completed cond.Cond = "Completed" + Ready cond.Cond = "Ready" + + // error type + + Failed cond.Cond = "Failed" +) diff --git a/status/status.go b/status/status.go index ceca8fc2..1823722c 100644 --- a/status/status.go +++ b/status/status.go @@ -61,6 +61,7 @@ var transitioningMap = map[string]string{ "InitialRolesPopulated": "activating", "ScalingActive": "pending", "AbleToScale": "pending", + "RunCompleted": "running", } // True == error