Merge pull request #4120 from ElvinEfendi/lua-balancer-logging

log info when endpoints change for a balancer
This commit is contained in:
Kubernetes Prow Robot 2019-05-26 01:17:50 -07:00 committed by GitHub
commit 008822b37f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 0 deletions

View file

@ -8,6 +8,10 @@
local util = require("util")
local split = require("util.split")
local string_format = string.format
local ngx_log = ngx.log
local INFO = ngx.INFO
local DECAY_TIME = 10 -- this value is in seconds
local PICK_SET_SIZE = 2
@ -107,6 +111,8 @@ function _M.sync(self, backend)
return
end
ngx_log(INFO, string_format("[%s] peers have changed for backend %s", self.name, backend.name))
self.peers = backend.endpoints
self.ewma = {}
self.ewma_last_touched_at = {}

View file

@ -1,5 +1,9 @@
local util = require("util")
local string_format = string.format
local ngx_log = ngx.log
local INFO = ngx.INFO
local _M = {}
function _M.new(self, o)
@ -19,6 +23,8 @@ function _M.sync(self, backend)
return
end
ngx_log(INFO, string_format("[%s] nodes have changed for backend %s", self.name, backend.name))
self.instance:reinit(nodes)
end

View file

@ -4,6 +4,10 @@ local util = require("util")
local ck = require("resty.cookie")
local math = require("math")
local string_format = string.format
local ngx_log = ngx.log
local INFO = ngx.INFO
local _M = balancer_resty:new({ factory = resty_chash, name = "sticky" })
local DEFAULT_COOKIE_NAME = "route"
@ -98,6 +102,8 @@ function _M.sync(self, backend)
return
end
ngx_log(INFO, string_format("[%s] nodes have changed for backend %s", self.name, backend.name))
self.cookie_session_affinity = backend.sessionAffinityConfig.cookieSessionAffinity
end