New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 778324 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Feature

Blocking:
issue 778330



Sign in to add a comment

Support metadata from file

Project Member Reported by emso@chromium.org, Oct 25 2017

Issue description

Simplify running of a startup script on images. 

Something like this:

template {
  ...
  metadata_from_file: "startup-script:tricium/startup.sh"
}
 

Comment 1 by emso@chromium.org, Oct 25 2017

Blocking: 778330

Comment 2 by s...@google.com, Oct 25 2017

Can you use some other auto-start mechanism? Our GCE VMs have startup scripts as part of the image that install packages from CIPD binaries and ensure they're running.

Fuchsia VMs also have some other auto-start mechanism that precludes the need for startup scripts in metadata.
The idea is to avoid having to bake custom images for workloads that don't really need any dependencies on OS level (like Tricium stuff), since custom images rot with time or require periodic maintenance (like we do with our image builder).

Regardless, metadata_from_file will also make our existing cipd_deployment metadata look nicer.

Comment 4 by emso@chromium.org, Nov 2 2017

How should I proceed with this? Do you have an agreement on how to best support custom Tricium images?

Comment 5 by s...@google.com, Nov 2 2017

What exactly is a custom Tricium image? Are you just taking our standard ccompute Trusty image and adding some extra stuff in? Are you building your own in parallel on https://uberchromegw.corp.google.com/i/internal.infra.cron? Something else?
More context: Tricium will be used to analyze CLs for gerrit-review.googlesource.com. Anyone can upload a CL there (any random person from the internet).

We can't run these tricium tasks on ccompute images or in ccompute GCE project because ccompute images various secrets "hardcoded" inside (either at the time the image is created or deployed later via puppet). These secrets are not needed for Tricium, and they can leak to external random people (because tricium analyzers are not perfectly sandboxed).

Instead we want to spin up completely standard GCE image in dedicated isolated GCE project.

Also we don't want to maintain a new custom image, because it adds toil (these image must be kept up-to-date with all security patches etc). Instead we want to use GCE images provided by the Cloud Platform and "convert" them into MP+Swarming bots via startup scripts supplied via metadata as described here https://cloud.google.com/deployment-manager/docs/step-by-step-guide/setting-metadata-and-startup-scripts

The startup script will essentially bootstrap CIPD client, then fetch and run MP agent (that will do the rest). Very minimal.

Placing this script inside a proto string is very nasty though. Thus this request to support including metadata from a file.

An alternative solution would be to generate templates.cfg from some more high-level definition. This would have to be done manually though after each modification.

Comment 7 by s...@google.com, Nov 2 2017

Status: Available (was: Untriaged)
All right, sounds fine. Then we should add metadata_from_file to templates.cfg.

When loading the config, we can probably just take each metadata_from_file, remove it, convert it from a key:filename string to a key:value string by loading the named file from luci-config, then add it to the template proto's metadata. Then the rest of the app doesn't need to know or care about metadata_from_file, it will just think there are some really long metadata keys.

GCE has a hard limit on the length of metadata values [1] so we can probably also reject files that are too long.

[1] https://cloud.google.com/compute/docs/reference/latest/instances/setMetadata

Comment 8 by emso@chromium.org, Nov 16 2017

Owner: emso@chromium.org
Status: Assigned (was: Available)

Comment 10 by emso@chromium.org, Nov 30 2017

Status: Fixed (was: Assigned)

Sign in to add a comment