diff --git a/deploy.yml b/deploy.yml index b6d00fd..dbec697 100644 --- a/deploy.yml +++ b/deploy.yml @@ -20,7 +20,7 @@ rules: resources: [events] verbs: [create] - apiGroups: [""] - resources: ["namespaces", "pods", "replicasets"] + resources: ["namespaces", "pods", "replicasets", "namespaces/status"] verbs: ["*"] --- kind: ClusterRoleBinding @@ -54,4 +54,4 @@ spec: serviceAccountName: synator containers: - name: synator - image: theykk/synator:v1.0.0 + image: theykk/synator:v1.1.0 diff --git a/handlers.py b/handlers.py index a6fd7aa..9bc1720 100644 --- a/handlers.py +++ b/handlers.py @@ -96,7 +96,7 @@ def newNamespace(spec, name, meta, logger, **kwargs): # TODO: Add configmap for secret in api_response.items: # Check secret have annotation - if secret.metadata.annotations.get("synator/sync") == "yes": + if secret.metadata.annotations and secret.metadata.annotations.get("synator/sync") == "yes": secret.metadata.annotations.pop('synator/sync') secret.metadata.resource_version = None secret.metadata.uid = None @@ -128,7 +128,8 @@ def reload_pod_config(body, meta, spec, status, old, new, diff, **kwargs): if pod.metadata.annotations: if pod.metadata.annotations.get('synator/reload') == 'configmap:' + meta.name: # Reload pod - api.delete_namespaced_pod(pod.metadata.name, pod.metadata.namespace) + api.delete_namespaced_pod( + pod.metadata.name, pod.metadata.namespace) @kopf.on.update('', 'v1', 'secrets', when=watch_namespace)