1
0
mirror of https://github.com/rancher/types.git synced 2025-09-18 07:52:41 +00:00

Add include system component log or not

Problem:
Now we could not exclude system component log from all log in cluster level

Solution:
Add include system component log flag
This commit is contained in:
Aiwantaozi
2018-12-10 19:42:18 +08:00
committed by Craig Jellick
parent 26acdceadb
commit 8bcbea18a1
2 changed files with 55 additions and 15 deletions

View File

@@ -37,25 +37,31 @@ type ProjectLogging struct {
Status ProjectLoggingStatus `json:"status"`
}
type LoggingCommonSpec struct {
DisplayName string `json:"displayName,omitempty"`
type LoggingCommonField struct {
DisplayName string `json:"displayName,omitempty"`
OutputFlushInterval int `json:"outputFlushInterval,omitempty" norman:"default=60"`
OutputTags map[string]string `json:"outputTags,omitempty"`
}
OutputFlushInterval int `json:"outputFlushInterval,omitempty" norman:"default=3"`
OutputTags map[string]string `json:"outputTags,omitempty"`
type LoggingTargets struct {
ElasticsearchConfig *ElasticsearchConfig `json:"elasticsearchConfig,omitempty"`
SplunkConfig *SplunkConfig `json:"splunkConfig,omitempty"`
KafkaConfig *KafkaConfig `json:"kafkaConfig,omitempty"`
SyslogConfig *SyslogConfig `json:"syslogConfig,omitempty"`
FluentForwarderConfig *FluentForwarderConfig `json:"fluentForwarderConfig,omitempty"`
CustomTargetConfig *CustomTargetConfig `json:"customTargetConfig,omitempty"`
}
type ClusterLoggingSpec struct {
LoggingCommonSpec
ClusterName string `json:"clusterName" norman:"type=reference[cluster]"`
LoggingTargets
LoggingCommonField
ClusterName string `json:"clusterName" norman:"type=reference[cluster]"`
ExcludeSystemComponent bool `json:"excludeSystemComponent,omitempty"`
}
type ProjectLoggingSpec struct {
LoggingCommonSpec
LoggingTargets
LoggingCommonField
ProjectName string `json:"projectName" norman:"type=reference[project]"`
}
@@ -94,8 +100,8 @@ type ElasticsearchConfig struct {
Endpoint string `json:"endpoint,omitempty" norman:"required"`
IndexPrefix string `json:"indexPrefix,omitempty" norman:"required"`
DateFormat string `json:"dateFormat,omitempty" norman:"required,type=enum,options=YYYY-MM-DD|YYYY-MM|YYYY,default=YYYY-MM-DD"`
AuthUserName string `json:"authUsername,omitempty"` //secret
AuthPassword string `json:"authPassword,omitempty"` //secret
AuthUserName string `json:"authUsername,omitempty"`
AuthPassword string `json:"authPassword,omitempty" norman:"type=password"`
Certificate string `json:"certificate,omitempty"`
ClientCert string `json:"clientCert,omitempty"`
ClientKey string `json:"clientKey,omitempty"`
@@ -107,7 +113,7 @@ type ElasticsearchConfig struct {
type SplunkConfig struct {
Endpoint string `json:"endpoint,omitempty" norman:"required"`
Source string `json:"source,omitempty"`
Token string `json:"token,omitempty" norman:"required"` //secret
Token string `json:"token,omitempty" norman:"required,type=password"`
Certificate string `json:"certificate,omitempty"`
ClientCert string `json:"clientCert,omitempty"`
ClientKey string `json:"clientKey,omitempty"`
@@ -130,7 +136,7 @@ type SyslogConfig struct {
Severity string `json:"severity,omitempty" norman:"default=notice,type=enum,options=emerg|alert|crit|err|warning|notice|info|debug"`
Program string `json:"program,omitempty"`
Protocol string `json:"protocol,omitempty" norman:"default=udp,type=enum,options=udp|tcp"`
Token string `json:"token,omitempty"`
Token string `json:"token,omitempty" norman:"type=password"`
Certificate string `json:"certificate,omitempty"`
ClientCert string `json:"clientCert,omitempty"`
ClientKey string `json:"clientKey,omitempty"`
@@ -150,8 +156,12 @@ type FluentServer struct {
Weight int `json:"weight,omitempty" norman:"default=100"`
Standby bool `json:"standby,omitempty" norman:"default=false"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
SharedKey string `json:"sharedKey,omitempty"`
Password string `json:"password,omitempty" norman:"type=password"`
SharedKey string `json:"sharedKey,omitempty" norman:"type=password"`
}
type CustomTargetConfig struct {
Content string `json:"content,omitempty"`
}
type LoggingSystemImages struct {
@@ -162,3 +172,13 @@ type LoggingSystemImages struct {
Busybox string `json:"busybox,omitempty"`
LogAggregatorFlexVolumeDriver string `json:"logAggregatorFlexVolumeDriver,omitempty"`
}
type ClusterTestInput struct {
ClusterName string `json:"clusterId" norman:"required,type=reference[cluster]"`
LoggingTargets
}
type ProjectTestInput struct {
ProjectName string `json:"projectId" norman:"required,type=reference[project]"`
LoggingTargets
}

View File

@@ -508,8 +508,28 @@ func logTypes(schema *types.Schemas) *types.Schemas {
m.DisplayName{}).
AddMapperForType(&Version, v3.ProjectLogging{},
m.DisplayName{}).
MustImport(&Version, v3.ClusterLogging{}).
MustImport(&Version, v3.ProjectLogging{})
MustImport(&Version, v3.ClusterTestInput{}).
MustImport(&Version, v3.ProjectTestInput{}).
MustImportAndCustomize(&Version, v3.ClusterLogging{}, func(schema *types.Schema) {
schema.CollectionActions = map[string]types.Action{
"test": {
Input: "clusterTestInput",
},
"dryRun": {
Input: "clusterTestInput",
},
}
}).
MustImportAndCustomize(&Version, v3.ProjectLogging{}, func(schema *types.Schema) {
schema.CollectionActions = map[string]types.Action{
"test": {
Input: "projectTestInput",
},
"dryRun": {
Input: "projectTestInput",
},
}
})
}
func globalTypes(schema *types.Schemas) *types.Schemas {