Comments (3)
If I understand you correctly, you want a container that:
- runs in Rancher
- iterates over all Rancher hosts using the Rancher API
- for each host finds the corresponding instances in AWS
- applies the "aws.instance_id" and "aws.availability_zone" label to the Rancher host using the Rancher API
Is my understanding correct?
Assuming so, it's step (3) that's the tricky one. The information available about a host in Rancher is not quite enough to easily identify it in AWS. That's why I introduced those labels in the first place. If we could solve that, there would be no need to have a separate service, and no need to label hosts either.
I'll have another poke around the Rancher API to see what might be possible. I'm open to suggestions if you have any ideas.
from rancher-reaper.
2 and 3 aren't quite right. I am thinking of a container that runs as a 'global service' ie an instance of this container runs on every host. This way you can make use of the ec2-metadata service at 169.254.169.254 to fetch data about the instance you are on without having to have any ec2 credentials or know anything about where you are.
- Fetch the local-hostname, instanceid and placement/availability_zone from the ec2 metadata service at 169.254.169.254 (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html)
- Call the rancher API and find the host with the matching hostname
- Apply the labels from #1.
If you label it as a 'agent' then it will automatically be spawned with variables for the config-url and credentials for rancher, so no hard-coding of either of these:
http://docs.rancher.com/rancher/v1.0/en/rancher-services/service-accounts/
If the container is scheduled as global service, no-restart then this will fire up once when a node provisions, mark the node, then exit and not take any additional resources.
from rancher-reaper.
OK gotcha.
What you're suggesting sounds feasible. It's not really something I'm willing to take on though, as I'm not a RancherOS user and I don't have the time to invest in this right now. If you decide to tackle it I'll drop a mention in the README though to help out other users.
The ideal solution of course would be having RancherOS be able to use the ec2 metadata in cloud-init. Seems that you're not the first to come across this problem:
rancher/os#1178
https://forums.rancher.com/t/getting-ec2-metadata-to-rancher-host-labels-on-rancheros/1467
https://forums.rancher.com/t/ec2-metadata-and-cloud-init/2975
from rancher-reaper.
Related Issues (11)
- https CATTLE_URL not working? HOT 4
- Make labels configurable?
- aws_sdk bug prevents rancher-reaper from removing hosts HOT 1
- eu-west-2 (London) availability zones being treated as invalid HOT 1
- AWS keys should be optional
- ERROR undefined method `request_uri'
- Doesn't handle malformed aws.availability_zone labels HOT 3
- One-shot mode to allow scheduling with cron
- Incorrect handling of nonexistent instances HOT 4
- Missing region error while reaping terminated host HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rancher-reaper.