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

Add abstract per path config reader #663

Merged
merged 14 commits into from
Sep 27, 2020
Merged

Add abstract per path config reader #663

merged 14 commits into from
Sep 27, 2020

Conversation

jcmoraisjr
Copy link
Owner

@jcmoraisjr jcmoraisjr commented Sep 9, 2020

Per path configuration is the ability to configure the same backend in distinct ways depending on the request uri, leading to less backend config colisions and more config flexibility. Currently this configuration is a manual and error prone process because haproxy doesn't provide the primitives needed to implement it in the way an ingress object was designed to operate.

This pr aims to provide an abstract implementation that reads per-path config from a []Paths field, deduplicate and convert them in a way haproxy can use.

This is the first step to configure other options which fits in the per-path context, and also move some configs from the frontend to the backend, leading to an even faster configuration on deployments with a high number (thousands) of distinct domains.

Tasks being implemented:

  • abstract copy
  • per path getter
  • move AuthHTTP
  • move Cors
  • move HSTS
  • move MaxBodySize
  • move RewriteURL
  • move SSLRedirect
  • move WAF
  • move WhitelistHTTP
  • cleanup old types and code

Add a backend's internal field `pathConfig` that holds per path configurations in a way haproxy can understand and use. Per path configurations will be added to the `[]Paths` field, simplifying the public interface. `pathConfig` is populated and data is deduplicated in an abstract way.
A small refactor in the annotation mapper to allow a direct reference to the per path configs. Most of the other methods should be removed after convert the annotation parsers.
remove legacy code used to deduplicate and redistribute per-path config in the annotation parser.
Change the name of the hash maps and support types to something one can understand its purpose. Annotation mapper has now two maps and the old naming was a bit confusing.
A small refactor to reuse the final `ConfigValue` data in both annotation mapper maps.
@jcmoraisjr jcmoraisjr changed the title WIP: Add abstract per path config reader Add abstract per path config reader Sep 12, 2020
@jcmoraisjr jcmoraisjr merged commit d03d369 into master Sep 27, 2020
@jcmoraisjr jcmoraisjr deleted the jm-path-config branch September 27, 2020 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant