Role Documentation

common

These roles are called common for no other reason than because I can’t think of a better name. Refactoring is also a pain :)

config_checks

Source: common/config_checks

Performs basic config checks to ensure that variables are configured properly.

There are two ‘sub’ roles within the config_checks role, and these are as follows.

kubernetes.

Ensures that the controlplane endpoint is defined, as there is no suitable default, given the target networks could theoretically be anything.

Variables used:

ovirt.

Performs a number of checks against the oVirt related variables.

The checks validate the following when they exist:

  • Username

  • Endpoint

  • Password

  • Datacentre name

  • Cluster name

Variables used

gather_env_info

Source: common/gather_env_info

Performs a number of calls to gather environment information. Determines what state haikoo is in for use later. This role contains a number of sub-roles.

Datacentre/Cluster

Source: common/gather_env_info/dc_cluster/tasks/main.yaml

Validates that the datacentre defined in ovirt_engine_datacenter_name exists within oVirt, as well as the cluster defined in ovirt_engine_cluster_name.

Fails the playbook if either do not exist.

Variables used:

Variables created:

Networks

Source: common/gather_env_info/networks/tasks/main.yaml

Validates that the networks defined in temp_vm_network and kubernetes_cluster_network exist in the datacentre.

Fails the playbook if any do not exist.

Variables used:

Variables created:

Storage

Source: common/gather_env_info/storage/tasks/main.yaml

Checks to see if the storage domain defined in template_storage_location exists within the oVirt cluster. Fails if it does not exist.

Variables used:

Variables created:

Templates

Source: common/gather_env_info/templates/tasks/main.yaml

Checks to see whether the base image exists within oVirt as a template. Also checks to see how many subversions exist. If only one, we can assume that the template has not been modified for use within haikoo.

Variables used:

Variables created:

Virtual Machines

Source: common/gather_env_info/virtual_machines

Gathers information about the virtual machines in the cluster. Adds all existing hosts to the inventory and schedules nodes to be created or deleted. Ultimately this sub-role is what controls whether to create a new cluster, to expand/shrink an existing one.

Variables Used:

Common

oVirt

Kubernetes

Variables Set:

Control Plane

Worker Node

grab_ssh_key

Source: common/grab_ssh_key

Grabs the SSH key, either from Github or from the local disk and sets the public key as the ssh_key variable.

Variables used:

Variables created:

set_defaults

Source: common/set_defaults

Performs basic config checks to ensure that variables are configured properly.

There are two ‘sub’ roles within the config_checks role, and these are as follows.

kubernetes

These roles heavily involve kubernetes, and the setup around them.

init_cluster

Source: kubernetes/init_cluster

Initializes a kubernetes cluster in multiple stages.

The stages are as follows:

  1. Create certificate key and save as certificate_key

  2. Create a join token and save as token

  3. Read the contents of the certificate key and join token into their respective vars.

  4. Set the kube_config variable to /etc/kubernetes/{{ kubernetes_cluster_name }}-cluster.conf

  5. Determine whether to use the DNS Endpoint or the IP Endpoint

  6. Template out the Kubernetes cluster config

  7. Pull all the Kubernetes images

  8. Run pre-flight Kubernetes checks

  9. Generate Certificates and save to kubeadm_init

  10. Generate /etc/kubernetes/admin.conf file.

  11. Write out the kubelet settings to /var/lib/kubelet/config.yaml and restart the kubelet

  12. Generate the static pod manifests and save to /etc/kubernetes/manifests/

  13. Upload the kubelet configuration to a configmap.

  14. Upload the certificates to kubeadm-certs.

  15. Mark the node as a control plane

  16. Generate the bootstrap tokens needed to join other nodes to the cluster

  17. Enable client certificate rotation

  18. Install all the addons (CoreDNS, kube-proxy)

  19. Loop until the API is ready.

Variables created:

control_plane_setup

Source: kubernetes/control_plane_setup

The necessary tasks required for setting a node up for use as a control plane.

Variables used:

Variables created:

prepare_node

Source: kubernetes/control_plane_setup

Role to handle setting up a node for use as a kubernetes node.

Variables used:

Variables created:

ovirt

connect

resize_disk

template

virtual_machine

wait_for_ip