kubeler 0.1.2__tar.gz → 0.1.3__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: kubeler
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: A dead simple Kubernetes Resources installer
5
5
  Home-page: https://github.com/glendmaatita/kubeler
6
6
  Author: Glend Maatita
@@ -138,7 +138,7 @@ You can also reference variables from a previous step using `ref.`.
138
138
  value: ref.redis.vars.password
139
139
  ```
140
140
 
141
- You can also reference variables from environment variables using `env.`.
141
+ You can also reference variables from environment variables using `env.`. In addition, using `.env` file defined in the same directory with `installer.yaml` also works for this case.
142
142
 
143
143
  ```
144
144
  - name: harbor
@@ -154,3 +154,39 @@ You can also reference variables from environment variables using `env.`.
154
154
  - `dir`: Directory where the manifest files reside.
155
155
  - `files`: List of files in the directory that will be executed in order.
156
156
  - `vars`: Variables for dynamic values inside the manifest file.
157
+
158
+ ## Options
159
+
160
+ There are some options available with installing Kubernetes Resources using Kubeler.
161
+
162
+ ### Exclude Steps
163
+
164
+ Use attributes `exclude=yes` or argument `--excludes` if you want to skip some steps from execution
165
+
166
+ ```
167
+ steps:
168
+ - name: cluster
169
+ dir: ./cluster
170
+ exclude: yes
171
+ ```
172
+
173
+ or
174
+ ```
175
+ --installer=./../examples/installer.yaml --excludes=argocd,redis
176
+ ```
177
+
178
+ ### Define starting point
179
+
180
+ Use argument `--start-from` if you want to execute steps from a certain point
181
+
182
+ ```
183
+ --installer=./../examples/installer.yaml --start-from=argocd
184
+ ```
185
+
186
+ ## Execute only some steps
187
+
188
+ Use argument `--steps` if you want to only execute some steps and exclude the other
189
+
190
+ ```
191
+ --installer=./../examples/installer.yaml --steps=argocd,redis
192
+ ```
@@ -112,7 +112,7 @@ You can also reference variables from a previous step using `ref.`.
112
112
  value: ref.redis.vars.password
113
113
  ```
114
114
 
115
- You can also reference variables from environment variables using `env.`.
115
+ You can also reference variables from environment variables using `env.`. In addition, using `.env` file defined in the same directory with `installer.yaml` also works for this case.
116
116
 
117
117
  ```
118
118
  - name: harbor
@@ -128,3 +128,39 @@ You can also reference variables from environment variables using `env.`.
128
128
  - `dir`: Directory where the manifest files reside.
129
129
  - `files`: List of files in the directory that will be executed in order.
130
130
  - `vars`: Variables for dynamic values inside the manifest file.
131
+
132
+ ## Options
133
+
134
+ There are some options available with installing Kubernetes Resources using Kubeler.
135
+
136
+ ### Exclude Steps
137
+
138
+ Use attributes `exclude=yes` or argument `--excludes` if you want to skip some steps from execution
139
+
140
+ ```
141
+ steps:
142
+ - name: cluster
143
+ dir: ./cluster
144
+ exclude: yes
145
+ ```
146
+
147
+ or
148
+ ```
149
+ --installer=./../examples/installer.yaml --excludes=argocd,redis
150
+ ```
151
+
152
+ ### Define starting point
153
+
154
+ Use argument `--start-from` if you want to execute steps from a certain point
155
+
156
+ ```
157
+ --installer=./../examples/installer.yaml --start-from=argocd
158
+ ```
159
+
160
+ ## Execute only some steps
161
+
162
+ Use argument `--steps` if you want to only execute some steps and exclude the other
163
+
164
+ ```
165
+ --installer=./../examples/installer.yaml --steps=argocd,redis
166
+ ```
@@ -1,5 +1,6 @@
1
1
  import argparse
2
2
  from .scripts.installer import Installer
3
+ from dotenv import load_dotenv
3
4
 
4
5
  def main():
5
6
  parser = argparse.ArgumentParser(description="Installer script")
@@ -9,11 +10,16 @@ def main():
9
10
  install_parser = subparsers.add_parser('install', help='Install command')
10
11
  install_parser.add_argument('--installer', type=str, default='./installer.yaml', help='Path to the config YAML file')
11
12
  install_parser.add_argument('--kube-config', type=str, default='~/kube/config', help='Path to the kube config file')
12
-
13
+ install_parser.add_argument('--start-from', type=str, default=None, help='Start from a specific step')
14
+ install_parser.add_argument('--steps', type=str, default=None, help='Only run specific steps, comma separated')
15
+ install_parser.add_argument('--excludes', type=str, default=None, help='Exlude some steps, comma separated')
13
16
  args = parser.parse_args()
14
17
 
18
+ # load .env content to environment variables
19
+ load_dotenv()
20
+
15
21
  if args.command == 'install':
