Skip to content

Commit

Permalink
fix(platform): ignore ca when set env (#1759)
Browse files Browse the repository at this point in the history
Co-authored-by: xdonggao <xdonggao@tencent.com>
  • Loading branch information
GaoXiaodong and xdonggao authored Feb 9, 2022
1 parent 939f14e commit ea1d1d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion api/platform/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"math/rand"
"net"
"os"
"path"
"strings"

Expand Down Expand Up @@ -391,7 +392,8 @@ func (cc ClusterCredential) RESTConfig(cls *Cluster) *rest.Config {
config.Host = fmt.Sprintf("https://%s", host)
}
}
if cc.CACert != nil {
// If api-server does not sign the ip in address, set ca then request, it will report x509 certificate error, need to ignore the certificate
if os.Getenv("TKE_IGNORE_CA") != "true" && cc.CACert != nil {
config.TLSClientConfig.CAData = cc.CACert
} else {
config.TLSClientConfig.Insecure = true
Expand Down
4 changes: 3 additions & 1 deletion api/platform/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"math/rand"
"net"
"os"
"path"
strings "strings"

Expand Down Expand Up @@ -401,7 +402,8 @@ func (cc ClusterCredential) RESTConfig(cls *Cluster) *rest.Config {
config.Host = fmt.Sprintf("https://%s", host)
}
}
if cc.CACert != nil {
// If api-server does not sign the ip in address, set ca then request, it will report x509 certificate error, need to ignore the certificate
if os.Getenv("TKE_IGNORE_CA") != "true" && cc.CACert != nil {
config.TLSClientConfig.CAData = cc.CACert
} else {
config.TLSClientConfig.Insecure = true
Expand Down

0 comments on commit ea1d1d0

Please sign in to comment.