Skip to content

Commit

Permalink
fix e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: chengzw <[email protected]>
  • Loading branch information
cr7258 committed May 21, 2024
1 parent 50ce84d commit 0bdc035
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
echo "Running kubecm add..."
echo "********************************************************************************"
bin/kubecm add -cf 2nd-kind
bin/kubecm add -cf 3rd-kind --context-name 3rd
bin/kubecm add -cf 3rd-kind --context-prefix 3rd
echo "********************************************************************************"
echo "Running kubecm merge multiple kubeconfig..."
echo "********************************************************************************"
Expand All @@ -85,7 +85,7 @@ jobs:
echo "********************************************************************************"
echo "Running kubecm switch..."
echo "********************************************************************************"
bin/kubecm s 3rd
bin/kubecm s 3rd-kind-3rd-kind
echo "********************************************************************************"
echo "Running kubecm delete..."
echo "********************************************************************************"
Expand All @@ -109,5 +109,5 @@ jobs:
echo "********************************************************************************"
echo "Running kubecm create..."
echo "********************************************************************************"
bin/kubecm create --user e2e --namespace default --cluster-role view --context-name kind-2nd-kind
bin/kubecm create --user e2e --namespace default --cluster-role view --context-prefix kind-2nd-kind
kubectl get all --kubeconfig e2e-kubeconfig.yaml
8 changes: 2 additions & 6 deletions docs/zh-cn/cli/kubecm_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@
kubecm add [flags]
```

>注意:如果 `-c` 被设置,且添加的 kubeconfig 文件中有**超过一个** context,会出现如下情况:
>- 如果设置了 `--context-name`,则 context 会以 `<context-name-0>`, `<context-name-1>` 的形式产生
>- 如果没有设置 `--context-name`,则会以 `<file-name-{hash}>` 的方式展示,其中 `{hash}` 是文件名的 MD5 哈希值
### 示例

```
# Merge test.yaml with $HOME/.kube/config
kubecm add -f test.yaml
# Merge test.yaml with $HOME/.kube/config and rename context name
kubecm add -cf test.yaml --context-name test
kubecm add -cf test.yaml --context-prefix test
# Add kubeconfig from stdin
cat /etc/kubernetes/admin.conf | kubecm add -f -
Expand All @@ -30,7 +26,7 @@ cat /etc/kubernetes/admin.conf | kubecm add -f -
### 选项

```
--context-name string override context name when add kubeconfig context
--context-prefix string override context name when add kubeconfig context
-c, --cover Overwrite local kubeconfig files
-f, --file string Path to merge kubeconfig files
Expand Down

0 comments on commit 0bdc035

Please sign in to comment.