cdk-team / cdk-team/CDK

建议修改一些内容,比如可以指定apiserver的url

Open
#98 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
4.7k
Forks
608
PR merge metrics
No merged PRs in 30d

Description

在最近的项目中,发现一个kubenets未授权访问的端口,但是目标url不在pods环境变量中,所以导致后续很多功能无法使用。
```
func ApiServerAddr() (string, error) {
protocol := ""
host, port := os.Getenv("KUBERNETES_SERVICE_HOST"), os.Getenv("KUBERNETES_SERVICE_PORT")
if len(host) == 0 || len(port) == 0 {
text := "err: cannot find kubernetes api host in ENV"
return "", errors.New(text)
}
if port == "8080" || port == "8001" {
protocol = "http://"
} else {
protocol = "https://"
}

return protocol + net.JoinHostPort(host, port), nil
}
```
建议将这里改的更灵活一点

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.