Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into release-3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pixiake committed Aug 1, 2024
2 parents 1415741 + 5cc39d7 commit b8edc41
Show file tree
Hide file tree
Showing 13 changed files with 494 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gen-repository-iso.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Build iso image to local
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: hack/gen-repository-iso
file: hack/gen-repository-iso/${{ matrix.dockerfile }}
Expand All @@ -54,7 +54,7 @@ jobs:
sha256sum *.iso > ${{ matrix.name }}.iso.sha256sum.txt
- name: Wait for release workflow to finish
uses: lewagon/[email protected].3
uses: lewagon/[email protected].4
with:
ref: ${{ github.ref }}
check-name: 'create draft release'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
go-version: 1.19
- name: golangci-lint
uses: golangci/golangci-lint-action@v4.0.0
uses: golangci/golangci-lint-action@v6.0.1
with:
version: v1.50.1
working-directory: ${{matrix.working-directory}}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![CI](https://github.com/kubesphere/kubekey/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/kubesphere/kubekey/actions?query=event%3Apush+branch%3Amaster+workflow%3ACI+)

> English | [中文](README_zh-CN.md)
> English | [中文](README_zh-CN.md) | [日本語](README_ja-JP.md)
### 👋 Welcome to KubeKey!

Expand Down
413 changes: 413 additions & 0 deletions README_ja-JP.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![CI](https://github.com/kubesphere/kubekey/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/kubesphere/kubekey/actions?query=event%3Apush+branch%3Amaster+workflow%3ACI+)

> [English](README.md) | 中文
> [English](README.md) | 中文 | [日本語](README_ja-JP.md)
KubeKey是一个开源的轻量级工具,用于部署Kubernetes集群。它提供了一种灵活、快速、方便的方式来安装Kubernetes/K3s、Kubernetes/K3s和KubeSphere,以及相关的云原生附加组件。它也是扩展和升级集群的有效工具。

Expand Down
19 changes: 19 additions & 0 deletions cmd/kk/apis/kubekey/v1alpha2/etcd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ type EtcdCluster struct {
Type string `yaml:"type" json:"type,omitempty"`
// ExternalEtcd describes how to connect to an external etcd cluster when type is set to external
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 Expand Up @@ -57,3 +60,19 @@ type ExternalEtcd struct {
// KeyFile is an SSL key file used to secure etcd communication.
KeyFile string `yaml:"keyFile" json:"keyFile,omitempty"`
}

// GetPort returns the port of etcd cluster
func (e *EtcdCluster) GetPort() int {
if e.Port == nil {
return 2379
}
return *e.Port
}

// GetPeerPort returns the peer port of etcd cluster
func (e *EtcdCluster) GetPeerPort() int {
if e.PeerPort == nil {
return 2380
}
return *e.PeerPort
}
17 changes: 10 additions & 7 deletions cmd/kk/pkg/etcd/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ func (g *GetStatus) Execute(runtime connector.Runtime) error {

if v, ok := g.PipelineCache.Get(common.ETCDCluster); ok {
c := v.(*EtcdCluster)
c.peerAddresses = append(c.peerAddresses, fmt.Sprintf("%s=https://%s:2380", etcdName, host.GetInternalIPv4Address()))
c.peerAddresses = append(c.peerAddresses, fmt.Sprintf("%s=https://%s:%d", etcdName, host.GetInternalIPv4Address(), g.KubeConf.Cluster.Etcd.GetPeerPort()))
c.clusterExist = true
// type: *EtcdCluster
g.PipelineCache.Set(common.ETCDCluster, c)
} else {
cluster.peerAddresses = append(cluster.peerAddresses, fmt.Sprintf("%s=https://%s:2380", etcdName, host.GetInternalIPv4Address()))
cluster.peerAddresses = append(cluster.peerAddresses, fmt.Sprintf("%s=https://%s:%d", etcdName, host.GetInternalIPv4Address(), g.KubeConf.Cluster.Etcd.GetPeerPort()))
cluster.clusterExist = true
g.PipelineCache.Set(common.ETCDCluster, cluster)
}
Expand Down Expand Up @@ -169,7 +169,7 @@ type GenerateAccessAddress struct {
func (g *GenerateAccessAddress) Execute(runtime connector.Runtime) error {
var addrList []string
for _, host := range runtime.GetHostsByRole(common.ETCD) {
addrList = append(addrList, fmt.Sprintf("https://%s:2379", host.GetInternalIPv4Address()))
addrList = append(addrList, fmt.Sprintf("https://%s:%d", host.GetInternalIPv4Address(), g.KubeConf.Cluster.Etcd.GetPort()))
}

accessAddresses := strings.Join(addrList, ",")
Expand Down Expand Up @@ -232,7 +232,7 @@ func (g *GenerateConfig) Execute(runtime connector.Runtime) error {
peerAddressesMap[v] = v
}

newPeerAddress := fmt.Sprintf("%s=https://%s:2380", etcdName, host.GetInternalIPv4Address())
newPeerAddress := fmt.Sprintf("%s=https://%s:%d", etcdName, host.GetInternalIPv4Address(), g.KubeConf.Cluster.Etcd.GetPeerPort())

if _, ok := peerAddressesMap[newPeerAddress]; !ok {
cluster.peerAddresses = append(cluster.peerAddresses, newPeerAddress)
Expand Down Expand Up @@ -309,6 +309,9 @@ func refreshConfig(KubeConf *common.KubeConf, runtime connector.Runtime, endpoin
"Name": etcdName,
"Ip": host.GetInternalIPv4Address(),
"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 Expand Up @@ -353,7 +356,7 @@ func (j *JoinMember) Execute(runtime connector.Runtime) error {
"export ETCDCTL_CA_FILE='/etc/ssl/etcd/ssl/ca.pem';"+
"%s/etcdctl --endpoints=%s member add %s %s",
host.GetName(), host.GetName(), common.BinDir, cluster.accessAddresses, etcdName,
fmt.Sprintf("https://%s:2380", host.GetInternalIPv4Address()))
fmt.Sprintf("https://%s:%d", host.GetInternalIPv4Address(), j.KubeConf.Cluster.Etcd.GetPeerPort()))

if _, err := runtime.GetRunner().SudoCmd(joinMemberCmd, true); err != nil {
return errors.Wrap(errors.WithStack(err), "add etcd member failed")
Expand Down Expand Up @@ -387,7 +390,7 @@ func (c *CheckMember) Execute(runtime connector.Runtime) error {
if err != nil {
return errors.Wrap(errors.WithStack(err), "list etcd member failed")
}
if !strings.Contains(memberList, fmt.Sprintf("https://%s:2379", host.GetInternalIPv4Address())) {
if !strings.Contains(memberList, fmt.Sprintf("https://%s:%d", host.GetInternalIPv4Address(), c.KubeConf.Cluster.Etcd.GetPort())) {
return errors.Wrap(errors.WithStack(err), "add etcd member failed")
}
} else {
Expand Down Expand Up @@ -417,7 +420,7 @@ func (b *BackupETCD) Execute(runtime connector.Runtime) error {
Dst: filepath.Join(b.KubeConf.Cluster.Etcd.BackupScriptDir, "etcd-backup.sh"),
Data: util.Data{
"Hostname": runtime.RemoteHost().GetName(),
"Etcdendpoint": fmt.Sprintf("https://%s:2379", runtime.RemoteHost().GetInternalIPv4Address()),
"Etcdendpoint": fmt.Sprintf("https://%s:%d", runtime.RemoteHost().GetInternalIPv4Address(), b.KubeConf.Cluster.Etcd.GetPort()),
"DataDir": b.KubeConf.Cluster.Etcd.DataDir,
"Backupdir": b.KubeConf.Cluster.Etcd.BackupDir,
"KeepbackupNumber": b.KubeConf.Cluster.Etcd.KeepBackupNumber + 1,
Expand Down
15 changes: 10 additions & 5 deletions cmd/kk/pkg/etcd/templates/etcd_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ ETCD_DATA_DIR={{ .DataDir }}
{{- else }}
ETCD_DATA_DIR=/var/lib/etcd
{{- end }}
ETCD_ADVERTISE_CLIENT_URLS=https://{{ .Ip }}:2379
ETCD_INITIAL_ADVERTISE_PEER_URLS=https://{{ .Ip }}:2380
ETCD_ADVERTISE_CLIENT_URLS=https://{{ .Ip }}:{{ .Port }}
ETCD_INITIAL_ADVERTISE_PEER_URLS=https://{{ .Ip }}:{{ .PeerPort }}
ETCD_INITIAL_CLUSTER_STATE={{ .State }}
ETCD_METRICS=basic
ETCD_LISTEN_CLIENT_URLS=https://{{ .Ip }}:2379,https://127.0.0.1:2379
ETCD_LISTEN_CLIENT_URLS=https://{{ .Ip }}:{{ .Port }},https://127.0.0.1:{{ .Port }}
ETCD_INITIAL_CLUSTER_TOKEN=k8s_etcd
ETCD_LISTEN_PEER_URLS=https://{{ .Ip }}:2380
ETCD_LISTEN_PEER_URLS=https://{{ .Ip }}:{{ .PeerPort }}
ETCD_NAME={{ .Name }}
ETCD_PROXY=off
ETCD_ENABLE_V2=true
Expand Down 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 All @@ -95,7 +100,7 @@ ETCD_PEER_KEY_FILE=/etc/ssl/etcd/ssl/member-{{ .Hostname }}-key.pem
ETCD_PEER_CLIENT_CERT_AUTH=true
# CLI settings
ETCDCTL_ENDPOINTS=https://127.0.0.1:2379
ETCDCTL_ENDPOINTS=https://127.0.0.1:{{ .Port }}
ETCDCTL_CACERT=/etc/ssl/etcd/ssl/ca.pem
ETCDCTL_KEY=/etc/ssl/etcd/ssl/admin-{{ .Hostname }}-key.pem
ETCDCTL_CERT=/etc/ssl/etcd/ssl/admin-{{ .Hostname }}.pem
Expand Down
2 changes: 1 addition & 1 deletion cmd/kk/pkg/k3s/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func (g *GenerateK3sServiceEnv) Execute(runtime connector.Runtime) error {
}
default:
for _, node := range runtime.GetHostsByRole(common.ETCD) {
endpoint := fmt.Sprintf("https://%s:%s", node.GetInternalIPv4Address(), kubekeyapiv1alpha2.DefaultEtcdPort)
endpoint := fmt.Sprintf("https://%s:%d", node.GetInternalIPv4Address(), g.KubeConf.Cluster.Etcd.GetPort())
endpointsList = append(endpointsList, endpoint)
}
externalEtcd.Endpoints = endpointsList
Expand Down
2 changes: 1 addition & 1 deletion cmd/kk/pkg/k8e/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func (g *GenerateK8eServiceEnv) Execute(runtime connector.Runtime) error {
}
default:
for _, node := range runtime.GetHostsByRole(common.ETCD) {
endpoint := fmt.Sprintf("https://%s:%s", node.GetInternalIPv4Address(), kubekeyapiv1alpha2.DefaultEtcdPort)
endpoint := fmt.Sprintf("https://%s:%d", node.GetInternalIPv4Address(), g.KubeConf.Cluster.Etcd.GetPort())
endpointsList = append(endpointsList, endpoint)
}
externalEtcd.Endpoints = endpointsList
Expand Down
2 changes: 1 addition & 1 deletion cmd/kk/pkg/kubernetes/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (g *GenerateKubeadmConfig) Execute(runtime connector.Runtime) error {
switch g.KubeConf.Cluster.Etcd.Type {
case kubekeyv1alpha2.KubeKey:
for _, host := range runtime.GetHostsByRole(common.ETCD) {
endpoint := fmt.Sprintf("https://%s:%s", host.GetInternalIPv4Address(), kubekeyv1alpha2.DefaultEtcdPort)
endpoint := fmt.Sprintf("https://%s:%d", host.GetInternalIPv4Address(), g.KubeConf.Cluster.Etcd.GetPort())
endpointsList = append(endpointsList, endpoint)
}
externalEtcd.Endpoints = endpointsList
Expand Down
4 changes: 4 additions & 0 deletions docs/kubernetes-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
| v1.27.13 | :white_check_mark: |
| v1.27.14 | :white_check_mark: |
| v1.27.15 | :white_check_mark: |
| v1.27.16 | :white_check_mark: |
| v1.28.0 | :white_check_mark: |
| v1.28.1 | :white_check_mark: |
| v1.28.2 | :white_check_mark: |
Expand All @@ -138,13 +139,16 @@
| v1.28.9 | :white_check_mark: |
| v1.28.10 | :white_check_mark: |
| v1.28.11 | :white_check_mark: |
| v1.28.12 | :white_check_mark: |
| v1.29.0 | :white_check_mark: |
| v1.29.1 | :white_check_mark: |
| v1.29.2 | :white_check_mark: |
| v1.29.3 | :white_check_mark: |
| v1.29.4 | :white_check_mark: |
| v1.29.5 | :white_check_mark: |
| v1.29.6 | :white_check_mark: |
| v1.29.7 | :white_check_mark: |
| v1.30.0 | :white_check_mark: |
| v1.30.1 | :white_check_mark: |
| v1.30.2 | :white_check_mark: |
| v1.30.3 | :white_check_mark: |
Loading

0 comments on commit b8edc41

Please sign in to comment.