File tree Expand file tree Collapse file tree 1 file changed +3
-32
lines changed
Expand file tree Collapse file tree 1 file changed +3
-32
lines changed Original file line number Diff line number Diff line change 1- import yaml
2-
3- # Load the YAML file
4- ingress_yaml = """
51apiVersion: networking.k8s.io/v1
62kind: Ingress
73metadata:
2521 port:
2622 number: 5900
2723 rules:
28- - host: " {{ fqdn }}"
24+ - host: {{ fqdn }}
2925 http:
3026 paths:
3127 - path: /backend(/|$)(.*)
4440 number: 5900
4541 tls:
4642 - hosts:
47- - "{{ fqdn }}"
48- secretName: secret-kmgs
49- """
50-
51- # Function to validate the required fields
52- def validate_ingress(ingress):
53- required_fields = {
54- 'fqdn': ingress['spec']['rules'][0]['host'],
55- 'cert-manager.io/cluster-issuer': ingress['metadata']['annotations'].get('cert-manager.io/cluster-issuer'),
56- 'ingressClassName': ingress['spec'].get('ingressClassName'),
57- 'frontapp-service': ingress['spec']['defaultBackend']['service']['name'],
58- 'aiservice-service': ingress['spec']['rules'][0]['http']['paths'][0]['backend']['service']['name'],
59- 'tls-secret-name': ingress['spec']['tls'][0].get('secretName')
60- }
61-
62- # Check each required field
63- for field, value in required_fields.items():
64- if value in [None, '', '{{ fqdn }}']:
65- print(f"ERROR: The field '{field}' is missing or empty.")
66- else:
67- print(f"Field '{field}' is valid: {value}")
68-
69- # Load YAML data
70- ingress_data = yaml.safe_load(ingress_yaml)
71-
72- # Validate
73- validate_ingress(ingress_data)
43+ - {{ fqdn }}
44+ secretName: secret-kmgs
You can’t perform that action at this time.
0 commit comments