Skip to content

Commit

Permalink
USe helper to get Asset Public URL
Browse files Browse the repository at this point in the history
Signed-off-by: Simo Sorce <[email protected]>
  • Loading branch information
simo5 committed Mar 14, 2018
1 parent 9884ceb commit 167f17e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
10 changes: 10 additions & 0 deletions pkg/cmd/server/apis/config/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,3 +642,13 @@ func CIDRsOverlap(cidr1, cidr2 string) bool {
}
return ipNet1.Contains(ipNet2.IP) || ipNet2.Contains(ipNet1.IP)
}

func GetAssetPublicURL(config *MasterConfig) string {
asset := ""
if config.OAuthConfig != nil {
asset = config.OAuthConfig.AssetPublicURL
} else if config.ExternalOAuthConfig != nil {
asset = config.ExternalOAuthConfig.AssetPublicURL
}
return asset
}
5 changes: 1 addition & 4 deletions pkg/cmd/server/origin/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,7 @@ func (c *MasterConfig) RunOpenShift(stopCh <-chan struct{}) error {
}

func (c *MasterConfig) buildHandlerChain(genericConfig *apiserver.Config) (func(apiHandler http.Handler, kc *apiserver.Config) http.Handler, map[string]apiserver.PostStartHookFunc, error) {
webconsolePublicURL := ""
if c.Options.OAuthConfig != nil {
webconsolePublicURL = c.Options.OAuthConfig.AssetPublicURL
}
webconsolePublicURL := configapi.GetAssetPublicURL(&c.Options)
webconsoleProxyHandler, err := c.newWebConsoleProxy()
if err != nil {
return nil, nil, err
Expand Down
6 changes: 3 additions & 3 deletions pkg/oc/bootstrap/docker/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"

"github.com/openshift/origin/pkg/cmd/server/apis/config"
configapi "github.com/openshift/origin/pkg/cmd/server/apis/config"
"github.com/openshift/origin/pkg/oc/bootstrap/docker/dockerhelper"
"github.com/openshift/origin/pkg/oc/bootstrap/docker/errors"
"github.com/openshift/origin/pkg/oc/bootstrap/docker/exec"
Expand Down Expand Up @@ -145,7 +145,7 @@ func isHealthy(f *clientcmd.Factory) (bool, error) {
return statusCode == 200, nil
}

func status(container *types.ContainerJSON, config *config.MasterConfig) string {
func status(container *types.ContainerJSON, config *configapi.MasterConfig) string {
mountMap := make(map[string]string)
for _, mount := range container.Mounts {
mountMap[mount.Destination] = mount.Source
Expand All @@ -165,7 +165,7 @@ func status(container *types.ContainerJSON, config *config.MasterConfig) string
status += fmt.Sprintf("The OpenShift cluster was started %s ago\n\n", duration)
}

status = status + fmt.Sprintf("Web console URL: %s\n", config.OAuthConfig.AssetPublicURL)
status = status + fmt.Sprintf("Web console URL: %s\n", configapi.GetAssetPublicURL(config))
status = status + fmt.Sprintf("\n")

status = status + fmt.Sprintf("Config is at host directory %s\n", mountMap["/var/lib/origin/openshift.local.config"])
Expand Down

0 comments on commit 167f17e

Please sign in to comment.