-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add Alibaba Cloud Provider #696
Conversation
c45bbf2
to
0d992c4
Compare
@xianlubird thanks for open the PR 🎉 and a new provider 🙂. |
@njuettner
I didn't change
So cloud you give me some advice on how to fix it, thanks. |
It fails due to a change from go 1.10 to go 1.11. gofmt behaves differently. |
docs/tutorials/alibabacloud.md
Outdated
@@ -0,0 +1,365 @@ | |||
# Setting up ExternalDNS for Services on Alibaba Cloud | |||
|
|||
This tutorial describes how to setup ExternalDNS for usage within a Kubernetes cluster on Alibaba Cloud. Make sure to use **>=0.4** version of ExternalDNS for this tutorial |
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 would recommend to change 0.4 to version 0.5.6. This would be the next version incl. Alibaba Cloud
|
||
if cfg.RoleName != "" { | ||
provider.setNextExpire(cfg.ExpireTime) | ||
go provider.refreshStsToken(1 * 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.
maybe this could be also configurable via flag or something. refreshing every 1 second sounds eager to me. WDTY?
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.
roleName
is a Alibaba Cloud STS Token role, it can be fetch from ECS internal API, so it don't need to be config via flag.refreshStsToken
, the first time is 1 second, but from the next time it will be turned to 9 minute.
func (p *AlibabaCloudProvider) refreshStsToken(sleepTime time.Duration) {
for {
time.Sleep(sleepTime)
now := time.Now()
sleepTime = p.nextExpire.Sub(nowTime)
log.Infof("Distance expiration time %v", sleepTime)
if sleepTime < time.Duration(10*time.Minute) {
sleepTime = time.Duration(time.Second * 1)
} else {
sleepTime = time.Duration(9 * time.Minute)
}
}
}
So in most situation, the refresh loop time will be 9 minute. I think it's fine.
Another question I just saw that your tests cover roughly 60% of your code, do you feel confident enough that everything works as expected? Other than my small notes it looks good to me. |
Thanks for your review. :-) |
Agreed, thanks for your hard work and offering Alibaba Cloud as new provider 🚀 . |
Add Alibaba Cloud provided