feat: support external traffic policy

Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
This commit is contained in:
AhmedGrati
2023-02-13 14:59:46 +01:00
parent f2aeb70e59
commit 6be6fdd165
18 changed files with 650 additions and 6 deletions
+13
View File
@@ -32,6 +32,8 @@ import (
const (
// LabelServiceType defines the type of service to be created
LabelServiceType = "kompose.service.type"
// LabelServiceExternalTrafficPolicy defines the external policy traffic of service to be created
LabelServiceExternalTrafficPolicy = "kompose.service.external-traffic-policy"
// LabelServiceGroup defines the group of services in a single pod
LabelServiceGroup = "kompose.service.group"
// LabelNodePortPort defines the port value for NodePort service
@@ -151,6 +153,17 @@ func handleServiceType(ServiceType string) (string, error) {
}
}
func handleServiceExternalTrafficPolicy(ServiceExternalTrafficPolicyType string) (string, error) {
switch strings.ToLower(ServiceExternalTrafficPolicyType) {
case "", "cluster":
return string(api.ServiceExternalTrafficPolicyTypeCluster), nil
case "local":
return string(api.ServiceExternalTrafficPolicyTypeLocal), nil
default:
return "", errors.New("Unknown value " + ServiceExternalTrafficPolicyType + " , supported values are 'local, cluster'")
}
}
func normalizeContainerNames(svcName string) string {
return strings.ToLower(svcName)
}