From af64e10400f8533a0c48ecdf5ab9b7fbf329e14e Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Mon, 26 Mar 2018 18:26:55 -0400 Subject: Vendor in lots of kubernetes stuff to shrink image size Signed-off-by: Daniel J Walsh Closes: #554 Approved by: mheon --- vendor/k8s.io/kubernetes/pkg/api/service/util.go | 69 ++---------------------- 1 file changed, 3 insertions(+), 66 deletions(-) (limited to 'vendor/k8s.io/kubernetes/pkg/api/service/util.go') 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 -} -- cgit v1.2.3-54-g00ecf