k8s #1

Merged
inecs merged 41 commits from k8s into main 2025-10-26 13:02:28 +03:00
2 changed files with 48 additions and 16 deletions
Showing only changes of commit 33e329c091 - Show all commits

View File

@@ -44,14 +44,16 @@ kind_clusters:
istio: true istio: true
kiali: true kiali: true
prometheus_stack: true prometheus_stack: true
ingress_host_http_port: 8081
ingress_host_https_port: 8443
# Порты для доступа к аддонам извне # Порты для доступа к аддонам извне
# Документация: https://devops.org.ru # Документация: https://devops.org.ru
# Ingress HTTP: http://localhost:8081
# Ingress HTTPS: https://localhost:8443
# Prometheus: http://localhost:9090 # Prometheus: http://localhost:9090
# Grafana: http://localhost:3000 (admin/admin) # Grafana: http://localhost:3000 (admin/admin)
# Kiali: http://localhost:20001 # Kiali: http://localhost:20001
addon_ports: addon_ports:
ingress_http: 8081
ingress_https: 8443
prometheus: 9090 prometheus: 9090
grafana: 3000 grafana: 3000
kiali: 20001 kiali: 20001

View File

@@ -124,20 +124,50 @@ def main():
} }
} }
# Добавляем extraPortMappings для ingress если нужно # Добавляем extraPortMappings для всех портов из addon_ports
if cluster.get('addons', {}).get('ingress_nginx'): addon_ports = cluster.get('addon_ports', {})
config['nodes'][0]['extraPortMappings'] = [ port_mappings = []
{
# Ingress порты
if addon_ports.get('ingress_http'):
port_mappings.append({
'containerPort': 80, 'containerPort': 80,
'hostPort': cluster.get('ingress_host_http_port', 8081), 'hostPort': addon_ports['ingress_http'],
'protocol': 'TCP' 'protocol': 'TCP'
}, })
{ if addon_ports.get('ingress_https'):
port_mappings.append({
'containerPort': 443, 'containerPort': 443,
'hostPort': cluster.get('ingress_host_https_port', 8443), 'hostPort': addon_ports['ingress_https'],
'protocol': 'TCP' 'protocol': 'TCP'
} })
]
# Prometheus порт
if addon_ports.get('prometheus'):
port_mappings.append({
'containerPort': 9090,
'hostPort': addon_ports['prometheus'],
'protocol': 'TCP'
})
# Grafana порт
if addon_ports.get('grafana'):
port_mappings.append({
'containerPort': 3000,
'hostPort': addon_ports['grafana'],
'protocol': 'TCP'
})
# Kiali порт
if addon_ports.get('kiali'):
port_mappings.append({
'containerPort': 20001,
'hostPort': addon_ports['kiali'],
'protocol': 'TCP'
})
if port_mappings:
config['nodes'][0]['extraPortMappings'] = port_mappings
# Добавляем worker nodes # Добавляем worker nodes
workers = cluster.get('workers', 0) workers = cluster.get('workers', 0)