Skip to content

Commit

Permalink
Merge pull request #1780 from smarterclayton/fix_1201615_https_in_swa…
Browse files Browse the repository at this point in the history
…gger

Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Apr 17, 2015
2 parents 8d3b97c + f53feee commit 532dedb
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 5 deletions.
4 changes: 4 additions & 0 deletions pkg/cmd/server/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ type MasterConfig struct {
// CORSAllowedOrigins
CORSAllowedOrigins []string

// MasterPublicURL is how clients can access the OpenShift API server
MasterPublicURL string

// EtcdStorageConfig contains information about how API resources are
// stored in Etcd. These values are only relevant when etcd is the
// backing store for the cluster.
EtcdStorageConfig EtcdStorageConfig

// EtcdClientInfo contains information about how to connect to etcd
EtcdClientInfo EtcdConnectionInfo

Expand Down
4 changes: 4 additions & 0 deletions pkg/cmd/server/api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ type MasterConfig struct {
// CORSAllowedOrigins
CORSAllowedOrigins []string `json:"corsAllowedOrigins"`

// MasterPublicURL is how clients can access the OpenShift API server
MasterPublicURL string `json:"masterPublicURL"`

// EtcdStorageConfig contains information about how API resources are
// stored in Etcd. These values are only relevant when etcd is the
// backing store for the cluster.
EtcdStorageConfig EtcdStorageConfig `json:"etcdStorageConfig"`

// EtcdClientInfo contains information about how to connect to etcd
EtcdClientInfo EtcdConnectionInfo `json:"etcdClientInfo"`
// KubeletClientInfo contains information about how to connect to kubelets
Expand Down
8 changes: 8 additions & 0 deletions pkg/cmd/server/api/validation/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import (
func ValidateMasterConfig(config *api.MasterConfig) fielderrors.ValidationErrorList {
allErrs := fielderrors.ValidationErrorList{}

if _, urlErrs := ValidateURL(config.MasterPublicURL, "masterPublicURL"); len(urlErrs) > 0 {
allErrs = append(allErrs, urlErrs...)
}

if config.AssetConfig != nil {
allErrs = append(allErrs, ValidateAssetConfig(config.AssetConfig).Prefix("assetConfig")...)
colocated := config.AssetConfig.ServingInfo.BindAddress == config.ServingInfo.BindAddress
Expand Down Expand Up @@ -115,6 +119,10 @@ func ValidateAssetConfig(config *api.AssetConfig) fielderrors.ValidationErrorLis
}
}

if _, urlErrs := ValidateURL(config.MasterPublicURL, "masterPublicURL"); len(urlErrs) > 0 {
allErrs = append(allErrs, urlErrs...)
}

return allErrs
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/server/api/validation/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func ValidateOAuthConfig(config *api.OAuthConfig) fielderrors.ValidationErrorLis
allErrs = append(allErrs, fielderrors.NewFieldRequired("masterURL"))
}

if len(config.MasterPublicURL) == 0 {
allErrs = append(allErrs, fielderrors.NewFieldRequired("masterPublicURL"))
if _, urlErrs := ValidateURL(config.MasterPublicURL, "masterPublicURL"); len(urlErrs) > 0 {
allErrs = append(allErrs, urlErrs...)
}

if len(config.AssetPublicURL) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/server/origin/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (c *AuthConfig) InstallAPI(container *restful.Container) []string {

return []string{
fmt.Sprintf("Started OAuth2 API at %%s%s", OpenShiftOAuthAPIPrefix),
fmt.Sprintf("Started login server at %%s%s", OpenShiftLoginPrefix),
fmt.Sprintf("Started Login endpoint at %%s%s", OpenShiftLoginPrefix),
}
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/cmd/server/origin/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,9 @@ func (c *MasterConfig) Run(protected []APIInstaller, unprotected []APIInstaller)

// install swagger
swaggerConfig := swagger.Config{
WebServices: append(safe.RegisteredWebServices(), open.RegisteredWebServices()...),
ApiPath: swaggerAPIPrefix,
WebServicesUrl: c.Options.MasterPublicURL,
WebServices: append(safe.RegisteredWebServices(), open.RegisteredWebServices()...),
ApiPath: swaggerAPIPrefix,
}
// log nothing from swagger
swagger.LogInfo = func(format string, v ...interface{}) {}
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/server/start/master_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func (args MasterArgs) BuildSerializeableMasterConfig() (*configapi.MasterConfig
BindAddress: args.ListenArg.ListenAddr.URL.Host,
},
CORSAllowedOrigins: corsAllowedOrigins.List(),
MasterPublicURL: masterPublicAddr.String(),

KubernetesMasterConfig: kubernetesMasterConfig,
EtcdConfig: etcdConfig,
Expand Down

0 comments on commit 532dedb

Please sign in to comment.