raijin-server 0.2.27__py3-none-any.whl → 0.2.28__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.
- raijin_server/__init__.py +1 -1
- raijin_server/modules/kong.py +95 -25
- {raijin_server-0.2.27.dist-info → raijin_server-0.2.28.dist-info}/METADATA +1 -1
- {raijin_server-0.2.27.dist-info → raijin_server-0.2.28.dist-info}/RECORD +8 -8
- {raijin_server-0.2.27.dist-info → raijin_server-0.2.28.dist-info}/WHEEL +0 -0
- {raijin_server-0.2.27.dist-info → raijin_server-0.2.28.dist-info}/entry_points.txt +0 -0
- {raijin_server-0.2.27.dist-info → raijin_server-0.2.28.dist-info}/licenses/LICENSE +0 -0
- {raijin_server-0.2.27.dist-info → raijin_server-0.2.28.dist-info}/top_level.txt +0 -0
raijin_server/__init__.py
CHANGED
raijin_server/modules/kong.py
CHANGED
|
@@ -52,7 +52,7 @@ def _check_existing_kong(ctx: ExecutionContext) -> bool:
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
def _check_orphan_crds(ctx: ExecutionContext) -> list[str]:
|
|
55
|
-
"""Detecta CRDs
|
|
55
|
+
"""Detecta CRDs do Kong que existem sem ownership do Helm."""
|
|
56
56
|
result = run_cmd(
|
|
57
57
|
["kubectl", "get", "crd", "-o", "name"],
|
|
58
58
|
ctx,
|
|
@@ -72,19 +72,71 @@ def _check_orphan_crds(ctx: ExecutionContext) -> list[str]:
|
|
|
72
72
|
return kong_crds
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
def
|
|
76
|
-
"""
|
|
77
|
-
typer.echo(f"
|
|
75
|
+
def _adopt_crds_for_helm(ctx: ExecutionContext, crds: list[str]) -> bool:
|
|
76
|
+
"""Adiciona labels do Helm aos CRDs existentes para permitir adocao."""
|
|
77
|
+
typer.echo(f"Adicionando labels Helm a {len(crds)} CRDs existentes...")
|
|
78
78
|
|
|
79
79
|
for crd in crds:
|
|
80
|
+
# Adiciona label managed-by
|
|
80
81
|
run_cmd(
|
|
81
|
-
["kubectl", "
|
|
82
|
+
["kubectl", "label", "crd", crd, "app.kubernetes.io/managed-by=Helm", "--overwrite"],
|
|
83
|
+
ctx,
|
|
84
|
+
check=False,
|
|
85
|
+
)
|
|
86
|
+
# Adiciona annotations de release
|
|
87
|
+
run_cmd(
|
|
88
|
+
["kubectl", "annotate", "crd", crd, "meta.helm.sh/release-name=kong", "--overwrite"],
|
|
89
|
+
ctx,
|
|
90
|
+
check=False,
|
|
91
|
+
)
|
|
92
|
+
run_cmd(
|
|
93
|
+
["kubectl", "annotate", "crd", crd, "meta.helm.sh/release-namespace=kong", "--overwrite"],
|
|
82
94
|
ctx,
|
|
83
95
|
check=False,
|
|
84
96
|
)
|
|
85
97
|
|
|
86
|
-
|
|
87
|
-
|
|
98
|
+
typer.secho(" ✓ CRDs preparados para adocao pelo Helm.", fg=typer.colors.GREEN)
|
|
99
|
+
return True
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _cleanup_orphan_crds(ctx: ExecutionContext, crds: list[str]) -> bool:
|
|
103
|
+
"""Remove CRDs do Kong completamente."""
|
|
104
|
+
typer.echo(f"Removendo {len(crds)} CRDs do Kong...")
|
|
105
|
+
|
|
106
|
+
for crd in crds:
|
|
107
|
+
run_cmd(
|
|
108
|
+
["kubectl", "delete", "crd", crd, "--ignore-not-found", "--wait=true"],
|
|
109
|
+
ctx,
|
|
110
|
+
check=False,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
# Aguarda e verifica se foram realmente removidos
|
|
114
|
+
typer.echo(" Aguardando remocao completa dos CRDs...")
|
|
115
|
+
max_attempts = 10
|
|
116
|
+
for attempt in range(max_attempts):
|
|
117
|
+
time.sleep(2)
|
|
118
|
+
remaining = _check_orphan_crds(ctx)
|
|
119
|
+
if not remaining:
|
|
120
|
+
typer.secho(" ✓ CRDs removidos com sucesso.", fg=typer.colors.GREEN)
|
|
121
|
+
return True
|
|
122
|
+
|
|
123
|
+
if attempt < max_attempts - 1:
|
|
124
|
+
typer.echo(f" Ainda restam {len(remaining)} CRDs. Tentando remover novamente...")
|
|
125
|
+
for crd in remaining:
|
|
126
|
+
run_cmd(
|
|
127
|
+
["kubectl", "delete", "crd", crd, "--ignore-not-found", "--wait=true", "--timeout=30s"],
|
|
128
|
+
ctx,
|
|
129
|
+
check=False,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
remaining = _check_orphan_crds(ctx)
|
|
133
|
+
if remaining:
|
|
134
|
+
typer.secho(f" ⚠️ {len(remaining)} CRDs ainda existem:", fg=typer.colors.YELLOW)
|
|
135
|
+
for crd in remaining[:5]:
|
|
136
|
+
typer.echo(f" - {crd}")
|
|
137
|
+
return False
|
|
138
|
+
|
|
139
|
+
return True
|
|
88
140
|
|
|
89
141
|
|
|
90
142
|
def _uninstall_kong(ctx: ExecutionContext) -> None:
|
|
@@ -158,29 +210,42 @@ def run(ctx: ExecutionContext) -> None:
|
|
|
158
210
|
if cleanup:
|
|
159
211
|
_uninstall_kong(ctx)
|
|
160
212
|
|
|
161
|
-
# Verificar CRDs
|
|
162
|
-
|
|
163
|
-
|
|
213
|
+
# Verificar CRDs existentes do Kong (sem ownership do Helm)
|
|
214
|
+
existing_crds = _check_orphan_crds(ctx)
|
|
215
|
+
skip_crds = False
|
|
216
|
+
|
|
217
|
+
if existing_crds:
|
|
164
218
|
typer.secho(
|
|
165
|
-
f"\n⚠️ Detectados {len(
|
|
219
|
+
f"\n⚠️ Detectados {len(existing_crds)} CRDs do Kong sem labels do Helm:",
|
|
166
220
|
fg=typer.colors.YELLOW,
|
|
167
221
|
)
|
|
168
|
-
for crd in
|
|
222
|
+
for crd in existing_crds[:5]:
|
|
169
223
|
typer.echo(f" - {crd}")
|
|
170
|
-
if len(
|
|
171
|
-
typer.echo(f" ... e mais {len(
|
|
224
|
+
if len(existing_crds) > 5:
|
|
225
|
+
typer.echo(f" ... e mais {len(existing_crds) - 5}")
|
|
172
226
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
|
|
227
|
+
typer.echo("\nOpcoes:")
|
|
228
|
+
typer.echo(" 1. Adotar CRDs existentes (adicionar labels Helm) - RECOMENDADO")
|
|
229
|
+
typer.echo(" 2. Deletar CRDs e deixar Helm recriar")
|
|
230
|
+
typer.echo(" 3. Ignorar CRDs (usar --skip-crds)")
|
|
231
|
+
typer.echo(" 4. Cancelar instalacao")
|
|
232
|
+
|
|
233
|
+
choice = typer.prompt("Escolha", default="1")
|
|
234
|
+
|
|
235
|
+
if choice == "1":
|
|
236
|
+
_adopt_crds_for_helm(ctx, existing_crds)
|
|
237
|
+
elif choice == "2":
|
|
238
|
+
cleanup_success = _cleanup_orphan_crds(ctx, existing_crds)
|
|
239
|
+
if not cleanup_success:
|
|
240
|
+
if not typer.confirm("CRDs ainda existem. Continuar mesmo assim?", default=False):
|
|
241
|
+
typer.secho("Instalacao cancelada.", fg=typer.colors.RED)
|
|
242
|
+
return
|
|
243
|
+
elif choice == "3":
|
|
244
|
+
skip_crds = True
|
|
245
|
+
typer.secho("Helm não gerenciará os CRDs existentes.", fg=typer.colors.YELLOW)
|
|
179
246
|
else:
|
|
180
|
-
typer.secho(
|
|
181
|
-
|
|
182
|
-
fg=typer.colors.YELLOW,
|
|
183
|
-
)
|
|
247
|
+
typer.secho("Instalacao cancelada.", fg=typer.colors.RED)
|
|
248
|
+
return
|
|
184
249
|
|
|
185
250
|
# Detectar dependencias
|
|
186
251
|
has_metallb = _check_metallb_installed(ctx)
|
|
@@ -273,6 +338,11 @@ podAnnotations:
|
|
|
273
338
|
|
|
274
339
|
run_cmd(["kubectl", "create", "namespace", "kong"], ctx, check=False)
|
|
275
340
|
|
|
341
|
+
# Monta args extras para o helm
|
|
342
|
+
extra_args = ["-f", str(values_path)]
|
|
343
|
+
if skip_crds:
|
|
344
|
+
extra_args.append("--skip-crds")
|
|
345
|
+
|
|
276
346
|
helm_upgrade_install(
|
|
277
347
|
release="kong",
|
|
278
348
|
chart="kong",
|
|
@@ -281,7 +351,7 @@ podAnnotations:
|
|
|
281
351
|
repo_url="https://charts.konghq.com",
|
|
282
352
|
ctx=ctx,
|
|
283
353
|
values=[],
|
|
284
|
-
extra_args=
|
|
354
|
+
extra_args=extra_args,
|
|
285
355
|
)
|
|
286
356
|
|
|
287
357
|
# Aguarda pods ficarem prontos
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
raijin_server/__init__.py,sha256=
|
|
1
|
+
raijin_server/__init__.py,sha256=WPj_zYPlDDdC8qb99tlMy-WAu5vWOQOyCldFgDmmT9Q,95
|
|
2
2
|
raijin_server/cli.py,sha256=2m7q1znMLbBdnUwN6oOUrCZXEqC2e7SfbjYkymbP4lQ,37884
|
|
3
3
|
raijin_server/config.py,sha256=QNiEVvrbW56XgvNn5-h3bkJm46Xc8mjNqPbvixXD8N0,4829
|
|
4
4
|
raijin_server/healthchecks.py,sha256=lzXdFw6S0hOYbUKbqksh4phb04lXgXdTspP1Dsz4dx8,15401
|
|
@@ -18,7 +18,7 @@ raijin_server/modules/hardening.py,sha256=4hz3ifkMhPlXa2n7gPxN0gitQgzALZ-073vuU3
|
|
|
18
18
|
raijin_server/modules/harness.py,sha256=uWTxTVJlY_VB6xi4ftMtTSaIb96HA8WJQS-RbyxU45M,5391
|
|
19
19
|
raijin_server/modules/istio.py,sha256=o0K5-Fw4LRs-kbAVgwzYxHzEt_aPFJG8suqOqvg2748,7297
|
|
20
20
|
raijin_server/modules/kafka.py,sha256=n7ZpLPWv6sKBJhdBiPe7VgeDB24YiCIOWvOQkWwt03Y,5664
|
|
21
|
-
raijin_server/modules/kong.py,sha256=
|
|
21
|
+
raijin_server/modules/kong.py,sha256=5KCGcIhnEkHHwYEDEDdUTaoDCUwn7HKaZetoqOBlP3E,12553
|
|
22
22
|
raijin_server/modules/kubernetes.py,sha256=9E6zV0zGQWZW92NVpxwYctpi-4JDmi6YzF3tKRI4HlU,13343
|
|
23
23
|
raijin_server/modules/loki.py,sha256=aNiUpnOFppZMXoQwYhn7IoPMzwUz4aHi6pbiqj1PRjc,5022
|
|
24
24
|
raijin_server/modules/metallb.py,sha256=uUuklc_RsQ-W2qDVRMQAxQm9HKGEqso444b1IwBpM6w,8554
|
|
@@ -38,9 +38,9 @@ raijin_server/scripts/checklist.sh,sha256=j6E0Kmk1EfjLvKK1VpCqzXJAXI_7Bm67LK4ndy
|
|
|
38
38
|
raijin_server/scripts/install.sh,sha256=Y1ickbQ4siQ0NIPs6UgrqUr8WWy7U0LHmaTQbEgavoI,3949
|
|
39
39
|
raijin_server/scripts/log_size_metric.sh,sha256=Iv4SsX8AuCYRou-klYn32mX41xB6j0xJGLBO6riw4rU,1208
|
|
40
40
|
raijin_server/scripts/pre-deploy-check.sh,sha256=XqMo7IMIpwUHF17YEmU0-cVmTDMoCGMBFnmS39FidI4,4912
|
|
41
|
-
raijin_server-0.2.
|
|
42
|
-
raijin_server-0.2.
|
|
43
|
-
raijin_server-0.2.
|
|
44
|
-
raijin_server-0.2.
|
|
45
|
-
raijin_server-0.2.
|
|
46
|
-
raijin_server-0.2.
|
|
41
|
+
raijin_server-0.2.28.dist-info/licenses/LICENSE,sha256=kJsMCjOiRZE0AQNtxWqBa32z9kMAaF4EUxyHj3hKaJo,1105
|
|
42
|
+
raijin_server-0.2.28.dist-info/METADATA,sha256=hVqz4e9G6A5HwIr9nHeGF1zGwDSKoiuPDPGttOAY1vM,22476
|
|
43
|
+
raijin_server-0.2.28.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
44
|
+
raijin_server-0.2.28.dist-info/entry_points.txt,sha256=3ZvxDX4pvcjkIRsXAJ69wIfVmKa78LKo-C3QhqN2KVM,56
|
|
45
|
+
raijin_server-0.2.28.dist-info/top_level.txt,sha256=Yz1xneCRtsZOzbPIcTAcrSxd-1p80pohMXYAZ74dpok,14
|
|
46
|
+
raijin_server-0.2.28.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|