Skip to content

Commit

Permalink
Merge pull request #406 from duanmengkk/rename_operator
Browse files Browse the repository at this point in the history
change the name of kosmos-operator to clusterlink-operator
  • Loading branch information
kosmos-robot authored Feb 4, 2024
2 parents bfce040 + cae2e37 commit 5aefdc9
Show file tree
Hide file tree
Showing 34 changed files with 184 additions and 212 deletions.
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ REGISTRY_PASSWORD?=""
REGISTRY_SERVER_ADDRESS?=""
KIND_IMAGE_TAG?="v1.25.3"

MACOS_TARGETS := clusterlink-controller-manager \
kosmos-operator \
MACOS_TARGETS := clusterlink-controller-manager \
clusterlink-operator \
clusterlink-elector \
clusterlink-network-manager \
clusterlink-proxy \
clustertree-cluster-manager \
scheduler \
clusterlink-network-manager \
clusterlink-proxy \
clustertree-cluster-manager \
scheduler \

# clusterlink-agent and clusterlink-floater only support linux platform
TARGETS := clusterlink-controller-manager \
kosmos-operator \
TARGETS := clusterlink-controller-manager \
clusterlink-operator \
clusterlink-agent \
clusterlink-elector \
clusterlink-floater \
Expand Down Expand Up @@ -116,7 +116,7 @@ test:
upload-images: images
@echo "push images to $(REGISTRY)"
docker push ${REGISTRY}/clusterlink-controller-manager:${VERSION}
docker push ${REGISTRY}/kosmos-operator:${VERSION}
docker push ${REGISTRY}/clusterlink-operator:${VERSION}
docker push ${REGISTRY}/clusterlink-agent:${VERSION}
docker push ${REGISTRY}/clusterlink-proxy:${VERSION}
docker push ${REGISTRY}/clusterlink-network-manager:${VERSION}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ import (
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"

"github.com/kosmos.io/kosmos/cmd/operator/app/options"
"github.com/kosmos.io/kosmos/pkg/operator"
"github.com/kosmos.io/kosmos/cmd/clusterlink/clusterlink-operator/app/options"
clusterlinkoperator "github.com/kosmos.io/kosmos/pkg/clusterlink/clusterlink-operator"
"github.com/kosmos.io/kosmos/pkg/scheme"
"github.com/kosmos.io/kosmos/pkg/sharedcli"
"github.com/kosmos.io/kosmos/pkg/sharedcli/klogflag"
"github.com/kosmos.io/kosmos/pkg/utils"
)

