aboutsummaryrefslogtreecommitdiff
path: root/vendor/k8s.io/kubernetes/pkg/api/service/util.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-03-26 18:26:55 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-27 18:09:12 +0000
commitaf64e10400f8533a0c48ecdf5ab9b7fbf329e14e (patch)
tree59160e3841b440dd35189c724bbb4375a7be173b /vendor/k8s.io/kubernetes/pkg/api/service/util.go
parent26d7e3c7b85e28c4e42998c90fdcc14079f13eef (diff)
downloadpodman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.tar.gz
podman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.tar.bz2
podman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.zip
Vendor in lots of kubernetes stuff to shrink image size
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #554 Approved by: mheon
Diffstat (limited to 'vendor/k8s.io/kubernetes/pkg/api/service/util.go')
-rw-r--r--vendor/k8s.io/kubernetes/pkg/api/service/util.go69
1 files changed, 3 insertions, 66 deletions
diff --git a/vendor/k8s.io/kubernetes/pkg/api/service/util.go b/vendor/k8s.io/kubernetes/pkg/api/service/util.go
index 50041f77e..5de5f2765 100644
--- a/vendor/k8s.io/kubernetes/pkg/api/service/util.go
+++ b/vendor/k8s.io/kubernetes/pkg/api/service/util.go
@@ -18,13 +18,9 @@ package service
import (
"fmt"
- "strconv"
- "strings"
-
- "k8s.io/kubernetes/pkg/api"
+ api "k8s.io/kubernetes/pkg/apis/core"
netsets "k8s.io/kubernetes/pkg/util/net/sets"
-
- "github.com/golang/glog"
+ "strings"
)
const (
@@ -77,72 +73,13 @@ func RequestsOnlyLocalTraffic(service *api.Service) bool {
return false
}
- // First check the beta annotation and then the first class field. This is so that
- // existing Services continue to work till the user decides to transition to the
- // first class field.
- if l, ok := service.Annotations[api.BetaAnnotationExternalTraffic]; ok {
- switch l {
- case api.AnnotationValueExternalTrafficLocal:
- return true
- case api.AnnotationValueExternalTrafficGlobal:
- return false
- default:
- glog.Errorf("Invalid value for annotation %v: %v", api.BetaAnnotationExternalTraffic, l)
- return false
- }
- }
return service.Spec.ExternalTrafficPolicy == api.ServiceExternalTrafficPolicyTypeLocal
}
-// NeedsHealthCheck Check if service needs health check.
+// NeedsHealthCheck checks if service needs health check.
func NeedsHealthCheck(service *api.Service) bool {
if service.Spec.Type != api.ServiceTypeLoadBalancer {
return false
}
return RequestsOnlyLocalTraffic(service)
}
-
-// GetServiceHealthCheckNodePort Return health check node port for service, if one exists
-func GetServiceHealthCheckNodePort(service *api.Service) int32 {
- // First check the beta annotation and then the first class field. This is so that
- // existing Services continue to work till the user decides to transition to the
- // first class field.
- if l, ok := service.Annotations[api.BetaAnnotationHealthCheckNodePort]; ok {
- p, err := strconv.Atoi(l)
- if err != nil {
- glog.Errorf("Failed to parse annotation %v: %v", api.BetaAnnotationHealthCheckNodePort, err)
- return 0
- }
- return int32(p)
- }
- return service.Spec.HealthCheckNodePort
-}
-
-// ClearExternalTrafficPolicy resets the ExternalTrafficPolicy field.
-func ClearExternalTrafficPolicy(service *api.Service) {
- // First check the beta annotation and then the first class field. This is so that
- // existing Services continue to work till the user decides to transition to the
- // first class field.
- if _, ok := service.Annotations[api.BetaAnnotationExternalTraffic]; ok {
- delete(service.Annotations, api.BetaAnnotationExternalTraffic)
- return
- }
- service.Spec.ExternalTrafficPolicy = api.ServiceExternalTrafficPolicyType("")
-}
-
-// SetServiceHealthCheckNodePort sets the given health check node port on service.
-// It does not check whether this service needs healthCheckNodePort.
-func SetServiceHealthCheckNodePort(service *api.Service, hcNodePort int32) {
- // First check the beta annotation and then the first class field. This is so that
- // existing Services continue to work till the user decides to transition to the
- // first class field.
- if _, ok := service.Annotations[api.BetaAnnotationExternalTraffic]; ok {
- if hcNodePort == 0 {
- delete(service.Annotations, api.BetaAnnotationHealthCheckNodePort)
- } else {
- service.Annotations[api.BetaAnnotationHealthCheckNodePort] = fmt.Sprintf("%d", hcNodePort)
- }
- return
- }
- service.Spec.HealthCheckNodePort = hcNodePort
-}