Esempio n. 1
0
def handle_subject_update(body, **_):
    wait_for_init()
    try:
        subject = AnarchySubject.get_from_resource(body)
        subject.handle_update(runtime)
    except AssertionError as e:
        operator_logger.warning('AnarchySubject %s invalid: %s', body['metadata']['name'], e)
Esempio n. 2
0
def handle_subject_event(event, **_):
    '''
    Anarchy uses on.event instead of on.delete because Anarchy needs custom
    for removing finalizers. The finalizer will be removed immediately if the
    AnarchyGovernor does not have a delete subject event handler. If there is
    a delete subject event handler then it is up to the governor logic to remove
    the finalizer.
    '''
    wait_for_init()
    resource = event['object']
    if event['type'] in ['ADDED', 'MODIFIED', None]:
        if 'deletionTimestamp' in resource['metadata']:
            subject = AnarchySubject.get_from_resource(resource)
            subject.handle_delete(runtime)
Esempio n. 3
0
def handle_subject_update(body, **_):
    wait_for_init()
    subject = AnarchySubject.get_from_resource(body)
    subject.handle_update(runtime)