API warn non-ExternalName services w/ externalName

This commit is contained in:
Tim Hockin
2023-07-13 18:58:09 -07:00
parent 7bd0a857e3
commit 182a4f858a
2 changed files with 12 additions and 2 deletions

View File

@@ -56,6 +56,9 @@ func GetWarningsForService(service, oldService *api.Service) []string {
if service.Spec.Type == api.ServiceTypeExternalName && len(service.Spec.ExternalIPs) > 0 {
warnings = append(warnings, fmt.Sprintf("spec.externalIPs is ignored when spec.type is %q", api.ServiceTypeExternalName))
}
if service.Spec.Type != api.ServiceTypeExternalName && service.Spec.ExternalName != "" {
warnings = append(warnings, fmt.Sprintf("spec.externalName is ignored when spec.type is not %q", api.ServiceTypeExternalName))
}
return warnings
}