Repository: kubean-io/kubean
Pull request #272 (2022-11-01 04:41:22)

update kubespray default version to v1.24.7
<!--  

Thanks for sending a pull request!  Here are some tips for you:

* make sure your commit is signed off

-->

**What type of PR is this?**
/kind feature

**What this PR does / why we need it**:
update kubespray default version to v1.24.7

**Which issue(s) this PR fixes**:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #

**Special notes for your reviewer**:




Patch:
diff --git a/api/apis/manifest/v1alpha1/types.go b/api/apis/manifest/v1alpha1/types.go
index ed616abe9..4a840e402 100644
--- a/api/apis/manifest/v1alpha1/types.go
+++ b/api/apis/manifest/v1alpha1/types.go
@@ -43,7 +43,7 @@ type Spec struct {
 
 type LocalService struct {
 	// +optional
-	ImageRepo map[ImageRepoType]string `json:"imageRepo" yaml:"imageRepo"`
+	RegistryRepo string `json:"registryRepo,omitempty" yaml:"registryRepo,omitempty"`
 	// +optional
 	FilesRepo string `json:"filesRepo,omitempty" yaml:"filesRepo,omitempty"`
 	// +optional
@@ -52,21 +52,6 @@ type LocalService struct {
 	HostsMap []*HostsMap `json:"hostsMap,omitempty" yaml:"hostsMap,omitempty"`
 }
 
-func (localService *LocalService) GetGHCRImageRepo() string {
-	if localService.ImageRepo == nil {
-		return ""
-	}
-	return localService.ImageRepo[GithubImageRepo]
-}
-
-type ImageRepoType string
-
-const KubeImageRepo ImageRepoType = "kubeImageRepo"
-const GCRImageRepo ImageRepoType = "gcrImageRepo"
-const GithubImageRepo ImageRepoType = "githubImageRepo"
-const DockerImageRepo ImageRepoType = "dockerImageRepo"
-const QuayImageRepo ImageRepoType = "quayImageRepo"
-
 type HostsMap struct {
 	// +required
 	Domain string `json:"domain,omitempty" yaml:"domain,omitempty"`
diff --git a/api/apis/manifest/v1alpha1/zz_generated.deepcopy.go b/api/apis/manifest/v1alpha1/zz_generated.deepcopy.go
index d00e35b32..2cba0373b 100644
--- a/api/apis/manifest/v1alpha1/zz_generated.deepcopy.go
+++ b/api/apis/manifest/v1alpha1/zz_generated.deepcopy.go
@@ -108,13 +108,6 @@ func (in *LocalAvailable) DeepCopy() *LocalAvailable {
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 func (in *LocalService) DeepCopyInto(out *LocalService) {
 	*out = *in
-	if in.ImageRepo != nil {
-		in, out := &in.ImageRepo, &out.ImageRepo
-		*out = make(map[ImageRepoType]string, len(*in))
-		for key, val := range *in {
-			(*out)[key] = val
-		}
-	}
 	if in.YumRepo != nil {
 		in, out := &in.YumRepo, &out.YumRepo
 		*out = make([]string, len(*in))
diff --git a/api/charts/crds/kubean.io_manifests.yaml b/api/charts/crds/kubean.io_manifests.yaml
index 4a5360854..a7f938df6 100644
--- a/api/charts/crds/kubean.io_manifests.yaml
+++ b/api/charts/crds/kubean.io_manifests.yaml
@@ -86,10 +86,8 @@ spec:
                           type: string
                       type: object
                     type: array
-                  imageRepo:
-                    additionalProperties:
-                      type: string
-                    type: object
+                  registryRepo:
+                    type: string
                   yumRepo:
                     items:
                       type: string
diff --git a/artifacts/generate_offline_package.sh b/artifacts/generate_offline_package.sh
index cc35f9b00..f0b190d2b 100644
--- a/artifacts/generate_offline_package.sh
+++ b/artifacts/generate_offline_package.sh
@@ -4,6 +4,7 @@ set -eo pipefail
 
 OPTION=${1:-'all'}
 KUBEAN_TAG=${KUBEAN_TAG:-"v0.1.0"}
+KUBE_VERSION=${KUBE_VERSION:-"v1.24.7"}
 
 CURRENT_DIR=$(pwd)
 ARCH=${ARCH:-"amd64"}
@@ -36,7 +37,7 @@ function generate_temp_list() {
   fi
   echo "$CURRENT_DIR/kubespray"
   cd $CURRENT_DIR/kubespray
-  bash contrib/offline/generate_list.sh -e"image_arch=${ARCH}"
+  bash contrib/offline/generate_list.sh -e"image_arch=${ARCH}" -e"kube_version=${KUBE_VERSION}"
 
   # Clean up unused images
   remove_images="aws-alb|aws-ebs|cert-manager|netchecker|weave|sig-storage|external_storage|cinder-csi|kubernetesui|flannel"
diff --git a/artifacts/manage_version_cr.sh b/artifacts/manage_version_cr.sh
index 64416e9b1..720d7d557 100755
--- a/artifacts/manage_version_cr.sh
+++ b/artifacts/manage_version_cr.sh
@@ -6,6 +6,7 @@ OPTION=${1:-'create_localartifactset'} ## create_localartifactset  create_manife
 
 KUBESPRAY_TAG=${KUBESPRAY_TAG:-"v2.19.0"} ## env from github action
 KUBEAN_TAG=${KUBEAN_TAG:-"v0.1.0"}        ## env from github action
+KUBE_VERSION=${KUBE_VERSION:-"v1.24.7"}
 
 CURRENT_DIR=$(cd $(dirname $0); pwd) ## artifacts dir
 CURRENT_DATE=$(date +%Y%m%d)
@@ -86,7 +87,8 @@ function update_docker_offline_version() {
 function create_offline_version_cr() {
   cni_version=$(extract_version "cni_version")
   containerd_version=$(extract_version "containerd_version")
-  kube_version=$(extract_version "kube_version" "kubespray-defaults")
+  # kube_version=$(extract_version "kube_version" "kubespray-defaults")
+  kube_version=${KUBE_VERSION}
   calico_version=$(extract_version "calico_version")
   cilium_version=$(extract_version "cilium_version")
   etcd_version=$(extract_etcd_version "$kube_version")
@@ -145,7 +147,8 @@ function create_info_manifest_cr() {
   containerd_version_default=$(extract_version "containerd_version")
   containerd_version_range=$(extract_version_range ".containerd_archive_checksums.amd64")
 
-  kube_version_default=$(extract_version "kube_version" "kubespray-defaults")
+  # kube_version_default=$(extract_version "kube_version" "kubespray-defaults")
+  kube_version_default=${kube_version}
   kube_version_range=$(extract_version_range ".kubelet_checksums.amd64")
 
   calico_version_default=$(extract_version "calico_version")
@@ -154,7 +157,7 @@ function create_info_manifest_cr() {
   cilium_version_default=$(extract_version "cilium_version")
   cilium_version_range="[]" ## anything
 
-  etcd_version_default=$(extract_etcd_version "$kube_version_default")
+  etcd_version_default=$(extract_etcd_version "${kube_version_default}")
   etcd_version_range=$(extract_version_range ".etcd_binary_checksums.amd64")
 
   docker_version_default=$(extract_version "docker_version" "container-engine/docker")
diff --git a/build/os-packages/packages.yml b/build/os-packages/packages.yml
index bde519828..e1abba947 100644
--- a/build/os-packages/packages.yml
+++ b/build/os-packages/packages.yml
@@ -16,10 +16,10 @@ docker:
     - containerd.io-1.6.4-3.1.el7
     - docker-ce-18.09.9-3.el7
     - docker-ce-19.03.15-3.el7
-    - docker-ce-20.10.20-3.el7
+    - docker-ce-20.10.17-3.el7
     - docker-ce-cli-18.09.9-3.el7
     - docker-ce-cli-19.03.15-3.el7
-    - docker-ce-cli-20.10.20-3.el7
+    - docker-ce-cli-20.10.17-3.el7
 
   redhat8:
     - containerd.io-1.4.9-3.1.el8
@@ -27,7 +27,7 @@ docker:
     - containerd.io-1.6.4-3.1.el8
     - docker-ce-3:18.09.9-3.el7
     - docker-ce-3:19.03.15-3.el8
-    - docker-ce-3:20.10.20-3.el8
+    - docker-ce-3:20.10.17-3.el8
     - docker-ce-cli-1:18.09.9-3.el7
     - docker-ce-cli-1:19.03.15-3.el8
-    - docker-ce-cli-1:20.10.20-3.el8
+    - docker-ce-cli-1:20.10.17-3.el8
diff --git a/charts/kubean/crds/kubean.io_manifests.yaml b/charts/kubean/crds/kubean.io_manifests.yaml
index 4a5360854..a7f938df6 100644
--- a/charts/kubean/crds/kubean.io_manifests.yaml
+++ b/charts/kubean/crds/kubean.io_manifests.yaml
@@ -86,10 +86,8 @@ spec:
                           type: string
                       type: object
                     type: array
-                  imageRepo:
-                    additionalProperties:
-                      type: string
-                    type: object
+                  registryRepo:
+                    type: string
                   yumRepo:
                     items:
                       type: string
diff --git a/pkg/controllers/infomanifest/controller.go b/pkg/controllers/infomanifest/controller.go
index 41b8aef8b..39ce982e6 100644
--- a/pkg/controllers/infomanifest/controller.go
+++ b/pkg/controllers/infomanifest/controller.go
@@ -173,8 +173,8 @@ func (c *Controller) UpdateLocalAvailableImage() {
 		return
 	}
 	imageRepo := "ghcr.m.daocloud.io"
-	if len(global.Spec.LocalService.GetGHCRImageRepo()) != 0 {
-		imageRepo = global.Spec.LocalService.GetGHCRImageRepo() // ghcr.io
+	if len(global.Spec.LocalService.RegistryRepo) != 0 {
+		imageRepo = global.Spec.LocalService.RegistryRepo
 	}
 	newImageName := fmt.Sprintf("%s/kubean-io/spray-job:%s", imageRepo, global.Spec.KubeanVersion)
 	if global.Status.LocalAvailable.KubesprayImage != newImageName {
diff --git a/playbooks/cluster-info.yml b/playbooks/cluster-info.yml
index 071d82d76..7e128879c 100644
--- a/playbooks/cluster-info.yml
+++ b/playbooks/cluster-info.yml
@@ -10,7 +10,7 @@
         kubectl -n kube-system get pod
         kubectl get --raw='/readyz?verbose'
       register: clusterinfo
-      retries: 5
-      delay: 30
+      retries: 3
+      delay: 10
       until: clusterinfo.rc == 0
     - debug: var=clusterinfo.stdout_lines
diff --git a/vendor/kubean.io/api/apis/manifest/v1alpha1/types.go b/vendor/kubean.io/api/apis/manifest/v1alpha1/types.go
index ed616abe9..4a840e402 100644
--- a/vendor/kubean.io/api/apis/manifest/v1alpha1/types.go
+++ b/vendor/kubean.io/api/apis/manifest/v1alpha1/types.go
@@ -43,7 +43,7 @@ type Spec struct {
 
 type LocalService struct {
 	// +optional
-	ImageRepo map[ImageRepoType]string `json:"imageRepo" yaml:"imageRepo"`
+	RegistryRepo string `json:"registryRepo,omitempty" yaml:"registryRepo,omitempty"`
 	// +optional
 	FilesRepo string `json:"filesRepo,omitempty" yaml:"filesRepo,omitempty"`
 	// +optional
@@ -52,21 +52,6 @@ type LocalService struct {
 	HostsMap []*HostsMap `json:"hostsMap,omitempty" yaml:"hostsMap,omitempty"`
 }
 
-func (localService *LocalService) GetGHCRImageRepo() string {
-	if localService.ImageRepo == nil {
-		return ""
-	}
-	return localService.ImageRepo[GithubImageRepo]
-}
-
-type ImageRepoType string
-
-const KubeImageRepo ImageRepoType = "kubeImageRepo"
-const GCRImageRepo ImageRepoType = "gcrImageRepo"
-const GithubImageRepo ImageRepoType = "githubImageRepo"
-const DockerImageRepo ImageRepoType = "dockerImageRepo"
-const QuayImageRepo ImageRepoType = "quayImageRepo"
-
 type HostsMap struct {
 	// +required
 	Domain string `json:"domain,omitempty" yaml:"domain,omitempty"`
diff --git a/vendor/kubean.io/api/apis/manifest/v1alpha1/zz_generated.deepcopy.go b/vendor/kubean.io/api/apis/manifest/v1alpha1/zz_generated.deepcopy.go
index d00e35b32..2cba0373b 100644
--- a/vendor/kubean.io/api/apis/manifest/v1alpha1/zz_generated.deepcopy.go
+++ b/vendor/kubean.io/api/apis/manifest/v1alpha1/zz_generated.deepcopy.go
@@ -108,13 +108,6 @@ func (in *LocalAvailable) DeepCopy() *LocalAvailable {
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 func (in *LocalService) DeepCopyInto(out *LocalService) {
 	*out = *in
-	if in.ImageRepo != nil {
-		in, out := &in.ImageRepo, &out.ImageRepo
-		*out = make(map[ImageRepoType]string, len(*in))
-		for key, val := range *in {
-			(*out)[key] = val
-		}
-	}
 	if in.YumRepo != nil {
 		in, out := &in.YumRepo, &out.YumRepo
 		*out = make([]string, len(*in))


Test patch:
diff --git a/pkg/controllers/infomanifest/controller_test.go b/pkg/controllers/infomanifest/controller_test.go
index 96fc6d97d..16cd73474 100644
--- a/pkg/controllers/infomanifest/controller_test.go
+++ b/pkg/controllers/infomanifest/controller_test.go
@@ -168,17 +168,11 @@ func Test_ParseConfigMapToLocalService(t *testing.T) {
 		},
 		{
 			name: "good string data",
-			arg:  &corev1.ConfigMap{Data: map[string]string{"localService": "      imageRepo: \n        kubeImageRepo: \"temp-registry.daocloud.io:5000/registry.k8s.io\"\n        gcrImageRepo: \"temp-registry.daocloud.io:5000/gcr.io\"\n        githubImageRepo: \"a\"\n        dockerImageRepo: \"b\"\n        quayImageRepo: \"c\"\n      filesRepo: 'http://temp-registry.daocloud.io:9000'\n      yumRepo:\n        - 'http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\$releasever/os/\\$basearch'\n        - 'http://temp-registry.daocloud.io:9000/centos/\\$releasever/os/\\$basearch'\n      hostsMap:\n        - domain: temp-registry.daocloud.io\n          address: 'a.b.c.d'\n"}},
+			arg:  &corev1.ConfigMap{Data: map[string]string{"localService": "      registryRepo: 'temp-registry.daocloud.io:5000'\n      filesRepo: 'http://temp-registry.daocloud.io:9000'\n      yumRepo:\n        - 'http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\$releasever/os/\\$basearch'\n        - 'http://temp-registry.daocloud.io:9000/centos/\\$releasever/os/\\$basearch'\n      hostsMap:\n        - domain: temp-registry.daocloud.io\n          address: 'a.b.c.d'"}},
 			want: &manifestv1alpha1.LocalService{
-				ImageRepo: map[manifestv1alpha1.ImageRepoType]string{
-					"kubeImageRepo":   "temp-registry.daocloud.io:5000/registry.k8s.io",
-					"gcrImageRepo":    "temp-registry.daocloud.io:5000/gcr.io",
-					"githubImageRepo": "a",
-					"dockerImageRepo": "b",
-					"quayImageRepo":   "c",
-				},
-				FilesRepo: "http://temp-registry.daocloud.io:9000",
-				YumRepo:   []string{"http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\$releasever/os/\\$basearch", "http://temp-registry.daocloud.io:9000/centos/\\$releasever/os/\\$basearch"},
+				RegistryRepo: "temp-registry.daocloud.io:5000",
+				FilesRepo:    "http://temp-registry.daocloud.io:9000",
+				YumRepo:      []string{"http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\$releasever/os/\\$basearch", "http://temp-registry.daocloud.io:9000/centos/\\$releasever/os/\\$basearch"},
 				HostsMap: []*manifestv1alpha1.HostsMap{
 					{Domain: "temp-registry.daocloud.io", Address: "a.b.c.d"},
 				},
@@ -314,7 +308,7 @@ func Test_UpdateGlobalLocalService1(t *testing.T) {
 						Name:      LocalServiceConfigMap,
 						Namespace: "default",
 					},
-					Data: map[string]string{"localService": "      imageRepo: \n        kubeImageRepo: \"temp-registry.daocloud.io:5000/registry.k8s.io\"\n        gcrImageRepo: \"temp-registry.daocloud.io:5000/gcr.io\"\n        githubImageRepo: \"a\"\n        dockerImageRepo: \"b\"\n        quayImageRepo: \"c\"\n      filesRepo: 'http://temp-registry.daocloud.io:9000'\n      yumRepo:\n        - 'http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\$releasever/os/\\$basearch'\n        - 'http://temp-registry.daocloud.io:9000/centos/\\$releasever/os/\\$basearch'\n      hostsMap: \n        - domain: temp-registry.daocloud.io\n          address: 'a.b.c.d'"},
+					Data: map[string]string{"localService": "      registryRepo: 'temp-registry.daocloud.io:5000'\n      filesRepo: 'http://temp-registry.daocloud.io:9000'\n      yumRepo:\n        - 'http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\$releasever/os/\\$basearch'\n        - 'http://temp-registry.daocloud.io:9000/centos/\\$releasever/os/\\$basearch'\n      hostsMap: \n        - domain: temp-registry.daocloud.io\n          address: 'a.b.c.d'"},
 				}
 				controller.ClientSet.CoreV1().ConfigMaps("default").Create(context.Background(), configMap, metav1.CreateOptions{})
 				controller.Create(context.Background(), global)
@@ -322,15 +316,9 @@ func Test_UpdateGlobalLocalService1(t *testing.T) {
 				controller.UpdateGlobalLocalService()
 			},
 			want: manifestv1alpha1.LocalService{
-				ImageRepo: map[manifestv1alpha1.ImageRepoType]string{
-					"kubeImageRepo":   "temp-registry.daocloud.io:5000/registry.k8s.io",
-					"gcrImageRepo":    "temp-registry.daocloud.io:5000/gcr.io",
-					"githubImageRepo": "a",
-					"dockerImageRepo": "b",
-					"quayImageRepo":   "c",
-				},
-				FilesRepo: "http://temp-registry.daocloud.io:9000",
-				YumRepo:   []string{"http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\$releasever/os/\\$basearch", "http://temp-registry.daocloud.io:9000/centos/\\$releasever/os/\\$basearch"},
+				RegistryRepo: "temp-registry.daocloud.io:5000",
+				FilesRepo:    "http://temp-registry.daocloud.io:9000",
+				YumRepo:      []string{"http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\$releasever/os/\\$basearch", "http://temp-registry.daocloud.io:9000/centos/\\$releasever/os/\\$basearch"},
 				HostsMap: []*manifestv1alpha1.HostsMap{
 					{
 						Domain:  "temp-registry.daocloud.io",
@@ -360,7 +348,7 @@ func Test_UpdateGlobalLocalService1(t *testing.T) {
 						Name:      LocalServiceConfigMap,
 						Namespace: "default",
 					},
-					Data: map[string]string{"localService": "      imageRepo: \n        kubeImageRepo: \"temp-registry.daocloud.io:5000/registry.k8s.io\"\n        gcrImageRepo: \"temp-registry.daocloud.io:5000/gcr.io\"\n        githubImageRepo: \"a\"\n        dockerImageRepo: \"b\"\n        quayImageRepo: \"c\"\n      filesRepo: 'http://temp-registry.daocloud.io:9000'\n      yumRepo:\n        - 'http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\$releasever/os/\\$basearch'\n        - 'http://temp-registry.daocloud.io:9000/centos/\\$releasever/os/\\$basearch'\n      hostsMap: \n        - domain: temp-registry.daocloud.io\n          address: 'a.b.c.d1'"},
+					Data: map[string]string{"localService": "      registryRepo: 'temp-registry.daocloud.io:5000'\n      filesRepo: 'http://temp-registry.daocloud.io:9000'\n      yumRepo:\n        - 'http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\$releasever/os/\\$basearch'\n        - 'http://temp-registry.daocloud.io:9000/centos/\\$releasever/os/\\$basearch'\n      hostsMap: \n        - domain: temp-registry.daocloud.io\n          address: 'a.b.c.d1'"},
 				}
 				controller.ClientSet.CoreV1().ConfigMaps("default").Update(context.Background(), configMap, metav1.UpdateOptions{})
 				controller.Create(context.Background(), global)
@@ -368,15 +356,9 @@ func Test_UpdateGlobalLocalService1(t *testing.T) {
 				controller.UpdateGlobalLocalService()
 			},
 			want: manifestv1alpha1.LocalService{
-				ImageRepo: map[manifestv1alpha1.ImageRepoType]string{
-					"kubeImageRepo":   "temp-registry.daocloud.io:5000/registry.k8s.io",
-					"gcrImageRepo":    "temp-registry.daocloud.io:5000/gcr.io",
-					"githubImageRepo": "a",
-					"dockerImageRepo": "b",
-					"quayImageRepo":   "c",
-				},
-				FilesRepo: "http://temp-registry.daocloud.io:9000",
-				YumRepo:   []string{"http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\$releasever/os/\\$basearch", "http://temp-registry.daocloud.io:9000/centos/\\$releasever/os/\\$basearch"},
+				RegistryRepo: "temp-registry.daocloud.io:5000",
+				FilesRepo:    "http://temp-registry.daocloud.io:9000",
+				YumRepo:      []string{"http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\$releasever/os/\\$basearch", "http://temp-registry.daocloud.io:9000/centos/\\$releasever/os/\\$basearch"},
 				HostsMap: []*manifestv1alpha1.HostsMap{
 					{
 						Domain:  "temp-registry.daocloud.io",
@@ -447,10 +429,7 @@ func Test_UpdateLocalAvailableImage(t *testing.T) {
 						Labels: map[string]string{OriginLabel: "v2"},
 					},
 					Spec: manifestv1alpha1.Spec{
-						LocalService: manifestv1alpha1.LocalService{ImageRepo: map[manifestv1alpha1.ImageRepoType]string{
-							"dockerImageRepo": "abc.io",
-							"githubImageRepo": "ghcr.io",
-						}},
+						LocalService:  manifestv1alpha1.LocalService{RegistryRepo: "abc.io"},
 						KubeanVersion: "123456",
 					},
 				}
@@ -458,7 +437,7 @@ func Test_UpdateLocalAvailableImage(t *testing.T) {
 				controller.InfoManifestClientSet.KubeanV1alpha1().Manifests().Update(context.Background(), global, metav1.UpdateOptions{})
 				controller.UpdateLocalAvailableImage()
 			},
-			want: "ghcr.io/kubean-io/spray-job:123456",
+			want: "abc.io/kubean-io/spray-job:123456",
 		},
 	}