mirror of
https://github.com/rancher/types.git
synced 2025-07-19 07:46:25 +00:00
Service type to ExternalName when hostname is set
This commit is contained in:
parent
d3064b6969
commit
c83306621b
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user