Portal:Cloud VPS/Admin/Puppet testing

From Wikitech

This page contains information on testing puppet code related to Cloud VPS hardware servers inside VM instances, specially openstack puppet code. This is, testing in virtual machines the puppet code meant for the hardware.

General instructions

Use the openstack Cloud VPS project. That's were this testing should happen.

Create VM instances and point them to the project local puppetmaster (usually openstack-puppetmaster-01.eqiad1.wikimedia.cloud). If you are testing a patch before merging to the puppet repo, you can put your code in this puppetmaster.

There would be some conflicts if we mix puppet code meant for hardware and meant for the Cloud VPS realm. This is usually solved using a patch like this:

diff --git a/modules/role/manifests/labs/instance.pp b/modules/role/manifests/labs/instance.pp
index 91833b8c32..320492e25b 100644
--- a/modules/role/manifests/labs/instance.pp
+++ b/modules/role/manifests/labs/instance.pp
@@ -4,7 +4,7 @@ class role::labs::instance {
     include ::profile::base::labs
     include sudo
     include ::base::instance_upstarts
-    include ::profile::openstack::main::observerenv
+    #include ::profile::openstack::main::observerenv
     include ::profile::openstack::main::cumin::target
     sudo::group { 'ops':

You can include this diff in the patch while you are testing it in Cloud VPS and drop that chunk just before merging it in gerrit.


The workflow for setting up the testing environment is:

  • be a projectadmin on the openstack Cloud VPS project
  • create a VM instance, usually small is enough
  • in horizon add the basic hiera config that can be found here. You will need additional tunning depending on which puppet code you are testing
  • run puppet agent in the instance a couple of times to do the puppetmaster change dancing. Delete /var/lib/puppet/ssl in the instance and generate the new client cert in the master, like sudo puppet cert sign cloudvirt-stretch-test-01.openstack.eqiad1.wikimedia.cloud
  • run puppet agent in the VM instance a couple of more times

Now that you have the instance ready:

  • send your puppet patch to the puppetmaster (to the git tree in /var/lib/git/operations/puppet)
  • run puppet agent in the VM instance
  • retry until done

Configuration for cloudnet servers

You will need this hiera config in horizon:

You will need to create some dummy interfaces, required by openstack, to emulate what we have in physical hardware:

sudo ip link add eth1 type dummy

In horizon, apply this role to the vm: role::wmcs::openstack::eqiad1::net

Configuration for cloudvirt servers

This hiera config should be used in horizon for a basic catalog compilation of the role::wmcs::openstack::eqiad1::virt role.

Configuration for cloudcontrol servers

If you are testing puppet code for the eqiad1 deployment use the role::wmcs::openstack::eqiad1::control role, and you will need this hiera config in horizon:

If you are testing puppet code for the codfw1dev deployment, use the role::wmcs::openstack::codfw1dev::control role plus this hiera config in horizon:

Configuration for labmon servers

This hiera config should be used in horizon for a basic catalog compilation of the role::wmcs::monitoring role.