Page MenuHomeSoftware Heritage

Add waagent profile to azure worker role
ClosedPublic

Authored by ardumont on Aug 1 2022, 6:13 PM.

Details

Summary

So we are able to activate swap for indexer workers.

Related to T4415
Depends on D8169

Test Plan

bin/octo on indexer-workers adapts the swap configuration:

$ $SWH_PUPPET_ENVIRONMENT_HOME/bin/octocatalog-diff vault-worker01.euwest.azure.internal.softwareheritage.org
...
*******************************************
+ File[/etc/waagent.conf] =>
   parameters =>
     "ensure": "present",
     "group": "root",
     "mode": "0644",
     "owner": "root"
*******************************************
+ File_line[ResourceDisk.EnableSwap] =>
   parameters =>
     "ensure": "present",
     "line": "ResourceDisk.EnableSwap=y",
     "match": "^ResourceDisk.EnableSwap=n",
     "path": "/etc/waagent.conf"
*******************************************
+ File_line[ResourceDisk.SwapSizeMB] =>
   parameters =>
     "ensure": "present",
     "line": "ResourceDisk.SwapSizeMB=14336",
     "match": "^ResourceDisk.SwapSizeMB=0",
     "path": "/etc/waagent.conf"
*******************************************
*** End octocatalog-diff on indexer-worker01.euwest.azure.internal.softwareheritage.org

bin/octo on azure worker without configuration manages the waagent.conf without activating swap:

$ $SWH_PUPPET_ENVIRONMENT_HOME/bin/octocatalog-diff vault-worker01.euwest.azure.internal.softwareheritage.org
...
*******************************************
+ File[/etc/waagent.conf] =>
   parameters =>
     "ensure": "present",
     "group": "root",
     "mode": "0644",
     "owner": "root"
*******************************************
+ File_line[/etc/waagent.conf-ResourceDisk.EnableSwap] =>
   parameters =>
     "ensure": "present",
     "line": "ResourceDisk.EnableSwap=n",
     "match": "^ResourceDisk\\.EnableSwap=",
     "path": "/etc/waagent.conf"
*******************************************
+ File_line[/etc/waagent.conf-ResourceDisk.SwapSizeMB] =>
   parameters =>
     "ensure": "present",
     "line": "ResourceDisk.SwapSizeMB=0",
     "match": "^ResourceDisk\\.SwapSizeMB=",
     "path": "/etc/waagent.conf"
*******************************************
*** End octocatalog-diff on vault-worker01.euwest.azure.internal.softwareheritage.org

Diff Detail

Repository
rSPSITE puppet-swh-site
Branch
staging
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 30578
Build 47806: arc lint + arc unit

Event Timeline

Let's use file_line resources instead of using a template which will be out of date 28 seconds after the change is pushed.

Let's use file_line resources instead of using a template which will be out of date 28 seconds after the change is pushed.

lol, ok.

i'm assuming then that the last line will have the expected values (when there is redundant configuration line).

Adapt according to suggestion

i'm assuming then that the last line will have the expected values (when there is redundant configuration line).

It's not an append-only mode. It's more of a sed-i like behavior so even better.

ardumont retitled this revision from Add waagent profile to azure indexer worker to Add waagent profile to azure worker role.Aug 2 2022, 10:09 AM
ardumont edited the summary of this revision. (Show Details)

I would suggest only matching on line beginnings, so that we can update the values and possibly disable swap if we find it problematic.
I've added escaping of the regexps.

site-modules/profile/manifests/swh/deploy/waagent.pp
1 ↗(On Diff #29507)

This should be a top-level profile (e.g. profile::waagent), as it has nothing to do with swh stuff

5–33 ↗(On Diff #29507)

Escape the regexps, and ensure that we disable swap if the setting disappears

ardumont marked an inline comment as done.
ardumont edited the test plan for this revision. (Show Details)

Adapt according to review to:

  • also allow swap deactivation if needed
  • escape regexp pattern matching

Not sure I understand the insistence on using variables, but *shrug*

This revision is now accepted and ready to land.Aug 2 2022, 10:53 AM