mirror of
https://github.com/rancher/types.git
synced 2025-09-19 08:52:46 +00:00
Cluster status
This commit is contained in:
@@ -5,19 +5,21 @@ import (
|
||||
"github.com/rancher/norman/types"
|
||||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/version"
|
||||
)
|
||||
|
||||
type ClusterConditionType string
|
||||
|
||||
const (
|
||||
// ClusterConditionReady Cluster ready to serve API (healthy when true, unhealthy when false)
|
||||
ClusterConditionReady condition.Cond = "Ready"
|
||||
ClusterConditionPending condition.Cond = "Pending"
|
||||
// ClusterConditionProvisioned Cluster is provisioned
|
||||
ClusterConditionProvisioned condition.Cond = "Provisioned"
|
||||
ClusterConditionUpdated condition.Cond = "Updated"
|
||||
ClusterConditionWaiting condition.Cond = "Waiting"
|
||||
ClusterConditionRemoved condition.Cond = "Removed"
|
||||
ClusterConditionReady condition.Cond = "Ready"
|
||||
ClusterConditionPending condition.Cond = "Pending"
|
||||
ClusterConditionCertsGenerated condition.Cond = "CertsGenerated"
|
||||
ClusterConditionEtcd condition.Cond = "etcd"
|
||||
ClusterConditionProvisioned condition.Cond = "Provisioned"
|
||||
ClusterConditionUpdated condition.Cond = "Updated"
|
||||
ClusterConditionWaiting condition.Cond = "Waiting"
|
||||
ClusterConditionRemoved condition.Cond = "Removed"
|
||||
// ClusterConditionNoDiskPressure true when all cluster nodes have sufficient disk
|
||||
ClusterConditionNoDiskPressure condition.Cond = "NoDiskPressure"
|
||||
// ClusterConditionNoMemoryPressure true when all cluster nodes have sufficient memory
|
||||
@@ -80,11 +82,13 @@ type ClusterStatus struct {
|
||||
CACert string `json:"caCert,omitempty"`
|
||||
Capacity v1.ResourceList `json:"capacity,omitempty"`
|
||||
Allocatable v1.ResourceList `json:"allocatable,omitempty"`
|
||||
AppliedSpec ClusterSpec `json:"appliedSpec,omitempty"`
|
||||
AppliedSpec *ClusterSpec `json:"appliedSpec,omitempty"`
|
||||
AppliedEtcdSpec *ClusterSpec `json:"appliedEtcdSpec,omitempty"`
|
||||
FailedSpec *ClusterSpec `json:"failedSpec,omitempty"`
|
||||
Requested v1.ResourceList `json:"requested,omitempty"`
|
||||
Limits v1.ResourceList `json:"limits,omitempty"`
|
||||
ClusterName string `json:"clusterName,omitempty"`
|
||||
Version *version.Info `json:"version,omitempty"`
|
||||
AppliedPodSecurityPolicyTemplateName string `json:"appliedPodSecurityPolicyTemplateId"`
|
||||
}
|
||||
|
||||
|
@@ -117,7 +117,6 @@ func clusterTypes(schemas *types.Schemas) *types.Schemas {
|
||||
).
|
||||
AddMapperForType(&Version, v3.ClusterStatus{},
|
||||
m.Drop{Field: "serviceAccountToken"},
|
||||
m.Drop{Field: "appliedSpec"},
|
||||
m.Drop{Field: "clusterName"},
|
||||
).
|
||||
AddMapperForType(&Version, v3.ClusterEvent{}, &m.Move{
|
||||
|
@@ -22,7 +22,7 @@ func (c *Creator) ToInternal(data map[string]interface{}) {
|
||||
}
|
||||
|
||||
func (c *Creator) ModifySchema(schema *types.Schema, schemas *types.Schemas) error {
|
||||
if schema.CanList(nil) && schema.CanCreate(nil) {
|
||||
if schema.CanList(nil) == nil && schema.CanCreate(nil) == nil {
|
||||
schema.ResourceFields["creatorId"] = types.Field{
|
||||
Type: "reference[/v3/schemas/user]",
|
||||
CodeName: "CreatorID",
|
||||
|
@@ -27,9 +27,10 @@ type condition struct {
|
||||
// Unknown == transitioning
|
||||
var transitioningMap = map[string]string{
|
||||
"Active": "activating",
|
||||
"AddonDeploy": "deploying",
|
||||
"AgentDeployed": "installing",
|
||||
"AddonDeploy": "provisioning",
|
||||
"AgentDeployed": "provisioning",
|
||||
"BackingNamespaceCreated": "configuring",
|
||||
"CertsGenerated": "provisioning",
|
||||
"ConfigOK": "configuring",
|
||||
"Created": "creating",
|
||||
"CreatorMadeOwner": "configuring",
|
||||
@@ -38,6 +39,7 @@ var transitioningMap = map[string]string{
|
||||
"DefaultProjectCreated": "configuring",
|
||||
"DockerProvisioned": "provisioning",
|
||||
"Downloaded": "downloading",
|
||||
"etcd": "provisioning",
|
||||
"Inactive": "deactivating",
|
||||
"Initialized": "initializing",
|
||||
"Installed": "installing",
|
||||
@@ -96,7 +98,7 @@ func concat(str, next string) string {
|
||||
if next == "" {
|
||||
return str
|
||||
}
|
||||
return str + ", " + next
|
||||
return str + "; " + next
|
||||
}
|
||||
|
||||
func Set(data map[string]interface{}) {
|
||||
|
Reference in New Issue
Block a user