MCPcopy Create free account
hub / github.com/ceph/ceph / validate

Method validate

src/python-common/ceph/deployment/service_spec.py:2529–2581  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2527 return self.virtual_ip
2528
2529 def validate(self) -> None:
2530 super(IngressSpec, self).validate()
2531
2532 if not self.backend_service:
2533 raise SpecValidationError(
2534 'Cannot add ingress: No backend_service specified')
2535 if not self.keepalive_only and not self.frontend_port:
2536 raise SpecValidationError(
2537 'Cannot add ingress: No frontend_port specified')
2538 if not self.keepalive_only and not self.monitor_port:
2539 raise SpecValidationError(
2540 'Cannot add ingress: No monitor_port specified')
2541 if not self.virtual_ip and not self.virtual_ips_list:
2542 raise SpecValidationError(
2543 'Cannot add ingress: No virtual_ip provided')
2544 if self.virtual_ip is not None and self.virtual_ips_list is not None:
2545 raise SpecValidationError(
2546 'Cannot add ingress: Single and multiple virtual IPs specified')
2547 if self.health_check_interval:
2548 valid_units = ['s', 'm', 'h']
2549 m = re.search(rf"^(\d+)({'|'.join(valid_units)})$", self.health_check_interval)
2550 if not m:
2551 raise SpecValidationError(
2552 f'Cannot add ingress: Invalid health_check_interval specified. '
2553 f'Valid units are: {valid_units}')
2554 if (
2555 self.haproxy_peer_communication_port is not None
2556 and self.backend_service.split('.')[0] != 'nfs'
2557 ):
2558 raise SpecValidationError(
2559 'The haproxy_peer_communication_port is valid only for NFS backend.'
2560 )
2561
2562 for port_val, fname in (
2563 (self.frontend_port, 'frontend_port'),
2564 (self.monitor_port, 'monitor_port'),
2565 (self.haproxy_peer_communication_port, 'haproxy_peer_communication_port'),
2566 ):
2567 if port_val is not None:
2568 validate_port(port_val, fname)
2569 validate_unique_ports(self.get_port_start())
2570
2571 # validate SSL parametes
2572 if self.monitor_ssl:
2573 if not self.ssl:
2574 raise SpecValidationError(
2575 'To enable SSL for stats, SSL must also be enabled on the frontend.'
2576 )
2577 if self.monitor_ssl_cert and bool(self.monitor_ssl_cert) != bool(self.monitor_ssl_key):
2578 raise SpecValidationError(
2579 'To enable monitor_ssl, both monitor_ssl_cert and monitor_ssl_key '
2580 'must be provided.'
2581 )
2582
2583
2584yaml.add_representer(IngressSpec, ServiceSpec.yaml_representer)

Callers

nothing calls this directly

Calls 8

get_port_startMethod · 0.95
SpecValidationErrorClass · 0.90
validate_portFunction · 0.90
validate_unique_portsFunction · 0.90
validateMethod · 0.45
searchMethod · 0.45
joinMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected