raijin-server 0.2.27__py3-none-any.whl → 0.2.29__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.
Potentially problematic release.
This version of raijin-server might be problematic. Click here for more details.
- raijin_server/__init__.py +1 -1
- raijin_server/modules/kong.py +107 -26
- {raijin_server-0.2.27.dist-info → raijin_server-0.2.29.dist-info}/METADATA +1 -1
- {raijin_server-0.2.27.dist-info → raijin_server-0.2.29.dist-info}/RECORD +8 -8
- {raijin_server-0.2.27.dist-info → raijin_server-0.2.29.dist-info}/WHEEL +0 -0
- {raijin_server-0.2.27.dist-info → raijin_server-0.2.29.dist-info}/entry_points.txt +0 -0
- {raijin_server-0.2.27.dist-info → raijin_server-0.2.29.dist-info}/licenses/LICENSE +0 -0
- {raijin_server-0.2.27.dist-info → raijin_server-0.2.29.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,23 +72,75 @@ 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"],
|
|
94
|
+
ctx,
|
|
95
|
+
check=False,
|
|
96
|
+
)
|
|
97
|
+
|
|
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"],
|
|
82
109
|
ctx,
|
|
83
110
|
check=False,
|
|
84
111
|
)
|
|
85
112
|
|
|
86
|
-
|
|
87
|
-
typer.
|
|
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:
|
|
91
|
-
"""Remove instalacao anterior do Kong."""
|
|
143
|
+
"""Remove instalacao anterior do Kong completamente, incluindo CRDs."""
|
|
92
144
|
typer.echo("Removendo instalacao anterior do Kong...")
|
|
93
145
|
|
|
94
146
|
run_cmd(
|
|
@@ -103,6 +155,17 @@ def _uninstall_kong(ctx: ExecutionContext) -> None:
|
|
|
103
155
|
check=False,
|
|
104
156
|
)
|
|
105
157
|
|
|
158
|
+
# Remove CRDs do Kong tambem
|
|
159
|
+
crds = _check_orphan_crds(ctx)
|
|
160
|
+
if crds:
|
|
161
|
+
typer.echo(f"Removendo {len(crds)} CRDs do Kong...")
|
|
162
|
+
for crd in crds:
|
|
163
|
+
run_cmd(
|
|
164
|
+
["kubectl", "delete", "crd", crd, "--ignore-not-found"],
|
|
165
|
+
ctx,
|
|
166
|
+
check=False,
|
|
167
|
+
)
|
|
168
|
+
|
|
106
169
|
time.sleep(5)
|
|
107
170
|
|
|
108
171
|
|
|
@@ -158,29 +221,42 @@ def run(ctx: ExecutionContext) -> None:
|
|
|
158
221
|
if cleanup:
|
|
159
222
|
_uninstall_kong(ctx)
|
|
160
223
|
|
|
161
|
-
# Verificar CRDs
|
|
162
|
-
|
|
163
|
-
|
|
224
|
+
# Verificar CRDs existentes do Kong (sem ownership do Helm)
|
|
225
|
+
existing_crds = _check_orphan_crds(ctx)
|
|
226
|
+
skip_crds = False
|
|
227
|
+
|
|
228
|
+
if existing_crds:
|
|
164
229
|
typer.secho(
|
|
165
|
-
f"\n⚠️ Detectados {len(
|
|
230
|
+
f"\n⚠️ Detectados {len(existing_crds)} CRDs do Kong sem labels do Helm:",
|
|
166
231
|
fg=typer.colors.YELLOW,
|
|
167
232
|
)
|
|
168
|
-
for crd in
|
|
233
|
+
for crd in existing_crds[:5]:
|
|
169
234
|
typer.echo(f" - {crd}")
|
|
170
|
-
if len(
|
|
171
|
-
typer.echo(f" ... e mais {len(
|
|
235
|
+
if len(existing_crds) > 5:
|
|
236
|
+
typer.echo(f" ... e mais {len(existing_crds) - 5}")
|
|
172
237
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
|
|
238
|
+
typer.echo("\nOpcoes:")
|
|
239
|
+
typer.echo(" 1. Adotar CRDs existentes (adicionar labels Helm) - RECOMENDADO")
|
|
240
|
+
typer.echo(" 2. Deletar CRDs e deixar Helm recriar")
|
|
241
|
+
typer.echo(" 3. Ignorar CRDs (usar --skip-crds)")
|
|
242
|
+
typer.echo(" 4. Cancelar instalacao")
|
|
243
|
+
|
|
244
|
+
choice = typer.prompt("Escolha", default="1")
|
|
245
|
+
|
|
246
|
+
if choice == "1":
|
|
247
|
+
_adopt_crds_for_helm(ctx, existing_crds)
|
|
248
|
+
elif choice == "2":
|
|
249
|
+
cleanup_success = _cleanup_orphan_crds(ctx, existing_crds)
|
|
250
|
+
if not cleanup_success:
|
|
251
|
+
if not typer.confirm("CRDs ainda existem. Continuar mesmo assim?", default=False):
|
|
252
|
+
typer.secho("Instalacao cancelada.", fg=typer.colors.RED)
|
|
253
|
+
return
|
|
254
|
+
elif choice == "3":
|
|
255
|
+
skip_crds = True
|
|
256
|
+
typer.secho("Helm não gerenciará os CRDs existentes.", fg=typer.colors.YELLOW)
|
|
179
257
|
else:
|
|
180
|
-
typer.secho(
|
|
181
|
-
|
|
182
|
-
fg=typer.colors.YELLOW,
|
|
183
|
-
)
|
|
258
|
+
typer.secho("Instalacao cancelada.", fg=typer.colors.RED)
|
|
259
|
+
return
|
|
184
260
|
|
|
185
261
|
# Detectar dependencias
|
|
186
262
|
has_metallb = _check_metallb_installed(ctx)
|
|
@@ -273,6 +349,11 @@ podAnnotations:
|
|
|
273
349
|
|
|
274
350
|
run_cmd(["kubectl", "create", "namespace", "kong"], ctx, check=False)
|
|
275
351
|
|
|
352
|
+
# Monta args extras para o helm
|
|
353
|
+
extra_args = ["-f", str(values_path)]
|
|
354
|
+
if skip_crds:
|
|
355
|
+
extra_args.append("--skip-crds")
|
|
356
|
+
|
|
276
357
|
helm_upgrade_install(
|
|
277
358
|
release="kong",
|
|
278
359
|
chart="kong",
|
|
@@ -281,7 +362,7 @@ podAnnotations:
|
|
|
281
362
|
repo_url="https://charts.konghq.com",
|
|
282
363
|
ctx=ctx,
|
|
283
364
|
values=[],
|
|
284
|
-
extra_args=
|
|
365
|
+
extra_args=extra_args,
|
|
285
366
|
)
|
|
286
367
|
|
|
287
368
|
# Aguarda pods ficarem prontos
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
raijin_server/__init__.py,sha256=
|
|
1
|
+
raijin_server/__init__.py,sha256=GFv9tjlsvvlB3sWf-ulGWC2aPNJKT90M5Vchdya9dVs,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=9_hFTbp5EYL6R3c91_xwW0pwJtPkgT1qxTwMa9xqq-k,12913
|
|
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.29.dist-info/licenses/LICENSE,sha256=kJsMCjOiRZE0AQNtxWqBa32z9kMAaF4EUxyHj3hKaJo,1105
|
|
42
|
+
raijin_server-0.2.29.dist-info/METADATA,sha256=xP_M7JES79b4Bd24Mg_lUeUa9Hz_hnogARe5nzPq_6w,22476
|
|
43
|
+
raijin_server-0.2.29.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
44
|
+
raijin_server-0.2.29.dist-info/entry_points.txt,sha256=3ZvxDX4pvcjkIRsXAJ69wIfVmKa78LKo-C3QhqN2KVM,56
|
|
45
|
+
raijin_server-0.2.29.dist-info/top_level.txt,sha256=Yz1xneCRtsZOzbPIcTAcrSxd-1p80pohMXYAZ74dpok,14
|
|
46
|
+
raijin_server-0.2.29.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|