/
names.go
69 lines (57 loc) · 2.26 KB
/
names.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
package cincinnati
import (
cv1beta1 "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1beta1"
"k8s.io/apimachinery/pkg/util/intstr"
)
const (
// NameContainerGraphBuilder is the Name property of the graph builder container
NameContainerGraphBuilder string = "graph-builder"
// NameContainerPolicyEngine is the Name property of the policy engine container
NameContainerPolicyEngine string = "policy-engine"
// NameInitContainerGraphData is the Name property of the graph data container
NameInitContainerGraphData string = "graph-data"
// openshiftConfigNamespace is the name of openshift's configuration namespace
openshiftConfigNamespace = "openshift-config"
// NameTrustedCAVolume is the name of the Volume used in Cincinnati's deployment containing the CA Cert
NameTrustedCAVolume = "trusted-ca"
// NameCertConfigMapKey is the ConfigMap key name where the operator expects the external registry CA Cert
NameCertConfigMapKey = "cincinnati-registry"
// namePullSecret is the OpenShift pull secret name
namePullSecret = "pull-secret"
)
func nameDeployment(instance *cv1beta1.Cincinnati) string {
return instance.Name
}
func namePodDisruptionBudget(instance *cv1beta1.Cincinnati) string {
return instance.Name
}
func nameEnvConfig(instance *cv1beta1.Cincinnati) string {
return instance.Name + "-env"
}
func nameConfig(instance *cv1beta1.Cincinnati) string {
return instance.Name + "-config"
}
func namePolicyEngineService(instance *cv1beta1.Cincinnati) string {
return instance.Name + "-policy-engine"
}
func nameGraphBuilderService(instance *cv1beta1.Cincinnati) string {
return instance.Name + "-graph-builder"
}
func namePolicyEngineRoute(instance *cv1beta1.Cincinnati) string {
return namePolicyEngineService(instance) + "-route"
}
func nameAdditionalTrustedCA(instance *cv1beta1.Cincinnati) string {
return instance.Name + "-trusted-ca"
}
func namePullSecretCopy(instance *cv1beta1.Cincinnati) string {
return instance.Name + "-" + namePullSecret
}
// When running a single replica, allow 0 available so we don't block node
// drains. Otherwise require 1.
func getMinAvailablePBD(instance *cv1beta1.Cincinnati) intstr.IntOrString {
minAvailable := intstr.FromInt(0)
if instance.Spec.Replicas >= 2 {
minAvailable = intstr.FromInt(1)
}
return minAvailable
}