GithubHelp home page GithubHelp logo

isabella232 / watchtower-2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nccloud/watchtower

0.0 0.0 0.0 41 KB

Effortlessly monitor your Kubernetes resource activity :rocket:

License: Apache License 2.0

Shell 3.27% Go 93.89% Dockerfile 2.85%

watchtower-2's Introduction


logo

๐Ÿ“– General Information

Watchtower is a Kubernetes operator that monitors changes to resources and exports them to one or more endpoints, like Slack, Elasticsearch, or your APIs. It filters objects based on user-specified criteria, prepares a template, and sends the request to the appropriate endpoint.

๐Ÿš€ Deployment

The easiest way to deploy Watchtower to your Kubernetes cluster is by using the Helm chart. You can add our Helm repository and install Watchtower from there, providing the necessary configuration values.

Example:

helm repo add nccloud https://nccloud.github.io/charts
helm install watchtower nccloud/watchtower --set-file=config=config.yaml # You can check examples section to prepare configuration. 

Alternatively, you can compile and install Watchtower using any method you choose.

โš™๏ธ Configuration

Watchtower's configuration is stored in the config.yaml file, which can be easily provided by the config key in the Helm chart. You can find some examples in the Examples section or check the Tap, Sink and Flow for all the fields.

๐Ÿ“ Architecture

Watchtower is based on the controller-runtime which helps you to build a Kubernetes operator. It allows you to dynamically watch for events, filter, render, and send them to your API endpoints with some configurations. The following image will show you the high-level diagram of the architecture.

Architecture

๐Ÿ›  Development

You can easily run Watchtower with a few steps without any 3rd party dependencies:

  1. Create a Kubernetes Cluster or change context for the existing one.
kind create cluster
  1. (Optionally) Create a hook from https://webhook.site for testing purposes.
  2. Edit config.yaml according to your wish.
  3. Run the application;
go run cmd/manager/main.go

๐Ÿ“– Examples

Send Deployment Statuses to Slack

This configuration allows you to send available replicas of the deployments in your cluster to a Slack channel via webhook.

# config.yaml
taps:
- name: MyDeployments
  kind: Deployment
  apiVersion: apps/v1
sinks:
- name: MySlackWebhook
  method: POST
  urlTemplate: "YOUR_SLACK_WEBHOOK_URL"
  bodyTemplate: "{\"text\":\"Name: {{ .metadata.name }}\nAvailableReplicas: {{ .status.availableReplicas }}\"}"
flows:
- tap: MyDeployments
  sink: MySlackWebhook

Send Service Account Tokens to your API

This configuration allows you to send service account tokens in the default namespace to your API endpoints.

# config.yaml
taps:
- name: ServiceAccountTokens
  kind: Secret
  apiVersion: v1
  filter:
    name: "^.*$-token-.*$"
    namespace: "default"
    object:
      key: ".type"
      operator: "=="
      value: "kubernetes.io/service-account-token"
sinks:
- name: MyAPIEndpoint
  method: PATCH
  urlTemplate: "YOUR_API_ENDPOINT"
  bodyTemplate: "{\"ca.crt\":\"{{ index .data \"ca.crt\" }}\",\"token\":\"{{ index .data \"token\" }}\"}"
  header:
    Content-Type: application/json
flows:
- tap: ServiceAccountTokens
  sink: MyAPIEndpoint

๐Ÿท๏ธ Versioning

We use SemVer for versioning. To see the available versions, check the tags on this repository.

โญ๏ธ Documentation

For more information about the functionality provided by this library, refer to the GoDoc documentation.

๐Ÿค Contribution

We welcome contributions, issues, and feature requests!
If you have any issues or suggestions, please feel free to check the issues page or create a new issue if you don't see one that matches your problem.
Also, please refer to our contribution guidelines for details.

๐Ÿ“ License

All functionalities are in beta and is subject to change. The code is provided as-is with no warranties.
Apache 2.0 License


logo
Made with โ™ฅ by Namecheap Cloud Team

watchtower-2's People

Contributors

sandromodarelli avatar yunussandikci 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.