Skip to content

Commit

Permalink
Merge pull request #2038 from liuxu623/master
Browse files Browse the repository at this point in the history
fix: backup script doesn't work when set etcd dataDir to another dir except '/var/lib/etcd'
  • Loading branch information
ks-ci-bot authored Nov 14, 2023
2 parents a9df358 + ede57bf commit b56826b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/kk/pkg/etcd/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ func (b *BackupETCD) Execute(runtime connector.Runtime) error {
Data: util.Data{
"Hostname": runtime.RemoteHost().GetName(),
"Etcdendpoint": fmt.Sprintf("https://%s:2379", runtime.RemoteHost().GetInternalAddress()),
"DataDir": b.KubeConf.Cluster.Etcd.DataDir,
"Backupdir": b.KubeConf.Cluster.Etcd.BackupDir,
"KeepbackupNumber": b.KubeConf.Cluster.Etcd.KeepBackupNumber + 1,
"EtcdBackupScriptDir": b.KubeConf.Cluster.Etcd.BackupScriptDir,
Expand Down
4 changes: 4 additions & 0 deletions cmd/kk/pkg/etcd/templates/backup_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ set -o pipefail
ETCDCTL_PATH='/usr/local/bin/etcdctl'
ENDPOINTS='{{ .Etcdendpoint }}'
{{- if .DataDir }}
ETCD_DATA_DIR="{{ .DataDir }}"
{{- else }}
ETCD_DATA_DIR="/var/lib/etcd"
{{- end }}
BACKUP_DIR="{{ .Backupdir }}/etcd-$(date +%Y-%m-%d-%H-%M-%S)"
KEEPBACKUPNUMBER='{{ .KeepbackupNumber }}'
ETCDBACKUPSCIPT='{{ .EtcdBackupScriptDir }}'
Expand Down

0 comments on commit b56826b

Please sign in to comment.