Giter Site home page Giter Site logo

ferhimedamine / rancher-service-updater Goto Github PK

View Code? Open in Web Editor NEW

This project forked from improving-minnesota/rancher-service-updater

0.0 2.0 0.0 373 KB

Application to upgrade Rancher servers based on service meta-data

License: Apache License 2.0

Makefile 1.35% Go 90.00% Shell 8.65%

rancher-service-updater's Introduction

Rancher Service Updater

CircleCI GitHub Release Apache License 2.0

An Inversion of Control (IOC) service used to notify Rancher of new container images and execute updates to those services based on container labels.

Configuring

  • AUTOUPDATE_ENABLE_LABEL [autoupdate.enable] - Specifies the container label to query for automatic update enabling.
  • AUTOUPDATE_ENVIRONMENT_NAMES [[".*"]] - An array of regex patterns to match Rancher environment names against. Environment name must match a pattern for auto-updating to occur in that environment.
  • AUTOUPDATE_HTTP_PORT [8080] - The port that the service updater listens on.
  • AUTOUPDATE_SLACK_WEBHOOK_URL - The webhook URL to use for sending Slack notifications. If not specified, Slack messaging is disabled.
  • AUTOUPDATE_SLACK_BOT_NAME - The bot name to send as for Slack messages.
  • CATTLE_ACCESS_KEY - The API access key for Rancher.
  • CATTLE_SECRET_KEY - The API secret key for Rancher.
  • CATTLE_URL - The Rancher server URL.

Enabling Auto-Updating for Rancher Environment

The Rancher Service Updater configures itself to only check certain environments for services to automatically update. This is done in conjunction with the API restrictions based on the credentials passed to the container. That is, if an environment specific key is used, then the updater will only ever try to update service within that environment.

If however, a global/user key is used, then the updater can update services in any environment that that key has access to. By default the updater is configured to allow updating of services in any environment. This is set via the AUTOUDPATE_ENVIRONMENT_NAMES environment variable which should contain a comma (,) separated list of regex patterns. The default value is .*.

In conjunction with a global key, this property can be used to restrict the environments. For example, assume a cluster with 3 environments: dev, qa, and production. The updater is configured with a global key that has access to all 3 environments. To restrict automatic updates to only the dev environment, set AUTOUPDATE_ENVIRONMENT_NAMES=dev. To restrict automatic updates to both the dev and qa environments, set AUTOUPDATE_ENVIRONMENT_NAMES=dev,qa

Enabling Auto-Updating for a Rancher Service

Configure a service to be automatically updated by adding a container label of autoupdate.enabled=true. Alternatively, the label to check can be specified by setting the AUTOUPDATE_ENABLE_LABEL environment variable

Determining if update is required

Currently Deployed Version Newly Published Version Update?
1.0 2.0 true
2.0 1.3 false
1.0 latest true
latest latest true
latest 1.0 false

Running Service Updater on Rancher

The Rancher Service Updater relies upon the standard environment variables for providing connection information to create a Rancher client instance.

If running this application as a container on a Rancher cluster itself, you can provide the following service labels to automatically provision the API credentials to the application.

  • io.rancher.container.create_agent=true
  • io.rancher.container.agent.role=environment

NOTE: When using this method, the provisioned API credentials are tied to the Rancher environment in which the service is deployed. Thus, it will only have access to update services within that same environment.

NOTE: If it is intended to auto-update services in multiple Rancher environments, then the API configuration must be provided via environment variables.

Triggering an upgrade.

Send a post to /upgrade with the following JSON payload:

{
  "docker_image": "docker:",
  "confirm": true,
  "start_first": false,
  "timeout": 30
}
  • docker_image - the image path that is now available. Optionally start with docker:
  • confirm - if the service upgrade should be confirmed/finished if successful
  • start_first - Optional. Default of false. If true, then sets new services to be started before terminated old services.
  • timeout - Optional. Timeout in seconds. Default of 30. Timeout for waiting for service upgrade to complete if confirm = true.

Security

This service provides not mechanism for authentication/authorization. It is the responsibility of the user to properly secure this service such that unauthorized access is not available.

rancher-service-updater's People

Contributors

johnrengelman avatar ahaynssen avatar

Watchers

James Cloos avatar Mohamed Amine Ferhi avatar

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.