

Molecule.yml for this scenario tells molecule to use the docker driver to bring up a Kubernetes-in-Docker container,Īnd by default exposes the API on the host’s port 9443. The scenario has the following structure: molecule/default There is no corresponding operator-sdk command for this scenario. The default scenario is intended for use during the development of your Ansible role or playbook, and will run it outside of the context of an operator. For Ansible Operators, we mostly use this to create the Kubernetes resources necessary to deploy your operator into Kubernetes.īelow we will walk through the structure and function of each file for each scenario. In a normal molecule scenario, this would import and run the associated role. It is used for one-time configuration of your test environment, for example, creating the cluster-wide CustomResourceDefinition that your Operator will watch.Ĭonverge.yml is an Ansible playbook that contains your core logic for the scenario.

You can put any arbitrary Ansible in this playbook. Prepare.yml is an Ansible playbook that is run once during the set up of a scenario. For full documentation on the options available here, see the molecule configuration documentation It defines what driver to use to stand up an environment and the associated configuration, linting rules, and a variety of other configuration options.

Molecule.yml is a configuration file for molecule. Our molecule scenarios have the following basic structure. The templates directory contains Jinja templates that are used by multiple scenarios to configure the Kubernetes cluster. The default, test-local, and cluster directories contain a set of files that together make up what is known as a molecule scenario. If you look into the molecule directory, you will see four directories ( default, test-local, cluster, templates). You can install them with ansible-galaxy collection install -r requirements.yml
