Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coherent format of container labels describing proxy behavior #426

Open
royra opened this issue Feb 7, 2024 · 1 comment
Open

coherent format of container labels describing proxy behavior #426

royra opened this issue Feb 7, 2024 · 1 comment

Comments

@royra
Copy link
Collaborator

royra commented Feb 7, 2024

Current labels:

  • preevy.access
  • preevy.inject_script
  • preevy.expose

Goals:

  • support multiple ports per container
  • support multiple behavior properties per port: private/public, injection
  • support multiple routes (aliases) per container port, each with its own behavior
  • sane defaults
  • consistent naming and scheme for labels
  • given a set of labels, the proxy agent can print the normalized configuration labels which is complete (like e.g, docker compose config)

Example 1 - defaults

services:
  my-service:
    ports:
    - 3000
    - 8080:8080
    - 8081:8081

can be normalized into:

services:
  my-service:
    ports:
    - 3000
    - 8080:8080
    - 8081:8081

    labels:
      preevy.routes.[3000].port: 3000
      preevy.routes.[3000].access: public
      preevy.routes.[8080].port: 8080
      preevy.routes.[8080].access: public
      preevy.routes.[8081].port: 8081
      preevy.routes.[8081].access: public

and results the following routes:

  • my-service-3000: port 3000, public
  • my-service-8080: port 8080, public
  • my-service-8081: port 8081, public

Example 2

services:
  my-service:
    ports:
    - 3000
    - 8080:8080
    - 8081:8081
    
    labels:
      # global default
      preevy.access: private 

      preevy.routes.[8080].access: public

      preevy.routes.web.port: 3000

      preevy.routes.web-with-tool.port: 3000
      preevy.routes.web-with-tool.inject_script.x.src: http://my-script.com

can be normalized into:

services:
  my-service:
    ports:
    - 3000
    - 8080:8080
    - 8081:8081
    
    labels:
      preevy.routes.web.port: 3000
      preevy.routes.web.access: private
      preevy.routes.web-with-tool.port: 3000
      preevy.routes.web-with-tool.access: private
      preevy.routes.web-with-tool.inject_script.x.src: http://my-script.com
      preevy.routes.[8080].port: 8080
      preevy.routes.[8080].access: public
      preevy.routes.[8081].port: 8081
      preevy.routes.[8081].access: private

and results the following routes:

  • web: port 3000, public
  • web-with-tool: port 3000, private, injects script http://my-script.com
  • my-service-8080: port 8080, public
  • my-service-8081: port 8081, private

note that the default route for port 3000 my-service-3000 is not created because its port is specified in the web and web-with-tool routes.

Edge cases

Missing port

    labels:
      preevy.routes.web.access: private    

This configuration is invalid: there is no preevy.routes.web.port label, can't determine the port for route web.

Redirecting default routes

    labels:
      preevy.routes.[8080].port: 3000

This configuration is valid albeit confusing. It creates the route my-service-8080 with port 3000 and disables the default route for port 3000 my-service-3000.

@aleclerc-cio
Copy link

I really like this format. It seems flexible enough and can be augmented with new features. I believe it would satisfy all my use cases in #421

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants