/
defaults.go
56 lines (49 loc) · 1.81 KB
/
defaults.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
package controllers
// Below are the default constants that we will
// use throughout the patterns operator code
const (
// Default Operator Namespace
OperatorNamespace = "openshift-operators"
// Default Operator Config Map Name
OperatorConfigMap = "patterns-operator-config"
// Default Subscription Namespace
SubscriptionNamespace = "openshift-operators"
// Default Application Namespace
ApplicationNamespace = "openshift-gitops"
)
// GitOps Subscription
const (
GitOpsDefaultChannel = "gitops-1.11"
GitOpsDefaultPackageName = "openshift-gitops-operator"
GitOpsDefaultCatalogSource = "redhat-operators"
GitOpsDefaultCatalogSourceNamespace = "openshift-marketplace"
GitOpsDefaultApprovalPlan = "Automatic"
)
// GitOps Configuration
const (
// Require manual intervention before Argo will sync new content. Default: False
GitOpsDefaultManualSync = "false"
// Require manual confirmation before installing and upgrading operators. Default: False
GitOpsDefaultManualApproval = "false"
// Dangerous. Force a specific version to be installed. Default: False
GitOpsDefaultUseCSV = "false"
)
var DefaultPatternOperatorConfig = map[string]string{
"gitops.catalogSource": GitOpsDefaultCatalogSource,
"gitops.name": GitOpsDefaultPackageName,
"gitops.channel": GitOpsDefaultChannel,
"gitops.sourceNamespace": GitOpsDefaultCatalogSourceNamespace,
"gitops.installApprovalPlan": GitOpsDefaultApprovalPlan,
"gitops.ManualSync": GitOpsDefaultManualSync,
}
type GitOpsConfig map[string]string
var PatternsOperatorConfig GitOpsConfig
func (g GitOpsConfig) getValueWithDefault(k string) string {
if v, present := g[k]; present {
return v
}
if defaultValue, present := DefaultPatternOperatorConfig[k]; present {
return defaultValue
}
return ""
}