-
Notifications
You must be signed in to change notification settings - Fork 6
/
refresh-cmap-restart-asd.go
54 lines (42 loc) · 1.38 KB
/
refresh-cmap-restart-asd.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
package pkg
import (
goctx "context"
"fmt"
)
// QuickRestart refreshes Aerospike config map and tries to warm restart Aerospike.
func (initp *InitParams) QuickRestart(ctx goctx.Context, cmName, cmNamespace string) error {
if cmNamespace == "" {
return fmt.Errorf("kubernetes namespace required as an argument")
}
if cmName == "" {
return fmt.Errorf("aerospike configmap required as an argument")
}
if err := initp.ExportK8sConfigmap(ctx, cmNamespace, cmName, configMapDir); err != nil {
return err
}
if err := initp.restartASD(); err != nil {
return err
}
// Update pod status in the k8s aerospike cluster object
return initp.manageVolumesAndUpdateStatus(ctx, "quickRestart")
}
func (initp *InitParams) UpdateConf(ctx goctx.Context, cmName, cmNamespace string) error {
if cmNamespace == "" {
return fmt.Errorf("kubernetes namespace required as an argument")
}
if cmName == "" {
return fmt.Errorf("aerospike configmap required as an argument")
}
if err := initp.ExportK8sConfigmap(ctx, cmNamespace, cmName, configMapDir); err != nil {
return err
}
// Create new Aerospike configuration
if err := initp.copyTemplates(configMapDir, configVolume); err != nil {
return err
}
if err := initp.createAerospikeConf(); err != nil {
return err
}
// Update pod status in the k8s aerospike cluster object
return initp.manageVolumesAndUpdateStatus(ctx, "noRestart")
}