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

feat(streams): add support for nginx streams #292

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

MemoryLeak55
Copy link

PR progress checklist (to be filled in by reviewers)

  • Changes to documentation are appropriate (or tick if not required)
  • Changes to tests are appropriate (or tick if not required)
  • Reviews completed

What type of PR is this?

Primary type

  • [build] Changes related to the build system
  • [chore] Changes to the build process or auxiliary tools and libraries such as documentation generation
  • [ci] Changes to the continuous integration configuration
  • [feat] A new feature
  • [fix] A bug fix
  • [perf] A code change that improves performance
  • [refactor] A code change that neither fixes a bug nor adds a feature
  • [revert] A change used to revert a previous commit
  • [style] Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)

Secondary type

  • [docs] Documentation changes
  • [test] Adding missing or correcting existing tests

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

N/A

Describe the changes you're proposing

Currently the formula does not have support for streams (TCP and UDP loadbalancing), and putting it in the nginx.conf file doesn't work due to key conflicts (the server key is used for the main config, but also used by streams). Either way, I couldn't get it right and it seems a bit cleaner in my opinion to have streams working like snippets instead of putting everything in the main config.

see https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/

Pillar / config required to test the proposed changes

I exactly copied and pasted the snippets functionality and changed it to streams, and added some defaults to the map file. I don't know how to test it, but am willing to learn. It's working for my use case so far, for what it's worth

Debug log showing how the proposed changes work

Documentation checklist

  • Updated the README (e.g. Available states). ---> N/A
  • Updated pillar.example.

Testing checklist

  • Included in Kitchen (i.e. under state_top).
  • Covered by new/existing tests (e.g. InSpec, Serverspec, etc.).
  • Updated the relevant test pillar.

Additional context

I've tried squashing the PR into a single commit that conforms to the commit message guidelines with little success.
As per the title the squash message should be

feat(streams): add support for nginx streams

Copy link
Member

@javierbertoli javierbertoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thomas-thorburn-connect this seems a nice addition to the formula!

There are a few minor format/code quality issues (some whitespaces at the end of some lines).

Also, if you can add some tests for this code, similar the the tests for snippets, that'd be great.

@@ -202,3 +212,7 @@
}) %}
{% endif %}
{% endif %}

{% if salt['grains.get']('os_family') == 'FreeBSD' %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a whitespace after the closing bracket, that tests are showing. Can you remove it?

@@ -105,7 +105,16 @@ nginx:
- upstream netdata:
- server: 127.0.0.1:19999
- keepalive: 64


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are whitespaces after the closing bracket, that tests are showing. Can you remove them?

- server:
- listen: 7000
- proxy_pass: some_upstream

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are whitespaces after the closing bracket, that tests are showing. Can you remove them?

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

Successfully merging this pull request may close these issues.

2 participants