raijin-server 0.2.23__py3-none-any.whl → 0.2.25__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 CHANGED
@@ -1,5 +1,5 @@
1
1
  """Pacote principal do CLI Raijin Server."""
2
2
 
3
- __version__ = "0.2.23"
3
+ __version__ = "0.2.25"
4
4
 
5
5
  __all__ = ["__version__"]
@@ -2,10 +2,11 @@
2
2
 
3
3
  import socket
4
4
  import time
5
+ from pathlib import Path
5
6
 
6
7
  import typer
7
8
 
8
- from raijin_server.utils import ExecutionContext, ensure_tool, require_root, run_cmd
9
+ from raijin_server.utils import ExecutionContext, ensure_tool, require_root, run_cmd, write_file
9
10
 
10
11
 
11
12
  ISTIO_PROFILES = ["default", "demo", "minimal", "ambient", "empty"]
@@ -23,6 +24,16 @@ def _detect_node_name(ctx: ExecutionContext) -> str:
23
24
  return socket.gethostname()
24
25
 
25
26
 
27
+ def _check_metallb_installed(ctx: ExecutionContext) -> bool:
28
+ """Verifica se MetalLB está instalado no cluster."""
29
+ result = run_cmd(
30
+ ["kubectl", "get", "deployment", "metallb-controller", "-n", "metallb-system"],
31
+ ctx,
32
+ check=False,
33
+ )
34
+ return result.returncode == 0
35
+
36
+
26
37
  def _check_existing_istio(ctx: ExecutionContext) -> bool:
27
38
  """Verifica se existe instalacao do Istio."""
28
39
  result = run_cmd(
@@ -112,34 +123,72 @@ def run(ctx: ExecutionContext) -> None:
112
123
  typer.secho(f"Perfil '{profile}' invalido. Usando 'default'.", fg=typer.colors.YELLOW)
113
124
  profile = "default"
114
125
 
126
+ # Detectar se MetalLB está instalado
127
+ has_metallb = _check_metallb_installed(ctx)
128
+
129
+ # Se não tem MetalLB, avisar e usar NodePort
130
+ if not has_metallb:
131
+ typer.secho(
132
+ "\n⚠ MetalLB não detectado. O IngressGateway será configurado como NodePort.",
133
+ fg=typer.colors.YELLOW,
134
+ )
135
+ typer.echo("Para usar LoadBalancer, instale MetalLB primeiro: raijin-server install metallb")
136
+ service_type = "NodePort"
137
+ else:
138
+ typer.secho("\n✓ MetalLB detectado. IngressGateway usará LoadBalancer.", fg=typer.colors.GREEN)
139
+ service_type = "LoadBalancer"
140
+
115
141
  node_name = _detect_node_name(ctx)
116
142
 
117
- # Instala com tolerations para control-plane
118
- # IMPORTANTE: Ao fazer override em arrays do Istio, precisamos especificar o 'name'
119
- # do componente para que o merge funcione corretamente
143
+ # Criar arquivo IstioOperator YAML (mais confiável que --set para configurações complexas)
144
+ istio_config = f"""apiVersion: install.istio.io/v1alpha1
145
+ kind: IstioOperator
146
+ metadata:
147
+ namespace: istio-system
148
+ spec:
149
+ profile: {profile}
150
+ components:
151
+ pilot:
152
+ enabled: true
153
+ k8s:
154
+ tolerations:
155
+ - key: node-role.kubernetes.io/control-plane
156
+ operator: Exists
157
+ effect: NoSchedule
158
+ - key: node-role.kubernetes.io/master
159
+ operator: Exists
160
+ effect: NoSchedule
161
+ nodeSelector:
162
+ kubernetes.io/hostname: {node_name}
163
+ ingressGateways:
164
+ - name: istio-ingressgateway
165
+ enabled: true
166
+ k8s:
167
+ tolerations:
168
+ - key: node-role.kubernetes.io/control-plane
169
+ operator: Exists
170
+ effect: NoSchedule
171
+ - key: node-role.kubernetes.io/master
172
+ operator: Exists
173
+ effect: NoSchedule
174
+ nodeSelector:
175
+ kubernetes.io/hostname: {node_name}
176
+ service:
177
+ type: {service_type}
178
+ values:
179
+ global:
180
+ proxy:
181
+ holdApplicationUntilProxyStarts: true
182
+ """
183
+
184
+ config_path = Path("/tmp/raijin-istio-config.yaml")
185
+ write_file(config_path, istio_config, ctx)
186
+
187
+ # Instala usando o arquivo de configuração
188
+ # Nota: istioctl não tem --timeout, ele usa readiness probes internamente
120
189
  install_cmd = [
121
190
  "istioctl", "install",
122
- "--set", f"profile={profile}",
123
- # Tolerations para istiod (control plane)
124
- "--set", "components.pilot.k8s.tolerations[0].key=node-role.kubernetes.io/control-plane",
125
- "--set", "components.pilot.k8s.tolerations[0].operator=Exists",
126
- "--set", "components.pilot.k8s.tolerations[0].effect=NoSchedule",
127
- "--set", "components.pilot.k8s.tolerations[1].key=node-role.kubernetes.io/master",
128
- "--set", "components.pilot.k8s.tolerations[1].operator=Exists",
129
- "--set", "components.pilot.k8s.tolerations[1].effect=NoSchedule",
130
- # NodeSelector para istiod
131
- "--set", f"components.pilot.k8s.nodeSelector.kubernetes\\.io/hostname={node_name}",
132
- # Tolerations para ingress gateway (DEVE incluir o name!)
133
- "--set", "components.ingressGateways[0].name=istio-ingressgateway",
134
- "--set", "components.ingressGateways[0].enabled=true",
135
- "--set", "components.ingressGateways[0].k8s.tolerations[0].key=node-role.kubernetes.io/control-plane",
136
- "--set", "components.ingressGateways[0].k8s.tolerations[0].operator=Exists",
137
- "--set", "components.ingressGateways[0].k8s.tolerations[0].effect=NoSchedule",
138
- "--set", "components.ingressGateways[0].k8s.tolerations[1].key=node-role.kubernetes.io/master",
139
- "--set", "components.ingressGateways[0].k8s.tolerations[1].operator=Exists",
140
- "--set", "components.ingressGateways[0].k8s.tolerations[1].effect=NoSchedule",
141
- # NodeSelector para ingress gateway
142
- "--set", f"components.ingressGateways[0].k8s.nodeSelector.kubernetes\\.io/hostname={node_name}",
191
+ "-f", str(config_path),
143
192
  "-y",
144
193
  ]
145
194
 
@@ -161,3 +210,13 @@ def run(ctx: ExecutionContext) -> None:
161
210
  )
