Changelog
Add a new parameter --context
to specify the context to be added when running kubecm add or merge command.
Prepare two kubeconfig.
./kubecm list --config kubeconfig1
+------------+-------------+-------------+----------+-------------------------+--------------+
| CURRENT | NAME | CLUSTER | USER | SERVER | Namespace |
+============+=============+=============+==========+=========================+==============+
| * | context1 | cluster1 | user1 | https://example1.com | default |
+------------+-------------+-------------+----------+-------------------------+--------------+
./kubecm list --config kubeconfig2
+------------+-------------+-------------+----------+-------------------------+----------------+
| CURRENT | NAME | CLUSTER | USER | SERVER | Namespace |
+============+=============+=============+==========+=========================+================+
| * | context2 | cluster2 | user2 | https://example2.com | kube-system |
+------------+-------------+-------------+----------+-------------------------+----------------+
| | context3 | cluster3 | user3 | https://example3.com | default |
+------------+-------------+-------------+----------+-------------------------+----------------+
| | context4 | cluster4 | user4 | https://example4.com | default |
+------------+-------------+-------------+----------+-------------------------+----------------+
Specify context2 and context3 to be added.
./kubecm add --config kubeconfig1 -f kubeconfig2 --context context2,context3
# result
+------------+-------------+-------------+----------+-------------------------+----------------+
| CURRENT | NAME | CLUSTER | USER | SERVER | Namespace |
+============+=============+=============+==========+=========================+================+
| * | context1 | cluster1 | user1 | https://example1.com | default |
+------------+-------------+-------------+----------+-------------------------+----------------+
| | context2 | cluster2 | user2 | https://example2.com | kube-system |
+------------+-------------+-------------+----------+-------------------------+----------------+
| | context3 | cluster3 | user3 | https://example3.com | default |
+------------+-------------+-------------+----------+-------------------------+----------------+
Specify context1 and context2 to be merged.
./kubecm merge kubeconfig1 kubeconfig2 --context context1,context2
# result
+------------+-------------+-------------+----------+-------------------------+----------------+
| CURRENT | NAME | CLUSTER | USER | SERVER | Namespace |
+============+=============+=============+==========+=========================+================+
| | context1 | cluster1 | user1 | https://example1.com | default |
+------------+-------------+-------------+----------+-------------------------+----------------+
| | context2 | cluster2 | user2 | https://example2.com | kube-system |
+------------+-------------+-------------+----------+-------------------------+----------------+
Specify the contexts to be added after overwriting the name with the context template.
./kubecm add --config kubeconfig1 -f kubeconfig2 --context cluster2-user2,cluster3-user3 --context-template cluster,user
# result
+------------+-------------------+-------------+----------+-------------------------+----------------+
| CURRENT | NAME | CLUSTER | USER | SERVER | Namespace |
+============+===================+=============+==========+=========================+================+
| | cluster2-user2 | cluster2 | user2 | https://example2.com | kube-system |
+------------+-------------------+-------------+----------+-------------------------+----------------+
| | cluster3-user3 | cluster3 | user3 | https://example3.com | default |
+------------+-------------------+-------------+----------+-------------------------+----------------+
| * | context1 | cluster1 | user1 | https://example1.com | default |
+------------+-------------------+-------------+----------+-------------------------+----------------+
What's Changed
- chore(deps): bump codecov/codecov-action from 4.4.0 to 4.4.1 by @dependabot in #957
- chore(deps): bump github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke from 1.0.890 to 1.0.929 by @dependabot in #958
- feat: allow specify the context to be added by @cr7258 in #962
Full Changelog: v0.29.0...v0.29.1