Skip to content

Commit

Permalink
change the name of kosmos-operator to clusterlink-operator
Browse files Browse the repository at this point in the history
Signed-off-by: duanmengkk <[email protected]>
  • Loading branch information
duanmengkk committed Feb 4, 2024
1 parent bfce040 commit a44c103
Show file tree
Hide file tree
Showing 34 changed files with 101 additions and 129 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ REGISTRY_SERVER_ADDRESS?=""
KIND_IMAGE_TAG?="v1.25.3"

MACOS_TARGETS := clusterlink-controller-manager \
kosmos-operator \
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 \
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 cluster-link 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
8 changes: 4 additions & 4 deletions hack/cluster.sh
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
"k8s.io/klog/v2"

"github.com/kosmos.io/kosmos/pkg/operator/clusterlink/option"
"github.com/kosmos.io/kosmos/pkg/operator/clusterlink/utils"
utils2 "github.com/kosmos.io/kosmos/pkg/utils"
"github.com/kosmos.io/kosmos/pkg/clusterlink/clusterlink-operator/option"
operatorutils "github.com/kosmos.io/kosmos/pkg/clusterlink/clusterlink-operator/utils"
kosmosutils "github.com/kosmos.io/kosmos/pkg/utils"
)

const (
Expand All @@ -33,11 +33,11 @@ func New() *AgentInstaller {

// create daemonset
func applyDaemonSet(opt *option.AddonOption) error {
clusterlinkAgentDaemonSetBytes, err := utils.ParseTemplate(clusterlinkAgentDaemonSet, DaemonSetReplace{
clusterlinkAgentDaemonSetBytes, err := operatorutils.ParseTemplate(clusterlinkAgentDaemonSet, DaemonSetReplace{
Namespace: opt.GetSpecNamespace(),
Name: ResourceName,
ImageRepository: opt.GetImageRepository(),
ProxyConfigMapName: utils2.ProxySecretName,
ProxyConfigMapName: kosmosutils.ProxySecretName,
Version: opt.Version,
ClusterName: opt.GetName(),
})
Expand All @@ -56,7 +56,7 @@ func applyDaemonSet(opt *option.AddonOption) error {
return fmt.Errorf("decode agent daemonset error: %v", err)
}

if err := utils.CreateOrUpdateDaemonSet(opt.KubeClientSet, clAgentDaemonSet); err != nil {
if err := operatorutils.CreateOrUpdateDaemonSet(opt.KubeClientSet, clAgentDaemonSet); err != nil {
return fmt.Errorf("create clusterlink agent daemonset error: %v", err)
}

Expand Down Expand Up @@ -91,9 +91,9 @@ func applySecret(opt *option.AddonOption) error {
// Create or update the Secret in the kube-public namespace
klog.Infof("[bootstrap-token] creating/updating Secret in kube-public namespace")

return utils.CreateOrUpdateSecret(opt.KubeClientSet, &corev1.Secret{
return operatorutils.CreateOrUpdateSecret(opt.KubeClientSet, &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: utils2.ProxySecretName,
Name: kosmosutils.ProxySecretName,
Namespace: opt.GetSpecNamespace(),
},
StringData: map[string]string{
Expand Down Expand Up @@ -123,7 +123,7 @@ func (i *AgentInstaller) Uninstall(opt *option.AddonOption) error {
}

configMapClient := opt.KubeClientSet.CoreV1().ConfigMaps(opt.GetSpecNamespace())
if err := configMapClient.Delete(context.TODO(), utils2.ProxySecretName, metav1.DeleteOptions{}); err != nil && !apierrors.IsNotFound(err) {
if err := configMapClient.Delete(context.TODO(), kosmosutils.ProxySecretName, metav1.DeleteOptions{}); err != nil && !apierrors.IsNotFound(err) {
return err
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
clientsetscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/klog/v2"

"github.com/kosmos.io/kosmos/pkg/operator/clusterlink/option"
"github.com/kosmos.io/kosmos/pkg/operator/clusterlink/utils"
utils2 "github.com/kosmos.io/kosmos/pkg/utils"
"github.com/kosmos.io/kosmos/pkg/clusterlink/clusterlink-operator/option"
operatorutils "github.com/kosmos.io/kosmos/pkg/clusterlink/clusterlink-operator/utils"
kosmosutils "github.com/kosmos.io/kosmos/pkg/utils"
)

const (
Expand All @@ -30,7 +30,7 @@ func New() *ElectorInstaller {
}

func applyServiceAccount(opt *option.AddonOption) error {
clElectorServiceAccountBytes, err := utils.ParseTemplate(clusterlinkElectorServiceAccount, ServiceAccountReplace{
clElectorServiceAccountBytes, err := operatorutils.ParseTemplate(clusterlinkElectorServiceAccount, ServiceAccountReplace{
Namespace: opt.GetSpecNamespace(),
Name: ResourceName,
})
Expand All @@ -48,7 +48,7 @@ func applyServiceAccount(opt *option.AddonOption) error {
return fmt.Errorf("decode elector serviceaccount error: %v", err)
}

if err := utils.CreateOrUpdateServiceAccount(opt.KubeClientSet, clElectorServiceAccount); err != nil {
if err := operatorutils.CreateOrUpdateServiceAccount(opt.KubeClientSet, clElectorServiceAccount); err != nil {
return fmt.Errorf("create clusterlink agent serviceaccount error: %v", err)
}

Expand All @@ -58,12 +58,12 @@ func applyServiceAccount(opt *option.AddonOption) error {
}

func applyDeployment(opt *option.AddonOption) error {
clElectorDeploymentBytes, err := utils.ParseTemplate(clusterlinkElectorDeployment, DeploymentReplace{
clElectorDeploymentBytes, err := operatorutils.ParseTemplate(clusterlinkElectorDeployment, DeploymentReplace{
Namespace: opt.GetSpecNamespace(),
Name: ResourceName,
ClusterName: opt.GetName(),
ImageRepository: opt.GetImageRepository(),
ProxyConfigMapName: utils2.ProxySecretName,
ProxyConfigMapName: kosmosutils.ProxySecretName,
Version: opt.Version,
})

Expand All @@ -81,7 +81,7 @@ func applyDeployment(opt *option.AddonOption) error {
return fmt.Errorf("decode elector deployment error: %v", err)
}

if err := utils.CreateOrUpdateDeployment(opt.KubeClientSet, clElectorDeployment); err != nil {
if err := operatorutils.CreateOrUpdateDeployment(opt.KubeClientSet, clElectorDeployment); err != nil {
return fmt.Errorf("create clusterlink elector deployment error: %v", err)
}

Expand All @@ -91,7 +91,7 @@ func applyDeployment(opt *option.AddonOption) error {
}

func applyClusterRole(opt *option.AddonOption) error {
clElectorClusterRoleBytes, err := utils.ParseTemplate(clusterlinkElectorClusterRole, ClusterRoleReplace{
clElectorClusterRoleBytes, err := operatorutils.ParseTemplate(clusterlinkElectorClusterRole, ClusterRoleReplace{
Name: ResourceName,
})

Expand All @@ -109,7 +109,7 @@ func applyClusterRole(opt *option.AddonOption) error {
return fmt.Errorf("decode elector clusterrole error: %v", err)
}

if err := utils.CreateOrUpdateClusterRole(opt.KubeClientSet, clElectorClusterRole); err != nil {
if err := operatorutils.CreateOrUpdateClusterRole(opt.KubeClientSet, clElectorClusterRole); err != nil {
return fmt.Errorf("create clusterlink elector clusterrole error: %v", err)
}

Expand All @@ -119,7 +119,7 @@ func applyClusterRole(opt *option.AddonOption) error {
}

func applyClusterRoleBinding(opt *option.AddonOption) error {
clElectorClusterRoleBindingBytes, err := utils.ParseTemplate(clusterlinkElectorClusterRoleBinding, ClusterRoleBindingReplace{
clElectorClusterRoleBindingBytes, err := operatorutils.ParseTemplate(clusterlinkElectorClusterRoleBinding, ClusterRoleBindingReplace{
Name: ResourceName,
Namespace: opt.GetSpecNamespace(),
})
Expand All @@ -138,7 +138,7 @@ func applyClusterRoleBinding(opt *option.AddonOption) error {
return fmt.Errorf("decode elector clusterrolebinding error: %v", err)
}

if err := utils.CreateOrUpdateClusterRoleBinding(opt.KubeClientSet, clElectorClusterRoleBinding); err != nil {
if err := operatorutils.CreateOrUpdateClusterRoleBinding(opt.KubeClientSet, clElectorClusterRoleBinding); err != nil {
return fmt.Errorf("create clusterlink elector clusterrolebinding error: %v", err)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
clientsetscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/klog/v2"

"github.com/kosmos.io/kosmos/pkg/operator/clusterlink/option"
"github.com/kosmos.io/kosmos/pkg/operator/clusterlink/utils"
"github.com/kosmos.io/kosmos/pkg/clusterlink/clusterlink-operator/option"
operatorutils "github.com/kosmos.io/kosmos/pkg/clusterlink/clusterlink-operator/utils"
)

type Installer struct {
Expand All @@ -20,7 +20,7 @@ func New() *Installer {
}

func (i *Installer) Install(opt *option.AddonOption) error {
clNamespaceBytes, err := utils.ParseTemplate(clusterlinkNamespace, NamespaceReplace{
clNamespaceBytes, err := operatorutils.ParseTemplate(clusterlinkNamespace, NamespaceReplace{
Namespace: opt.GetSpecNamespace(),
})

Expand All @@ -38,7 +38,7 @@ func (i *Installer) Install(opt *option.AddonOption) error {
return fmt.Errorf("decode namespace error: %v", err)
}

if err := utils.CreateOrUpdateNamespace(opt.KubeClientSet, clNamespace); err != nil {
if err := operatorutils.CreateOrUpdateNamespace(opt.KubeClientSet, clNamespace); err != nil {
return fmt.Errorf("create clusterlink namespace error: %v", err)
}

Expand Down
Loading

0 comments on commit a44c103

Please sign in to comment.