Thursday, 2021-07-01

opendevreviewSunday Mgbogu proposed openstack/kuryr-kubernetes master: wip: Loadbalancers reconciliation  https://review.opendev.org/c/openstack/kuryr-kubernetes/+/79890406:49
digitalsimboja@ltomasbo: I need more on list compression07:02
digitalsimbojaYou mean multiple for-loop?07:02
ltomasbodigitalsimboja, good morning07:05
ltomasboI mean instead of having the 2 for loops one after another07:06
digitalsimbojaokay07:06
ltomasbolook for python list comprehension in google to check what it is, if you don't know about it07:06
ltomasboit is basicallyl to speed up the processing of going through both for loops07:06
digitalsimbojaOkay, got it!07:06
ltomasboand to have it in a more compress format07:06
digitalsimbojasure07:28
opendevreviewSunday Mgbogu proposed openstack/kuryr-kubernetes master: Added the Service Creation Flow Diagram  https://review.opendev.org/c/openstack/kuryr-kubernetes/+/79806407:43
digitalsimboja@ltomasbo, @maysams: I am having a little challenge. Initially, this was not occuring so I wonder why11:20
digitalsimbojaWhen I want to fetch the loadbalancers from OpenStack, it stores it on a memory11:21
digitalsimboja Now I need to see the contents by selecting the 'id' but its reporting that *** TypeError: 'generator' object is not subscriptable11:21
digitalsimboja lbaas.load_balancers()11:21
digitalsimboja<generator object Resource.list at 0x7ffb9de596d0>11:21
digitalsimbojalbaas = clients.get_loadbalancer.client()11:23
digitalsimbojaloadbalancers = lbaas.load_balancer()11:23
digitalsimbojaPlease take a look11:24
digitalsimbojahttp://paste.openstack.org/show/807099/11:24
ltomasbodigitalsimboja, it is telling you you are using the "for loadbalancer in loadbalancers['id']:" wrongly11:50
ltomasbowith python you can inspect the methods an object has with dir11:51
ltomasbodir(loadbalancers)11:51
digitalsimbojachecking..11:51
ltomasbonote loadbalancers will have the dict with all the loadbalanacers11:51
ltomasboso doing loadbalancers['id'] is wong11:51
ltomasbowrong11:51
ltomasboyou need to first get one of the loadbalancers from the loadbalancers and later get the id11:52
ltomasbofor the specific loadbalanacer, not over the loadbalancer object11:52
maysamsdigitalsimboja: loadbalancers is a generator https://realpython.com/introduction-to-python-generators/#using-generators12:00
digitalsimbojaGot it!12:00
opendevreviewSunday Mgbogu proposed openstack/kuryr-kubernetes master: wip: Loadbalancers reconciliation  https://review.opendev.org/c/openstack/kuryr-kubernetes/+/79890412:45
digitalsimbojaHello!13:13
digitalsimbojaloadbalancers_id not in lbs_id13:13
digitalsimbojahttp://paste.openstack.org/show/807104/13:14
digitalsimbojaJust a little clarification: loadbalancers_id is fetched from Octavia while lbs_id is from kubernetes CRD, I was to check if there are loadbalancers_id not in lbs_id or the other way around lbs_id 'not in' loadbalancers_id ?13:16
digitalsimbojaStill confusing...?13:16
digitalsimbojaRight now I have deleted the 'test' loadbalancers on OpenStack ... but its still available on KuryrCRD13:18
digitalsimbojaSo I am supposing I was to check if lbs_id not in loadbalancers_id13:18
digitalsimboja@ltomasbo, @maysams: Please clarify13:19
ltomasbodigitalsimboja, you need to check if the loadbalancer ID annotated on the CRD status still exists on the OpenStack side13:20
digitalsimbojahttp://paste.openstack.org/show/807106/13:20
digitalsimbojaso it should be lbs_id not in loadbalancers_id13:20
ltomasboand if it does not exists on OpenStack side, then remove it from the status so that the reconcile is trigger and a new openstack loadbalancer is generated13:20
digitalsimbojacorrect13:20
digitalsimbojalbs_id represents the lb in CRD, while loadbalancers_id represents the lb in OpenStack13:21
maysamsdigitalsimboja: You're checking if a list is not present on another list "if loadbalancers_id not in lbs_id:"13:21
ltomasbodigitalsimboja, if you are confuse with your own vars name... that means that perhaps you should rename them to something more meaninful... lbs_id or loadbalancer_id does not make it clear to know if they are the id on the CRD or on the openstack side13:21
ltomasboand... you don't need an if... you need a for loop13:22
maysamsdigitalsimboja: I'm assuming that is not what you wanted to check13:22
digitalsimbojaYeah I need to iterate over each item13:22
ltomasboyep, exactly what maysams said! XD13:23
digitalsimbojayeah for loop13:23
digitalsimbojaSo I would be picking the items from OpenStack loadbalancers_id and checking them with CRD 13:24
digitalsimbojaLet me work on that then13:24
maysamsdigitalsimboja: always make use of logs at each step, it will be extremely helpful to avoid errors like this. Also, adding comments to code itself is useful to organize it13:24
ltomasbodigitalsimboja, I think you need to do it the other way around13:25
ltomasboyou need to check if the loadbalancer ID annnotated on the CRD exists on the OpenStack side13:25
digitalsimbojaOkay got it13:26
digitalsimboja@maysams Sure!13:26

Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!