Kubernetes-Learning-Playground/multi-clusters

feat: 对 kubectl-multicluster 命令行进行扩展

Closed this issue · 3 comments

支持 apply delete 等 kubectl 原生功能,增强用户对 kubectl-multicluster 命令行的依赖,不至于查询的时候使用 kubectl-multicluster而创建资源时使用 kubectl 。

基本完成

[root@VM-0-16-centos ~]# kubectl-multicluster
kubectl-multicluster [flags]

Usage:
  kubectl-multicluster [command]

Examples:
kubectl-multicluster [flags]

Available Commands:
  apply       Apply a configuration to a resource by file name or stdin
  completion  Generate the autocompletion script for the specified shell
  delete      Delete resources by file names, stdin, resources and names, or by resources and label selector
  describe    describe [flags]
  help        Help about any command
  list        list resource [flags]

Flags:
  -h, --help   help for kubectl-multicluster

Use "kubectl-multicluster [command] --help" for more information about a command.
[root@VM-0-16-centos yaml]# kubectl-multicluster delete -f multi_cluster_resource_configmap_example.yaml
multiclusterresource.mulitcluster.practice.com "myconfigmap.configmap" deleted
[root@VM-0-16-centos yaml]# kubectl-multicluster list configmaps --name=multiclusterresource-configmap
CLUSTER	NAME	NAMESPACE	DATA
[root@VM-0-16-centos yaml]# kubectl-multicluster apply -f multi_cluster_resource_configmap_example.yaml
multiclusterresource.mulitcluster.practice.com/myconfigmap.configmap created
[root@VM-0-16-centos yaml]# kubectl-multicluster list configmaps --name=multiclusterresource-configmap
CLUSTER 	NAME                          	NAMESPACE	DATA
tencent1	multiclusterresource-configmap	default  	3
tencent2	multiclusterresource-configmap	default  	3
tencent4	multiclusterresource-configmap	default  	3

需要读取 .multi-cluster-operator/config的字段