| ... | ... |
@@ -144,6 +144,9 @@ type MasterConfig struct {
|
| 144 | 144 |
// ProjectConfig holds information about project creation and defaults |
| 145 | 145 |
ProjectConfig ProjectConfig |
| 146 | 146 |
|
| 147 |
+ // RoutingConfig holds information about routing and route generation |
|
| 148 |
+ RoutingConfig RoutingConfig |
|
| 149 |
+ |
|
| 147 | 150 |
// NetworkConfig to be passed to the compiled in network plugin |
| 148 | 151 |
NetworkConfig NetworkConfig |
| 149 | 152 |
} |
| ... | ... |
@@ -164,6 +167,11 @@ type ProjectConfig struct {
|
| 164 | 164 |
SecurityAllocator *SecurityAllocator |
| 165 | 165 |
} |
| 166 | 166 |
|
| 167 |
+type RoutingConfig struct {
|
|
| 168 |
+ // Subdomain is the suffix appended to $service.$namespace. to form the default route hostname |
|
| 169 |
+ Subdomain string |
|
| 170 |
+} |
|
| 171 |
+ |
|
| 167 | 172 |
type SecurityAllocator struct {
|
| 168 | 173 |
// UIDAllocatorRange defines the total set of Unix user IDs (UIDs) that will be allocated to projects automatically, and the size of the |
| 169 | 174 |
// block each namespace gets. For example, 1000-1999/10 will allocate ten UIDs per namespace, and will be able to allocate up to 100 blocks |
| ... | ... |
@@ -22,6 +22,9 @@ func init() {
|
| 22 | 22 |
if len(obj.PolicyConfig.OpenShiftInfrastructureNamespace) == 0 {
|
| 23 | 23 |
obj.PolicyConfig.OpenShiftInfrastructureNamespace = bootstrappolicy.DefaultOpenShiftInfraNamespace |
| 24 | 24 |
} |
| 25 |
+ if len(obj.RoutingConfig.Subdomain) == 0 {
|
|
| 26 |
+ obj.RoutingConfig.Subdomain = "router.default.local" |
|
| 27 |
+ } |
|
| 25 | 28 |
}, |
| 26 | 29 |
func(obj *KubernetesMasterConfig) {
|
| 27 | 30 |
if obj.MasterCount == 0 {
|
| ... | ... |
@@ -133,6 +133,9 @@ type MasterConfig struct {
|
| 133 | 133 |
// ProjectConfig holds information about project creation and defaults |
| 134 | 134 |
ProjectConfig ProjectConfig `json:"projectConfig"` |
| 135 | 135 |
|
| 136 |
+ // RoutingConfig holds information about routing and route generation |
|
| 137 |
+ RoutingConfig RoutingConfig `json:"routingConfig"` |
|
| 138 |
+ |
|
| 136 | 139 |
// NetworkConfig to be passed to the compiled in network plugin |
| 137 | 140 |
NetworkConfig NetworkConfig `json:"networkConfig"` |
| 138 | 141 |
} |
| ... | ... |
@@ -186,6 +189,11 @@ type PolicyConfig struct {
|
| 186 | 186 |
OpenShiftInfrastructureNamespace string `json:"openshiftInfrastructureNamespace"` |
| 187 | 187 |
} |
| 188 | 188 |
|
| 189 |
+type RoutingConfig struct {
|
|
| 190 |
+ // Subdomain is the suffix appended to $service.$namespace. to form the default route hostname |
|
| 191 |
+ Subdomain string `json:"subdomain"` |
|
| 192 |
+} |
|
| 193 |
+ |
|
| 189 | 194 |
// NetworkConfig to be passed to the compiled in network plugin |
| 190 | 195 |
type NetworkConfig struct {
|
| 191 | 196 |
NetworkPluginName string `json:"networkPluginName"` |
| ... | ... |
@@ -135,6 +135,8 @@ func ValidateMasterConfig(config *api.MasterConfig) ValidationResults {
|
| 135 | 135 |
|
| 136 | 136 |
validationResults.AddErrors(ValidateProjectConfig(config.ProjectConfig).Prefix("projectConfig")...)
|
| 137 | 137 |
|
| 138 |
+ validationResults.AddErrors(ValidateRoutingConfig(config.RoutingConfig).Prefix("routingConfig")...)
|
|
| 139 |
+ |
|
| 138 | 140 |
validationResults.Append(ValidateAPILevels(config.APILevels, api.KnownOpenShiftAPILevels, api.DeadOpenShiftAPILevels, "apiLevels")) |
| 139 | 141 |
|
| 140 | 142 |
return validationResults |
| ... | ... |
@@ -361,3 +363,15 @@ func ValidateProjectConfig(config api.ProjectConfig) fielderrors.ValidationError |
| 361 | 361 |
} |
| 362 | 362 |
return allErrs |
| 363 | 363 |
} |
| 364 |
+ |
|
| 365 |
+func ValidateRoutingConfig(config api.RoutingConfig) fielderrors.ValidationErrorList {
|
|
| 366 |
+ allErrs := fielderrors.ValidationErrorList{}
|
|
| 367 |
+ |
|
| 368 |
+ if len(config.Subdomain) == 0 {
|
|
| 369 |
+ allErrs = append(allErrs, fielderrors.NewFieldRequired("subdomain"))
|
|
| 370 |
+ } else if !util.IsDNS1123Subdomain(config.Subdomain) {
|
|
| 371 |
+ allErrs = append(allErrs, fielderrors.NewFieldInvalid("subdomain", config.Subdomain, "must be a valid subdomain"))
|
|
| 372 |
+ } |
|
| 373 |
+ |
|
| 374 |
+ return allErrs |
|
| 375 |
+} |
| ... | ... |
@@ -134,7 +134,6 @@ const ( |
| 134 | 134 |
OpenShiftAPIV1 = "v1" |
| 135 | 135 |
OpenShiftAPIPrefixV1Beta3 = LegacyOpenShiftAPIPrefix + "/" + OpenShiftAPIV1Beta3 |
| 136 | 136 |
OpenShiftAPIPrefixV1 = OpenShiftAPIPrefix + "/" + OpenShiftAPIV1 |
| 137 |
- OpenShiftRouteSubdomain = "router.default.local" |
|
| 138 | 137 |
swaggerAPIPrefix = "/swaggerapi/" |
| 139 | 138 |
) |
| 140 | 139 |
|
| ... | ... |
@@ -1108,9 +1107,7 @@ func (c *MasterConfig) RouteAllocator() *routeallocationcontroller.RouteAllocati |
| 1108 | 1108 |
KubeClient: kclient, |
| 1109 | 1109 |
} |
| 1110 | 1110 |
|
| 1111 |
- subdomain := env("OPENSHIFT_ROUTE_SUBDOMAIN", OpenShiftRouteSubdomain)
|
|
| 1112 |
- |
|
| 1113 |
- plugin, err := routeplugin.NewSimpleAllocationPlugin(subdomain) |
|
| 1111 |
+ plugin, err := routeplugin.NewSimpleAllocationPlugin(c.Options.RoutingConfig.Subdomain) |
|
| 1114 | 1112 |
if err != nil {
|
| 1115 | 1113 |
glog.Fatalf("Route plugin initialization failed: %v", err)
|
| 1116 | 1114 |
} |