-
Notifications
You must be signed in to change notification settings - Fork 89
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
Azure support #54
base: master
Are you sure you want to change the base?
Azure support #54
Conversation
} | ||
|
||
fmt.Printf("Starting sleep: %v\n", time.Now().Unix()) | ||
time.Sleep(180 * time.Second) |
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 should probably alter this to just poll on the static IP I provide until it's available. This was a quick hack to fix an issue I had noticed around an agent getting assigned at times +1 builds.
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 this should use polling, which is how we handle this for the other providers. You can use this example as reference https://github.com/drone/autoscaler/blob/master/drivers/amazon/create.go#L122:L175
Msg("cannot terminate instance") | ||
return err | ||
} | ||
return nil |
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 noticed lines 44-51 and 60-67 look to be the same
if err != nil { | ||
logger.Error(). | ||
Err(err). | ||
Msg("cannot terminate instance") | ||
return err | ||
} |
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.
this error is already handled at line 46
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.
Yep will remove
} | ||
|
||
// CreatePublicIP creates a new public IP | ||
func (p *provider) createPublicIP(ctx context.Context, ipName string) (ip network.PublicIPAddress, err error) { |
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.
is creating a static public IP necessary? can we just use the ephemeral public IP address associated with the instance? This is what we do for other cloud providers.
@@ -40,6 +42,8 @@ type installer struct { | |||
keepaliveTimeout time.Duration | |||
runner config.Runner | |||
labels map[string]string | |||
dockerUsername string | |||
dockerPassword string |
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.
these changes can be removed. We have a separate PR that is proposing this change
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.
Yea I proposed that PR 😄 . I'll remove these from this PR
|
||
[[override]] | ||
name = "github.com/Azure/go-autorest" | ||
version = "13.0.0" |
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.
the Gopkg
files were removed and replaced with go.mod
files. You may want to sync up your codebase with the latest version
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.
K will move to go.mod
"github.com/drone/autoscaler" | ||
"github.com/rs/zerolog/log" | ||
"fmt" | ||
"time" |
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.
best practice for import ordering https://github.com/golang/go/wiki/CodeReviewComments#imports
|
||
func (p *provider) computeMachineRequest(ctx context.Context, base string, opts autoscaler.InstanceCreateOpts) (compute.VirtualMachine, *string, error) { | ||
buf := new(bytes.Buffer) | ||
err := p.userdata.Execute(buf, &opts) |
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.
unhandled exception
thanks for submitting the pull request. I have added some comments about specific sections of code. I also recommend taking a look at AWS or GCP and trying to more closely mirror the structure and conventions (logging, polling, functions, etc). For example, you will notice we have very detailed logging in the other providers. |
*# | ||
*.#* | ||
*~ |
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.
what are these lines for?
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.
Emacs backup files
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.
these should be removed and added to your global .gitignore file or in .git/info/exclude
return nil, err | ||
} | ||
|
||
azureInstance, err := future.Result(client) |
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.
unhandled error
} | ||
|
||
azureInstance, err := future.Result(client) | ||
client.Start(ctx, p.resourceGroup, p.vmName) |
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.
does start return any parameters? if it returns an error it needs to be handled
return nil, err | ||
} | ||
|
||
fmt.Printf("Starting sleep: %v\n", time.Now().Unix()) |
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.
use logger instead of fmt.Print
or println
No description provided.