diff --git a/README.md b/README.md index 00e2a5b..8e3d33d 100644 --- a/README.md +++ b/README.md @@ -240,7 +240,9 @@ tinkerbell: --tink-worker-id ID machine / worker ID --tink-tls BOOL enable TLS to tink-server (default: false) --tink-insecure-tls BOOL allow insecure TLS (default: true) - --tink-insecure-registries LIST comma-separated insecure registries + --tink-insecure-registries LIST comma-separated insecure registries; each registry may be prefixed + with http:// (default) or https:// (HTTPS with skip TLS verify). + Example: foo.local,http://bar.local:5000,https://baz.local --tink-registry-username USER registry auth username --tink-registry-password PASS registry auth password --tink-syslog-host HOST remote syslog host diff --git a/captain/cli/_parser.py b/captain/cli/_parser.py index 4e6d129..47a90a6 100644 --- a/captain/cli/_parser.py +++ b/captain/cli/_parser.py @@ -522,7 +522,11 @@ def _add_tink_flags(parser: configargparse.ArgParser) -> None: env_var="TINK_INSECURE_REGISTRIES", metavar="LIST", default="", - help="comma-separated insecure registries", + help=( + "comma-separated insecure registries; each registry may be prefixed " + "with http:// (default) or https:// (HTTPS with skip TLS verify). " + "Example: foo.local,http://bar.local:5000,https://baz.local" + ), ) g.add_argument( "--tink-registry-username", diff --git a/mkosi.extra/etc/systemd/system/tink-agent-setup.service b/mkosi.extra/etc/systemd/system/tink-agent-setup.service index 6954014..b5724a7 100644 --- a/mkosi.extra/etc/systemd/system/tink-agent-setup.service +++ b/mkosi.extra/etc/systemd/system/tink-agent-setup.service @@ -6,6 +6,9 @@ Requires=containerd.service # Only start when Tinkerbell parameters are on the kernel command line ConditionKernelCommandLine=|tink_worker_image ConditionKernelCommandLine=|docker_registry +# Allow up to 10 restart attempts within 10 minutes before giving up. +StartLimitIntervalSec=600 +StartLimitBurst=10 [Service] Type=oneshot @@ -13,6 +16,16 @@ RemainAfterExit=yes ExecStart=/usr/local/bin/tink-agent-setup TimeoutStartSec=300 +# Retry to prevent transient failures from preventing tink-agent from starting +# with exponential backoff between attempts. +Restart=on-failure +RestartSec=5 +RestartMaxDelaySec=60 +RestartSteps=5 + +# When setup finally succeeds, explicitly restart tink-agent to get past tink-agent dependency error preventing it from starting +ExecStartPost=-/bin/systemctl --no-block start tink-agent.service + # Logging StandardOutput=journal StandardError=journal diff --git a/mkosi.extra/usr/local/bin/tink-agent-setup b/mkosi.extra/usr/local/bin/tink-agent-setup index bb51ee1..64ae064 100755 --- a/mkosi.extra/usr/local/bin/tink-agent-setup +++ b/mkosi.extra/usr/local/bin/tink-agent-setup @@ -9,7 +9,12 @@ # registry_password= Registry auth password # tinkerbell_tls= Enable TLS for tink-server # tinkerbell_insecure_tls= Allow insecure TLS -# insecure_registries= Comma-separated insecure registries +# insecure_registries= Comma-separated insecure registries. Each +# registry may be prefixed with a scheme: +# http://host -> plain HTTP (no TLS) +# https://host -> HTTPS with skip_verify +# host -> plain HTTP (default, +# matches prior behaviour) set -euo pipefail @@ -83,15 +88,46 @@ configure_insecure_registries() { for registry in "${REGISTRIES[@]}"; do registry=$(echo "$registry" | xargs) # trim whitespace [[ -z "$registry" ]] && continue - mkdir -p "${certs_dir}/${registry}" - cat > "${certs_dir}/${registry}/hosts.toml" < "${certs_dir}/${host}/hosts.toml" < "${certs_dir}/${host}/hosts.toml" <&1; then