// NewOperatorCommand creates a *cobra.Command object with default parameters
func NewOperatorCommand(ctx context.Context) *cobra.Command {
// NewLinkOperatorCommand creates a *cobra.Command object with default parameters
func NewLinkOperatorCommand(ctx context.Context) *cobra.Command {
opts := options.NewOptions()

cmd := &cobra.Command{
Use: "kosmos-operator",
Long: `Deploy Kosmos components according to the cluster`,
Use: "kosmos-clusterlink-operator",
Long: `Deploy Kosmos clusterlink components according to the cluster`,
RunE: func(cmd *cobra.Command, args []string) error {
// validate options
if errs := opts.Validate(); len(errs) != 0 {
Expand Down Expand Up @@ -116,7 +116,7 @@ func Run(ctx context.Context, opts *options.Options) error {
return err
}

clusterNodeController := operator.Reconciler{
clusterNodeController := clusterlinkoperator.Reconciler{
Scheme: mgr.GetScheme(),
ControlPanelKubeConfig: controlPanelKubeConfig,
ClusterName: os.Getenv(utils.EnvClusterName),
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
apiserver "k8s.io/apiserver/pkg/server"
"k8s.io/component-base/cli"

"github.com/kosmos.io/kosmos/cmd/operator/app"
"github.com/kosmos.io/kosmos/cmd/clusterlink/clusterlink-operator/app"
)

func main() {
ctx := apiserver.SetupSignalContext()
cmd := app.NewOperatorCommand(ctx)
cmd := app.NewLinkOperatorCommand(ctx)
code := cli.Run(cmd)
os.Exit(code)
}
5 changes: 0 additions & 5 deletions cmd/koslet/OWNERS

This file was deleted.

7 changes: 0 additions & 7 deletions cmd/koslet/app/server.go

This file was deleted.

15 changes: 0 additions & 15 deletions cmd/koslet/main.go

This file was deleted.

14 changes: 7 additions & 7 deletions deploy/kosmos-operator.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: kosmos-operator
name: clusterlink-operator
namespace: kosmos-system
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kosmos-operator
name: clusterlink-operator
namespace: kosmos-system
labels:
app: operator
Expand All @@ -21,7 +21,7 @@ spec:
labels:
app: operator
spec:
serviceAccountName: kosmos-operator
serviceAccountName: clusterlink-operator
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -36,11 +36,11 @@ spec:
topologyKey: kubernetes.io/hostname
containers:
- name: operator
image: ghcr.io/kosmos-io/kosmos-operator:__VERSION__
image: ghcr.io/kosmos-io/clusterlink-operator:__VERSION__
imagePullPolicy: IfNotPresent
command:
- kosmos-operator
- --controlpanelconfig=/etc/kosmos-operator/kubeconfig
- clusterlink-operator
- --controlpanelconfig=/etc/clusterlink-operator/kubeconfig
resources:
limits:
memory: 200Mi
Expand All @@ -54,7 +54,7 @@ spec:
- name: USE_PROXY
value: "false"
volumeMounts:
- mountPath: /etc/kosmos-operator
- mountPath: /etc/clusterlink-operator
name: proxy-config
readOnly: true
volumes:
Expand Down
2 changes: 1 addition & 1 deletion deploy/kosmos-rbac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ subjects:
name: clusterlink-controller-manager
namespace: kosmos-system
- kind: ServiceAccount
name: kosmos-operator
name: clusterlink-operator
namespace: kosmos-system
2 changes: 1 addition & 1 deletion docs/proposals/kosmosctl/offline_installation_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ kosmosctl install --private-image-registry=registry.local.com --kosmos-vesion=0.

```txt
ghcr.io/kosmos-io/clustertree-cluster-manager:v0.3,0
ghcr.io/kosmos-io/kosmos-operator:v0.3.0
ghcr.io/kosmos-io/clusterlink-operator:v0.3.0
ghcr.io/kosmos-io/clusterlink-agent:v0.3.0
ghcr.io/kosmos-io/clusterlink-network-manager:v0.3.0
ghcr.io/kosmos-io/clusterlink-controller-manager:v0.3.0
Expand Down
170 changes: 85 additions & 85 deletions hack/cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,87 +63,87 @@ function create_cluster() {
# prepare external kubeconfig
docker exec ${clustername}-control-plane /bin/sh -c "cat /etc/kubernetes/admin.conf" | sed -e "s|${clustername}-control-plane|$dockerip|g" -e "/certificate-authority-data:/d" -e "5s/^/ insecure-skip-tls-verify: true\n/" -e "w ${CLUSTER_DIR}/kubeconfig"

# install calico
if [ "${CN_ZONE}" == false ]; then
docker pull quay.io/tigera/operator:v1.29.0
docker pull docker.io/calico/cni:v3.25.0
docker pull docker.io/calico/typha:v3.25.0
docker pull docker.io/calico/pod2daemon-flexvol:v3.25.0
docker pull docker.io/calico/kube-controllers:v3.25.0
docker pull docker.io/calico/node:v3.25.0
docker pull docker.io/calico/csi:v3.25.0
docker pull docker.io/percona:5.7
docker pull docker.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
docker pull docker.io/library/nginx:latest
docker pull docker.io/library/busybox:latest
docker pull docker.io/prom/mysqld-exporter:v0.13.0
else
docker pull quay.m.daocloud.io/tigera/operator:v1.29.0
docker pull docker.m.daocloud.io/calico/cni:v3.25.0
docker pull docker.m.daocloud.io/calico/typha:v3.25.0
docker pull docker.m.daocloud.io/calico/pod2daemon-flexvol:v3.25.0
docker pull docker.m.daocloud.io/calico/kube-controllers:v3.25.0
docker pull docker.m.daocloud.io/calico/node:v3.25.0
docker pull docker.m.daocloud.io/calico/csi:v3.25.0
docker pull docker.m.daocloud.io/percona:5.7
docker pull docker.m.daocloud.io/library/nginx:latest
docker pull docker.m.daocloud.io/library/busybox:latest
docker pull docker.m.daocloud.io/prom/mysqld-exporter:v0.13.0
docker pull docker.m.daocloud.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3

docker tag quay.m.daocloud.io/tigera/operator:v1.29.0 quay.io/tigera/operator:v1.29.0
docker tag docker.m.daocloud.io/calico/cni:v3.25.0 docker.io/calico/cni:v3.25.0
docker tag docker.m.daocloud.io/calico/typha:v3.25.0 docker.io/calico/typha:v3.25.0
docker tag docker.m.daocloud.io/calico/pod2daemon-flexvol:v3.25.0 docker.io/calico/pod2daemon-flexvol:v3.25.0
docker tag docker.m.daocloud.io/calico/kube-controllers:v3.25.0 docker.io/calico/kube-controllers:v3.25.0
docker tag docker.m.daocloud.io/calico/node:v3.25.0 docker.io/calico/node:v3.25.0
docker tag docker.m.daocloud.io/calico/csi:v3.25.0 docker.io/calico/csi:v3.25.0
docker tag docker.m.daocloud.io/percona:5.7 docker.io/percona:5.7
docker tag docker.m.daocloud.io/library/nginx:latest docker.io/library/nginx:latest
docker tag docker.m.daocloud.io/library/busybox:latest docker.io/library/busybox:latest
docker tag docker.m.daocloud.io/prom/mysqld-exporter:v0.13.0 docker.io/prom/mysqld-exporter:v0.13.0
docker tag docker.m.daocloud.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3 docker.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
fi

kind load docker-image -n "$clustername" quay.io/tigera/operator:v1.29.0
kind load docker-image -n "$clustername" docker.io/calico/cni:v3.25.0
kind load docker-image -n "$clustername" docker.io/calico/typha:v3.25.0
kind load docker-image -n "$clustername" docker.io/calico/pod2daemon-flexvol:v3.25.0
kind load docker-image -n "$clustername" docker.io/calico/kube-controllers:v3.25.0
kind load docker-image -n "$clustername" docker.io/calico/node:v3.25.0
kind load docker-image -n "$clustername" docker.io/calico/csi:v3.25.0
kind load docker-image -n "$clustername" docker.io/percona:5.7
kind load docker-image -n "$clustername" docker.io/library/nginx:latest
kind load docker-image -n "$clustername" docker.io/library/busybox:latest
kind load docker-image -n "$clustername" docker.io/prom/mysqld-exporter:v0.13.0
kind load docker-image -n "$clustername" docker.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3

if "${clustername}" == $HOST_CLUSTER_NAME; then
if [ "${CN_ZONE}" == false ]; then
docker pull docker.io/bitpoke/mysql-operator-orchestrator:v0.6.3
docker pull docker.io/prom/mysqld-exporter:v0.13.0
docker pull docker.io/bitpoke/mysql-operator-sidecar-8.0:v0.6.3
docker pull docker.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
docker pull docker.io/bitpoke/mysql-operator:v0.6.3
else
docker pull docker.m.daocloud.io/bitpoke/mysql-operator-orchestrator:v0.6.3
docker pull docker.m.daocloud.io/prom/mysqld-exporter:v0.13.0
docker pull docker.m.daocloud.io/bitpoke/mysql-operator-sidecar-8.0:v0.6.3
docker pull docker.m.daocloud.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
docker pull docker.m.daocloud.io/bitpoke/mysql-operator:v0.6.3

docker tag docker.m.daocloud.io/bitpoke/mysql-operator-orchestrator:v0.6.3 docker.io/bitpoke/mysql-operator-orchestrator:v0.6.3
docker tag docker.m.daocloud.io/prom/mysqld-exporter:v0.13.0 docker.io/prom/mysqld-exporter:v0.13.0
docker tag docker.m.daocloud.io/bitpoke/mysql-operator-sidecar-8.0:v0.6.3 docker.io/bitpoke/mysql-operator-sidecar-8.0:v0.6.3
docker tag docker.m.daocloud.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3 docker.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
docker tag docker.m.daocloud.io/bitpoke/mysql-operator:v0.6.3 docker.io/bitpoke/mysql-operator:v0.6.3
fi
kind load docker-image -n "$clustername" docker.io/bitpoke/mysql-operator-orchestrator:v0.6.3
kind load docker-image -n "$clustername" docker.io/prom/mysqld-exporter:v0.13.0
kind load docker-image -n "$clustername" docker.io/bitpoke/mysql-operator-sidecar-8.0:v0.6.3
kind load docker-image -n "$clustername" docker.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
kind load docker-image -n "$clustername" docker.io/bitpoke/mysql-operator:v0.6.3
fi
# # install calico
# if [ "${CN_ZONE}" == false ]; then
# docker pull quay.io/tigera/operator:v1.29.0
# docker pull docker.io/calico/cni:v3.25.0
# docker pull docker.io/calico/typha:v3.25.0
# docker pull docker.io/calico/pod2daemon-flexvol:v3.25.0
# docker pull docker.io/calico/kube-controllers:v3.25.0
# docker pull docker.io/calico/node:v3.25.0
# docker pull docker.io/calico/csi:v3.25.0
# docker pull docker.io/percona:5.7
# docker pull docker.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
# docker pull docker.io/library/nginx:latest
# docker pull docker.io/library/busybox:latest
# docker pull docker.io/prom/mysqld-exporter:v0.13.0
# else
# docker pull quay.m.daocloud.io/tigera/operator:v1.29.0
# docker pull docker.m.daocloud.io/calico/cni:v3.25.0
# docker pull docker.m.daocloud.io/calico/typha:v3.25.0
# docker pull docker.m.daocloud.io/calico/pod2daemon-flexvol:v3.25.0
# docker pull docker.m.daocloud.io/calico/kube-controllers:v3.25.0
# docker pull docker.m.daocloud.io/calico/node:v3.25.0
# docker pull docker.m.daocloud.io/calico/csi:v3.25.0
# docker pull docker.m.daocloud.io/percona:5.7
# docker pull docker.m.daocloud.io/library/nginx:latest
# docker pull docker.m.daocloud.io/library/busybox:latest
# docker pull docker.m.daocloud.io/prom/mysqld-exporter:v0.13.0
# docker pull docker.m.daocloud.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
#
# docker tag quay.m.daocloud.io/tigera/operator:v1.29.0 quay.io/tigera/operator:v1.29.0
# docker tag docker.m.daocloud.io/calico/cni:v3.25.0 docker.io/calico/cni:v3.25.0
# docker tag docker.m.daocloud.io/calico/typha:v3.25.0 docker.io/calico/typha:v3.25.0
# docker tag docker.m.daocloud.io/calico/pod2daemon-flexvol:v3.25.0 docker.io/calico/pod2daemon-flexvol:v3.25.0
# docker tag docker.m.daocloud.io/calico/kube-controllers:v3.25.0 docker.io/calico/kube-controllers:v3.25.0
# docker tag docker.m.daocloud.io/calico/node:v3.25.0 docker.io/calico/node:v3.25.0
# docker tag docker.m.daocloud.io/calico/csi:v3.25.0 docker.io/calico/csi:v3.25.0
# docker tag docker.m.daocloud.io/percona:5.7 docker.io/percona:5.7
# docker tag docker.m.daocloud.io/library/nginx:latest docker.io/library/nginx:latest
# docker tag docker.m.daocloud.io/library/busybox:latest docker.io/library/busybox:latest
# docker tag docker.m.daocloud.io/prom/mysqld-exporter:v0.13.0 docker.io/prom/mysqld-exporter:v0.13.0
# docker tag docker.m.daocloud.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3 docker.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
# fi
#
# kind load docker-image -n "$clustername" quay.io/tigera/operator:v1.29.0
# kind load docker-image -n "$clustername" docker.io/calico/cni:v3.25.0
# kind load docker-image -n "$clustername" docker.io/calico/typha:v3.25.0
# kind load docker-image -n "$clustername" docker.io/calico/pod2daemon-flexvol:v3.25.0
# kind load docker-image -n "$clustername" docker.io/calico/kube-controllers:v3.25.0
# kind load docker-image -n "$clustername" docker.io/calico/node:v3.25.0
# kind load docker-image -n "$clustername" docker.io/calico/csi:v3.25.0
# kind load docker-image -n "$clustername" docker.io/percona:5.7
# kind load docker-image -n "$clustername" docker.io/library/nginx:latest
# kind load docker-image -n "$clustername" docker.io/library/busybox:latest
# kind load docker-image -n "$clustername" docker.io/prom/mysqld-exporter:v0.13.0
# kind load docker-image -n "$clustername" docker.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
#
# if "${clustername}" == $HOST_CLUSTER_NAME; then
# if [ "${CN_ZONE}" == false ]; then
# docker pull docker.io/bitpoke/mysql-operator-orchestrator:v0.6.3
# docker pull docker.io/prom/mysqld-exporter:v0.13.0
# docker pull docker.io/bitpoke/mysql-operator-sidecar-8.0:v0.6.3
# docker pull docker.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
# docker pull docker.io/bitpoke/mysql-operator:v0.6.3
# else
# docker pull docker.m.daocloud.io/bitpoke/mysql-operator-orchestrator:v0.6.3
# docker pull docker.m.daocloud.io/prom/mysqld-exporter:v0.13.0
# docker pull docker.m.daocloud.io/bitpoke/mysql-operator-sidecar-8.0:v0.6.3
# docker pull docker.m.daocloud.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
# docker pull docker.m.daocloud.io/bitpoke/mysql-operator:v0.6.3
#
# docker tag docker.m.daocloud.io/bitpoke/mysql-operator-orchestrator:v0.6.3 docker.io/bitpoke/mysql-operator-orchestrator:v0.6.3
# docker tag docker.m.daocloud.io/prom/mysqld-exporter:v0.13.0 docker.io/prom/mysqld-exporter:v0.13.0
# docker tag docker.m.daocloud.io/bitpoke/mysql-operator-sidecar-8.0:v0.6.3 docker.io/bitpoke/mysql-operator-sidecar-8.0:v0.6.3
# docker tag docker.m.daocloud.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3 docker.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
# docker tag docker.m.daocloud.io/bitpoke/mysql-operator:v0.6.3 docker.io/bitpoke/mysql-operator:v0.6.3
# fi
# kind load docker-image -n "$clustername" docker.io/bitpoke/mysql-operator-orchestrator:v0.6.3
# kind load docker-image -n "$clustername" docker.io/prom/mysqld-exporter:v0.13.0
# kind load docker-image -n "$clustername" docker.io/bitpoke/mysql-operator-sidecar-8.0:v0.6.3
# kind load docker-image -n "$clustername" docker.io/bitpoke/mysql-operator-sidecar-5.7:v0.6.3
# kind load docker-image -n "$clustername" docker.io/bitpoke/mysql-operator:v0.6.3
# fi
kubectl --context="kind-${clustername}" create -f "$CURRENT/calicooperator/tigera-operator.yaml" || $("${REUSE}" -eq "true")
kind export kubeconfig --name "$clustername"
util::wait_for_crd installations.operator.tigera.io
Expand Down Expand Up @@ -259,10 +259,10 @@ function deploy_cluster() {

kubectl --context="kind-${clustername}" -n kosmos-system delete secret controlpanel-config || true
kubectl --context="kind-${clustername}" -n kosmos-system create secret generic controlpanel-config --from-file=kubeconfig="${ROOT}/environments/cluster-host/kubeconfig"
sed -e "s|__VERSION__|$VERSION|g" -e "w ${ROOT}/environments/kosmos-operator.yml" "$ROOT"/deploy/kosmos-operator.yml
kubectl --context="kind-${clustername}" apply -f "${ROOT}/environments/kosmos-operator.yml"
sed -e "s|__VERSION__|$VERSION|g" -e "w ${ROOT}/environments/clusterlink-operator.yml" "$ROOT"/deploy/clusterlink-operator.yml
kubectl --context="kind-${clustername}" apply -f "${ROOT}/environments/clusterlink-operator.yml"

echo "cluster $clustername deploy kosmos-operator success"
echo "cluster $clustername deploy clusterlink-operator success"

sed -e "s|__VERSION__|$VERSION|g" -e "w ${ROOT}/environments/kosmos-scheduler.yml" "$ROOT"/deploy/scheduler/deployment.yaml
kubectl --context="kind-${clustername}" apply -f "${ROOT}/environments/kosmos-scheduler.yml"
Expand All @@ -282,7 +282,7 @@ function load_cluster_images() {
kind load docker-image -n "$clustername" ghcr.io/kosmos-io/clusterlink-network-manager:"${VERSION}"
kind load docker-image -n "$clustername" ghcr.io/kosmos-io/clusterlink-controller-manager:"${VERSION}"
kind load docker-image -n "$clustername" ghcr.io/kosmos-io/clusterlink-elector:"${VERSION}"
kind load docker-image -n "$clustername" ghcr.io/kosmos-io/kosmos-operator:"${VERSION}"
kind load docker-image -n "$clustername" ghcr.io/kosmos-io/clusterlink-operator:"${VERSION}"
kind load docker-image -n "$clustername" ghcr.io/kosmos-io/clusterlink-agent:"${VERSION}"
kind load docker-image -n "$clustername" ghcr.io/kosmos-io/clusterlink-proxy:"${VERSION}"
kind load docker-image -n "$clustername" ghcr.io/kosmos-io/clustertree-cluster-manager:"${VERSION}"
Expand Down
2 changes: 1 addition & 1 deletion hack/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ MIN_Go_VERSION=go1.19.0
CLUSTERLINK_TARGET_SOURCE=(
scheduler=cmd/scheduler
clusterlink-proxy=cmd/clusterlink/proxy
kosmos-operator=cmd/operator
clusterlink-operator=cmd/clusterlink/clusterlink-operator
clusterlink-elector=cmd/clusterlink/elector
clusterlink-agent=cmd/clusterlink/agent
clusterlink-floater=cmd/clusterlink/floater
Expand Down
Loading

0 comments on commit 5aefdc9

Please sign in to comment.