These are chat archives for ManageIQ/manageiq/containers

16th
May 2018
Beni Cherniavsky-Paskin
@cben
May 16 12:27
hi
containerimage_created is not a k8s event. it's raised internally by refresh when it discovers a new image.
if you refresh after deleting last pod using the image, ContainerImage should get archived in DB (deleted_on set);
if you re-create app with same image hash and refresh, the same record should (I hope, this is recent improvement) get un-archived.
Beni Cherniavsky-Paskin
@cben
May 16 12:33
in that case, after_create hook doesn't run, so event is not raised.
@lfu do you think that's a bug or feature? IMHO it's good, the typical usage for that event is scanning the image, which is expensive to repeat just because pod was deleted & re-created...
(BTW, this holds for external images. If the image exists in openshift internal registry, deleting the pod won't even archive it manageiq)
However, if you're not seeing any other events, I think the k8s event listener is not working for you.
Lucy Fu
@lfu
May 16 12:51
thanks for the reply. but containerimage_created policy event was raised when i used the image to deploy a new application for the very first time. the image exists before my execution. it was not created by that time. so the event seems weird to me.
Lucy Fu
@lfu
May 16 12:56
@cben at this moment i goal is to get some k8s events coming in to kick off policy events to test policy/alert. seems container node is the only container class that has the complete setup in UI for policy/alert. what oc commands should i use to find a node, then reboot it?
Beni Cherniavsky-Paskin
@cben
May 16 14:49
none of the container classes has a complete setup for alerts. (node only implements special external prometheus alerts; we never tried to make regular event/timer based alerts work)
oc get nodes to list nodes. add -o yaml if you need more details.
afaik there is no API to reboot nodes; just reboot over ssh, or power cycle the VM (if have any such access)

the image exists before my execution. it was not created by that time. so the event seems weird to me.

if you mean it existed in oc get images, that's a bit weird. if it existed externally, say in docker hub, that's totally expected.
(event name is perhaps misnomer, it's more "image discovered" than "created")

Beni Cherniavsky-Paskin
@cben
May 16 14:55
anyway, when you new-app, there should be many events in oc get events and most of these should at least make it to policy.log
Beni Cherniavsky-Paskin
@cben
May 16 15:01
on master, if synthetic raise_evm_event without EmsEvent is good enough for you, you can also oc new-project => refresh => should raise containerproject_created reliably. this is not on gaprindashvili yet.
Lucy Fu
@lfu
May 16 15:25
@cben thanks for all the info! other than i don’t see much container events in policy.log, i agree what you said about the policy/alert status for container events, both here and in BZ. :+1:
the only node in my testing env is the server itself. I dare not to reboot it.