Skip to content

Commit

Permalink
support custome etcd args
Browse files Browse the repository at this point in the history
Signed-off-by: pixiake <[email protected]>

(cherry picked from commit 1dd1e54)
Signed-off-by: pixiake <[email protected]>
  • Loading branch information
pixiake committed Jul 30, 2024
1 parent 19d546b commit 3aa568d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/kk/apis/kubekey/v1alpha2/etcd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type EtcdCluster struct {
External ExternalEtcd `yaml:"external" json:"external,omitempty"`
Port *int `yaml:"port" json:"port,omitempty"`
PeerPort *int `yaml:"peerPort" json:"peerPort,omitempty"`
ExtraArgs []string `yaml:"extraArgs" json:"extraArgs,omitempty"`
BackupDir string `yaml:"backupDir" json:"backupDir,omitempty"`
BackupPeriod int `yaml:"backupPeriod" json:"backupPeriod,omitempty"`
KeepBackupNumber int `yaml:"keepBackupNumber" json:"keepBackupNumber,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions cmd/kk/pkg/etcd/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ func refreshConfig(KubeConf *common.KubeConf, runtime connector.Runtime, endpoin
"Hostname": host.GetName(),
"Port": KubeConf.Cluster.Etcd.GetPort(),
"PeerPort": KubeConf.Cluster.Etcd.GetPeerPort(),
"ExtraArgs": KubeConf.Cluster.Etcd.ExtraArgs,
"State": state,
"PeerAddresses": strings.Join(endpoints, ","),
"UnsupportedArch": UnsupportedArch,
Expand Down
5 changes: 5 additions & 0 deletions cmd/kk/pkg/etcd/templates/etcd_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ ETCD_LOG_LEVEL={{ .LogLevel }}
{{- if .UnsupportedArch }}
ETCD_UNSUPPORTED_ARCH={{ .Arch }}
{{ end }}
{{- if .ExtraArgs }}
{{- range $index, $value := .ExtraArgs }}
{{ $value }}
{{- end }}
{{- end }}
# TLS settings
ETCD_TRUSTED_CA_FILE=/etc/ssl/etcd/ssl/ca.pem
Expand Down

0 comments on commit 3aa568d

Please sign in to comment.