mirror of
https://github.com/rancher/types.git
synced 2025-07-13 05:14:01 +00:00
adding cluster scan types
This commit is contained in:
parent
2810a6fa79
commit
cefb190927
56
apis/management.cattle.io/v3/cluster_scan_types.go
Normal file
56
apis/management.cattle.io/v3/cluster_scan_types.go
Normal file
@ -0,0 +1,56 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/condition"
|
||||
"github.com/rancher/norman/types"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
ClusterScanConditionCreated condition.Cond = "Created"
|
||||
ClusterScanConditionCompleted condition.Cond = "Completed"
|
||||
)
|
||||
|
||||
type ClusterScanConfig struct {
|
||||
}
|
||||
|
||||
type ClusterScanCondition struct {
|
||||
// Type of condition.
|
||||
Type string `json:"type"`
|
||||
// Status of the condition, one of True, False, Unknown.
|
||||
Status v1.ConditionStatus `json:"status"`
|
||||
// The last time this condition was updated.
|
||||
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
|
||||
// Last time the condition transitioned from one status to another.
|
||||
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
|
||||
// The reason for the condition's last transition.
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// Human-readable message indicating details about last transition
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
type ClusterScanSpec struct {
|
||||
ScanType string `json:"scanType"`
|
||||
// cluster ID
|
||||
ClusterID string `json:"clusterId,omitempty" norman:"required,type=reference[cluster]"`
|
||||
// manual flag
|
||||
Manual bool `yaml:"manual" json:"manual,omitempty"`
|
||||
// scanConfig
|
||||
ScanConfig ClusterScanConfig `yaml:",omitempty" json:"scanConfig,omitempty"`
|
||||
}
|
||||
|
||||
type ClusterScanStatus struct {
|
||||
Conditions []ClusterScanCondition `json:"conditions"`
|
||||
}
|
||||
|
||||
type ClusterScan struct {
|
||||
types.Namespaced
|
||||
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ClusterScanSpec `json:"spec"`
|
||||
Status ClusterScanStatus `yaml:"status" json:"status,omitempty"`
|
||||
}
|
@ -30,6 +30,7 @@ const (
|
||||
ClusterActionBackupEtcd = "backupEtcd"
|
||||
ClusterActionRestoreFromEtcdBackup = "restoreFromEtcdBackup"
|
||||
ClusterActionRotateCertificates = "rotateCertificates"
|
||||
ClusterActionRunCISScan = "runSecurityScan"
|
||||
|
||||
// ClusterConditionReady Cluster ready to serve API (healthy when true, unhealthy when false)
|
||||
ClusterConditionReady condition.Cond = "Ready"
|
||||
|
@ -40,6 +40,7 @@ var (
|
||||
Init(globalDNSTypes).
|
||||
Init(kontainerTypes).
|
||||
Init(etcdBackupTypes).
|
||||
Init(clusterScanTypes).
|
||||
Init(monitorTypes).
|
||||
Init(credTypes).
|
||||
Init(mgmtSecretTypes).
|
||||
@ -227,6 +228,7 @@ func clusterTypes(schemas *types.Schemas) *types.Schemas {
|
||||
Input: "rotateCertificateInput",
|
||||
Output: "rotateCertificateOutput",
|
||||
}
|
||||
schema.ResourceActions[v3.ClusterActionRunCISScan] = types.Action{}
|
||||
})
|
||||
}
|
||||
|
||||
@ -832,3 +834,10 @@ func clusterTemplateTypes(schemas *types.Schemas) *types.Schemas {
|
||||
MustImport(&Version, v3.ClusterTemplate{}).
|
||||
MustImport(&Version, v3.ClusterTemplateRevision{})
|
||||
}
|
||||
|
||||
func clusterScanTypes(schemas *types.Schemas) *types.Schemas {
|
||||
return schemas.MustImportAndCustomize(&Version, v3.ClusterScan{}, func(schema *types.Schema) {
|
||||
schema.CollectionMethods = []string{http.MethodGet}
|
||||
schema.ResourceMethods = []string{http.MethodGet, http.MethodDelete}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user