-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create instances using custom configurations #4886
Create instances using custom configurations #4886
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything LGTM, in case that the config file contains 1 host only.
Is this expected?
str: Identifier of the created instance. | ||
""" | ||
client = boto3.resource('ec2') | ||
instance = client.create_instances(ImageId=config.ami, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be always 1 host?
Otherwise, [0] should be assigned by a variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the config is always "plain", in the Allocator
class the function ___get_custom_config()
validates the config comes with the correct format. In the case of a VagrantConfig
, the config should be something like this
ip: '192.168.57.3'
cpu: 1
memory: 2048
box: 'generic/ubuntu2004'
box_version: '4.3.8'
public_key: '/tmp/wazuh-qa/VAGRANT-1179DAFB-EFDD-47BA-B97F-5ECC8B3428B7/instance_key.pub'
If the file has a list of hosts or something different, it will raise an error that the data on the file doesn't match with the model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Notes
LGTM
…n no custom config is provided
Description
This PR enables the usage of a custom configuration file to generate instances, this configuration file must be a
.yaml
that matches the specificProviderConfig
. E.g a custom vagrant config:We can observe it matches the
VagrantConfig
modelTesting performed
Vagrant instance creation
VagrantConfig
valuestest.yaml
python launchers/allocation.py --provider vagrant --size small --composite-name linux-ubuntu-20.04-amd64 --custom-provider-config test.yaml
track-output
and the createdVagrantfile
/tmp/wazuh-qa/VAGRANT-6B268EB6-3E12-454A-85EF-1B52548F4882/Vagrantfile
AWS instance creation
Usage validation
AWSConfig
valuestest.yaml
python launchers/allocation.py --provider aws --size small --composite-name linux-ubuntu-20.04-amd64 --custom-provider-config test.yaml
track-output
and the created instance on AWS