Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ spec:
- -c
- |
kc=/var/run/secrets/hosted_cluster/kubeconfig
kubectl --kubeconfig $kc config set clusters.default.server "https://[${KUBERNETES_SERVICE_HOST}]:${KUBERNETES_SERVICE_PORT}"
kubectl --kubeconfig $kc config set clusters.default.server "{{.KubernetesServiceURL}}"
kubectl --kubeconfig $kc config set clusters.default.certificate-authority /hosted-ca/ca.crt
kubectl --kubeconfig $kc config set users.admin.tokenFile /var/run/secrets/hosted_cluster/token
kubectl --kubeconfig $kc config set contexts.default.cluster default
Expand All @@ -78,11 +78,6 @@ spec:
volumeMounts:
- mountPath: /var/run/secrets/hosted_cluster
name: hosted-cluster-api-access
env:
- name: KUBERNETES_SERVICE_PORT
value: "{{.KubernetesServicePort}}"
- name: KUBERNETES_SERVICE_HOST
value: "{{.KubernetesServiceHost}}"
containers:
# hosted-cluster-token creates a token with a custom path(/var/run/secrets/hosted_cluster/token)
# The token path is included in the kubeconfig used by cncc containers to talk to the hosted clusters API server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ spec:
- -c
- |
kc=/var/run/secrets/hosted_cluster/kubeconfig
kubectl --kubeconfig $kc config set clusters.default.server "https://[${KUBERNETES_SERVICE_HOST}]:${KUBERNETES_SERVICE_PORT}"
kubectl --kubeconfig $kc config set clusters.default.server "{{.KubernetesServiceURL}}"
kubectl --kubeconfig $kc config set clusters.default.certificate-authority /hosted-ca/ca.crt
kubectl --kubeconfig $kc config set users.admin.tokenFile /var/run/secrets/hosted_cluster/token
kubectl --kubeconfig $kc config set contexts.default.cluster default
Expand All @@ -89,11 +89,6 @@ spec:
volumeMounts:
- mountPath: /var/run/secrets/hosted_cluster
name: hosted-cluster-api-access
env:
- name: KUBERNETES_SERVICE_PORT
value: "{{.KubernetesServicePort}}"
- name: KUBERNETES_SERVICE_HOST
value: "{{.KubernetesServiceHost}}"
automountServiceAccountToken: false
{{- end }}
containers:
Expand Down
5 changes: 3 additions & 2 deletions pkg/network/cloud_network.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package network

import (
"net"
"os"
"path/filepath"

Expand Down Expand Up @@ -42,8 +43,8 @@ func renderCloudNetworkConfigController(conf *operv1.NetworkSpec, bootstrapResul
data.Data["PlatformTypeAzure"] = v1.AzurePlatformType
data.Data["PlatformTypeGCP"] = v1.GCPPlatformType
data.Data["CloudNetworkConfigControllerImage"] = os.Getenv("CLOUD_NETWORK_CONFIG_CONTROLLER_IMAGE")
data.Data["KubernetesServiceHost"] = cloudBootstrapResult.APIServers[bootstrap.APIServerDefaultLocal].Host
data.Data["KubernetesServicePort"] = cloudBootstrapResult.APIServers[bootstrap.APIServerDefaultLocal].Port
localAPIServer := cloudBootstrapResult.APIServers[bootstrap.APIServerDefaultLocal]
data.Data["KubernetesServiceURL"] = "https://" + net.JoinHostPort(localAPIServer.Host, localAPIServer.Port)
data.Data["ExternalControlPlane"] = cloudBootstrapResult.ControlPlaneTopology == configv1.ExternalTopologyMode
data.Data["PlatformAzureEnvironment"] = ""
data.Data["PlatformAWSCAPath"] = ""
Expand Down
5 changes: 3 additions & 2 deletions pkg/network/multus_admission_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/base64"
"fmt"
"net"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -75,8 +76,8 @@ func renderMultusAdmissonControllerConfig(manifestDir string, externalControlPla
data.Data["RHOBSMonitoring"] = os.Getenv("RHOBS_MONITORING")
if hsc.Enabled {
data.Data["AdmissionControllerNamespace"] = hsc.Namespace
data.Data["KubernetesServiceHost"] = bootstrapResult.Infra.APIServers[bootstrap.APIServerDefaultLocal].Host
data.Data["KubernetesServicePort"] = bootstrapResult.Infra.APIServers[bootstrap.APIServerDefaultLocal].Port
localAPIServer := bootstrapResult.Infra.APIServers[bootstrap.APIServerDefaultLocal]
data.Data["KubernetesServiceURL"] = "https://" + net.JoinHostPort(localAPIServer.Host, localAPIServer.Port)
data.Data["CLIImage"] = os.Getenv("CLI_IMAGE")
data.Data["TokenMinterImage"] = os.Getenv("TOKEN_MINTER_IMAGE")
data.Data["TokenAudience"] = os.Getenv("TOKEN_AUDIENCE")
Expand Down