feat: move various config options to advanced flags (#1217)
* feat: move various config options to advanced flags Signed-off-by: Devin Buhl <devin@buhl.casa> * fix: remove lp refs Signed-off-by: Devin Buhl <devin@buhl.casa> --------- Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
1 parent
e738a6f69c
commit
8339d142b7
14 files changed
+19
-47
No files matched your search
@@ -31,8 +31,6 @@ class Loader:
|
||||
validation.validate_cloudflare(data)
|
||||
validation.validate_host_network(data)
|
||||
validation.validate_bootstrap_dns_server(data)
|
||||
validation.validate_cilium_loadbalancer_mode(data)
|
||||
validation.validate_local_storage_path(data)
|
||||
validation.validate_cluster_cidrs(data)
|
||||
validation.validate_nodes(data)
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from email_validator import validate_email, EmailNotValidError
|
||||
from functools import wraps
|
||||
from pathvalidate import is_valid_filepath, ValidationError
|
||||
from shutil import which
|
||||
from typing import Callable, Optional
|
||||
from zoneinfo import available_timezones
|
||||
@@ -11,11 +10,10 @@ import requests
|
||||
import socket
|
||||
import sys
|
||||
|
||||
DISTRIBUTIONS = ["k0s", "k3s", "talos"]
|
||||
CILIUM_LOADBALANCER_MODES = ["dsr", "snat"]
|
||||
GLOBAL_CLI_TOOLS = ["age", "cloudflared", "flux", "sops", "jq", "kubeconform", "kustomize"]
|
||||
TALOS_CLI_TOOLS = ["talosctl", "talhelper"]
|
||||
K0S_CLI_TOOLS = ["k0sctl"]
|
||||
DISTRIBUTIONS = ["k0s", "k3s", "talos"]
|
||||
GLOBAL_CLI_TOOLS = ["age", "cloudflared", "flux", "sops", "jq", "kubeconform", "kustomize"]
|
||||
TALOS_CLI_TOOLS = ["talosctl", "talhelper"]
|
||||
K0S_CLI_TOOLS = ["k0sctl"]
|
||||
|
||||
def required(*keys: str):
|
||||
def wrapper_outter(func: Callable):
|
||||
@@ -158,19 +156,6 @@ def validate_cloudflare(domain: str, token: str, account_tag: str, tunnel_secret
|
||||
except CloudFlare.exceptions.CloudFlareAPIError as e:
|
||||
raise ValueError(f"Cloudflare domain {domain} not found or token does not have access to it") from e
|
||||
|
||||
@required("bootstrap_cilium_loadbalancer_mode")
|
||||
def validate_cilium_loadbalancer_mode(mode: str, **_) -> None:
|
||||
if mode not in CILIUM_LOADBALANCER_MODES:
|
||||
raise ValueError(f"Invalid Cilium load balancer mode {mode}")
|
||||
|
||||
@required("bootstrap_local_storage_path")
|
||||
def validate_local_storage_path(path: str, **_) -> None:
|
||||
try:
|
||||
if not is_valid_filepath(path, platform="linux"):
|
||||
raise ValueError(f"Invalid local storage path {path}")
|
||||
except ValidationError as e:
|
||||
raise ValueError(f"Invalid local storage path {path}") from e
|
||||
|
||||
@required("bootstrap_dns_server")
|
||||
def validate_bootstrap_dns_server(dns_server: str, **_) -> None:
|
||||
_validate_ip(dns_server)
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
|
||||
- name: Remove local storage path
|
||||
ansible.builtin.file:
|
||||
path: "#{ bootstrap_local_storage_path }#"
|
||||
path: "#{ bootstrap_advanced_flags.local_storage_path|default('/var/openebs/local', true) }#"
|
||||
state: absent
|
||||
|
||||
- name: Reboot
|
||||
|
||||
@@ -28,4 +28,4 @@ spec:
|
||||
enabled: true
|
||||
name: openebs-hostpath
|
||||
isDefaultClass: false
|
||||
basePath: "#{ bootstrap_local_storage_path }#"
|
||||
basePath: "#{ bootstrap_advanced_flags.local_storage_path|default('/var/openebs/local', true) }#"
|
||||
@@ -4,7 +4,7 @@
|
||||
[ $(id -u) -eq 0 ] || exec sudo $0 $@
|
||||
|
||||
# Remove local storage data
|
||||
rm -rf "#{ bootstrap_local_storage_path }#"
|
||||
rm -rf "#{ bootstrap_advanced_flags.local_storage_path|default('/var/openebs/local', true) }#"
|
||||
|
||||
# Reboot
|
||||
(sleep 10 && systemctl reboot)&
|
||||
|
||||
@@ -88,7 +88,7 @@ l2announcements:
|
||||
#% endif %#
|
||||
loadBalancer:
|
||||
algorithm: maglev
|
||||
mode: "#{ bootstrap_cilium_loadbalancer_mode|default('dsr', true) }#"
|
||||
mode: "#{ bootstrap_advanced_flags.cilium_loadbalancer_mode|default('dsr', true) }#"
|
||||
localRedirectPolicy: true
|
||||
operator:
|
||||
replicas: 1
|
||||
|
||||
@@ -49,7 +49,7 @@ l2announcements:
|
||||
#% endif %#
|
||||
loadBalancer:
|
||||
algorithm: maglev
|
||||
mode: "#{ bootstrap_cilium_loadbalancer_mode|default('dsr', true) }#"
|
||||
mode: "#{ bootstrap_advanced_flags.cilium_loadbalancer_mode|default('dsr', true) }#"
|
||||
localRedirectPolicy: true
|
||||
operator:
|
||||
replicas: 1
|
||||
|
||||
@@ -62,12 +62,6 @@ bootstrap_internal_ingress_addr:
|
||||
# 3. you are not force redirecting DNS requests to it - this will break cert generation over DNS01
|
||||
bootstrap_dns_server: 1.1.1.1
|
||||
|
||||
# (Advanced) Cilium load balancer mode, choose either 'dsr' or 'snat'
|
||||
# Due to unknown reasons some people need this set to 'snat' in order
|
||||
# for Cilium L2 announcements to work properly. Keep this dsr unless
|
||||
# you have issues with connecting to Cilium L2 announcements.
|
||||
bootstrap_cilium_loadbalancer_mode: dsr
|
||||
|
||||
# Keep the next three options default unless you know what you are doing
|
||||
# (Advanced) Enable ipv6
|
||||
bootstrap_ipv6_enabled: false
|
||||
@@ -77,9 +71,6 @@ bootstrap_cluster_cidr: 10.42.0.0/16
|
||||
# (Advanced) For ipv6 use format 10.43.0.0/16,fd78:c889:47fb:e0::/112
|
||||
bootstrap_service_cidr: 10.43.0.0/16
|
||||
|
||||
# (Advanced) Path for openebs openebs-hostpath to use for storage on ALL nodes
|
||||
bootstrap_local_storage_path: /var/openebs/local
|
||||
|
||||
# Node information
|
||||
bootstrap_nodes:
|
||||
# Use only 1, 3 or more odd master nodes, recommended is 3
|
||||
@@ -98,7 +89,16 @@ bootstrap_nodes:
|
||||
|
||||
#
|
||||
# Do not make changes below this line unless you know what you are doing
|
||||
# These options are not validated and may break your cluster
|
||||
#
|
||||
|
||||
# bootstrap_advanced_flags:
|
||||
# update_resolv_conf: true # Disable to prevent changes to nodes /etc/resolv.conf
|
||||
# # Disable to prevent changes to nodes /etc/resolv.conf
|
||||
# update_resolv_conf: true
|
||||
# # Cilium load balancer mode, choose either 'dsr' or 'snat'
|
||||
# # Due to unknown reasons some people need this set to 'snat' in order
|
||||
# # for Cilium L2 announcements to work properly. Keep this dsr unless
|
||||
# # you have issues with connecting to Cilium L2 announcements.
|
||||
# cilium_loadbalancer_mode: dsr
|
||||
# # Path for openebs openebs-hostpath to use for storage on ALL nodes
|
||||
# local_storage_path: /var/openebs/local
|
||||
Reference in new issue
Block a user