From b66c7f9633ba5b1ebf18bc890eeba03c4bc1108e Mon Sep 17 00:00:00 2001 From: Joao Morais Date: Wed, 27 Sep 2017 17:15:48 -0300 Subject: [PATCH] Update to Ingress a426b89 --- Godeps/Godeps.json | 145 +++++++++--------- .../ingress/annotations/upstreamvhost/main.go | 42 +++++ .../pkg/ingress/controller/annotations.go | 2 + .../ingress/core/pkg/ingress/status/status.go | 49 +++--- .../k8s.io/ingress/core/pkg/ingress/types.go | 4 + 5 files changed, 141 insertions(+), 101 deletions(-) create mode 100644 vendor/k8s.io/ingress/core/pkg/ingress/annotations/upstreamvhost/main.go diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 7707d6d27..229d4741b 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -771,178 +771,183 @@ }, { "ImportPath": "k8s.io/ingress/core/pkg/base64", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/file", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/alias", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/auth", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/authreq", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/authtls", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/class", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/clientbodybuffersize", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/cors", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/defaultbackend", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/healthcheck", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/ipwhitelist", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/parser", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/portinredirect", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/proxy", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/ratelimit", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/redirect", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/rewrite", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/secureupstream", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/serviceupstream", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/sessionaffinity", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/snippet", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/sslpassthrough", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" + }, + { + "ImportPath": "k8s.io/ingress/core/pkg/ingress/annotations/upstreamvhost", + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/controller", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/defaults", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/errors", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/resolver", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/status", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/ingress/store", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/k8s", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/net", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/net/ssl", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/strings", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" }, { "ImportPath": "k8s.io/ingress/core/pkg/task", - "Comment": "nginx-0.9.0-beta.12-28-g7434c50c", - "Rev": "7434c50cdbf43e6f329ef28e5c37bcbd2d883267" + "Comment": "nginx-0.9.0-beta.13-17-ga426b896", + "Rev": "a426b8964efec4bb0d78f34ef7e980e772284c64" } ] } diff --git a/vendor/k8s.io/ingress/core/pkg/ingress/annotations/upstreamvhost/main.go b/vendor/k8s.io/ingress/core/pkg/ingress/annotations/upstreamvhost/main.go new file mode 100644 index 000000000..1603905d0 --- /dev/null +++ b/vendor/k8s.io/ingress/core/pkg/ingress/annotations/upstreamvhost/main.go @@ -0,0 +1,42 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package upstreamvhost + +import ( + extensions "k8s.io/api/extensions/v1beta1" + + "k8s.io/ingress/core/pkg/ingress/annotations/parser" +) + +const ( + annotation = "ingress.kubernetes.io/upstream-vhost" +) + +type upstreamVhost struct { +} + +// NewParser creates a new upstream VHost annotation parser +func NewParser() parser.IngressAnnotation { + return upstreamVhost{} +} + +// Parse parses the annotations contained in the ingress rule +// used to indicate if the location/s contains a fragment of +// configuration to be included inside the paths of the rules +func (a upstreamVhost) Parse(ing *extensions.Ingress) (interface{}, error) { + return parser.GetStringAnnotation(annotation, ing) +} diff --git a/vendor/k8s.io/ingress/core/pkg/ingress/controller/annotations.go b/vendor/k8s.io/ingress/core/pkg/ingress/controller/annotations.go index 245c2c484..af2037dc7 100644 --- a/vendor/k8s.io/ingress/core/pkg/ingress/controller/annotations.go +++ b/vendor/k8s.io/ingress/core/pkg/ingress/controller/annotations.go @@ -39,6 +39,7 @@ import ( "k8s.io/ingress/core/pkg/ingress/annotations/sessionaffinity" "k8s.io/ingress/core/pkg/ingress/annotations/snippet" "k8s.io/ingress/core/pkg/ingress/annotations/sslpassthrough" + "k8s.io/ingress/core/pkg/ingress/annotations/upstreamvhost" "k8s.io/ingress/core/pkg/ingress/errors" "k8s.io/ingress/core/pkg/ingress/resolver" ) @@ -78,6 +79,7 @@ func newAnnotationExtractor(cfg extractorConfig) annotationExtractor { "Alias": alias.NewParser(), "ClientBodyBufferSize": clientbodybuffersize.NewParser(), "DefaultBackend": defaultbackend.NewParser(cfg), + "UpstreamVhost": upstreamvhost.NewParser(), }, } } diff --git a/vendor/k8s.io/ingress/core/pkg/ingress/status/status.go b/vendor/k8s.io/ingress/core/pkg/ingress/status/status.go index 2d126465b..219642d69 100644 --- a/vendor/k8s.io/ingress/core/pkg/ingress/status/status.go +++ b/vendor/k8s.io/ingress/core/pkg/ingress/status/status.go @@ -85,13 +85,11 @@ type statusSync struct { // workqueue used to keep in sync the status IP/s // in the Ingress rules syncQueue *task.Queue - - runLock *sync.Mutex } // Run starts the loop to keep the status in sync func (s statusSync) Run(stopCh <-chan struct{}) { - go wait.Forever(s.elector.Run, 0) + go s.elector.Run() go wait.Forever(s.update, updateInterval) go s.syncQueue.Run(time.Second, stopCh) <-stopCh @@ -140,9 +138,6 @@ func (s statusSync) Shutdown() { } func (s *statusSync) sync(key interface{}) error { - s.runLock.Lock() - defer s.runLock.Unlock() - if s.syncQueue.IsShuttingDown() { glog.V(2).Infof("skipping Ingress status update (shutting down in progress)") return nil @@ -162,18 +157,6 @@ func (s *statusSync) sync(key interface{}) error { return nil } -// callback invoked function when a new leader is elected -func (s *statusSync) callback(leader string) { - if s.syncQueue.IsShuttingDown() { - return - } - - glog.V(2).Infof("new leader elected (%v)", leader) - if leader == s.pod.Name { - glog.V(2).Infof("I am the new status update leader") - } -} - func (s statusSync) keyfunc(input interface{}) (interface{}, error) { return input, nil } @@ -186,9 +169,9 @@ func NewStatusSyncer(config Config) Sync { } st := statusSync{ - pod: pod, - runLock: &sync.Mutex{}, - Config: config, + pod: pod, + + Config: config, } st.syncQueue = task.NewCustomTaskQueue(st.sync, st.keyfunc) @@ -201,10 +184,13 @@ func NewStatusSyncer(config Config) Sync { callbacks := leaderelection.LeaderCallbacks{ OnStartedLeading: func(stop <-chan struct{}) { - st.callback(pod.Name) + glog.V(2).Infof("I am the new status update leader") }, OnStoppedLeading: func() { - st.callback("") + glog.V(2).Infof("I am not status update leader anymore") + }, + OnNewLeader: func(identity string) { + glog.Infof("new leader elected: %v", identity) }, } @@ -218,18 +204,19 @@ func NewStatusSyncer(config Config) Sync { lock := resourcelock.ConfigMapLock{ ConfigMapMeta: meta_v1.ObjectMeta{Namespace: pod.Namespace, Name: electionID}, - Client: config.Client.Core(), + Client: config.Client.CoreV1(), LockConfig: resourcelock.ResourceLockConfig{ - Identity: electionID, + Identity: pod.Name, EventRecorder: recorder, }, } + ttl := 30 * time.Second le, err := leaderelection.NewLeaderElector(leaderelection.LeaderElectionConfig{ Lock: &lock, - LeaseDuration: 30 * time.Second, - RenewDeadline: 15 * time.Second, - RetryPeriod: 5 * time.Second, + LeaseDuration: ttl, + RenewDeadline: ttl / 2, + RetryPeriod: ttl / 4, Callbacks: callbacks, }) @@ -246,7 +233,7 @@ func NewStatusSyncer(config Config) Sync { func (s *statusSync) runningAddresses() ([]string, error) { if s.PublishService != "" { ns, name, _ := k8s.ParseNameNS(s.PublishService) - svc, err := s.Client.Core().Services(ns).Get(name, meta_v1.GetOptions{}) + svc, err := s.Client.CoreV1().Services(ns).Get(name, meta_v1.GetOptions{}) if err != nil { return nil, err } @@ -267,7 +254,7 @@ func (s *statusSync) runningAddresses() ([]string, error) { } // get information about all the pods running the ingress controller - pods, err := s.Client.Core().Pods(s.pod.Namespace).List(meta_v1.ListOptions{ + pods, err := s.Client.CoreV1().Pods(s.pod.Namespace).List(meta_v1.ListOptions{ LabelSelector: labels.SelectorFromSet(s.pod.Labels).String(), }) if err != nil { @@ -285,7 +272,7 @@ func (s *statusSync) runningAddresses() ([]string, error) { } func (s *statusSync) isRunningMultiplePods() bool { - pods, err := s.Client.Core().Pods(s.pod.Namespace).List(meta_v1.ListOptions{ + pods, err := s.Client.CoreV1().Pods(s.pod.Namespace).List(meta_v1.ListOptions{ LabelSelector: labels.SelectorFromSet(s.pod.Labels).String(), }) if err != nil { diff --git a/vendor/k8s.io/ingress/core/pkg/ingress/types.go b/vendor/k8s.io/ingress/core/pkg/ingress/types.go index f8eacb22b..0cb76a719 100644 --- a/vendor/k8s.io/ingress/core/pkg/ingress/types.go +++ b/vendor/k8s.io/ingress/core/pkg/ingress/types.go @@ -273,6 +273,10 @@ type Location struct { Service *api.Service `json:"service,omitempty"` // Port describes to which port from the service Port intstr.IntOrString `json:"port"` + // Overwrite the Host header passed into the backend. Defaults to + // vhost of the incoming request. + // +optional + UpstreamVhost string `json:"upstream-vhost"` // BasicDigestAuth returns authentication configuration for // an Ingress rule. // +optional