Giter Site home page Giter Site logo

Comments (3)

ampedandwired avatar ampedandwired commented on June 19, 2024

If I understand you correctly, you want a container that:

  1. runs in Rancher
  2. iterates over all Rancher hosts using the Rancher API
  3. for each host finds the corresponding instances in AWS
  4. 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.

jhmartin avatar jhmartin commented on June 19, 2024

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.

  1. 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)
  2. Call the rancher API and find the host with the matching hostname
  3. 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.

ampedandwired avatar ampedandwired commented on June 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.