Fix CNI_COMMAND=VERSION case
In case of VERSION command k8s v1.16 and higher sends only {"cniVersion": "0.4.0"} to the stdio, but kuryr-cni expected cni-conf with kuryr_conf field. Also k8s expects json in the stdio, but logs was also there. So need to strictly redirect it into stderr in this case. It's a work around, because maintanable way here is to use golang's version based on containernetworking library. Change-Id: I9095ced11f78eb1ae2890883fa6da4df74213480 Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
This commit is contained in:
@@ -40,7 +40,8 @@ def run():
|
|||||||
else:
|
else:
|
||||||
d = jsonutils.load(sys.stdin)
|
d = jsonutils.load(sys.stdin)
|
||||||
cni_conf = utils.CNIConfig(d)
|
cni_conf = utils.CNIConfig(d)
|
||||||
args = ['--config-file', cni_conf.kuryr_conf]
|
args = (['--config-file', cni_conf.kuryr_conf] if 'kuryr_conf' in d
|
||||||
|
else [])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if cni_conf.debug:
|
if cni_conf.debug:
|
||||||
|
@@ -329,6 +329,8 @@ logging.register_options(CONF)
|
|||||||
def init(args, **kwargs):
|
def init(args, **kwargs):
|
||||||
version_k8s = version.version_info.version_string()
|
version_k8s = version.version_info.version_string()
|
||||||
CONF(args=args, project='kuryr-k8s', version=version_k8s, **kwargs)
|
CONF(args=args, project='kuryr-k8s', version=version_k8s, **kwargs)
|
||||||
|
if os.environ.get('CNI_COMMAND') == 'VERSION':
|
||||||
|
CONF.set_default('use_stderr', True)
|
||||||
|
|
||||||
|
|
||||||
def setup_logging():
|
def setup_logging():
|
||||||
|
Reference in New Issue
Block a user