Skip to content

Commit

Permalink
set all variables out of function
Browse files Browse the repository at this point in the history
  • Loading branch information
Prajithp committed Feb 13, 2021
1 parent d65cfb2 commit db1e59d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
import kubernetes
import os

def watch_namespace(namespace, **_):
namespaces = os.getenv('WATCH_NAMESPACE')
if namespaces is None or namespaces == "":
return True
WATCH_NAMESPACE = os.getenv('WATCH_NAMESPACE')
if WATCH_NAMESPACE is not None:
all_namespaces = WATCH_NAMESPACE.split(',')

all_namespaces = namespaces.split(',')
if namespace in all_namespaces:
def watch_namespace(namespace, **_):
if WATCH_NAMESPACE == "" or namespace in all_namespaces:
return True
return False

@kopf.on.create('', 'v1', 'secrets', annotations={'synator/sync': 'yes'}, when=watch_namespace)
@kopf.on.update('', 'v1', 'secrets', annotations={'synator/sync': 'yes'}, when=watch_namespace)
def update_secret(body, meta, spec, status, old, new, diff, **kwargs):
Expand Down

0 comments on commit db1e59d

Please sign in to comment.