fix: исправлена проблема с пробросом портов Ingress

- Исправлена логика добавления extraPortMappings в конфигурацию Kind
- Порты 80 и 443 теперь правильно пробрасываются на host (8081, 8443)
- Создана документация k8s-ingress-fix.md с инструкциями
This commit is contained in:
Сергей Антропов
2025-10-26 10:58:37 +03:00
parent eca556cca7
commit df7473fbd9
2 changed files with 128 additions and 14 deletions

View File

@@ -126,21 +126,25 @@ def main():
# Добавляем extraPortMappings для всех портов из addon_ports
addon_ports = cluster.get('addon_ports', {})
port_mappings = []
# Ingress порты
if addon_ports.get('ingress_http'):
port_mappings.append({
'containerPort': 80,
'hostPort': addon_ports['ingress_http'],
'protocol': 'TCP'
})
if addon_ports.get('ingress_https'):
port_mappings.append({
'containerPort': 443,
'hostPort': addon_ports['ingress_https'],
'protocol': 'TCP'
})
# Ingress порты для проброса на host
if addon_ports.get('ingress_http') or addon_ports.get('ingress_https'):
# Добавляем extraPortMappings к control-plane узлу
if 'extraPortMappings' not in config['nodes'][0]:
config['nodes'][0]['extraPortMappings'] = []
if addon_ports.get('ingress_http'):
config['nodes'][0]['extraPortMappings'].append({
'containerPort': 80,
'hostPort': addon_ports['ingress_http'],
'protocol': 'TCP'
})
if addon_ports.get('ingress_https'):
config['nodes'][0]['extraPortMappings'].append({
'containerPort': 443,
'hostPort': addon_ports['ingress_https'],
'protocol': 'TCP'
})
# Не добавляем extraPortMappings для портов аддонов - используем port-forward