yk8s.infra
This section contains various configuration options necessary for all cluster types, Terraform and bare-metal based.
yk8s.infra.ansible_hosts
Entries to the Ansible hosts file. Will be rendered to a YAML-based file into the inventory. This option is mandatory for bare-metal clusters and is automatically managed if Terraform is used.
Migrating from yk8s.infra.hosts_file
Bare-metal clusters which previously used a self-managed ini-based inventory file must migrate their inventory file and either configure the Ansible hosts directly in their configuration or migrate the ini-based file to a YAML- or JSON-based file and then import that file in their configuration.
It is recommended to configure the Ansible hosts directly in the configuration via the suboptions listed below.
However, the following gives a baseline for the conversion:
Convert the ini-based host file to YAML
ansible-inventory -i <PATH_TO_CURRENT_HOSTS_FILE> --yaml --list --export --output config/hosts.yaml
Edit the file structure of
config/hosts.yamlsuch that the file can be properly imported into the configuration. It must follow the structure of this example:frontend: children: masters: {} masters: hosts: example-master-0: ansible_host: 192.0.2.10 local_ipv4_address: 192.0.2.10 example-master-1: ansible_host: 192.0.2.11 local_ipv4_address: 192.0.2.11 example-master-2: ansible_host: 192.0.2.12 local_ipv4_address: 192.0.2.12 workers: hosts: example-worker-0: ansible_host: 192.0.2.20 local_ipv4_address: 192.0.2.20 example-worker-1: ansible_host: 192.0.2.21 local_ipv4_address: 192.0.2.21 example-worker-2: ansible_host: 192.0.2.22 local_ipv4_address: 192.0.2.22 # NOTE: Since this block matches Tarook's default, # it can be omitted. orchestrator: hosts: localhost: ansible_connection: local ansible_python_interpreter: '{{ ansible_playbook_python }}' # NOTE: Since this block matches Tarook's default, # it can be omitted. all: vars: ansible_python_interpreter: /usr/bin/python3
You may then set
yk8s.infra.ansible_hosts = yk8s-lib.importYAML ./hosts.yaml;to import the file in your configuration.Attention
The file has to be added to the git repository in order to be evaluated by Nix.
Check the parts regarding YAML in the Ansible documentation: https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html
Type::
attribute set of (submodule)
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.ansible_hosts.<name>.children
Type::
attribute set of (submodule)
Default::
{ }
Declared by
yk8s.infra.ansible_hosts.<name>.hosts
Type::
attribute set of (JSON value)
Default::
{ }
Declared by
yk8s.infra.ansible_hosts.<name>.hosts.<name>.ansible_host
Type::
null or IPv4 address in four-octets decimal notation or IPv6 address in colon-hexadecimal notation or RFC1123 subdomain name
Default::
null
Declared by
yk8s.infra.ansible_hosts.<name>.hosts.<name>.local_ipv4_address
Type::
null or IPv4 address in four-octets decimal notation
Default::
null
Declared by
yk8s.infra.ansible_hosts.<name>.hosts.<name>.local_ipv6_address
Type::
null or IPv6 address in colon-hexadecimal notation
Default::
null
Declared by
yk8s.infra.ansible_hosts.<name>.vars
Type::
attribute set of (JSON value)
Default::
{ }
Declared by
yk8s.infra.ansible_hosts.all.vars.ansible_python_interpreter
Type::
Absolute POSIX path (without special '.' and '..')
Default::
"/usr/bin/python3"
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.ansible_hosts.frontend
Type::
submodule
Default::
{
children = {
gateways = { };
};
}
Example::
{
children = {
masters = { };
};
}
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.ansible_hosts.gateways
Type::
submodule
Default::
{ }
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.ansible_hosts.masters
Type::
submodule
Example::
{
hosts = {
devcluster-master-1 = {
ansible_host = "172.30.154.66";
local_ipv4_address = "172.30.154.66";
};
};
}
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.ansible_hosts.orchestrator
Type::
submodule
Default::
{
hosts = {
localhost = {
ansible_connection = "local";
ansible_python_interpreter = "{{ ansible_playbook_python }}";
};
};
}
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.ansible_hosts.workers
Type::
submodule
Default::
{ }
Example::
{
hosts = {
devcluster-worker-1 = {
ansible_host = "172.30.154.99";
local_ipv4_address = "172.30.154.99";
};
};
}
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.cluster_name
Name of the cluster that is to be build and managed.
Used to distinguish the cluster from others and to name harbour infrastructure resources.
Type::
non-empty string without spaces
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.ipv4_enabled
Whether to enable IPv4.
Type::
boolean
Default::
true
Example::
false
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.ipv6_enabled
Whether to enable IPv6.
Type::
boolean
Default::
false
Example::
true
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.networking_fixed_ip
Type::
null or IPv4 address in four-octets decimal notation
Default::
null
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.networking_fixed_ip_v6
Type::
null or IPv6 address in colon-hexadecimal notation
Default::
null
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.subnet_cidr
The IPv4 CIDR of the internally used network.
Only applies if yk8s.infra.ipv4_enabled is set to true.
Type::
IPv4 address in four-octets decimal notation plus subnet in CIDR notation
Default::
"172.30.154.0/24"
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix
yk8s.infra.subnet_v6_cidr
The IPv6 CIDR of the internally used network.
Only applies if yk8s.infra.ipv6_enabled is set to true.
Type::
IPv6 address in colon-hexadecimal notation plus subnet in CIDR notation
Default::
"fd00::/120"
Declared by https://gitlab.com/alasca.cloud/tarook/tarook/-/tree/devel/nix/yk8s/infra.nix