162
211
 
163
212
  typer.secho("\n✓ Istio instalado com sucesso.", fg=typer.colors.GREEN, bold=True)
213
+
214
+ if service_type == "NodePort":
215
+ typer.echo("\n📌 Acesso ao Istio IngressGateway (NodePort):")
216
+ typer.echo(" kubectl get svc -n istio-system istio-ingressgateway")
217
+ typer.echo("\nPara expor via LoadBalancer, instale MetalLB:")
218
+ typer.echo(" raijin-server install metallb")
219
+ else:
220
+ typer.echo("\n📌 Acesso ao Istio IngressGateway (LoadBalancer):")
221
+ typer.echo(" kubectl get svc -n istio-system istio-ingressgateway")
222
+ typer.echo(" Aguarde o EXTERNAL-IP ser atribuido pelo MetalLB")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: raijin-server
3
- Version: 0.2.23
3
+ Version: 0.2.25
4
4
  Summary: CLI para automacao de setup e hardening de servidores Ubuntu Server.
5
5
  Home-page: https://example.com/raijin-server
6
6
  Author: Equipe Raijin
@@ -1,4 +1,4 @@
1
- raijin_server/__init__.py,sha256=I_fkWDB-5TUP0NDV7veqIiKtCPCo88OjVOrc0McymDM,95
1
+ raijin_server/__init__.py,sha256=Fb2dY-WZNdEoZ2C5SWUDZG_DzfMcBF1q-cf_ss9lo7s,95
2
2
  raijin_server/cli.py,sha256=71nn7QN0f3MJkXcHr0STXmxljr-CaPibzOoiItbOT88,28571
3
3
  raijin_server/config.py,sha256=QNiEVvrbW56XgvNn5-h3bkJm46Xc8mjNqPbvixXD8N0,4829
