kubeler 0.1.0__tar.gz → 0.1.2__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
kubeler-0.1.2/PKG-INFO ADDED
@@ -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,130 @@
1
+ # Kubeler
2
+
3
+ Simple Kubernetes Resources installer
4
+
5
+ Dependencies
6
+ - Python >= 3.12
7
+
8
+ # Installation
9
+
10
+ ```
11
+ pip install kubeler
12
+ ```
13
+
14
+ ## Usage
15
+ ```
16
+ kubeler install --installer=./examples/installer.yaml
17
+ ```
18
+
19
+ ## Configuration
20
+
21
+ 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.
22
+
23
+ ```
24
+ #cmd: kubectl apply -f namespace.yaml
25
+ ---
26
+ kind: Namespace
27
+ apiVersion: v1
28
+ metadata:
29
+ name: staging
30
+ labels:
31
+ name: staging
32
+ ---
33
+ ```
34
+
35
+ Then, create an installer YAML file to define your K8s resources. For example:
36
+
37
+ ```
38
+ init:
39
+ cmd:
40
+ - apt update -y
41
+ - apt upgrade
42
+
43
+ group:
44
+ name: k8s
45
+ steps:
46
+ - name: cluster
47
+ dir: ./cluster
48
+ - name: cert-manager
49
+ dir: ./cert
50
+ ```
51
+
52
+ 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.
53
+
54
+ If you have multiple files inside a directory and want to define the execution order, you can list your files in the desired sequence.
55
+
56
+ ```
57
+ ...
58
+ - name: argocd
59
+ dir: ./tools/argocd
60
+ files:
61
+ - manifest.yaml
62
+ - ingress.yaml
63
+ ```
64
+
65
+ You can also use variables to dynamically insert values into your manifest file.
66
+
67
+ ```
68
+ ...
69
+ spec:
70
+ ingressClassName: {{ ingress_class }}
71
+ rules:
72
+ - host: {{ host_url }}
73
+ http:
74
+ paths:
75
+ - path: /
76
+ pathType: Prefix
77
+ backend:
78
+ service:
79
+ name: argocd-server
80
+ port:
81
+ name: https
82
+ ```
83
+
84
+ Then, define the variables in `installer.yaml`.
85
+
86
+ ```
87
+ - name: argocd
88
+ dir: ./tools/argocd
89
+ files:
90
+ - manifest.yaml
91
+ - ingress.yaml
92
+ vars:
93
+ - name: ingress_class
94
+ value: nginx
95
+ - name: host_url
96
+ value: argocd.example.com
97
+ ```
98
+
99
+ You can also reference variables from a previous step using `ref.`.
100
+
101
+ ```
102
+ - name: redis
103
+ dir: ./tools/redis
104
+ vars:
105
+ - name: password
106
+ value: Password01
107
+
108
+ - name: harbor
109
+ dir: ./tools/harbor
110
+ vars:
111
+ - name: redis_password
112
+ value: ref.redis.vars.password
113
+ ```
114
+
115
+ You can also reference variables from environment variables using `env.`.
116
+
117
+ ```
118
+ - name: harbor
119
+ dir: ./tools/harbor
120
+ vars:
121
+ - name: redis_password
122
+ value: env.REDIS_PASSWORD
123
+ ```
124
+
125
+ ### Attributes
126
+
127
+ - `name`: Name of the step.
128
+ - `dir`: Directory where the manifest files reside.
129
+ - `files`: List of files in the directory that will be executed in order.
130
+ - `vars`: Variables for dynamic values inside the manifest file.
@@ -1,5 +1,5 @@
1
1
  import argparse
2
- from scripts.installer import Installer
2
+ from .scripts.installer import Installer
3
3
 
4
4
  def main():
5
5
  parser = argparse.ArgumentParser(description="Installer script")
@@ -1,5 +1,5 @@
1
1
  import yaml, os, sys, subprocess, shutil, jinja2
2
- from scripts.models.kubeler import Kubeler
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.
@@ -10,4 +10,6 @@ kubeler.egg-info/entry_points.txt
10
10
  kubeler.egg-info/requires.txt
11
11
  kubeler.egg-info/top_level.txt
12
12
  kubeler/scripts/__init__.py
13
- kubeler/scripts/installer.py
13
+ kubeler/scripts/installer.py
14
+ kubeler/scripts/models/__init__.py
15
+ kubeler/scripts/models/kubeler.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='kubeler',
5
- version='0.1.0',
5
+ version='0.1.2',
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
  install_requires=[
kubeler-0.1.0/PKG-INFO 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/README.md DELETED
@@ -1,17 +0,0 @@
1
- # Kubeler
2
-
3
- Simple Kubernetes Resources installer
4
-
5
- Dependencies
6
- - Python >= 3.12
7
-
8
- # Installation
9
-
10
- ```
11
- pip install kubeler
12
- ```
13
-
14
- ## Usage
15
- ```
16
- kubeler install --installer=./examples/installer.yaml
17
- ```
@@ -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
- ```
File without changes
File without changes
File without changes