-
Notifications
You must be signed in to change notification settings - Fork 37
Add GCE Cloud - Issue #78 #82
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ce7e671
Adding GCE model and admin forms
machristie e0e2e30
GCE serializers, viewsets, etc.
machristie 83f9457
client_email and project_name not required any longer
machristie 816971f
Reverting changes: cloudman only supports EC2 or EC2-compatible clouds
machristie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
django-cloudlaunch/baselaunch/migrations/0019_gce_gcecredentials.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # Generated by Django 1.9 on 2017-06-21 14:35 | ||
| from __future__ import unicode_literals | ||
|
|
||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
| import fernet_fields.fields | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('baselaunch', '0018_auto_20170613_1553'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name='GCE', | ||
| fields=[ | ||
| ('cloud_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='baselaunch.Cloud')), | ||
| ('region_name', models.CharField(max_length=100)), | ||
| ('zone_name', models.CharField(max_length=100)), | ||
| ], | ||
| options={ | ||
| 'verbose_name': 'GCE', | ||
| 'verbose_name_plural': 'GCE', | ||
| }, | ||
| bases=('baselaunch.cloud',), | ||
| ), | ||
| migrations.CreateModel( | ||
| name='GCECredentials', | ||
| fields=[ | ||
| ('credentials_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='baselaunch.Credentials')), | ||
| ('credentials', fernet_fields.fields.EncryptedTextField()), | ||
| ], | ||
| options={ | ||
| 'verbose_name': 'GCE Credentials', | ||
| 'verbose_name_plural': 'GCE Credentials', | ||
| }, | ||
| bases=('baselaunch.credentials',), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # Generated by Django 1.9 on 2017-07-27 00:54 | ||
| from __future__ import unicode_literals | ||
|
|
||
| from django.db import migrations | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('baselaunch', '0020_azure_model_change'), | ||
| ('baselaunch', '0019_gce_gcecredentials'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@machristie So I was looking at this a bit. Since an HTTP header can't have any carriage returns or line feeds, I was wondering whether this might pose a problem. However, it looks like JSON data in a header is ok, provided that the json encoder makes sure there are no CR/LFs, which is probably doable. I guess we can test this once the corresponding CloudLaunch UI changes are made.
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.
Ah good catch, I wasn't thinking about CR/LFs. I think you're right and this will work as long as the JSON doesn't have CR/LFs.
The other approach would be to split out the fields into separate headers. I considered doing this because I read somewhere that web servers tend to support headers with values only up to 8KB. But the credentials file I have is only 2,330 bytes, so it should fit comfortably.
Eventually I decided to just treat the credentials as a kind of opaque blob for the sake of simplicity. But I'd be curious to know if you have an opinion on whether I should have separate headers for each field or not.
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.
I think it makes sense to leave it as a single header, since this would correspond directly to the gce_service_creds_dict on the cloudbridge side. On the UI side, we could have an upload field so that the user can upload his/her credentials file, which would be subsequently sent across through this header if it's being used as temporary creds, or saved in the "credentials" database field, if it's going to be persistent.
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.
I guess we'll just leave this like it is until further testing from the UI.