Git Product home page Git Product logo

tg-watch-api's Introduction

tg-watch-api

This project provides an example that uses Kubernetes watch API to monitor ingress changes and create Twingate resources

Prerequisites

  1. A working Kubernetes Cluster
  2. Kubectl

How to Use

  1. Clone the project
git clone https://github.com/Twingate-Labs/tg-watch-api
cd tg-watch-api
  1. modify cluster-role-binding.yaml
    1. subjects.name: name of the service account if you do not want to use namespace default service account
    2. subjects.namespace: namespace of the cluster-role-binding, make sure this is the same namespace as the tg-watch-api application
  2. apply cluster-role.yaml and cluster-role-binding.yaml
kubectl -n {namespace} apply -f templates/cluster-role.yaml -f templates/cluster-role-binding.yaml
  1. modify .example-env
    1. TG_API_KEY: Twingate API Key
    2. TG_ACCOUNT: Full URL of the Twingate tenant e.g. acme.twingate.com
    3. TG_REMOTE_NETWORK: Twingate remote network to create the resource in
    4. TG_GROUP_NAME: Twingate group which can access the created resources
    5. DOMAIN_LIST: List of domain names to create Twingate resources i.e. the application would not create resource if the ingress host is not part of this list
  2. create secret using .example-env, this need to be created in the same namespace as the tg-watch-api application
kubectl -n {namespace} create secret generic tg-watch-api --from-env-file=.example-env
  1. deploy the tg-watch-api application
kubectl -n {namespace} apply -f templates/statefulset.yaml

How to Delete the Application

kubectl -n {namespace} delete -f templates/statefulset.yaml -f templates/cluster-role.yaml -f templates/cluster-role-binding.yaml
kubectl -n {namespace} delete secrete tg-watch-api

Known Limitations

  1. Ingress deletion events are not covered by this example as GKE does not fire delete events for ingress
  2. Ingress modification events are not covered by this example
  3. Currently, the statefulset only supports replica of 1

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.