kubernetes-watch 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,134 @@
1
+ Metadata-Version: 2.1
2
+ Name: kubernetes-watch
3
+ Version: 0.1.0
4
+ Summary:
5
+ License: MIT
6
+ Author: bmotevalli
7
+ Author-email: b.motevalli@gmail.com
8
+ Requires-Python: >=3.11,<4.0
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Requires-Dist: boto3 (==1.34.68)
13
+ Requires-Dist: cryptography (==42.0.5)
14
+ Requires-Dist: gitpython (==3.1.43)
15
+ Requires-Dist: humps (==0.2.2)
16
+ Requires-Dist: hvac (==2.1.0)
17
+ Requires-Dist: kubernetes (==29.0.0)
18
+ Requires-Dist: prefect (==2.18.0)
19
+ Requires-Dist: pyyaml (==6.0.1)
20
+ Requires-Dist: requests (==2.31.0)
21
+ Description-Content-Type: text/markdown
22
+
23
+ # kube_watch
24
+
25
+ # To setup the project:
26
+
27
+ - `poetry install`
28
+ - `poetry shell`
29
+
30
+ # To install package to your environment:
31
+
32
+ python setup.py install
33
+
34
+
35
+ # Description
36
+ The kube_watch library is build on top of <a href='https://docs.prefect.io/latest/'>Prefect</a>. The library is designed to define workflows in a declaritive and flexible fashion. Originally, workflows in Prefect are defined via decorators such as @flow and @task. In kube_watch, workflows can be defined in a declaritive form via yaml files. The library is mainly focused on running scheduled workflows in kubernetes environment. However, it can easily be extended to be used for any purpose requiring a workflow. The workflow manifest has the following generic structure:
37
+
38
+ ```
39
+ workflow:
40
+ name: Dummy Workflow
41
+ runner: concurrent
42
+ tasks:
43
+ - name: Task_A
44
+ module: <module_path>
45
+ task: <func_name>
46
+ inputsArgType: arg
47
+ inputs:
48
+ parameters:
49
+ - name: x1
50
+ value: y1
51
+ - name: x2
52
+ value: y2
53
+ - name: x3
54
+ type: env
55
+ value: Y3
56
+
57
+ - name: Task_B
58
+ module: <module_path>
59
+ task: <func_name>
60
+ inputsArgType: arg
61
+ inputs:
62
+ parameters:
63
+ - name: xx1
64
+ value: yy1
65
+ - name: xx2
66
+ value: yy2
67
+ dependency:
68
+ - taskName: Task_A
69
+ inputParamName: xx3
70
+
71
+ - name: Task_C
72
+ module: <module_path>
73
+ task: <func_name>
74
+ inputsArgType: arg
75
+ conditional:
76
+ tasks: ["Task_B"]
77
+ ```
78
+
79
+
80
+ **runner**: concurrent | sequential: if concurrent selected, tasks will be run concurrently.
81
+
82
+ **module**: all modules are located in 'modules' directory in kube_watch. This is where you can extend the library and add new tasks / modules. Below modules, there are submodules such as providers, clusters, and logic. Within each of this submodules, specific modules are defined. For example: providers.aws contains a series of tasks related to AWS. In this case, <module_path> = providers.aws. To add new tasks, add a new module with a similar pattern and refer the path in your task block.
83
+
84
+ **task**: task is simply the name function that you put in the <module_path>. i.e. as you define a function in a module, you can simply start to use it in your manifests.
85
+
86
+ **inputArgType**: arg | dict | list: if the task functions accept known-fixed number of parameters, then use arg.
87
+
88
+ **dependency**: this block defines dependency of a child task to its parent. If **inputParamName** is defined, then OUTPUT of the parent task is passed to the child with an argument name defined by inputParamName.
89
+
90
+ **IMPORTATN NOTE**: A strict assumption is that task functions return a single output. If there are cases with multiple output, wrap them into a dictionary and unwrap them in the child task.
91
+
92
+ **conditional**: These are blocks where you can define when a task runs depending on the outcome of its parent. The parent task should return True or False.
93
+
94
+
95
+ Parameters have also a type entry: env | static. static is default value. If type is defined as env, the parameter value is loaded from Environment Variables. In this case, value should be the name of the corresponding env var.
96
+
97
+ In above examples:
98
+
99
+ ```
100
+ def Task_A(x1, x2, x3):
101
+ # do something
102
+ return output_A
103
+
104
+ def Task_B(xx1, xx2, xx3):
105
+ # do something else
106
+ return output_B
107
+
108
+ def Task_C():
109
+ # do another thing
110
+ return output_C
111
+ ```
112
+
113
+
114
+
115
+ # Batch workflows
116
+ kube_watch also enables to run workflows in batch. A separate manifest with following form is required:
117
+
118
+ batchFlows:
119
+ runner: sequential
120
+ items:
121
+ - path: path_to_flow_A.yaml
122
+ - path: path_to_flow_B.yaml
123
+ - path: path_to_flow_C.yaml
124
+
125
+
126
+ # cron_app
127
+ The cron_app folder contains an example use case of kube_watch library. The cron_app can be used to deploy a CronJob in a kubernetes environment. The app assumes the manifests are located in a separate repository. It will clone the repo and read the manifests and runs the workflows.
128
+
129
+ # Connect to a server
130
+ ## Start Server
131
+ `prefect server start`
132
+ ## To Connect
133
+ To connect to a server, simply set the following environment variable: `PREFECT_API_URL`
134
+
@@ -0,0 +1,33 @@
1
+ kube_watch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ kube_watch/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ kube_watch/enums/kube.py,sha256=z6ceQwHV9-LB1bMitaMeX8kBXt2GCVdVDFAwc6DQffo,94
4
+ kube_watch/enums/logic.py,sha256=Dzh24fZpYahIt0YWpXe1_4FIoJNlwwgYOCnwEAjo8Uk,154
5
+ kube_watch/enums/providers.py,sha256=nMX-hXqhgLJMFmC5nmMy8Ajnr7tiya3B5NWn57EMcxk,248
6
+ kube_watch/enums/workflow.py,sha256=yMViHxigDfft7Qmsg3ou7x-vmMbw2IopbMkeNtHhbMI,321
7
+ kube_watch/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ kube_watch/models/common.py,sha256=mECTcFVLEitlN38l8tqP-BI1kwYev3Jxq0kDSH5pE0o,543
9
+ kube_watch/models/workflow.py,sha256=S1c5cWAXJYnnRUHglE9JO61cfoWw4Q26o1wfZ2SKdsY,1452
10
+ kube_watch/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ kube_watch/modules/clusters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ kube_watch/modules/clusters/kube.py,sha256=Fje6-vUA1KQ4x8T6cUYJT_eVwUYw-dR71h95ixSLqLM,7767
13
+ kube_watch/modules/logic/actions.py,sha256=Nf5-pzKobcd-CYNWhaz-j6wucAE6cb2nKqfNzaM26Tw,1223
14
+ kube_watch/modules/logic/checks.py,sha256=CFIMVURKJP5Y3mByyJkFCrJBlVUjTG2XixiwoRquXN4,157
15
+ kube_watch/modules/logic/load.py,sha256=5DKi3nAFMcoNQL504JaDc-_REJSc6GyxeXLWQwNl0BM,227
16
+ kube_watch/modules/logic/merge.py,sha256=vwc2TwcGU-vH5W0bFXzAzOMHt36ksdS4if1c4IbTeXs,926
17
+ kube_watch/modules/logic/scheduler.py,sha256=-p5qh3FnEQ1jlkaY0Lrj9U-vau1b07NYAXBP6M09yoU,3517
18
+ kube_watch/modules/logic/trasnform.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ kube_watch/modules/mock/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ kube_watch/modules/mock/mock_generator.py,sha256=V7u5e_j_XIzFnv4sqhd44wBPuJIjd8ZeH9znfqxtIyE,609
21
+ kube_watch/modules/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
+ kube_watch/modules/providers/aws.py,sha256=N3dmImU0_yIJJS0JrW8FqJ-66_jGip0QBfb7-4VDKTA,6606
23
+ kube_watch/modules/providers/git.py,sha256=h3rcn1FhU82nF52Ol9YHyFk4cvPxxaz_AxHnip8OXPY,1183
24
+ kube_watch/modules/providers/github.py,sha256=WCpZIKHr4U0a4El1leXkaCv1jznf9ob5xHVeTNSpNG0,5338
25
+ kube_watch/modules/providers/vault.py,sha256=eGQbjrVLlHzOPW8SqRWn6S6j8WsQBvvG7jOhzJKEh1o,3983
26
+ kube_watch/standalone/metarecogen/ckan_to_gn.py,sha256=FBiv6McWh4hqV6Bz08zGLzEIe4v1-D3FawjBKYbV7Ms,4767
27
+ kube_watch/watch/__init__.py,sha256=6Ay9P_Ws7rP7ZaIrFRZtp_1uwVK4ZDmkkNhFyqPNQIU,61
28
+ kube_watch/watch/helpers.py,sha256=MlsPuUHIYfKHB8GZf2yEz779hQwen_s3xBOp9gQu6oI,4377
29
+ kube_watch/watch/workflow.py,sha256=7AODfNDx9oc1lAuPfF4muATs-6eTZZk6WfD5yN20tGo,4688
30
+ kubernetes_watch-0.1.0.dist-info/LICENSE,sha256=StyinJRmy--Pc2vQbRToZSN4sjSVg3zccMFrktVcrEw,1096
31
+ kubernetes_watch-0.1.0.dist-info/METADATA,sha256=und08LWAWf0i7YXPJum-q-qFn5dltM2CUDEh7rhQUyo,4813
32
+ kubernetes_watch-0.1.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
33
+ kubernetes_watch-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.6.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any