-
Notifications
You must be signed in to change notification settings - Fork 94
/
system_app_rules.go
100 lines (87 loc) · 2.99 KB
/
system_app_rules.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
package prometheusrules
import (
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
corev1 "k8s.io/api/core/v1"
appsv1alpha1 "github.com/3scale/3scale-operator/apis/apps/v1alpha1"
"github.com/3scale/3scale-operator/pkg/3scale/amp/component"
)
func init() {
PrometheusRuleFactories = append(PrometheusRuleFactories, NewSystemAppPrometheusRuleFactory)
}
type SystemAppPrometheusRuleFactory struct {
}
func NewSystemAppPrometheusRuleFactory() PrometheusRuleFactory {
return &SystemAppPrometheusRuleFactory{}
}
func (s *SystemAppPrometheusRuleFactory) Type() string {
return "system-app"
}
func (s *SystemAppPrometheusRuleFactory) PrometheusRule(_ bool, ns string) *monitoringv1.PrometheusRule {
options, err := systemOptions(ns)
if err != nil {
panic(err)
}
return component.NewSystem(options).SystemAppPrometheusRules()
}
func systemOptions(ns string) (*component.SystemOptions, error) {
o := component.NewSystemOptions()
tmp := "_"
// Required options for generating PrometheusRules
o.CommonLabels = commonSystemLabels()
o.Namespace = ns
// Required options for passing validation, but not needed for generating the prometheus rules
// To fix this, more granularity at options level.
o.WildcardDomain = "_"
o.ImageTag = "_"
o.EventHooksURL = "_"
o.ApicastSystemMasterProxyConfigEndpoint = "_"
o.MemcachedServers = "_"
o.AdminEmail = &tmp
o.AppProviderContainerResourceRequirements = &corev1.ResourceRequirements{}
o.AppMasterContainerResourceRequirements = &corev1.ResourceRequirements{}
o.AppDeveloperContainerResourceRequirements = &corev1.ResourceRequirements{}
o.SidekiqContainerResourceRequirements = &corev1.ResourceRequirements{}
o.AdminAccessToken = "_"
o.AdminPassword = "_"
o.AdminUsername = "_"
o.ApicastAccessToken = "_"
o.ApicastRegistryURL = "_"
o.MasterAccessToken = "_"
o.MasterName = "_"
o.MasterUsername = "_"
o.MasterPassword = "_"
o.RecaptchaPublicKey = &tmp
o.RecaptchaPrivateKey = &tmp
o.AppSecretKeyBase = "_"
o.BackendSharedSecret = "_"
o.TenantName = "_"
o.AppReplicas = 1
o.SidekiqReplicas = 1
o.S3FileStorageOptions = &component.S3FileStorageOptions{ConfigurationSecretName: "_"}
o.SmtpSecretOptions = component.SystemSMTPSecretOptions{
Address: &tmp,
Authentication: &tmp,
Domain: &tmp,
OpenSSLVerifyMode: &tmp,
Password: &tmp,
Port: &tmp,
Username: &tmp,
}
o.CommonAppLabels = map[string]string{}
o.AppPodTemplateLabels = map[string]string{}
o.CommonSidekiqLabels = map[string]string{}
o.SidekiqPodTemplateLabels = map[string]string{}
o.ProviderUILabels = map[string]string{}
o.MasterUILabels = map[string]string{}
o.DeveloperUILabels = map[string]string{}
o.MemcachedLabels = map[string]string{}
o.SMTPLabels = map[string]string{}
o.UserSessionTTL = &tmp
return o, o.Validate()
}
func commonSystemLabels() map[string]string {
return map[string]string{
"app": appsv1alpha1.Default3scaleAppLabel,
"threescale_component": "system",
}
}