KeyError on "labels" when metadata does not have the labels attribute in k8s yml file

Bug #1659436 reported by Vedamurthy Joshi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
Trunk
Fix Committed
High
Vedamurthy Joshi

Bug Description

R4.0 3028

In the below example, metadata does not have labels attribute
----
Such a pod would not get the IP, and we see the below keyError

root@vedu-vm1-1:/# tail -f /var/log/contrail/contrail-kube-manager-stdout.log
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gevent/greenlet.py", line 327, in run
    result = self._run(*self.args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/kube_manager/vnc/vnc_kubernetes.py", line 208, in vnc_process
    self.pod_mgr.process(event)
  File "/usr/lib/python2.7/dist-packages/kube_manager/vnc/vnc_pod.py", line 200, in process
    labels = event['object']['metadata']['labels']
KeyError: 'labels'
---------
[root@vedu-vm1-1 centos]# cat busybox.yaml
apiVersion: v1
kind: Pod
metadata:
  name: busybox
  namespace: default
spec:
  containers:
  - image: busybox
    command:
      - sleep
      - "3600"
    imagePullPolicy: IfNotPresent
    name: busybox
  restartPolicy: Always
[root@vedu-vm1-1 centos]#

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/28209
Submitter: Vedamurthy Joshi (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/28209
Committed: http://github.org/Juniper/contrail-controller/commit/0e24aa1a93bc0c02e2be44414075471475e4c601
Submitter: Zuul (<email address hidden>)
Branch: master

commit 0e24aa1a93bc0c02e2be44414075471475e4c601
Author: Vedu Joshi <email address hidden>
Date: Thu Jan 26 04:42:38 2017 +0530

labels need not be defined in kube inputs

Avoid hitting KeyError

Change-Id: I941bbbe1f647c9fdc887ed50b8ab30eaa4f21725
Closes-Bug: 1659436

Jeba Paulaiyan (jebap)
tags: added: contrail-kube-manager
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.