Cluster Configuration
The environment variables
affect how the user interact with the cluster via the
action scripts. The directory
config/
however holds the configuration of the cluster itself
and can be adjusted to customize the YAOOK/K8s cluster to fit your needs. It also
contains operational flags which can trigger operational tasks.
The cluster repository layout
your_cluster_repo
├── config/ # All user configuration now resides in this directory
│ ├── config.toml # Legacy cluster configuration, referenced in default.nix
│ ├── default.nix # Nix-based cluster configuration
│ └── hosts # Manual Ansible hosts file for bare-metal, referenced in default.nix
├── inventory/yaook-k8s/ # Ansible inventory is now completely generated and MAY be excluded from version control
│ ├── group-vars/ # Variables passed to Ansible
│ └── hosts # Ansible hosts file, generated from config even for bare-metal
├── state/ # Auto-generated files that need to be preserved. MUST be checked into version control
│ ├── wireguard/
│ │ └── ipam.toml # WireGuard IP address management
│ ├── terraform/ # Terraform specific state files
┊ ┊
The ./config directory is completely handled by the user. The ./inventory directory is completely generated and may be ignored from the VCS. The ./state directory both input and output of the inventory generation and has to be added to VCS.
+---------+
| ./state |
+--+---^--+
| |
+------v---+---------+
+----------+ | | +-------------+
| ./config +---> Nix module +---> ./inventory |
+----------+ | | +-------------+
+--------------------+
The config/default.nix
configuration file
After
initializing a cluster repository,
config/default.nix
contains a minimal configuration with default values.
However, you’ll still need to adjust some of them before
triggering cluster creation.
When an action script is run, Nix automatically reads the configuration file,
processes it, and puts variables into the inventory/
. The inventory/
is automatically included. Following the concept of separation of concerns,
variables are only available to stages/layers which need them.
For all available options see Configuration Options
The config/config.toml
configuration file
The config.toml
is the legacy configuration file and can be imported in
default.nix
to allow for gradual migration.
.
Custom Configuration
Since YAOOK/K8s allows to execute custom playbook(s), the custom section allows you to specify your own custom variables to be used in these.
Custom Configuration
custom = {
my_custom_variable = "mycustomvalue";
};
Ansible Configuration
The Ansible configuration file can be found in the ansible/
directory. It is used across all stages and layers.
Default Ansible configuration
# Ansible configuration
[defaults]
action_plugins = plugins/action
filter_plugins = plugins/filter
stdout_callback = yaml
bin_ansible_callbacks = True
host_key_checking = True
force_valid_group_names = never
# Give certain events, e.g., escalation prompt (become) more time to avoid premature cancellations
timeout = 60
retry_files_enabled = False # Do not create .retry files
#callback_whitelist = profile_tasks
forks = 42
[inventory]
enable_plugins = host_list,script,yaml,ini,openstack
# Fail, not warn if any inventory source could not be parsed
unparsed_is_failed = true
[ssh_connection]
# https://stackoverflow.com/questions/40340761/is-it-possible-to-have-ansible-retry-on-connection-failure
retries=10
ssh_args=-o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=../../etc/ssh_known_hosts -o ControlMaster=auto -o ControlPersist=60s
pipelining=true
transfer_method=piped
[connection]
# https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-pipelining
pipelining=true