mirror of
https://github.com/rancher/types.git
synced 2025-09-20 01:22:31 +00:00
Enable monitoring
This commit is contained in:
committed by
Craig Jellick
parent
7e9e19dd37
commit
41b69d549b
@@ -14,6 +14,7 @@ var (
|
||||
CreatorMadeOwner condition.Cond = "CreatorMadeOwner"
|
||||
DefaultNetworkPolicyCreated condition.Cond = "DefaultNetworkPolicyCreated"
|
||||
ProjectConditionInitialRolesPopulated condition.Cond = "InitialRolesPopulated"
|
||||
ProjectConditionMonitoringEnabled condition.Cond = "MonitoringEnabled"
|
||||
)
|
||||
|
||||
type Project struct {
|
||||
@@ -29,6 +30,7 @@ type Project struct {
|
||||
type ProjectStatus struct {
|
||||
Conditions []ProjectCondition `json:"conditions"`
|
||||
PodSecurityPolicyTemplateName string `json:"podSecurityPolicyTemplateId"`
|
||||
MonitoringStatus *MonitoringStatus `json:"monitoringStatus,omitempty" norman:"nocreate,noupdate"`
|
||||
}
|
||||
|
||||
type ProjectCondition struct {
|
||||
@@ -52,6 +54,7 @@ type ProjectSpec struct {
|
||||
ClusterName string `json:"clusterName,omitempty" norman:"required,type=reference[cluster]"`
|
||||
ResourceQuota *ProjectResourceQuota `json:"resourceQuota,omitempty"`
|
||||
NamespaceDefaultResourceQuota *NamespaceResourceQuota `json:"namespaceDefaultResourceQuota,omitempty"`
|
||||
EnableProjectMonitoring bool `json:"enableProjectMonitoring" norman:"default=false"`
|
||||
}
|
||||
|
||||
type GlobalRole struct {
|
||||
|
@@ -41,13 +41,15 @@ const (
|
||||
ClusterConditionDefaultNamespaceAssigned condition.Cond = "DefaultNamespaceAssigned"
|
||||
// ClusterConditionSystemNamespacesAssigned true when cluster's system namespaces has been initially assigned to
|
||||
// a system project
|
||||
ClusterConditionSystemNamespacesAssigned condition.Cond = "SystemNamespacesAssigned"
|
||||
ClusterConditionAddonDeploy condition.Cond = "AddonDeploy"
|
||||
ClusterConditionSystemAccountCreated condition.Cond = "SystemAccountCreated"
|
||||
ClusterConditionAgentDeployed condition.Cond = "AgentDeployed"
|
||||
ClusterConditionGlobalAdminsSynced condition.Cond = "GlobalAdminsSynced"
|
||||
ClusterConditionInitialRolesPopulated condition.Cond = "InitialRolesPopulated"
|
||||
ClusterConditionAlertingEnabled condition.Cond = "AlertingEnabled"
|
||||
ClusterConditionSystemNamespacesAssigned condition.Cond = "SystemNamespacesAssigned"
|
||||
ClusterConditionAddonDeploy condition.Cond = "AddonDeploy"
|
||||
ClusterConditionSystemAccountCreated condition.Cond = "SystemAccountCreated"
|
||||
ClusterConditionAgentDeployed condition.Cond = "AgentDeployed"
|
||||
ClusterConditionGlobalAdminsSynced condition.Cond = "GlobalAdminsSynced"
|
||||
ClusterConditionInitialRolesPopulated condition.Cond = "InitialRolesPopulated"
|
||||
ClusterConditionPrometheusOperatorDeployed condition.Cond = "PrometheusOperatorDeployed"
|
||||
ClusterConditionMonitoringEnabled condition.Cond = "MonitoringEnabled"
|
||||
ClusterConditionAlertingEnabled condition.Cond = "AlertingEnabled"
|
||||
|
||||
ClusterDriverImported = "imported"
|
||||
ClusterDriverLocal = "local"
|
||||
@@ -86,6 +88,7 @@ type ClusterSpec struct {
|
||||
DockerRootDir string `json:"dockerRootDir,omitempty" norman:"default=/var/lib/docker"`
|
||||
EnableNetworkPolicy *bool `json:"enableNetworkPolicy" norman:"default=false"`
|
||||
EnableClusterAlerting bool `json:"enableClusterAlerting" norman:"default=false"`
|
||||
EnableClusterMonitoring bool `json:"enableClusterMonitoring" norman:"default=false"`
|
||||
}
|
||||
|
||||
type ImportedConfig struct {
|
||||
@@ -114,6 +117,7 @@ type ClusterStatus struct {
|
||||
AppliedPodSecurityPolicyTemplateName string `json:"appliedPodSecurityPolicyTemplateId"`
|
||||
AppliedEnableNetworkPolicy bool `json:"appliedEnableNetworkPolicy" norman:"nocreate,noupdate,default=false"`
|
||||
Capabilities Capabilities `json:"capabilities,omitempty"`
|
||||
MonitoringStatus *MonitoringStatus `json:"monitoringStatus,omitempty" norman:"nocreate,noupdate"`
|
||||
}
|
||||
|
||||
type ClusterComponentStatus struct {
|
||||
@@ -223,3 +227,7 @@ type IngressCapabilities struct {
|
||||
IngressProvider string `json:"ingressProvider,omitempty"`
|
||||
CustomDefaultBackend bool `json:"customDefaultBackend,omitempty"`
|
||||
}
|
||||
|
||||
type MonitoringInput struct {
|
||||
Answers map[string]string `json:"answers,omitempty"`
|
||||
}
|
||||
|
35
apis/management.cattle.io/v3/monitoring_types.go
Normal file
35
apis/management.cattle.io/v3/monitoring_types.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/condition"
|
||||
"k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
type MonitoringStatus struct {
|
||||
GrafanaEndpoint string `json:"grafanaEndpoint,omitempty"`
|
||||
Conditions []MonitoringCondition `json:"conditions,omitempty"`
|
||||
}
|
||||
|
||||
type MonitoringCondition struct {
|
||||
// Type of cluster condition.
|
||||
Type ClusterConditionType `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"`
|
||||
}
|
||||
|
||||
const (
|
||||
MonitoringConditionGrafanaDeployed condition.Cond = "GrafanaDeployed"
|
||||
MonitoringConditionPrometheusDeployed condition.Cond = "PrometheusDeployed"
|
||||
MonitoringConditionAlertmaanagerDeployed condition.Cond = "AlertmanagerDeployed"
|
||||
MonitoringConditionNodeExporterDeployed condition.Cond = "NodeExporterDeployed"
|
||||
MonitoringConditionKubeStateExporterDeployed condition.Cond = "KubeStateExporterDeployed"
|
||||
MonitoringConditionMetricExpressionDeployed condition.Cond = "MetricExpressionDeployed"
|
||||
)
|
@@ -145,6 +145,7 @@ func clusterTypes(schemas *types.Schemas) *types.Schemas {
|
||||
MustImport(&Version, v3.ImportClusterYamlInput{}).
|
||||
MustImport(&Version, v3.ImportYamlOutput{}).
|
||||
MustImport(&Version, v3.ExportOutput{}).
|
||||
MustImport(&Version, v3.MonitoringInput{}).
|
||||
MustImportAndCustomize(&Version, v3.ETCDService{}, func(schema *types.Schema) {
|
||||
schema.MustCustomizeField("extraArgs", func(field types.Field) types.Field {
|
||||
field.Default = map[string]interface{}{
|
||||
@@ -170,14 +171,20 @@ func clusterTypes(schemas *types.Schemas) *types.Schemas {
|
||||
schema.ResourceActions["exportYaml"] = types.Action{
|
||||
Output: "exportOutput",
|
||||
}
|
||||
schema.ResourceActions["enableMonitoring"] = types.Action{
|
||||
Input: "monitoringInput",
|
||||
}
|
||||
schema.ResourceActions["disableMonitoring"] = types.Action{}
|
||||
})
|
||||
}
|
||||
|
||||
func authzTypes(schemas *types.Schemas) *types.Schemas {
|
||||
return schemas.
|
||||
MustImport(&Version, v3.ProjectStatus{}).
|
||||
AddMapperForType(&Version, v3.Project{}, m.DisplayName{},
|
||||
&m.Embed{Field: "status"}).
|
||||
AddMapperForType(&Version, v3.Project{},
|
||||
m.DisplayName{},
|
||||
&m.Embed{Field: "status"},
|
||||
).
|
||||
AddMapperForType(&Version, v3.GlobalRole{}, m.DisplayName{}).
|
||||
AddMapperForType(&Version, v3.RoleTemplate{}, m.DisplayName{}).
|
||||
AddMapperForType(&Version,
|
||||
@@ -195,6 +202,10 @@ func authzTypes(schemas *types.Schemas) *types.Schemas {
|
||||
Output: "project",
|
||||
},
|
||||
"exportYaml": {},
|
||||
"enableMonitoring": {
|
||||
Input: "monitoringInput",
|
||||
},
|
||||
"disableMonitoring": {},
|
||||
}
|
||||
}).
|
||||
MustImportAndCustomize(&Version, v3.GlobalRole{}, func(schema *types.Schema) {
|
||||
|
Reference in New Issue
Block a user