16
- installer = Installer(installer=args.installer, kube_config=args.kube_config)
22
+ installer = Installer(installer=args.installer, kube_config=args.kube_config, start_from=args.start_from, steps=args.steps, excludes=args.excludes)
17
23
  installer.install()
18
24
 
19
25
  if __name__ == "__main__":
@@ -4,9 +4,13 @@ from .models.kubeler import Kubeler
4
4
  tmp_dir = "/tmp/kubeler"
5
5
 
6
6
  class Installer:
7
- def __init__(self, installer, kube_config):
7
+ def __init__(self, installer, kube_config, start_from, steps, excludes):
8
8
  self.installer = installer
9
9
  self.kube_config = kube_config
10
+ self.start_from = start_from
11
+ self.kube_config = kube_config
12
+ self.steps = steps
13
+ self.excludes = excludes
10
14
 
11
15
  # get the directory path of the installer and kube_config
12
16
  self.installer_dir_path = os.path.dirname(installer)
@@ -127,6 +131,32 @@ class Installer:
127
131
  if var.value.startswith("env."):
128
132
  env_var = var.value.split("env.")[1]
129
133
  var.value = os.environ.get(env_var)
134
+
135
+ # handle excludes
136
+ if self.excludes != None:
137
+ excludes = self.excludes.split(",")
138
+ for exclude in excludes:
139
+ for step in kubeler.group.steps:
140
+ if step.name == exclude:
141
+ kubeler.group.steps.remove(step)
142
+
143
+ for step in kubeler.group.steps:
144
+ if step.exclude == "yes" or step.exclude == True:
145
+ kubeler.group.steps.remove(step)
146
+
147
+ # handle start from step
148
+ if self.start_from != None:
149
+ start_from = self.start_from
150
+ for step in kubeler.group.steps:
151
+ if step.name == start_from:
152
+ kubeler.group.steps = kubeler.group.steps[kubeler.group.steps.index(step):]
153
+
154
+ # handle only run specific steps
155
+ if self.steps != None:
156
+ steps = self.steps.split(",")
157
+ for step in kubeler.group.steps:
158
+ if step.name not in steps:
159
+ kubeler.group.steps.remove(step)
130
160
 
131
161
  return kubeler
132
162
 
@@ -14,6 +14,7 @@ class Step(BaseModel):
14
14
  dir: str = Field(title="Directory of the step", min_length=3, max_length=255)
15
15
  files: List[str] | None = Field(default=None, title="Files to be processed in order")
16
16
  vars: List[Variable] | None = Field(default=None,title="Variables to be passed to the step")
17
+ exclude: str | bool | None = Field(default=None, title="Exclude the step from execution")
17
18
 
18
19
  class Group(BaseModel):
19
20
  name: str = Field(title="Initial Command")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: kubeler
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: A dead simple Kubernetes Resources installer
5
5
  Home-page: https://github.com/glendmaatita/kubeler
6
6
  Author: Glend Maatita
@@ -138,7 +138,7 @@ You can also reference variables from a previous step using `ref.`.
138
138
  value: ref.redis.vars.password
139
139
  ```
140
140
 
141
- You can also reference variables from environment variables using `env.`.
141
+ You can also reference variables from environment variables using `env.`. In addition, using `.env` file defined in the same directory with `installer.yaml` also works for this case.
142
142
 
143
143
  ```
144
144
  - name: harbor
@@ -154,3 +154,39 @@ You can also reference variables from environment variables using `env.`.
154
154
  - `dir`: Directory where the manifest files reside.
155
155
  - `files`: List of files in the directory that will be executed in order.
156
156
  - `vars`: Variables for dynamic values inside the manifest file.
157
+
158
+ ## Options
159
+
160
+ There are some options available with installing Kubernetes Resources using Kubeler.
161
+
162
+ ### Exclude Steps
163
+
164
+ Use attributes `exclude=yes` or argument `--excludes` if you want to skip some steps from execution
165
+
166
+ ```
167
+ steps:
168
+ - name: cluster
169
+ dir: ./cluster
170
+ exclude: yes
171
+ ```
172
+
173
+ or
174
+ ```
175
+ --installer=./../examples/installer.yaml --excludes=argocd,redis
176
+ ```
177
+
178
+ ### Define starting point
179
+
180
+ Use argument `--start-from` if you want to execute steps from a certain point
181
+
182
+ ```
183
+ --installer=./../examples/installer.yaml --start-from=argocd
184
+ ```
185
+
186
+ ## Execute only some steps
187
+
188
+ Use argument `--steps` if you want to only execute some steps and exclude the other
189
+
190
+ ```
191
+ --installer=./../examples/installer.yaml --steps=argocd,redis
192
+ ```
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='kubeler',
5
- version='0.1.2',
5
+ version='0.1.3',
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
  install_requires=[
File without changes
File without changes
File without changes