test-kitchen / kitchen-google

Google Compute Engine driver for Test-Kitchen

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automatically generate SSH key and add to metadata

thumperward opened this issue Β· comments

πŸ—£οΈ Foreword

Thank for taking the time to fill this feature request fully. Without it we may not be able to , and the issue may be closed without resolution.

πŸ™ Problem Statement

The driver documentation explains how to add an SSH key to the project metadata, or else to configure the driver to inject an existing one into the VM metadata. However there is no reason that the driver couldn't create this key on-the-fly rather than it having to exist already. This is analogous to the way e.g. kitchen-ec2 can generate ephemeral keypairs.

❔ Possible Solution

Add a generate_key function somewhere above create_instance_object which creates an ephemeral SSH key (if username is not set) and adds it to instance_metadata.

‴️ Describe alternatives you've considered

Alternatively OSlogin could be used directly, but the Ruby bindings for OSlogin are auto-generated and documentation is nonexistent.

βž• Additional context

Analogous code path for kitchen-ec2