support kubesphere v3.2.1

Signed-off-by: 24sama <leo@kubesphere.io>
This commit is contained in:
24sama 2021-11-29 14:15:19 +08:00
parent e0eba5e1f0
commit 491aa5e7d8
8 changed files with 287 additions and 72 deletions

View File

@ -23,8 +23,8 @@ import (
"github.com/kubesphere/kubekey/cmd/ctl/util"
"github.com/kubesphere/kubekey/pkg/common"
"github.com/kubesphere/kubekey/pkg/pipelines"
"github.com/kubesphere/kubekey/pkg/version/kubernetes"
"github.com/kubesphere/kubekey/pkg/version/kubesphere"
"github.com/kubesphere/kubekey/version"
"github.com/spf13/cobra"
"time"
)
@ -111,13 +111,14 @@ func (o *CreateClusterOptions) AddFlags(cmd *cobra.Command) {
func completionSetting(cmd *cobra.Command) (err error) {
cmd.ValidArgsFunction = func(cmd *cobra.Command, args []string, toComplete string) (
strings []string, directive cobra.ShellCompDirective) {
versionArray := []string{"v2.1.1", "v3.0.0", "v3.1.0", "v3.1.1", "v3.2.0", time.Now().Add(-time.Hour * 24).Format("nightly-20060102")}
versionArray := kubesphere.VersionsStringArr()
versionArray = append(versionArray, time.Now().Add(-time.Hour*24).Format("nightly-20060102"))
return versionArray, cobra.ShellCompDirectiveNoFileComp
}
err = cmd.RegisterFlagCompletionFunc("with-kubernetes", func(cmd *cobra.Command, args []string, toComplete string) (
strings []string, directive cobra.ShellCompDirective) {
return version.SupportedK8sVersionList(), cobra.ShellCompDirectiveNoFileComp
return kubernetes.SupportedK8sVersionList(), cobra.ShellCompDirectiveNoFileComp
})
return
}

View File

@ -22,8 +22,8 @@ import (
"github.com/kubesphere/kubekey/cmd/ctl/util"
"github.com/kubesphere/kubekey/pkg/common"
"github.com/kubesphere/kubekey/pkg/pipelines"
"github.com/kubesphere/kubekey/pkg/version/kubernetes"
"github.com/kubesphere/kubekey/pkg/version/kubesphere"
"github.com/kubesphere/kubekey/version"
"github.com/spf13/cobra"
"time"
)
@ -99,13 +99,14 @@ func (o *UpgradeOptions) AddFlags(cmd *cobra.Command) {
func completionSetting(cmd *cobra.Command) (err error) {
cmd.ValidArgsFunction = func(cmd *cobra.Command, args []string, toComplete string) (
strings []string, directive cobra.ShellCompDirective) {
versionArray := []string{"v2.1.1", "v3.0.0", "v3.1.0", "v3.1.1", "v3.2.0", time.Now().Add(-time.Hour * 24).Format("nightly-20060102")}
versionArray := kubesphere.VersionsStringArr()
versionArray = append(versionArray, time.Now().Add(-time.Hour*24).Format("nightly-20060102"))
return versionArray, cobra.ShellCompDirectiveNoFileComp
}
err = cmd.RegisterFlagCompletionFunc("with-kubernetes", func(cmd *cobra.Command, args []string, toComplete string) (
strings []string, directive cobra.ShellCompDirective) {
return version.SupportedK8sVersionList(), cobra.ShellCompDirectiveNoFileComp
return kubernetes.SupportedK8sVersionList(), cobra.ShellCompDirectiveNoFileComp
})
return
}

View File

@ -18,6 +18,7 @@ package version
import (
"fmt"
"github.com/kubesphere/kubekey/pkg/version/kubernetes"
"github.com/kubesphere/kubekey/version"
"github.com/spf13/cobra"
"io"
@ -71,6 +72,6 @@ func printVersion(short bool) error {
}
func printSupportedK8sVersionList(output io.Writer) (err error) {
_, err = output.Write([]byte(fmt.Sprintln(strings.Join(version.SupportedK8sVersionList(), "\n"))))
_, err = output.Write([]byte(fmt.Sprintln(strings.Join(kubernetes.SupportedK8sVersionList(), "\n"))))
return
}

View File

@ -77,3 +77,34 @@ func VersionSupport(version string) bool {
}
return false
}
// SupportedK8sVersionList returns the supported list of Kubernetes
func SupportedK8sVersionList() []string {
return []string{
"v1.15.12",
"v1.16.8",
"v1.16.10",
"v1.16.12",
"v1.16.13",
"v1.17.0",
"v1.17.4",
"v1.17.5",
"v1.17.6",
"v1.17.7",
"v1.17.8",
"v1.17.9",
"v1.18.3",
"v1.18.5",
"v1.18.6",
"v1.18.8",
"v1.19.0",
"v1.19.8",
"v1.19.9",
"v1.20.4",
"v1.20.6",
"v1.20.10",
"v1.21.4",
"v1.21.5",
"v1.22.1",
}
}

View File

@ -142,3 +142,20 @@ var KsV320 = &KsInstaller{
V311.String(),
},
}
var KsV321 = &KsInstaller{
Version: V321.String(),
CRDTemplate: templates.KsInstaller,
ClusterConfigurationTemplate: templates.V321,
K8sSupportVersions: []string{
"v1.19",
"v1.20",
"v1.21",
"v1.22",
},
UpgradeSupportVersions: []string{
V310.String(),
V311.String(),
V320.String(),
},
}

View File

@ -0,0 +1,198 @@
/*
Copyright 2021 The KubeSphere Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package templates
import (
"github.com/lithammer/dedent"
"text/template"
)
var V321 = template.Must(template.New("v3.2.1").Parse(
dedent.Dedent(`
---
apiVersion: installer.kubesphere.io/v1alpha1
kind: ClusterConfiguration
metadata:
name: ks-installer
namespace: kubesphere-system
labels:
version: {{ .Tag }}
spec:
persistence:
storageClass: ""
authentication:
jwtSecret: ""
local_registry: ""
# dev_tag: ""
etcd:
monitoring: false
endpointIps: localhost
port: 2379
tlsEnable: true
common:
core:
console:
enableMultiLogin: true
port: 30880
type: NodePort
# apiserver:
# resources: {}
# controllerManager:
# resources: {}
redis:
enabled: false
volumeSize: 2Gi
openldap:
enabled: false
volumeSize: 2Gi
minio:
volumeSize: 20Gi
monitoring:
# type: external
endpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090
GPUMonitoring:
enabled: false
gpu:
kinds:
- resourceName: "nvidia.com/gpu"
resourceType: "GPU"
default: true
es:
# master:
# volumeSize: 4Gi
# replicas: 1
# resources: {}
# data:
# volumeSize: 20Gi
# replicas: 1
# resources: {}
logMaxAge: 7
elkPrefix: logstash
basicAuth:
enabled: false
username: ""
password: ""
externalElasticsearchHost: ""
externalElasticsearchPort: ""
alerting:
enabled: false
# thanosruler:
# replicas: 1
# resources: {}
auditing:
enabled: false
# operator:
# resources: {}
# webhook:
# resources: {}
devops:
enabled: false
jenkinsMemoryLim: 2Gi
jenkinsMemoryReq: 1500Mi
jenkinsVolumeSize: 8Gi
jenkinsJavaOpts_Xms: 512m
jenkinsJavaOpts_Xmx: 512m
jenkinsJavaOpts_MaxRAM: 2g
events:
enabled: false
# operator:
# resources: {}
# exporter:
# resources: {}
# ruler:
# enabled: true
# replicas: 2
# resources: {}
logging:
enabled: false
containerruntime: docker
logsidecar:
enabled: true
replicas: 2
# resources: {}
metrics_server:
enabled: false
monitoring:
storageClass: ""
# kube_rbac_proxy:
# resources: {}
# kube_state_metrics:
# resources: {}
# prometheus:
# replicas: 1
# volumeSize: 20Gi
# resources: {}
# operator:
# resources: {}
# adapter:
# resources: {}
# node_exporter:
# resources: {}
# alertmanager:
# replicas: 1
# resources: {}
# notification_manager:
# resources: {}
# operator:
# resources: {}
# proxy:
# resources: {}
gpu:
nvidia_dcgm_exporter:
enabled: false
# resources: {}
multicluster:
clusterRole: none
network:
networkpolicy:
enabled: false
ippool:
type: none
topology:
type: none
openpitrix:
store:
enabled: false
servicemesh:
enabled: false
kubeedge:
enabled: false
cloudCore:
nodeSelector: {"node-role.kubernetes.io/worker": ""}
tolerations: []
cloudhubPort: "10000"
cloudhubQuicPort: "10001"
cloudhubHttpsPort: "10002"
cloudstreamPort: "10003"
tunnelPort: "10004"
cloudHub:
advertiseAddress:
- ""
nodeLimit: "100"
service:
cloudhubNodePort: "30000"
cloudhubQuicNodePort: "30001"
cloudhubHttpsNodePort: "30002"
cloudstreamNodePort: "30003"
tunnelNodePort: "30004"
edgeWatcher:
nodeSelector: {"node-role.kubernetes.io/worker": ""}
tolerations: []
edgeWatcherAgent:
nodeSelector: {"node-role.kubernetes.io/worker": ""}
tolerations: []
`)))

View File

@ -30,6 +30,7 @@ const (
V310
V311
V320
V321
)
var VersionList = []Version{
@ -38,6 +39,7 @@ var VersionList = []Version{
V310,
V311,
V320,
V321,
}
var VersionMap = map[string]*KsInstaller{
@ -46,12 +48,41 @@ var VersionMap = map[string]*KsInstaller{
V310.String(): KsV310,
V311.String(): KsV311,
V320.String(): KsV320,
V321.String(): KsV321,
}
var CNSource = map[string]bool{
V310.String(): true,
V311.String(): true,
V320.String(): true,
V321.String(): true,
}
func (v Version) String() string {
switch v {
case V211:
return "v2.1.1"
case V300:
return "v3.0.0"
case V310:
return "v3.1.0"
case V311:
return "v3.1.1"
case V320:
return "v3.2.0"
case V321:
return "v3.2.1"
default:
return "invalid option"
}
}
func VersionsStringArr() []string {
strArr := make([]string, 0, len(VersionList))
for i, v := range VersionList {
strArr[i] = v.String()
}
return strArr
}
func StabledVersionSupport(version string) (*KsInstaller, bool) {
@ -104,20 +135,3 @@ func DevRelease(version string) (*KsInstaller, bool) {
func Latest() *KsInstaller {
return VersionMap[VersionList[len(VersionList)-1].String()]
}
func (v Version) String() string {
switch v {
case V211:
return "v2.1.1"
case V300:
return "v3.0.0"
case V310:
return "v3.1.0"
case V311:
return "v3.1.1"
case V320:
return "v3.2.0"
default:
return "invalid option"
}
}

View File

@ -1,48 +0,0 @@
/*
Copyright 2021 The KubeSphere Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package version
// SupportedK8sVersionList returns the supported list of Kubernetes
func SupportedK8sVersionList() []string {
return []string{
"v1.15.12",
"v1.16.8",
"v1.16.10",
"v1.16.12",
"v1.16.13",
"v1.17.0",
"v1.17.4",
"v1.17.5",
"v1.17.6",
"v1.17.7",
"v1.17.8",
"v1.17.9",
"v1.18.3",
"v1.18.5",
"v1.18.6",
"v1.18.8",
"v1.19.0",
"v1.19.8",
"v1.19.9",
"v1.20.4",
"v1.20.6",
"v1.20.10",
"v1.21.4",
"v1.21.5",
"v1.22.1",
}
}