27 lines
767 B
Text
27 lines
767 B
Text
# Hetzner Cloud server configuration schema
|
|
import regex
|
|
import provisioning.lib as lib
|
|
import .defaults_hetzner as defaults
|
|
|
|
schema Server_hetzner(defaults.ServerDefaults_hetzner):
|
|
"""Hetzner Cloud server configuration"""
|
|
|
|
# Required fields
|
|
hostname: str
|
|
|
|
# Optional fields
|
|
title?: str
|
|
network_private_ip?: str
|
|
extra_hostnames?: [str]
|
|
|
|
# Services/taskservs
|
|
taskservs?: [lib.TaskServDef]
|
|
|
|
# Clusters
|
|
clusters?: [lib.ClusterDef]
|
|
|
|
check:
|
|
len(hostname) > 0, "Hostname required"
|
|
len(hostname) <= 63, "Hostname max 63 characters"
|
|
regex.match(hostname, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"), "Hostname must be DNS-compatible"
|
|
not (hostname =~ "^-|-$"), "Hostname cannot start or end with hyphen"
|