mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
fix(k8s/config): force insecure-skip-tls-verify option for internal use [BE-11706] (#537)
This commit is contained in:
parent
38562f9560
commit
4b992c6f3e
2 changed files with 11 additions and 0 deletions
|
@ -167,6 +167,16 @@ func (handler *Handler) buildConfig(r *http.Request, tokenData *portainer.TokenD
|
||||||
func (handler *Handler) buildCluster(r *http.Request, endpoint portainer.Endpoint, isInternal bool) clientV1.NamedCluster {
|
func (handler *Handler) buildCluster(r *http.Request, endpoint portainer.Endpoint, isInternal bool) clientV1.NamedCluster {
|
||||||
kubeConfigInternal := handler.kubeClusterAccessService.GetClusterDetails(r.Host, endpoint.ID, isInternal)
|
kubeConfigInternal := handler.kubeClusterAccessService.GetClusterDetails(r.Host, endpoint.ID, isInternal)
|
||||||
|
|
||||||
|
if isInternal {
|
||||||
|
return clientV1.NamedCluster{
|
||||||
|
Name: buildClusterName(endpoint.Name),
|
||||||
|
Cluster: clientV1.Cluster{
|
||||||
|
Server: kubeConfigInternal.ClusterServerURL,
|
||||||
|
InsecureSkipTLSVerify: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
selfSignedCert := false
|
selfSignedCert := false
|
||||||
serverUrl, err := url.Parse(kubeConfigInternal.ClusterServerURL)
|
serverUrl, err := url.Parse(kubeConfigInternal.ClusterServerURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -109,6 +109,7 @@ func (service *kubeClusterAccessService) GetClusterDetails(hostURL string, endpo
|
||||||
Str("host_URL", hostURL).
|
Str("host_URL", hostURL).
|
||||||
Str("HTTPS_bind_address", service.httpsBindAddr).
|
Str("HTTPS_bind_address", service.httpsBindAddr).
|
||||||
Str("base_URL", baseURL).
|
Str("base_URL", baseURL).
|
||||||
|
Bool("is_internal", isInternal).
|
||||||
Msg("kubeconfig")
|
Msg("kubeconfig")
|
||||||
|
|
||||||
clusterServerURL, err := url.JoinPath("https://", hostURL, baseURL, "/api/endpoints/", strconv.Itoa(int(endpointID)), "/kubernetes")
|
clusterServerURL, err := url.JoinPath("https://", hostURL, baseURL, "/api/endpoints/", strconv.Itoa(int(endpointID)), "/kubernetes")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue