Git Product home page Git Product logo

subdomain-mapper-operator's Introduction

subdomain-mapper-operator (IN-PROGRESS)

Why?

I wanted something similar to vercel previews where an environment is created automatically with a subdomain.

What?

This operator maps the subdomain <service_name>.<yourdomain>.<tld> to <service_name>.

How?

It watches for new services that have the annotation and patches the ingress when a service is created, modified or removed.

It uses https://github.com/flant/shell-operator

Usage and example

The services must have the following annotation:

annotations:
  subdomain-mapper/ingress: "your-ingress-name"
  subdomain-mapper/domain: "your-domain"

example:

annotations:
  subdomain-mapper/ingress: "main-ingress"
  subdomain-mapper/domain: "andreisurugiu.com"

You need to specify the ingress to add the hosts to.

Create the RBAC permissions and the service account:

# apply rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/DeluxeOwl/subdomain-mapper-operator/main/rbac.yaml
# apply operator.yaml
kubectl apply -f https://raw.githubusercontent.com/DeluxeOwl/subdomain-mapper-operator/main/operator.yaml

# example service and pod
kubectl apply -f https://raw.githubusercontent.com/DeluxeOwl/subdomain-mapper-operator/main/examples/example.yaml

Development

  1. Build it yourself (multi-arch):
docker buildx ls
docker buildx create --name multi-arch
docker buildx use multi-arch
docker buildx inspect --bootstrap
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t username/subdomain-mapper:latest --push .
  1. Change the image from operator.yaml to use your image.

todo

  • add tests

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.