kubeler 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- kubeler/main.py +1 -1
- kubeler/scripts/installer.py +10 -1
- kubeler/scripts/models/__init__.py +1 -0
- kubeler/scripts/models/kubeler.py +26 -0
- kubeler-0.1.2.dist-info/METADATA +156 -0
- kubeler-0.1.2.dist-info/RECORD +12 -0
- kubeler-0.1.0.dist-info/METADATA +0 -43
- kubeler-0.1.0.dist-info/RECORD +0 -10
- {kubeler-0.1.0.dist-info → kubeler-0.1.2.dist-info}/LICENSE +0 -0
- {kubeler-0.1.0.dist-info → kubeler-0.1.2.dist-info}/WHEEL +0 -0
- {kubeler-0.1.0.dist-info → kubeler-0.1.2.dist-info}/entry_points.txt +0 -0
- {kubeler-0.1.0.dist-info → kubeler-0.1.2.dist-info}/top_level.txt +0 -0
kubeler/main.py
CHANGED
kubeler/scripts/installer.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import yaml, os, sys, subprocess, shutil, jinja2
|
2
|
-
from
|
2
|
+
from .models.kubeler import Kubeler
|
3
3
|
|
4
4
|
tmp_dir = "/tmp/kubeler"
|
5
5
|
|
@@ -119,6 +119,15 @@ class Installer:
|
|
119
119
|
for ref in step.vars:
|
120
120
|
if ref.name == var_name:
|
121
121
|
var.value = ref.value
|
122
|
+
|
123
|
+
# handle environment variables
|
124
|
+
for step in kubeler.group.steps:
|
125
|
+
if step.vars != None:
|
126
|
+
for var in step.vars:
|
127
|
+
if var.value.startswith("env."):
|
128
|
+
env_var = var.value.split("env.")[1]
|
129
|
+
var.value = os.environ.get(env_var)
|
130
|
+
|
122
131
|
return kubeler
|
123
132
|
|
124
133
|
# open the configuration file
|
@@ -0,0 +1 @@
|
|
1
|
+
# init
|
@@ -0,0 +1,26 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
from pydantic.fields import Field
|
3
|
+
from typing import List
|
4
|
+
|
5
|
+
class Init(BaseModel):
|
6
|
+
cmd: List[str] | None = Field(default=None, title="Initial Command")
|
7
|
+
|
8
|
+
class Variable(BaseModel):
|
9
|
+
name: str = Field(title="Name of the variable", min_length=3, max_length=255)
|
10
|
+
value: str | bool | int = Field(title="Value of the variable")
|
11
|
+
|
12
|
+
class Step(BaseModel):
|
13
|
+
name: str = Field(title="Name of the steps", min_length=3, max_length=255)
|
14
|
+
dir: str = Field(title="Directory of the step", min_length=3, max_length=255)
|
15
|
+
files: List[str] | None = Field(default=None, title="Files to be processed in order")
|
16
|
+
vars: List[Variable] | None = Field(default=None,title="Variables to be passed to the step")
|
17
|
+
|
18
|
+
class Group(BaseModel):
|
19
|
+
name: str = Field(title="Initial Command")
|
20
|
+
steps: List[Step] = Field(title="List of steps to be executed")
|
21
|
+
|
22
|
+
class Kubeler(BaseModel):
|
23
|
+
init: Init | None = Field(default=None,title="Initial Command")
|
24
|
+
group: Group | None = Field(default=None,title="List of groups")
|
25
|
+
|
26
|
+
|
@@ -0,0 +1,156 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: kubeler
|
3
|
+
Version: 0.1.2
|
4
|
+
Summary: A dead simple Kubernetes Resources installer
|
5
|
+
Home-page: https://github.com/glendmaatita/kubeler
|
6
|
+
Author: Glend Maatita
|
7
|
+
Author-email: me@glendmaatita.com
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Requires-Python: >=3.12
|
12
|
+
Description-Content-Type: text/markdown
|
13
|
+
License-File: LICENSE
|
14
|
+
Requires-Dist: jinja2>=3.1.5
|
15
|
+
Requires-Dist: kubernetes>=32.0.0
|
16
|
+
Requires-Dist: pydantic>=2.10.6
|
17
|
+
Dynamic: author
|
18
|
+
Dynamic: author-email
|
19
|
+
Dynamic: classifier
|
20
|
+
Dynamic: description
|
21
|
+
Dynamic: description-content-type
|
22
|
+
Dynamic: home-page
|
23
|
+
Dynamic: requires-dist
|
24
|
+
Dynamic: requires-python
|
25
|
+
Dynamic: summary
|
26
|
+
|
27
|
+
# Kubeler
|
28
|
+
|
29
|
+
Simple Kubernetes Resources installer
|
30
|
+
|
31
|
+
Dependencies
|
32
|
+
- Python >= 3.12
|
33
|
+
|
34
|
+
# Installation
|
35
|
+
|
36
|
+
```
|
37
|
+
pip install kubeler
|
38
|
+
```
|
39
|
+
|
40
|
+
## Usage
|
41
|
+
```
|
42
|
+
kubeler install --installer=./examples/installer.yaml
|
43
|
+
```
|
44
|
+
|
45
|
+
## Configuration
|
46
|
+
|
47
|
+
You can use your existing K8s manifest files. For a simple setup, just add `cmd: [kubectl/helm command]` to your manifest file. For example, you can take a look at some examples in the `examples` directory.
|
48
|
+
|
49
|
+
```
|
50
|
+
#cmd: kubectl apply -f namespace.yaml
|
51
|
+
---
|
52
|
+
kind: Namespace
|
53
|
+
apiVersion: v1
|
54
|
+
metadata:
|
55
|
+
name: staging
|
56
|
+
labels:
|
57
|
+
name: staging
|
58
|
+
---
|
59
|
+
```
|
60
|
+
|
61
|
+
Then, create an installer YAML file to define your K8s resources. For example:
|
62
|
+
|
63
|
+
```
|
64
|
+
init:
|
65
|
+
cmd:
|
66
|
+
- apt update -y
|
67
|
+
- apt upgrade
|
68
|
+
|
69
|
+
group:
|
70
|
+
name: k8s
|
71
|
+
steps:
|
72
|
+
- name: cluster
|
73
|
+
dir: ./cluster
|
74
|
+
- name: cert-manager
|
75
|
+
dir: ./cert
|
76
|
+
```
|
77
|
+
|
78
|
+
Please note that when you create `installer.yml`, Kubeler will execute commands in order. So, make sure to place dependent resources before any resources that rely on them.
|
79
|
+
|
80
|
+
If you have multiple files inside a directory and want to define the execution order, you can list your files in the desired sequence.
|
81
|
+
|
82
|
+
```
|
83
|
+
...
|
84
|
+
- name: argocd
|
85
|
+
dir: ./tools/argocd
|
86
|
+
files:
|
87
|
+
- manifest.yaml
|
88
|
+
- ingress.yaml
|
89
|
+
```
|
90
|
+
|
91
|
+
You can also use variables to dynamically insert values into your manifest file.
|
92
|
+
|
93
|
+
```
|
94
|
+
...
|
95
|
+
spec:
|
96
|
+
ingressClassName: {{ ingress_class }}
|
97
|
+
rules:
|
98
|
+
- host: {{ host_url }}
|
99
|
+
http:
|
100
|
+
paths:
|
101
|
+
- path: /
|
102
|
+
pathType: Prefix
|
103
|
+
backend:
|
104
|
+
service:
|
105
|
+
name: argocd-server
|
106
|
+
port:
|
107
|
+
name: https
|
108
|
+
```
|
109
|
+
|
110
|
+
Then, define the variables in `installer.yaml`.
|
111
|
+
|
112
|
+
```
|
113
|
+
- name: argocd
|
114
|
+
dir: ./tools/argocd
|
115
|
+
files:
|
116
|
+
- manifest.yaml
|
117
|
+
- ingress.yaml
|
118
|
+
vars:
|
119
|
+
- name: ingress_class
|
120
|
+
value: nginx
|
121
|
+
- name: host_url
|
122
|
+
value: argocd.example.com
|
123
|
+
```
|
124
|
+
|
125
|
+
You can also reference variables from a previous step using `ref.`.
|
126
|
+
|
127
|
+
```
|
128
|
+
- name: redis
|
129
|
+
dir: ./tools/redis
|
130
|
+
vars:
|
131
|
+
- name: password
|
132
|
+
value: Password01
|
133
|
+
|
134
|
+
- name: harbor
|
135
|
+
dir: ./tools/harbor
|
136
|
+
vars:
|
137
|
+
- name: redis_password
|
138
|
+
value: ref.redis.vars.password
|
139
|
+
```
|
140
|
+
|
141
|
+
You can also reference variables from environment variables using `env.`.
|
142
|
+
|
143
|
+
```
|
144
|
+
- name: harbor
|
145
|
+
dir: ./tools/harbor
|
146
|
+
vars:
|
147
|
+
- name: redis_password
|
148
|
+
value: env.REDIS_PASSWORD
|
149
|
+
```
|
150
|
+
|
151
|
+
### Attributes
|
152
|
+
|
153
|
+
- `name`: Name of the step.
|
154
|
+
- `dir`: Directory where the manifest files reside.
|
155
|
+
- `files`: List of files in the directory that will be executed in order.
|
156
|
+
- `vars`: Variables for dynamic values inside the manifest file.
|
@@ -0,0 +1,12 @@
|
|
1
|
+
kubeler/__init__.py,sha256=xuYziAiR_MvvngneqgskzBPoVTHLwxRs6l--kORxv7s,7
|
2
|
+
kubeler/main.py,sha256=awZQX-gALoffxvgGHWqGKlcJ68jOv5goTWQvAebL9Ls,822
|
3
|
+
kubeler/scripts/__init__.py,sha256=xuYziAiR_MvvngneqgskzBPoVTHLwxRs6l--kORxv7s,7
|
4
|
+
kubeler/scripts/installer.py,sha256=21xTHLDQ24rshuJtw6NXbnnSVhPeNVcZDXUAVNQeV9I,5561
|
5
|
+
kubeler/scripts/models/__init__.py,sha256=xuYziAiR_MvvngneqgskzBPoVTHLwxRs6l--kORxv7s,7
|
6
|
+
kubeler/scripts/models/kubeler.py,sha256=0NMrxdrscikNLx3nS1097AInb39NQkbaVpBE17Dj8e4,1041
|
7
|
+
kubeler-0.1.2.dist-info/LICENSE,sha256=g8iEDGIIhDh0wHq4B7md4cWUJ69HC13i010cmASC9Lg,1059
|
8
|
+
kubeler-0.1.2.dist-info/METADATA,sha256=31vh65R7FZHI6CpHCDpZsTLJlC7DN_vIB3dYpDP_Y3I,3380
|
9
|
+
kubeler-0.1.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
10
|
+
kubeler-0.1.2.dist-info/entry_points.txt,sha256=-HM8L2j9zOFjn8DGCEqANNS-rSvA8dXlyzWhTZD_02Q,46
|
11
|
+
kubeler-0.1.2.dist-info/top_level.txt,sha256=Chw1LcDOq_cKEex9nHyQOMq8-C6QpLdJjK1s_1MnDEk,8
|
12
|
+
kubeler-0.1.2.dist-info/RECORD,,
|
kubeler-0.1.0.dist-info/METADATA
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.2
|
2
|
-
Name: kubeler
|
3
|
-
Version: 0.1.0
|
4
|
-
Summary: A dead simple Kubernetes Resources installer
|
5
|
-
Home-page: https://github.com/glendmaatita/kubeler
|
6
|
-
Author: Glend Maatita
|
7
|
-
Author-email: me@glendmaatita.com
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
10
|
-
Classifier: Operating System :: OS Independent
|
11
|
-
Requires-Python: >=3.12
|
12
|
-
Description-Content-Type: text/markdown
|
13
|
-
License-File: LICENSE
|
14
|
-
Requires-Dist: jinja2>=3.1.5
|
15
|
-
Requires-Dist: kubernetes>=32.0.0
|
16
|
-
Requires-Dist: pydantic>=2.10.6
|
17
|
-
Dynamic: author
|
18
|
-
Dynamic: author-email
|
19
|
-
Dynamic: classifier
|
20
|
-
Dynamic: description
|
21
|
-
Dynamic: description-content-type
|
22
|
-
Dynamic: home-page
|
23
|
-
Dynamic: requires-dist
|
24
|
-
Dynamic: requires-python
|
25
|
-
Dynamic: summary
|
26
|
-
|
27
|
-
# Kubeler
|
28
|
-
|
29
|
-
Simple Kubernetes Resources installer
|
30
|
-
|
31
|
-
Dependencies
|
32
|
-
- Python >= 3.12
|
33
|
-
|
34
|
-
# Installation
|
35
|
-
|
36
|
-
```
|
37
|
-
pip install kubeler
|
38
|
-
```
|
39
|
-
|
40
|
-
## Usage
|
41
|
-
```
|
42
|
-
kubeler install --installer=./examples/installer.yaml
|
43
|
-
```
|
kubeler-0.1.0.dist-info/RECORD
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
kubeler/__init__.py,sha256=xuYziAiR_MvvngneqgskzBPoVTHLwxRs6l--kORxv7s,7
|
2
|
-
kubeler/main.py,sha256=dFIQdARfQE9v_5LYa--qkLr_5Qpg9zyYqMHH56_17Rc,821
|
3
|
-
kubeler/scripts/__init__.py,sha256=xuYziAiR_MvvngneqgskzBPoVTHLwxRs6l--kORxv7s,7
|
4
|
-
kubeler/scripts/installer.py,sha256=zcZOZYMWeVPPeOaVo32Vhx6mJn_nQEdJO4zARpquCC0,5216
|
5
|
-
kubeler-0.1.0.dist-info/LICENSE,sha256=g8iEDGIIhDh0wHq4B7md4cWUJ69HC13i010cmASC9Lg,1059
|
6
|
-
kubeler-0.1.0.dist-info/METADATA,sha256=jz1TyCe9R_lUT5Z27Qd2Dx4_KG6x05u-BFSD_6_AKKo,934
|
7
|
-
kubeler-0.1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
8
|
-
kubeler-0.1.0.dist-info/entry_points.txt,sha256=-HM8L2j9zOFjn8DGCEqANNS-rSvA8dXlyzWhTZD_02Q,46
|
9
|
-
kubeler-0.1.0.dist-info/top_level.txt,sha256=Chw1LcDOq_cKEex9nHyQOMq8-C6QpLdJjK1s_1MnDEk,8
|
10
|
-
kubeler-0.1.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|