diff --git a/.github/workflows/dev_images.yml b/.github/workflows/dev_images.yml
new file mode 100644
index 000000000..f9720f7e9
--- /dev/null
+++ b/.github/workflows/dev_images.yml
@@ -0,0 +1,33 @@
+name: Dev Images
+on:
+ push:
+ pull_request:
+ workflow_dispatch:
+jobs:
+ images:
+ runs-on: ubuntu-latest
+ permissions: write-all
+ # not trigger on 'kosmos-io/kosmos'
+ if: github.repository != 'kosmos-io/kosmos'
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ - name: Set up qemu
+ uses: docker/setup-qemu-action@v2
+ - name: Login registry
+ run: |
+ echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
+ - name: 'Get Previous tag'
+ id: previoustag
+ uses: "WyriHaximus/github-action-get-previous-tag@v1"
+ with:
+ fallback: 1.0.0
+ - name: Push images
+ env:
+ ON_PLUGINS: true
+ REGISTRY: ghcr.io/${{ github.repository_owner }}/${{ github.repository_name }}
+ TAG: ${{ steps.previoustag.outputs.tag }}
+ run: |
+ make upload-images REGISTRY=${REGISTRY%?} VERSION=$TAG
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 000000000..e69de29bb
diff --git a/Makefile b/Makefile
index f90b439fd..7465e0841 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,15 @@ REGISTRY_PASSWORD?=""
REGISTRY_SERVER_ADDRESS?=""
KIND_IMAGE_TAG?="v1.25.3"
+MACOS_TARGETS := clusterlink-controller-manager \
+ kosmos-operator \
+ clusterlink-elector \
+ clusterlink-network-manager \
+ clusterlink-proxy \
+ clustertree-cluster-manager \
+ scheduler \
+
+# clusterlink-agent and clusterlink-floater only support linux platform
TARGETS := clusterlink-controller-manager \
kosmos-operator \
clusterlink-agent \
@@ -19,6 +28,11 @@ TARGETS := clusterlink-controller-manager \
clustertree-cluster-manager \
scheduler \
+# If GOOS is macOS, assign the value of MACOS_TARGETS to TARGETS
+ifeq ($(GOOS), darwin)
+ TARGETS := $(MACOS_TARGETS)
+endif
+
CTL_TARGETS := kosmosctl
# Build code.
@@ -82,12 +96,13 @@ multi-platform-images: $(MP_TARGET)
.PHONY: clean
clean:
- rm -rf _tmp _output
+ hack/clean.sh
.PHONY: update
update:
hack/update-all.sh
+# verify-all.sh can not found
.PHONY: verify
verify:
hack/verify-all.sh
@@ -118,7 +133,7 @@ release:
@make release-kosmosctl GOOS=darwin GOARCH=arm64
release-kosmosctl:
- hack/release.sh kosmosctl ${GOOS} ${GOARCH}
+ hack/release.sh kosmosctl ${GOOS} ${GOARCH} ${VERSION}
.PHONY: lint
lint: golangci-lint
diff --git a/README.md b/README.md
index c88c0e1ca..cf093404a 100644
--- a/README.md
+++ b/README.md
@@ -45,24 +45,105 @@ The Kosmos scheduling module is an extension developed on top of the Kubernetes
Whether building a hybrid cloud environment or requiring flexible deployment of workloads across different clusters, the Kosmos scheduling module serves as a reliable solution, assisting users in managing containerized applications more efficiently.
## Quick Start
+
+This guide will cover:
+- Use Kind create three kubernetes cluster
+- Install `kosmosctl`, you can download from the releases page or build from source
+- Install `kosmos` control plane components in a Kubernetes cluster which is known as `host cluster`.
+- Join a member cluster to `kosmos` control plane on the `host cluster`.
+- Use the Kosmos clusters.
+
+### Prerequisites
+- [Go](https://golang.org/) version v1.20+
+- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) version v1.19+
+- [kind](https://kind.sigs.k8s.io/) version v0.14.0+
+
+### Deploy and run Kosmos control plane use script
+
+run the following script:
+
+```bash
+hack/local-up-kosmosctl.sh
+```
+
+### Deploy and run Kosmos step by step
+
+#### 1. Use Kind create cluster
+- Config your kind cluster use flow config, change the param as you need
+```yaml
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+networking:
+ # WARNING: It is _strongly_ recommended that you keep this the default
+ # (127.0.0.1) for security reasons. However it is possible to change this.
+ apiServerAddress: "192.168.200.112"
+ # By default the API server listens on a random open port.
+ # You may choose a specific port but probably don't need to in most cases.
+ # Using a random port makes it easier to spin up multiple clusters.
+ apiServerPort: 1443
+nodes:
+- role: control-plane
+ extraPortMappings:
+ - containerPort: "{{container_port}}"
+ hostPort: "{{host_port}}"
+ protocol: TCP
+ listenAddress: "{{host_ipaddress}}"
+#- role: worker
+#- role: worker
+```
+- create cluster1
+ `kind create cluster -n kind-cluster1 --config /path/to/kind-config`
+- create cluster2
+ `kind create cluster -n kind-cluster2 --config /path/to/kind-config`
+- create cluster3
+ `kind create cluster -n kind-cluster3 --config /path/to/kind-config`
+
+#### 2. Install `kosmosctl`
+
+##### 2.1 Use prebuild Binary executable file
+- Download from the releases page, only support macOS and linux
+- put `kosmosctl` to you Path, so you can execute `kosmosctl` without absolute path
+
+##### 2.2 Build from source
+- Download source
+`git clone https://github.com/kosmos-io/kosmos.git`
+- Build code, the output file is in the` /_output/bin/linux/amd64/kosmosctl`
+`make kosmosctl VERSION=v0.1.9`]
+- you can find any available version or tags in [here](https://github.com/kosmos-io/kosmos/tags)
+
+##### 3. Install `kosmos` control plane components
The following command allows you to quickly run an experimental environment with three clusters.
-Install the control plane in the host cluster.
+Install the control plane in the host cluster.
+Please config the pod can access the kind cluster apiServer, avoid the `kosmos-operator` CrashLoopBackOff
```Shell
kosmosctl install --cni calico --default-nic eth0 (We build a network tunnel based the network interface value passed by the arg default-nic)
```
-
-Join the two member clusters.
+##### 4. Join to `kosmos` control plane
+- Get the cluster1 and cluster2 kubeconfig and put it on the host cluster
+- Join the two member clusters(execute on the host cluster).
```Shell
kosmosctl join cluster --name cluster1 --kubeconfig ~/kubeconfig/cluster1-kubeconfig --cni calico --default-nic eth0 --enable-all
kosmosctl join cluster --name cluster2 --kubeconfig ~/kubeconfig/cluster2-kubeconfig --cni calico --default-nic eth0 --enable-all
```
-And then we can Use the Kosmos clusters like single cluster.
+##### 5. Use the Kosmos clusters like single cluster on the control plane.
+```shell
+kubectl get nodes
+```
+- use this command we can see the two cluster nodes Name like `kosmos-*` roles as `agent`
+
## Contact
If you have questions, feel free to reach out to us in the following ways:
- [Email](mailto:wuyingjun@cmss.chinamobile.com)
- [WeChat](./docs/images/kosmos-WeChatIMG.png)
+
+## Contributing
+
+If you're interested in being a contributor and want to get involved in
+developing the Karmada code, please see [CONTRIBUTING](CONTRIBUTING.md) for
+details on submitting patches and the contribution workflow.
+
## Contributors
@@ -75,7 +156,7 @@ Made with [contrib.rocks](https://contrib.rocks).
Copyright 2023 the KOSMOS Authors. All rights reserved.
-Licensed under the Apache License, Version 2.0.
+Licensed under the Apache License, Version 2.0. See the [LICENSE](LICENSE) file for details.
diff --git a/README_zh.md b/README_zh.md
index f4df99343..c60a70da7 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -48,7 +48,7 @@ Kosmos调度模块是基于Kubernetes调度框架的扩展开发,旨在满足
```bash
kosmosctl install --cni calico --default-nic eth0 (参数default-nic 表示基于哪个网卡创建网络隧道)
```
-加入两个子集群
+加入两个子集群(在kosmos控制面上执行)
```bash
kosmosctl join cluster --name cluster1 --kubeconfig ~/kubeconfig/cluster1-kubeconfig --cni calico --default-nic eth0 --enable-all
kosmosctl join cluster --name cluster2 --kubeconfig ~/kubeconfig/cluster2-kubeconfig --cni calico --default-nic eth0 --enable-all
diff --git a/deploy/clusterlink-elector.yml b/deploy/clusterlink-elector.yml
index 42840cafe..7f6201ca0 100644
--- a/deploy/clusterlink-elector.yml
+++ b/deploy/clusterlink-elector.yml
@@ -65,7 +65,6 @@ spec:
- mountPath: /etc/clusterlink
name: proxy-config
readOnly: true
- serviceAccount: clusterlink-elector
serviceAccountName: clusterlink-elector
tolerations:
- effect: NoSchedule
diff --git a/deploy/kindClusterConfig/kind-cluster1-config.yml b/deploy/kindClusterConfig/kind-cluster1-config.yml
new file mode 100644
index 000000000..a7d545f33
--- /dev/null
+++ b/deploy/kindClusterConfig/kind-cluster1-config.yml
@@ -0,0 +1,19 @@
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+networking:
+ # WARNING: It is _strongly_ recommended that you keep this the default
+ # (127.0.0.1) for security reasons. However it is possible to change this.
+ apiServerAddress: "{{host_ipaddress}}"
+ # By default the API server listens on a random open port.
+ # You may choose a specific port but probably don't need to in most cases.
+ # Using a random port makes it easier to spin up multiple clusters.
+ apiServerPort: 1443
+nodes:
+ - role: control-plane
+#- role: worker
+#- role: worker
+# extraPortMappings:
+# - containerPort: 6443
+# hostPort: 1443
+# protocol: TCP
+# listenAddress: 192.168.200.112
\ No newline at end of file
diff --git a/deploy/kindClusterConfig/kind-cluster2-config.yml b/deploy/kindClusterConfig/kind-cluster2-config.yml
new file mode 100644
index 000000000..2749b21c7
--- /dev/null
+++ b/deploy/kindClusterConfig/kind-cluster2-config.yml
@@ -0,0 +1,19 @@
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+networking:
+ # WARNING: It is _strongly_ recommended that you keep this the default
+ # (127.0.0.1) for security reasons. However it is possible to change this.
+ apiServerAddress: "{{host_ipaddress}}"
+ # By default the API server listens on a random open port.
+ # You may choose a specific port but probably don't need to in most cases.
+ # Using a random port makes it easier to spin up multiple clusters.
+ apiServerPort: 2443
+nodes:
+ - role: control-plane
+#- role: worker
+#- role: worker
+# extraPortMappings:
+# - containerPort: 6443
+# hostPort: 1443
+# protocol: TCP
+# listenAddress: 192.168.200.112
\ No newline at end of file
diff --git a/deploy/kindClusterConfig/kind-cluster3-config.yml b/deploy/kindClusterConfig/kind-cluster3-config.yml
new file mode 100644
index 000000000..9ed72c4af
--- /dev/null
+++ b/deploy/kindClusterConfig/kind-cluster3-config.yml
@@ -0,0 +1,19 @@
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+networking:
+ # WARNING: It is _strongly_ recommended that you keep this the default
+ # (127.0.0.1) for security reasons. However it is possible to change this.
+ apiServerAddress: "{{host_ipaddress}}"
+ # By default the API server listens on a random open port.
+ # You may choose a specific port but probably don't need to in most cases.
+ # Using a random port makes it easier to spin up multiple clusters.
+ apiServerPort: 3443
+nodes:
+ - role: control-plane
+#- role: worker
+#- role: worker
+# extraPortMappings:
+# - containerPort: 6443
+# hostPort: 1443
+# protocol: TCP
+# listenAddress: 192.168.200.112
\ No newline at end of file
diff --git a/deploy/scheduler/deployment.yaml b/deploy/scheduler/deployment.yaml
index 2959b9863..e9fdf9161 100644
--- a/deploy/scheduler/deployment.yaml
+++ b/deploy/scheduler/deployment.yaml
@@ -51,7 +51,6 @@ spec:
restartPolicy: Always
dnsPolicy: ClusterFirst
serviceAccountName: kosmos-scheduler
- serviceAccount: kosmos-scheduler
---
apiVersion: v1
diff --git a/docs/clustertree/README.md b/docs/clustertree/README.md
new file mode 100644
index 000000000..b9cb8038b
--- /dev/null
+++ b/docs/clustertree/README.md
@@ -0,0 +1,76 @@
+# ClusterTree(集群容器编排)
+
+## 技术架构图
+
+
+- 所有的服务部署都需要在kosmos控制面上执行,通过kosmos的控制面将工作负载(deploy、service、PV、PVCS)
+- 所有的controller都是通过Cluster-Manager这个服务来进行管理
+- 整个ClusterTree暂时只用到Cluster这个CRD,这个CRD中主要存储整个kosmos集群中各个集群的kubeconfig配置信息
+- controller通过读取Cluster 这个CRD来读取kubeconfig然后进行调和
+
+## 详细介绍
+### 如何进行本地debug
+- 推荐使用goland进行开发和测试
+- 使用kind创建3个集群,具体参考[README中的Quick Start](../../README.md#quick-start)部分内容
+- 配置Program Arguments 为
+`--kube-qps=500 --kube-burst=1000 --kubeconfig=$ProjectFileDir$/kube-config/kosmos-control-cluster-config.yaml --leader-elect=false --multi-cluster-service=false --v=4`
+将`--kubeconfig`改成kosmos主集群配置
+- 由于kind创建的3个集群,是通过内部的coredns进行通信,所以在Cluster-Manager进行debug或者运行的时候,需要改下config的获取,并修改IP和端口信息
+
+### Cluster-Manger
+- 整体的模块拆分如下
+- controller目录包含pod、pv、pvc的调和以及跨集群的服务导入、服务导出(实现服务的注册和服务发现)
+- extensions目录包含kosmos自身daemonset处理的controller,实现kosmos daemonset下发到不同的集群
+- node-server目录主要功能为管理整个集群的node,通过http的api提供一些服务,比如执行命令、获取日志
+
+```text
+└── cluster-manager
+ ├── cluster_controller.go
+ ├── controllers
+ │ ├── common_controller.go
+ │ ├── mcs
+ │ │ ├── auto_mcs_controller.go
+ │ │ ├── serviceexport_controller.go
+ │ │ └── serviceimport_controller.go
+ │ ├── node_lease_controller.go
+ │ ├── node_resources_controller.go
+ │ ├── pod
+ │ │ ├── leaf_pod_controller.go
+ │ │ ├── root_pod_controller.go
+ │ │ └── storage_handler.go
+ │ ├── pv
+ │ │ ├── leaf_pv_controller.go
+ │ │ ├── oneway_pv_controller.go
+ │ │ └── root_pv_controller.go
+ │ └── pvc
+ │ ├── leaf_pvc_controller.go
+ │ ├── oneway_pvc_controller.go
+ │ └── root_pvc_controller.go
+ ├── extensions
+ │ └── daemonset
+ │ ├── constants.go
+ │ ├── daemonset_controller.go
+ │ ├── daemonset_mirror_controller.go
+ │ ├── distribute_controller.go
+ │ ├── host_daemon_controller.go
+ │ ├── pod_reflect_controller.go
+ │ ├── update.go
+ │ └── utils.go
+ ├── node-server
+ │ ├── api
+ │ │ ├── errdefs.go
+ │ │ ├── exec.go
+ │ │ ├── helper.go
+ │ │ ├── logs.go
+ │ │ └── remotecommand
+ │ │ ├── attach.go
+ │ │ ├── exec.go
+ │ │ ├── httpstream.go
+ │ │ └── websocket.go
+ │ └── server.go
+ └── utils
+ ├── leaf_model_handler.go
+ ├── leaf_resource_manager.go
+ └── rootcluster.go
+
+```
\ No newline at end of file
diff --git a/docs/images/demo-check-node.png b/docs/images/demo-check-node.png
new file mode 100644
index 000000000..6f7072857
Binary files /dev/null and b/docs/images/demo-check-node.png differ
diff --git a/hack/build.sh b/hack/build.sh
index 3d547f6c9..4ccc09af6 100755
--- a/hack/build.sh
+++ b/hack/build.sh
@@ -23,7 +23,7 @@ set -o pipefail
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${REPO_ROOT}/hack/util.sh"
-LDFLAGS="$(util::version_ldflags) ${LDFLAGS:-}"
+LDFLAGS="$(util::version_ldflags "${VERSION:-}") ${LDFLAGS:-}"
function build_binary() {
local -r target=$1
@@ -39,6 +39,7 @@ function build_binary() {
done
}
+
function build_binary_for_platform() {
local -r target=$1
local -r platform=$2
diff --git a/hack/clean.sh b/hack/clean.sh
new file mode 100755
index 000000000..c3c6b4c37
--- /dev/null
+++ b/hack/clean.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+# This script clean builds tmp files and go cache.
+#
+# Usage:
+# hack/clean.sh
+# Environments:
+# BUILD_PLATFORMS: platforms to build. You can set one or more platforms separated by comma.
+# e.g.: linux/amd64,linux/arm64
+# Examples:
+# hack/clean.sh
+
+REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
+source "${REPO_ROOT}/hack/util.sh"
+
+function clean() {
+ echo "${REPO_ROOT}"/_tmp "${REPO_ROOT}"/_output
+ rm -rf "${REPO_ROOT}"/_tmp "${REPO_ROOT}"/_output
+ util::go_clean_cache
+}
+clean
\ No newline at end of file
diff --git a/hack/local-up-kosmos.sh b/hack/local-up-kosmos.sh
new file mode 100755
index 000000000..bd8e5531f
--- /dev/null
+++ b/hack/local-up-kosmos.sh
@@ -0,0 +1,84 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+function usage() {
+ echo "Usage:"
+ echo " hack/local-up-kosmos.sh [HOST_IPADDRESS] [-h]"
+ echo "Args:"
+ echo " HOST_IPADDRESS: (required) if you want to export clusters' API server port to specific IP address"
+ echo " h: print help information"
+}
+
+while getopts 'h' OPT; do
+ case $OPT in
+ h)
+ usage
+ exit 0
+ ;;
+ ?)
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+TEMP_PATH=$(mktemp -d)
+trap '{ rm -rf ${TEMP_PATH}; }' EXIT
+
+REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
+KUBECONFIG_PATH=${KUBECONFIG_PATH:-"${HOME}/.kube"}
+MEMBER_CLUSTER_1_NAME=${MEMBER_CLUSTER_1_NAME:-"kosmos-cluster1"}
+MEMBER_CLUSTER_2_NAME=${MEMBER_CLUSTER_2_NAME:-"kosmos-cluster2"}
+MEMBER_CLUSTER_3_NAME=${PULL_MODE_CLUSTER_NAME:-"kosmos-cluster3"}
+#MEMBER_TMP_CONFIG_PREFIX="member-tmp"
+#MEMBER_CLUSTER_1_TMP_CONFIG="${KUBECONFIG_PATH}/${MEMBER_TMP_CONFIG_PREFIX}-${MEMBER_CLUSTER_1_NAME}.config"
+#MEMBER_CLUSTER_2_TMP_CONFIG="${KUBECONFIG_PATH}/${MEMBER_TMP_CONFIG_PREFIX}-${MEMBER_CLUSTER_2_NAME}.config"
+#PULL_MODE_CLUSTER_TMP_CONFIG="${KUBECONFIG_PATH}/${MEMBER_TMP_CONFIG_PREFIX}-${PULL_MODE_CLUSTER_NAME}.config"
+HOST_IPADDRESS=${1:-}
+KIND_LOG_FILE=${KIND_LOG_FILE:-"/tmp/kosmos"}
+GOOS=$(go env GOOS)
+GOARCH=$(go env GOARCH)
+# make kosmosctl with recently tags
+make kosmosctl VERSION="$(git describe --tags --abbrev=0)"
+cp "${REPO_ROOT}/_output/bin/${GOOS}/${GOARCH}"/kosmosctl /usr/local/bin/
+
+# delete kosmos create clusters
+kind delete clusters "${MEMBER_CLUSTER_1_NAME}" "${MEMBER_CLUSTER_2_NAME}" "${MEMBER_CLUSTER_3_NAME}" >> "${KIND_LOG_FILE}" 2>&1
+
+if [[ -n "${HOST_IPADDRESS}" ]]; then # If bind the port of clusters(cluster1[as the host cluster], cluster2 and cluster3) to the host IP
+ echo "HOST_IPADDRESS" "${HOST_IPADDRESS}" "${TEMP_PATH}"
+ cp -rf "${REPO_ROOT}"/deploy/kindClusterConfig/kind-cluster1-config.yml "${TEMP_PATH}"/"${MEMBER_CLUSTER_1_NAME}"-config.yml
+ cp -rf "${REPO_ROOT}"/deploy/kindClusterConfig/kind-cluster2-config.yml "${TEMP_PATH}"/"${MEMBER_CLUSTER_2_NAME}"-config.yml
+ cp -rf "${REPO_ROOT}"/deploy/kindClusterConfig/kind-cluster3-config.yml "${TEMP_PATH}"/"${MEMBER_CLUSTER_3_NAME}"-config.yml
+
+ sed -i'' -e "s/{{host_ipaddress}}/${HOST_IPADDRESS}/g" "${TEMP_PATH}"/"${MEMBER_CLUSTER_1_NAME}"-config.yml
+ sed -i'' -e "s/{{host_ipaddress}}/${HOST_IPADDRESS}/g" "${TEMP_PATH}"/"${MEMBER_CLUSTER_2_NAME}"-config.yml
+ sed -i'' -e "s/{{host_ipaddress}}/${HOST_IPADDRESS}/g" "${TEMP_PATH}"/"${MEMBER_CLUSTER_3_NAME}"-config.yml
+ else
+ echo "HOST_IPADDRESS is required please input the host_ipaddress"
+ exit 1
+fi
+# create cluster use kind
+kind create cluster -n "${MEMBER_CLUSTER_1_NAME}" --config "${TEMP_PATH}"/"${MEMBER_CLUSTER_1_NAME}"-config.yml --kubeconfig ~/.kube/kind-config
+kind create cluster -n "${MEMBER_CLUSTER_2_NAME}" --config "${TEMP_PATH}"/"${MEMBER_CLUSTER_2_NAME}"-config.yml --kubeconfig ~/.kube/kind-config
+kind create cluster -n "${MEMBER_CLUSTER_3_NAME}" --config "${TEMP_PATH}"/"${MEMBER_CLUSTER_3_NAME}"-config.yml --kubeconfig ~/.kube/kind-config
+
+# switch context
+export KUBECONFIG=~/.kube/kind-config
+kubectl config use-context kind-"${MEMBER_CLUSTER_1_NAME}"
+# install kosmos control plane
+kosmosctl install --cni calico --default-nic eth0
+# export config to config file
+kubectl config view --minify --flatten > ~/.kube/kind-kosmos-cluster1-config
+kubectl config use-context kind-"${MEMBER_CLUSTER_2_NAME}"
+kubectl config view --minify --flatten > ~/.kube/kind-kosmos-cluster2-config
+kubectl config use-context kind-"${MEMBER_CLUSTER_3_NAME}"
+kubectl config view --minify --flatten > ~/.kube/kind-kosmos-cluster3-config
+# switch context to host-cluster
+kubectl config use-context kind-kosmos-cluster1
+# join cluster to host-cluster control plane
+kosmosctl join cluster --cni calico --default-nic eth0 --name cluster2 --kubeconfig ~/.kube/kind-kosmos-cluster2-config --enable-all
+kosmosctl join cluster --cni calico --default-nic eth0 --name cluster3 --kubeconfig ~/.kube/kind-kosmos-cluster3-config --enable-all
\ No newline at end of file
diff --git a/hack/release.sh b/hack/release.sh
index b5157752b..750699c6d 100755
--- a/hack/release.sh
+++ b/hack/release.sh
@@ -7,14 +7,15 @@ set -o pipefail
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${REPO_ROOT}/hack/util.sh"
-LDFLAGS="$(util::version_ldflags) ${LDFLAGS:-}"
+LDFLAGS="$(util::version_ldflags "$VERSION") ${LDFLAGS:-}"
function release_binary() {
local -r target=$1
local -r os=$2
local -r arch=$3
+ local -r tag=$4
- release_binary_for_platform "${target}" "${os}" "${arch}"
+ release_binary_for_platform "${target}" "${os}" "${arch}" "${tag}"
}
function release_binary_for_platform() {
diff --git a/hack/util.sh b/hack/util.sh
index d879d7837..ac3f5f7ad 100755
--- a/hack/util.sh
+++ b/hack/util.sh
@@ -442,8 +442,13 @@ function util::get_version() {
}
function util::version_ldflags() {
- # Git information
- GIT_VERSION=$(util::get_version)
+ # set GIT_VERSION from param
+ GIT_VERSION=${1:-}
+ # If GIT_VERSION is not provided, use util::get_version
+ if [ -z "$GIT_VERSION" ]; then
+ GIT_VERSION=$(util::get_version)
+ fi
+ #GIT_VERSION=$(util::get_version)
GIT_COMMIT_HASH=$(git rev-parse HEAD)
if git_status=$(git status --porcelain 2>/dev/null) && [[ -z ${git_status} ]]; then
GIT_TREESTATE="clean"
@@ -527,4 +532,12 @@ function util::wait_for_crd() {
echo "The following CRDs were not stored within the specified timeout of ${timeout}s: ${crd_names[*]}"
return 1
+}
+
+function util::go_clean_cache() {
+ set -x
+ # clean go cache avoid macos make error
+ # vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go:18:2: open /usr/local/go/src/expvar: too many open files in system
+ go clean -cache
+ set +x
}
\ No newline at end of file
diff --git a/hack/verify-all.sh b/hack/verify-all.sh
new file mode 100755
index 000000000..5cc10eafc
--- /dev/null
+++ b/hack/verify-all.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
+
+# Show progress
+set -x
+
+# Orders are determined by two factors:
+# (1) Less Execution time item should be executed first.
+# (2) More likely to fail item should be executed first.
+bash "$REPO_ROOT/hack/verify-vendor.sh"
+bash "$REPO_ROOT/hack/verify-crds.sh"
+bash "$REPO_ROOT/hack/verify-codegen.sh"
+
+set +x
diff --git a/test/e2e/deploy/mysql-operator/mysqll-operator.yaml b/test/e2e/deploy/mysql-operator/mysqll-operator.yaml
index 7f6475440..b6e696861 100644
--- a/test/e2e/deploy/mysql-operator/mysqll-operator.yaml
+++ b/test/e2e/deploy/mysql-operator/mysqll-operator.yaml
@@ -114,7 +114,6 @@ spec:
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
- serviceAccount: mysql-operator
serviceAccountName: mysql-operator
volumes:
- configMap: