1
0
mirror of https://github.com/rancher/types.git synced 2025-07-05 09:46:13 +00:00

Set clusterIP field in all cases

This commit is contained in:
Alena Prokharchyk 2018-03-01 10:07:44 -08:00
parent fdeee128f6
commit 7b23a3c49c

View File

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