1
0
mirror of https://github.com/rancher/types.git synced 2025-06-25 21:21:32 +00:00

Merge pull request #263 from alena1108/feb28

Service type to ExternalName when hostname is set
This commit is contained in:
Alena Prokharchyk 2018-02-28 21:29:05 -08:00 committed by GitHub
commit 9eba3c1e08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ package schema
import (
"github.com/rancher/norman/types"
"github.com/rancher/norman/types/convert"
)
type ServiceSpecMapper struct {
@ -14,9 +15,12 @@ func (e ServiceSpecMapper) ToInternal(data map[string]interface{}) {
if data == nil {
return
}
data["clusterIp"] = "None"
data["type"] = "ClusterIP"
if convert.IsEmpty(data["hostname"]) {
data["type"] = "ClusterIP"
data["clusterIp"] = "None"
} else {
data["type"] = "ExternalName"
}
}
func (e ServiceSpecMapper) ModifySchema(schema *types.Schema, schemas *types.Schemas) error {