Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tunnel-cloud manifests 模版缺少参数 #27

Open
yhlooo opened this issue Sep 2, 2022 · 0 comments
Open

tunnel-cloud manifests 模版缺少参数 #27

yhlooo opened this issue Sep 2, 2022 · 0 comments

Comments

@yhlooo
Copy link

yhlooo commented Sep 2, 2022

发生了什么:

在我的 minikube 中尝试使用 edgeadm 将其转换为一个具有边缘能力的集群,我执行了以下命令

edgeadm change --ca.cert ./ca.crt --ca.key ./ca.key

其日志输出如下:

image

看起来并没有成功

我猜测的原因:

从命令执行的输出来看,是往 Kubernetes 创建一个 Secret 报错了,原因是某个值不是一个合法的 base64

找到相关代码:

option := map[string]interface{}{
"Namespace": constant.NamespaceEdgeSystem,
"TunnelCloudEdgeToken": tunnelCloudToken,
"TunnelProxyServerKey": base64.StdEncoding.EncodeToString(kubeletKey),
"TunnelProxyServerCrt": base64.StdEncoding.EncodeToString(kubeletCert),
"TunnelPersistentConnectionServerKey": base64.StdEncoding.EncodeToString(serviceKey),
"TunnelPersistentConnectionServerCrt": base64.StdEncoding.EncodeToString(serviceCert),
}
tunnelCloudYaml := common.ReadYaml(c.manifests+"/"+manifests.APP_TUNNEL_CLOUD, manifests.TunnelCloudYaml)
err = kubeclient.CreateResourceWithFile(c.clientSet, tunnelCloudYaml, option)
if err != nil {
return "", err
}

  1. 247 行读取 tunnel-cloud 组件的 manifests 模版,因为没有指定所以使用的是默认值 manifests.TunnelCloudYaml
    其中有一个名为 tunnel-cloud-cert 的 Secret ,含有变量 {{.TunnelAnpServerCet}}{{.TunnelAnpServerKey}}
  2. 238 行定义了为 tunnel-cloud manifests 模版填充的变量,其中并没有 "TunnelAnpServerCet""TunnelAnpServerKey" 两个键,因此生成的最终的 manifests 中这两个变量会被 <no value> 替代(这不是个合法的 base64 字符串)
  3. 248 行的 CreateResourceWithFile 方法会使用变量填充模版,然后提交到 Kubernetes ,导致了上述报错

经过我验证,如果在 manifests 中注释掉相关 Secret 中 tunnel-anp-server.crttunnel-anp-server.key 即可无错误地通过这段逻辑。但是因为不了解这个证书的用途,因此也不确定这样是否会导致其它问题。

其它信息:

执行 edgeadm version 的输出:

{
   "gitVersion": "v0.8.0",
   "gitBranch": "release-1.20",
   "gitCommit": "d63c731345424cd26e39734144b852784f4245aa",
   "gitTreeState": "dirty",
   "buildDate": "2022-07-25T14:11:51Z",
   "goVersion": "go1.17.11",
   "compiler": "gc",
   "platform": "linux/amd64"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant