/
util.go
35 lines (29 loc) · 922 Bytes
/
util.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
package cluster
import (
"fmt"
"text/template"
"github.com/grtl/mysql-operator/pkg/operator/backupschedule"
)
// FuncMap can be used to execute templates with the helper functions from
// the cluster operator.
var FuncMap = template.FuncMap{
"PVCName": backupschedule.PVCName,
"StatefulSetName": StatefulSetName,
"ServiceName": ServiceName,
"ReadServiceName": ReadServiceName,
}
// StatefulSetName returns a name for the stateful set associated with the
// given clusterName.
func StatefulSetName(clusterName string) string {
return clusterName
}
// ServiceName returns a name for the service associated with the given
// clusterName.
func ServiceName(clusterName string) string {
return clusterName
}
// ReadServiceName returns a name for the read service associated with the
// given clusterName.
func ReadServiceName(clusterName string) string {
return fmt.Sprintf("%s-read", clusterName)
}