Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/myENA/rancher-herder
Rancher service registration for consul
https://github.com/myENA/rancher-herder
Last synced: 3 months ago
JSON representation
Rancher service registration for consul
- Host: GitHub
- URL: https://github.com/myENA/rancher-herder
- Owner: myENA
- License: apache-2.0
- Archived: true
- Created: 2017-10-13T20:26:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-11T21:45:09.000Z (about 7 years ago)
- Last Synced: 2024-05-01T13:45:30.897Z (9 months ago)
- Language: Go
- Size: 46.9 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rancher - Rancher service registrator for Consul - Rancher service registration for consul (Rancher 2.0 / Community projects)
README
# Rancher service registrator for consul (WIP)
This service is compatible with Rancher 2.0, and more specifically for embeded kubernetes/cattle orchestration.This service is opinionated on how it detects and registers services. It pays special attention to the kubernetes label `annotation.io.kubernetes.container.ports`
and uses it to detect exposed ports. In general if it detects the label it will register the service in consul, however,
it will not register a health check. To register a health check some labels must be applied to the service; specifically `herder.service.check.http.path` ` herder.service.check.port`.If the `-strict` flag is passed then the `herder.service.enable` label must be set on the service or else the service will be ignored. It is also important to
not that this service registers containers in the environment (k8s namespace) that is deployed in. To run the service globally you will need to supply the container
with admin api keys by setting the ENV variables `CATTLE_URL` `CATTLE_SECRET_KEY` `CATTLE_ACCESS_KEY` and deploy with the cluster level core-services.##### Note: The container will restart once or twice the first time it runs. Working on the why, but after it restarts the service runs properly
#### Build
```bash
glide up -v
go build
```#### CLI Flags
```bash
Usage of ./cattle-herder:
-consulDc string
Consul Datacenter
-consulIp string
Set the consul ip for the services to be registered to. If blank it tries to connect to the host external IP
If this flag is not passed the rancher host is detected and consul attempts to register t the agent on the public IP of the host
-debug
Enable debug logs
-interval duration
How often to run reconcile calculated by value * time.Minute (default 10ns)
-strict
Enable this flag to enforce the herder.service.enable label```
# Compose Labels
Herder compose labels:
```yaml
## Rancher labels for the service account
## http://rancher.com/docs/rancher/v1.6/en/rancher-services/service-accounts/
io.rancher.container.create_agent: true
io.rancher.container.agent.role: environmentAdmin
```
Service labels:
```yaml
## Herder specific labels
## All labels are strings because that is how they are depicted in the WS event Data
herder.service.enable: string # If strict flag is passed this must be set to true to register the service
herder.service.name: string # The service name to display in the services view in consul
herder.service.check.port: string # The port to register for the service check (NOT ASSUMED)
herder.service.check.http.schema: string # HTTP or HTTPS
herder.service.check.http.path: string # The health check path "/health"
herder.service.check.tcp: string # True|False gets parsed to a bool for the service definition
herder.service.check.interval: string # Check interval
herder.service.tags: string # A string with comma separated tags ex. "Tag1,Tag2"
```