kubernetes-watch 0.1.0__tar.gz → 0.1.2__tar.gz
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.
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/PKG-INFO +7 -8
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/README.md +111 -111
- kubernetes_watch-0.1.2/kube_watch/standalone/metarecogen/Dockerfile +16 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/pyproject.toml +6 -8
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/LICENSE +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/__init__.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/enums/__init__.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/enums/kube.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/enums/logic.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/enums/providers.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/enums/workflow.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/models/__init__.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/models/common.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/models/workflow.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/__init__.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/clusters/__init__.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/clusters/kube.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/logic/actions.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/logic/checks.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/logic/load.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/logic/merge.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/logic/scheduler.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/logic/trasnform.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/mock/__init__.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/mock/mock_generator.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/providers/__init__.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/providers/aws.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/providers/git.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/providers/github.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/modules/providers/vault.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/standalone/metarecogen/ckan_to_gn.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/watch/__init__.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/watch/helpers.py +0 -0
- {kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/watch/workflow.py +0 -0
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: kubernetes-watch
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary:
|
|
5
|
-
License: MIT
|
|
6
5
|
Author: bmotevalli
|
|
7
6
|
Author-email: b.motevalli@gmail.com
|
|
8
|
-
Requires-Python: >=3.
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Requires-Python: >=3.10,<4
|
|
10
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
10
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Requires-Dist: GitPython (==3.1.43)
|
|
13
|
+
Requires-Dist: PyYAML (==6.0.1)
|
|
12
14
|
Requires-Dist: boto3 (==1.34.68)
|
|
13
|
-
Requires-Dist: cryptography (==42.0.5)
|
|
14
|
-
Requires-Dist: gitpython (==3.1.43)
|
|
15
15
|
Requires-Dist: humps (==0.2.2)
|
|
16
16
|
Requires-Dist: hvac (==2.1.0)
|
|
17
17
|
Requires-Dist: kubernetes (==29.0.0)
|
|
18
18
|
Requires-Dist: prefect (==2.18.0)
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist: requests (==2.31.0)
|
|
19
|
+
Requires-Dist: requests (==2.32.3)
|
|
21
20
|
Description-Content-Type: text/markdown
|
|
22
21
|
|
|
23
22
|
# kube_watch
|
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
# kube_watch
|
|
2
|
-
|
|
3
|
-
# To setup the project:
|
|
4
|
-
|
|
5
|
-
- `poetry install`
|
|
6
|
-
- `poetry shell`
|
|
7
|
-
|
|
8
|
-
# To install package to your environment:
|
|
9
|
-
|
|
10
|
-
python setup.py install
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# Description
|
|
14
|
-
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:
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
workflow:
|
|
18
|
-
name: Dummy Workflow
|
|
19
|
-
runner: concurrent
|
|
20
|
-
tasks:
|
|
21
|
-
- name: Task_A
|
|
22
|
-
module: <module_path>
|
|
23
|
-
task: <func_name>
|
|
24
|
-
inputsArgType: arg
|
|
25
|
-
inputs:
|
|
26
|
-
parameters:
|
|
27
|
-
- name: x1
|
|
28
|
-
value: y1
|
|
29
|
-
- name: x2
|
|
30
|
-
value: y2
|
|
31
|
-
- name: x3
|
|
32
|
-
type: env
|
|
33
|
-
value: Y3
|
|
34
|
-
|
|
35
|
-
- name: Task_B
|
|
36
|
-
module: <module_path>
|
|
37
|
-
task: <func_name>
|
|
38
|
-
inputsArgType: arg
|
|
39
|
-
inputs:
|
|
40
|
-
parameters:
|
|
41
|
-
- name: xx1
|
|
42
|
-
value: yy1
|
|
43
|
-
- name: xx2
|
|
44
|
-
value: yy2
|
|
45
|
-
dependency:
|
|
46
|
-
- taskName: Task_A
|
|
47
|
-
inputParamName: xx3
|
|
48
|
-
|
|
49
|
-
- name: Task_C
|
|
50
|
-
module: <module_path>
|
|
51
|
-
task: <func_name>
|
|
52
|
-
inputsArgType: arg
|
|
53
|
-
conditional:
|
|
54
|
-
tasks: ["Task_B"]
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
**runner**: concurrent | sequential: if concurrent selected, tasks will be run concurrently.
|
|
59
|
-
|
|
60
|
-
**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.
|
|
61
|
-
|
|
62
|
-
**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.
|
|
63
|
-
|
|
64
|
-
**inputArgType**: arg | dict | list: if the task functions accept known-fixed number of parameters, then use arg.
|
|
65
|
-
|
|
66
|
-
**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.
|
|
67
|
-
|
|
68
|
-
**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.
|
|
69
|
-
|
|
70
|
-
**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.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
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.
|
|
74
|
-
|
|
75
|
-
In above examples:
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
def Task_A(x1, x2, x3):
|
|
79
|
-
# do something
|
|
80
|
-
return output_A
|
|
81
|
-
|
|
82
|
-
def Task_B(xx1, xx2, xx3):
|
|
83
|
-
# do something else
|
|
84
|
-
return output_B
|
|
85
|
-
|
|
86
|
-
def Task_C():
|
|
87
|
-
# do another thing
|
|
88
|
-
return output_C
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
# Batch workflows
|
|
94
|
-
kube_watch also enables to run workflows in batch. A separate manifest with following form is required:
|
|
95
|
-
|
|
96
|
-
batchFlows:
|
|
97
|
-
runner: sequential
|
|
98
|
-
items:
|
|
99
|
-
- path: path_to_flow_A.yaml
|
|
100
|
-
- path: path_to_flow_B.yaml
|
|
101
|
-
- path: path_to_flow_C.yaml
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
# cron_app
|
|
105
|
-
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.
|
|
106
|
-
|
|
107
|
-
# Connect to a server
|
|
108
|
-
## Start Server
|
|
109
|
-
`prefect server start`
|
|
110
|
-
## To Connect
|
|
111
|
-
To connect to a server, simply set the following environment variable: `PREFECT_API_URL`
|
|
1
|
+
# kube_watch
|
|
2
|
+
|
|
3
|
+
# To setup the project:
|
|
4
|
+
|
|
5
|
+
- `poetry install`
|
|
6
|
+
- `poetry shell`
|
|
7
|
+
|
|
8
|
+
# To install package to your environment:
|
|
9
|
+
|
|
10
|
+
python setup.py install
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Description
|
|
14
|
+
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:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
workflow:
|
|
18
|
+
name: Dummy Workflow
|
|
19
|
+
runner: concurrent
|
|
20
|
+
tasks:
|
|
21
|
+
- name: Task_A
|
|
22
|
+
module: <module_path>
|
|
23
|
+
task: <func_name>
|
|
24
|
+
inputsArgType: arg
|
|
25
|
+
inputs:
|
|
26
|
+
parameters:
|
|
27
|
+
- name: x1
|
|
28
|
+
value: y1
|
|
29
|
+
- name: x2
|
|
30
|
+
value: y2
|
|
31
|
+
- name: x3
|
|
32
|
+
type: env
|
|
33
|
+
value: Y3
|
|
34
|
+
|
|
35
|
+
- name: Task_B
|
|
36
|
+
module: <module_path>
|
|
37
|
+
task: <func_name>
|
|
38
|
+
inputsArgType: arg
|
|
39
|
+
inputs:
|
|
40
|
+
parameters:
|
|
41
|
+
- name: xx1
|
|
42
|
+
value: yy1
|
|
43
|
+
- name: xx2
|
|
44
|
+
value: yy2
|
|
45
|
+
dependency:
|
|
46
|
+
- taskName: Task_A
|
|
47
|
+
inputParamName: xx3
|
|
48
|
+
|
|
49
|
+
- name: Task_C
|
|
50
|
+
module: <module_path>
|
|
51
|
+
task: <func_name>
|
|
52
|
+
inputsArgType: arg
|
|
53
|
+
conditional:
|
|
54
|
+
tasks: ["Task_B"]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
**runner**: concurrent | sequential: if concurrent selected, tasks will be run concurrently.
|
|
59
|
+
|
|
60
|
+
**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.
|
|
61
|
+
|
|
62
|
+
**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.
|
|
63
|
+
|
|
64
|
+
**inputArgType**: arg | dict | list: if the task functions accept known-fixed number of parameters, then use arg.
|
|
65
|
+
|
|
66
|
+
**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.
|
|
67
|
+
|
|
68
|
+
**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.
|
|
69
|
+
|
|
70
|
+
**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.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
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.
|
|
74
|
+
|
|
75
|
+
In above examples:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
def Task_A(x1, x2, x3):
|
|
79
|
+
# do something
|
|
80
|
+
return output_A
|
|
81
|
+
|
|
82
|
+
def Task_B(xx1, xx2, xx3):
|
|
83
|
+
# do something else
|
|
84
|
+
return output_B
|
|
85
|
+
|
|
86
|
+
def Task_C():
|
|
87
|
+
# do another thing
|
|
88
|
+
return output_C
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
# Batch workflows
|
|
94
|
+
kube_watch also enables to run workflows in batch. A separate manifest with following form is required:
|
|
95
|
+
|
|
96
|
+
batchFlows:
|
|
97
|
+
runner: sequential
|
|
98
|
+
items:
|
|
99
|
+
- path: path_to_flow_A.yaml
|
|
100
|
+
- path: path_to_flow_B.yaml
|
|
101
|
+
- path: path_to_flow_C.yaml
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# cron_app
|
|
105
|
+
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.
|
|
106
|
+
|
|
107
|
+
# Connect to a server
|
|
108
|
+
## Start Server
|
|
109
|
+
`prefect server start`
|
|
110
|
+
## To Connect
|
|
111
|
+
To connect to a server, simply set the following environment variable: `PREFECT_API_URL`
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
FROM python:3.11-slim
|
|
2
|
+
# FROM python:3
|
|
3
|
+
# Simple Dockerfile used to run 'ckan_to_gn.py' script
|
|
4
|
+
|
|
5
|
+
# Install pip and requests library
|
|
6
|
+
RUN pip install --no-cache-dir --upgrade pip \
|
|
7
|
+
&& pip install --no-cache-dir requests
|
|
8
|
+
|
|
9
|
+
# Set work dir
|
|
10
|
+
WORKDIR /usr/app/src
|
|
11
|
+
|
|
12
|
+
# Copy python script
|
|
13
|
+
COPY ckan_to_gn.py ./
|
|
14
|
+
|
|
15
|
+
# Run it
|
|
16
|
+
CMD ["python3", "ckan_to_gn.py"]
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "kubernetes-watch"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.2"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = ["bmotevalli <b.motevalli@gmail.com>"]
|
|
6
|
-
readme = "README.md"
|
|
7
6
|
packages = [{include = "kube_watch"}]
|
|
8
|
-
|
|
7
|
+
readme = "README.md"
|
|
9
8
|
|
|
10
9
|
[tool.poetry.dependencies]
|
|
11
|
-
python = "
|
|
10
|
+
python = ">=3.10,<4"
|
|
12
11
|
prefect = "2.18.0"
|
|
13
12
|
boto3 = "1.34.68"
|
|
14
13
|
hvac = "2.1.0"
|
|
15
14
|
humps = "0.2.2"
|
|
16
|
-
requests = "2.
|
|
15
|
+
requests = "2.32.3"
|
|
17
16
|
kubernetes = "29.0.0"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
cryptography = "42.0.5"
|
|
17
|
+
PyYAML = "6.0.1"
|
|
18
|
+
GitPython = "3.1.43"
|
|
21
19
|
|
|
22
20
|
|
|
23
21
|
[build-system]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kubernetes_watch-0.1.0 → kubernetes_watch-0.1.2}/kube_watch/standalone/metarecogen/ckan_to_gn.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|