forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
103 lines (84 loc) · 2.45 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package constant
import (
"fmt"
)
const (
AppName = "rancher-logging"
TesterAppName = "rancher-logging-tester"
AppInitVersion = "0.1.1"
systemCatalogName = "system-library"
templateName = "rancher-logging"
)
const (
LoggingNamespace = "cattle-logging"
)
//daemonset, pod, container name
const (
FluentdName = "fluentd"
FluentdHelperName = "fluentd-helper"
LogAggregatorName = "log-aggregator"
FluentdTesterName = "fluentd-test"
FluentdTesterContainerName = "dry-run"
)
//config
const (
LoggingSecretName = "fluentd"
LoggingSSLSecretName = "fluentd-ssl"
LoggingSecretClusterConfigKey = "cluster.conf"
LoggingSecretProjectConfigKey = "project.conf"
)
//target
const (
Elasticsearch = "elasticsearch"
Splunk = "splunk"
Kafka = "kafka"
Syslog = "syslog"
FluentForwarder = "fluentforwarder"
CustomTarget = "customtarget"
)
const (
GoogleKubernetesEngine = "googleKubernetesEngine"
)
//ssl
const (
DefaultCertDir = "/fluentd/etc/config/ssl"
CaFileName = "ca.pem"
ClientCertName = "client-cert.pem"
ClientKeyName = "client-key.pem"
)
const (
ClusterLevel = "cluster"
ProjectLevel = "project"
)
var (
FluentdTesterSelector = map[string]string{"app": "fluentd-tester"}
FluentdSelector = map[string]string{"app": "fluentd"}
LogAggregatorSelector = map[string]string{"app": "log-aggregator"}
)
func SecretDataKeyCa(level, name string) string {
return fmt.Sprintf("%s_%s_%s", level, name, CaFileName)
}
func SecretDataKeyCert(level, name string) string {
return fmt.Sprintf("%s_%s_%s", level, name, ClientCertName)
}
func SecretDataKeyCertKey(level, name string) string {
return fmt.Sprintf("%s_%s_%s", level, name, ClientKeyName)
}
func RancherLoggingTemplateID() string {
return fmt.Sprintf("%s-%s", systemCatalogName, templateName)
}
func RancherLoggingFullVersion() string {
return fmt.Sprintf("%s-%s-%s", systemCatalogName, templateName, AppInitVersion)
}
func RancherLoggingCatalogID(version string) string {
return fmt.Sprintf("catalog://?catalog=%s&template=%s&version=%s", systemCatalogName, templateName, version)
}
func RancherLoggingConfigSecretName() string {
return fmt.Sprintf("%s-%s", AppName, LoggingSecretName)
}
func RancherLoggingSSLSecretName() string {
return fmt.Sprintf("%s-%s", AppName, LoggingSSLSecretName)
}
func GetNamespacePattern(namespace string) string {
return fmt.Sprintf("^%s$", namespace)
}