4
4
  raijin_server/healthchecks.py,sha256=lzXdFw6S0hOYbUKbqksh4phb04lXgXdTspP1Dsz4dx8,15401
@@ -15,7 +15,7 @@ raijin_server/modules/full_install.py,sha256=xiKe2GLuZ97c4YdTmhP-kwDVuJJ9Xq3dlgc
15
15
  raijin_server/modules/grafana.py,sha256=DdDLxmTeFnDRvcRLkpg1RuR9o1ZAArk2W-DTLLyfWHg,6009
16
16
  raijin_server/modules/hardening.py,sha256=4hz3ifkMhPlXa2n7gPxN0gitQgzALZ-073vuU3LM4RI,1616
17
17
  raijin_server/modules/harness.py,sha256=uWTxTVJlY_VB6xi4ftMtTSaIb96HA8WJQS-RbyxU45M,5391
18
- raijin_server/modules/istio.py,sha256=YUC6-r9gY9Ay-NtbN23wn9eAGRAEgsIn8IuBJUDFM5w,6156
18
+ raijin_server/modules/istio.py,sha256=LxH_3VKWMq_F8WFumkxgL0dhFmG309XB4TbSUggJEic,7301
19
19
  raijin_server/modules/kafka.py,sha256=n7ZpLPWv6sKBJhdBiPe7VgeDB24YiCIOWvOQkWwt03Y,5664
20
20
  raijin_server/modules/kong.py,sha256=cRDzAP9Ne3Qte6sqmxWUS-aJVgiaf4B0uqFvg02Nw5E,5076
21
21
  raijin_server/modules/kubernetes.py,sha256=waSf2cCVnLicN5o3M47MzMzmHHtvKeFXm1__8ynQzA0,11871
@@ -37,9 +37,9 @@ raijin_server/scripts/checklist.sh,sha256=j6E0Kmk1EfjLvKK1VpCqzXJAXI_7Bm67LK4ndy
37
37
  raijin_server/scripts/install.sh,sha256=Y1ickbQ4siQ0NIPs6UgrqUr8WWy7U0LHmaTQbEgavoI,3949
38
38
  raijin_server/scripts/log_size_metric.sh,sha256=Iv4SsX8AuCYRou-klYn32mX41xB6j0xJGLBO6riw4rU,1208
39
39
  raijin_server/scripts/pre-deploy-check.sh,sha256=XqMo7IMIpwUHF17YEmU0-cVmTDMoCGMBFnmS39FidI4,4912
40
- raijin_server-0.2.23.dist-info/licenses/LICENSE,sha256=kJsMCjOiRZE0AQNtxWqBa32z9kMAaF4EUxyHj3hKaJo,1105
41
- raijin_server-0.2.23.dist-info/METADATA,sha256=4Acy_Ht1vivZ_M7NXcFWCNSgdtgBVKUq4_fOOxYtq4I,22476
42
- raijin_server-0.2.23.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
43
- raijin_server-0.2.23.dist-info/entry_points.txt,sha256=3ZvxDX4pvcjkIRsXAJ69wIfVmKa78LKo-C3QhqN2KVM,56
44
- raijin_server-0.2.23.dist-info/top_level.txt,sha256=Yz1xneCRtsZOzbPIcTAcrSxd-1p80pohMXYAZ74dpok,14
45
- raijin_server-0.2.23.dist-info/RECORD,,
40
+ raijin_server-0.2.25.dist-info/licenses/LICENSE,sha256=kJsMCjOiRZE0AQNtxWqBa32z9kMAaF4EUxyHj3hKaJo,1105
41
+ raijin_server-0.2.25.dist-info/METADATA,sha256=IZM1t1KEU8iBnJ6bXc2FLoL7XIsJ_01Y5HhZ_Qirt0w,22476
42
+ raijin_server-0.2.25.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
43
+ raijin_server-0.2.25.dist-info/entry_points.txt,sha256=3ZvxDX4pvcjkIRsXAJ69wIfVmKa78LKo-C3QhqN2KVM,56
44
+ raijin_server-0.2.25.dist-info/top_level.txt,sha256=Yz1xneCRtsZOzbPIcTAcrSxd-1p80pohMXYAZ74dpok,14
45
+ raijin_server-0.2.25.dist-info/RECORD,,