Page MenuHomePhabricator

wikireplicas last-minute infra work to discuss / resolve
Closed, ResolvedPublic

Description

Recording this for posterity, so others can review/discuss/fix as appropriate tomorrow or at a later time!

First there was the creation of two new public IPs in the high-traffic2 space in eqiad. This was done via Netbox and worked flawlessly :)

https://netbox.wikimedia.org/ipam/ip-addresses/7642/
https://netbox.wikimedia.org/ipam/ip-addresses/7643/

After a fair amount of debugging and thinking and compiling, the main patch to configure the LVS service ended up being:

https://gerrit.wikimedia.org/r/c/operations/puppet/+/655533/16

Basic Followups:

https://gerrit.wikimedia.org/r/c/operations/puppet/+/659409/2 (turn on production lvs config)
https://gerrit.wikimedia.org/r/c/operations/puppet/+/659414 (allow $PRODUCTION_NETWORKS access to wikireplicas via ferm, for at least LVS healthchecks to work, but seems sane in general)

At this point things seemed like they should Just Work, but connections through the new LVS-based public IPs weren't working correctly from <anywhere reasonable>. After a bunch of debugging, eventually we figured out that I had completely missed the fact that dbproxy1018 and dbproxy1019, the service hosts that LVS was intended to route the traffic to, were not in the normal production vlans, and thus LVS didn't have a direct route to them, and was sending the traffic back to the eqiad juniper routers. The traffic would then loop between Juniper and LVS until the TTL expired.

These hosts are in cloud-support1-c-eqiad. So we decided the most-expedient thing to do for the evening was just to add the bare minimum LVS interface configurations to make just this service work for its primary and backup LVS hosts (lvs1014 and lvs1016). This isn't a general-case solution yet, but i didn't want to take more risks by affecting more LVSes and/or subnets. The result is basically this patch to add just this one extra vlan, to just those two LVS boxes:

https://gerrit.wikimedia.org/r/c/operations/puppet/+/659439

I would have assigned these IPs in netbox before merging this patch, but netbox's interface-name seemed to force me to use only the existing interfaces from the dropdown menu, so I couldn't really add it there first since the (virtual, tagged) interfaces didn't exist yet in puppetdb. So I just skipped netbox on those two IPs for now, more on that later...

The switch side also had to be manually fixed up to add the vlan to the available set on the row C interface for these two hosts manually:

bblack@asw2-c-eqiad# set interfaces xe-4/0/5 unit 0 family ethernet-switching vlan members cloud-support1-c-eqiad 
bblack@asw2-c-eqiad# set interfaces xe-2/0/13 unit 0 family ethernet-switching vlan members cloud-support1-c-eqiad

I realize this should have come from homer, but when I dug into homer's control of this stuff, it turns out it pulls this from netbox, which we skipped earlier, so on with the show...

WIth the interfaces now functioning, I ran the puppet agents on lvs101[46] to ensure puppetdb got its updates, and then was able to ask netbox to update from puppetdb for these two hosts, which did correctly create correct tagged-vlan address objects for them AFAICS, at:

https://netbox.wikimedia.org/ipam/ip-addresses/7650/
https://netbox.wikimedia.org/ipam/ip-addresses/7654/

And I'm assuming at tihs point that this would now close the loop and eventually homer would report no switch config diffs from my manual change, but I haven't checked on that yet!

We'll have to revisit all of this later/next-week and decide in the short- and medium- terms how we'll handle this sort of case and whether these hacks need to be re-done in a different way, or expanded on (more vlans and lvs hosts) to avoid future problems, etc.

Event Timeline

@BBlack I'm not sure what happened on Netbox here and here, but it seems that the IP addresses were created twice with a different netmask (and yes, Netbox allows it :/ ).

When creating an VIP address you can follow https://wikitech.wikimedia.org/wiki/DNS/Netbox#How_to_manually_allocate_a_special_purpose_IP_address_in_Netbox

For the DNS side there is no harm as duplicates are skipped and the netmask has no effect.
From what I can see you can just delete the /27 ones and all should be good.
I'm adding to the list of possible Netbox reports one that detects those duplicates too.

It looks like the /27 is what I manually created, and then the /32 was probably patched in later from puppetdb after everything was configured and running.

As for the manual creation with /27, I was using the GUI starting at e.g. https://netbox.wikimedia.org/ipam/prefixes/43/ip-addresses/ and clicking the "N IPs Available" button, which pre-fills the next one. I just didn't manage to look at the netmask that it prefilled there as /27.

The more interesting Netbox question here, is what the correct way is to define a new tagged virtual interface that doesn't exist yet (the loop I had with the interface-name dropdown and puppetdb and homer, etc)

Other than those duplicate IPs, Netbox/Homer is all good.

As server interfaces IPs are not configured by Netbox (only IP allocation) it doesn't matter much in which order it's made. It's also such an infrequent usecase than writing automation script for it is not worth it.

The 2 risks are either:

  • race condition (manually configuring an IP on the host, while automation assign the same IP to another host)
  • stale data (manually creating objects in Netbox that don't match reality (eg. typoed IP or interface name)

You can either:

  1. create the interface manually in Netbox
  2. allocate the IPs
  3. configure the IP on the device
  4. Run puppetdb importer to check if everything went well.

puppetdb importer prevents the risk of stale data

Or configure the IP on the host first, then run puppetdb importer to sync it, which should warn if an interface IP is already assigned.
Regardless of the method, you can also double check everything manually to be extra safe.

Also note that the cloud-support-XXX vlans are being phased out, so no need to add a LVS leg in all of them if not required for that task.

Marostegui lowered the priority of this task from High to Medium.Sep 24 2021, 9:48 AM

Can this be closed?

BBlack assigned this task to ayounsi.