From 2e79e8d365f219c664ee4659b12afeeb585622fc Mon Sep 17 00:00:00 2001 From: Robb Hamilton Date: Mon, 18 Feb 2019 14:35:36 -0500 Subject: [PATCH] Fix bug where cluster name is incorrect in kubeconfig created from serviceaccount --- cmd/bridge/main.go | 3 --- frontend/public/components/about-modal.jsx | 1 - frontend/public/components/service-account.jsx | 3 ++- server/server.go | 3 --- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/cmd/bridge/main.go b/cmd/bridge/main.go index ce5f7243f42..7d3fafa7967 100644 --- a/cmd/bridge/main.go +++ b/cmd/bridge/main.go @@ -52,8 +52,6 @@ func main() { // See https://github.com/openshift/service-serving-cert-signer fServiceCAFile := fs.String("service-ca-file", "", "CA bundle for OpenShift services signed with the service signing certificates.") - fTectonicClusterName := fs.String("tectonic-cluster-name", "tectonic", "The Tectonic cluster name.") - fUserAuth := fs.String("user-auth", "disabled", "disabled | oidc | openshift") fUserAuthOIDCIssuerURL := fs.String("user-auth-oidc-issuer-url", "", "The OIDC/OAuth2 issuer URL.") fUserAuthOIDCCAFile := fs.String("user-auth-oidc-ca-file", "", "PEM file for the OIDC/OAuth2 issuer.") @@ -163,7 +161,6 @@ func main() { BaseURL: baseURL, LogoutRedirect: logoutRedirect, TectonicCACertFile: caCertFilePath, - ClusterName: *fTectonicClusterName, Branding: branding, DocumentationBaseURL: documentationBaseURL, GoogleTagManagerID: *fGoogleTagManagerID, diff --git a/frontend/public/components/about-modal.jsx b/frontend/public/components/about-modal.jsx index 014f9a5ab27..55fcc4d15d9 100644 --- a/frontend/public/components/about-modal.jsx +++ b/frontend/public/components/about-modal.jsx @@ -12,7 +12,6 @@ class AboutModal_ extends React.Component { super(props); this.state = { kubernetesVersion: null, - clusterName: null, }; } diff --git a/frontend/public/components/service-account.jsx b/frontend/public/components/service-account.jsx index b6529353452..adf686f7e61 100644 --- a/frontend/public/components/service-account.jsx +++ b/frontend/public/components/service-account.jsx @@ -20,7 +20,8 @@ const KubeConfigify = (kind, sa) => ({ k8sGet(SecretModel, name, namespace).then(({data}) => { const server = window.SERVER_FLAGS.kubeAPIServerURL; - const clusterName = window.SERVER_FLAGS.clusterName; + const url = new URL(server); + const clusterName = url.host; const token = atob(data.token); const cert = data['ca.crt']; diff --git a/server/server.go b/server/server.go index 29a51eb6d00..9163d3bbd39 100644 --- a/server/server.go +++ b/server/server.go @@ -55,7 +55,6 @@ type jsGlobals struct { AlertManagerBaseURL string `json:"alertManagerBaseURL"` Branding string `json:"branding"` DocumentationBaseURL string `json:"documentationBaseURL"` - ClusterName string `json:"clusterName"` GoogleTagManagerID string `json:"googleTagManagerID"` LoadTestFactor int `json:"loadTestFactor"` } @@ -70,7 +69,6 @@ type Server struct { Auther *auth.Authenticator StaticUser *auth.User KubectlClientID string - ClusterName string KubeAPIServerURL string DocumentationBaseURL *url.URL Branding string @@ -254,7 +252,6 @@ func (s *Server) indexHandler(w http.ResponseWriter, r *http.Request) { LoginErrorURL: proxy.SingleJoiningSlash(s.BaseURL.String(), AuthLoginErrorEndpoint), LogoutURL: proxy.SingleJoiningSlash(s.BaseURL.String(), authLogoutEndpoint), LogoutRedirect: s.LogoutRedirect.String(), - ClusterName: s.ClusterName, KubeAPIServerURL: s.KubeAPIServerURL, Branding: s.Branding, DocumentationBaseURL: s.DocumentationBaseURL.String(),