Page MenuHomePhabricator

Define scap::sources in a way that is shared between prod and beta
Closed, DeclinedPublic

Description

Follows-up from T127771. See also T161675.

The Horizon interface allows enabling roles on instances. Both via the per-instance "Puppet configuration" tab, and via the project-wide configuration page based on instance name prefixes (somewhat similar to what we do in site.pp for production).

The problem is that while role::deployment_server is applied to tin.deployment-prep (Beta Cluster), the Hiera values from role/common/deployment_server.yaml are not.

It seems for the most part, things specific to an individual cluster have their own Hiera yaml file and don't use the role file, so it seems safe to include these by default in Beta Cluster, with per-cluster overrides as we do already (eqiad, codfw, labs, etc.)

It should be possible to write something in Puppet for production in a way that also works on Beta by default (if it doesn't need Beta-specific overrides). Right now that is not the case because scap::sources needs to be kept in sync via deployment-prep's own Yaml file.

Event Timeline

Change 436439 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[operations/puppet@production] deployment-prep: Remove override for scap::sources

https://gerrit.wikimedia.org/r/436439

Change 436440 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[operations/puppet@production] puppetmaster: Add role_hierarchy to labs.hiera

https://gerrit.wikimedia.org/r/436440

Change 436439 abandoned by Krinkle:
deployment-prep: Remove override for scap::sources

Reason:
Discussing at T161675

https://gerrit.wikimedia.org/r/436439

Change 436440 abandoned by Krinkle:
puppetmaster: Add role_hierarchy to labs.hiera

Reason:
Discussing at T161675

https://gerrit.wikimedia.org/r/436440

Krinkle renamed this task from Include role/common in beta-cluster hieradata hierarchy to Define scap::sources in a way that is shared between prod and beta.May 31 2018, 4:06 PM
Krinkle updated the task description. (Show Details)

Change 436581 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[operations/puppet@production] Move scap::sources from role::deployment_server to common

https://gerrit.wikimedia.org/r/436581

Change 436581 abandoned by Krinkle:
Move scap::sources from role::deployment_server to common

https://gerrit.wikimedia.org/r/436581

Can I propose an alternative?

  1. Get rid of that hiera thing
  2. Write a small script that runs on a regular cron, which gets a list of all projects known to gerrit, checks whether a scap/ directory exists, and if it hasn't been cloned it does so

That can be pushed to every deployment server, and will remove a puppet dep.

Gets all scap-enabled projects -- looking for a checkout and cloning if not present wouldn't be complicated.

#!/usr/bin/python

import json
import requests

projects = json.loads(requests.get('https://gerrit.wikimedia.org/r/projects/?pp=0').text[4:])

for project in projects:
	if projects[project]['state'] != 'ACTIVE':
		print('{}: Project isn\'t active'.format(project))
		continue
	if 'web_links' not in projects[project] or len(projects[project]['web_links']) == 0:
		print('{}: No web links are available for this project'.format(project))
		continue

	url = None
	for web_link in projects[project]['web_links']:
		if web_link['name'] == 'gitiles':
			url = web_link['url']
	if not url:
		print('{}: No gitiles url found'.format(project))
		continue

	# Try getting the scap directory
	scap_request = requests.get('{}/+/HEAD/scap'.format(url))
	if scap_request.status_code == 404:
		print('{}: No scap dir found'.format(project))
	else:
		print('{}: SCAP-ish!'.format(project))
Vvjjkkii renamed this task from Define scap::sources in a way that is shared between prod and beta to xxbaaaaaaa.Jul 1 2018, 1:06 AM
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from xxbaaaaaaa to Define scap::sources in a way that is shared between prod and beta.Jul 2 2018, 2:16 AM
CommunityTechBot lowered the priority of this task from High to Medium.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.

I think nthis request is ultimatly asking for $_role support in the wmcs puppet hiera config. This is something that has come up a few times before specifically

Some previous conversations on trying to add roles to the cloud hiera lookup:

  • T120165 -> two years ago, got denied in favor of horizon puppet prefixes
  • T211029 -> three years ago, when it was decided to use version control for the cloud enc
  • T127771 -> three years ago, a request to add role support, unblocked by horizon puppet prefixes

and T280324 which was resolved as the machine got decommissioned.

@dcaro had a patch out for this but it got abandoned when the above got closed. perhaps they can resurect that patch. in the mean time i think that scap::sources have been added to hieradata/cloud/eqiad1/deployment-prep/common.yaml

bd808 subscribed.

Making the custom role function used in production work in Cloud VPS or specifically deployment-prep would be swell. If that ever happens this will happen as a side effect.

I believe the following 2 steps should result in the same thing we would get if the role keyword was working:

  • copy/paste the content from hieradata/role/common/deployment_server/kubernetes.yaml into hieradata/cloud/eqiad1/deployment-prep/common.yaml
  • edit a puppet project or prefix tab in Horizon and ensure all the profiles are applied that are also included in modules/role/manifests/deployment_server.pp