formancehq / stack

Open Source Infrastructure for the Financial Internet
https://www.formance.com
Other
362 stars 50 forks source link

fix(operator): update Caddyfile templates to set Host header for reverse proxy #1686

Closed flemzord closed 2 months ago

flemzord commented 2 months ago

Add header_up Host {upstream_hostport} to reverse_proxy directives in Caddyfile templates to ensure correct Host header is passed to upstream services.

coderabbitai[bot] commented 2 months ago

Walkthrough

The pull request primarily consists of cosmetic formatting changes across multiple files in the codebase. These changes include adjustments to comment alignment, spacing, and organization of import statements. No alterations to the functionality or logic of the code were made, ensuring that the underlying behavior remains unchanged.

Changes

File Path Change Summary
components/operator/api/formance.com/v1beta1/auth_types.go, database_types.go, ledger_types.go, resourcereference_types.go, settings_types.go, stack_types.go Formatting changes to comments and struct fields for improved readability.
components/operator/api/stack.formance.com/v1beta3/stack_types.go, components/operator/internal/core/reconciler.go, components/operator/internal/resources/auths/deployment.go, components/operator/internal/resources/benthos/controller.go, components/operator/internal/resources/brokerconsumers/controller.go, components/operator/internal/resources/brokers/reconcile.go, components/operator/internal/resources/brokers/utils.go, components/operator/internal/resources/brokers/watch.go, components/operator/internal/resources/caddy/caddy.go, components/operator/internal/resources/databases/env.go, components/operator/internal/resources/gateways/Caddyfile.gotpl, components/operator/internal/resources/ledgers/init.go, components/operator/internal/resources/orchestrations/deployments.go, components/operator/internal/resources/searches/init.go, components/operator/internal/resources/webhooks/deployment.go, components/operator/internal/tests/database_controller_test.go, components/operator/internal/tests/gateway_controller_test.go, components/operator/internal/tests/orchestration_controller_test.go Minor modifications in import statements, including reordering and adding blank lines for better readability.
components/operator/internal/resources/gateways/Caddyfile.gotpl Added header_up Host {upstream_hostport} in reverse_proxy configuration for services.

Possibly related PRs

Suggested labels

ee/orchestration, components/operator

Poem

In the code where rabbits play,
Formatting changes brighten the day.
Comments aligned, imports in line,
Readability's boost, oh how divine!
With each little hop, the code feels right,
A tidy burrow, a coder's delight! 🐇✨

[!TIP]

OpenAI O1 model for chat - We have deployed OpenAI's latest O1 model for chat. - OpenAI claims that this model has superior reasoning capabilities than their GPT-4o model. - Please share any feedback with us in the [discussions post](https://discord.com/channels/1134356397673414807/1283929536186155099).

Recent review details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between 1011a1644676f4ec48f15d1de4cf8998569d7a84 and d1236501fa982023d962b1bd3c4c6c7cc2900963.
Files ignored due to path filters (11) * `components/operator/config/crd/bases/formance.com_ledgers.yaml` is excluded by `!**/*.yaml` * `components/operator/config/crd/bases/formance.com_resourcereferences.yaml` is excluded by `!**/*.yaml` * `components/operator/config/crd/bases/formance.com_settings.yaml` is excluded by `!**/*.yaml` * `components/operator/helm/crds/templates/crds/apiextensions.k8s.io_v1_customresourcedefinition_ledgers.formance.com.yaml` is excluded by `!**/*.yaml` * `components/operator/helm/crds/templates/crds/apiextensions.k8s.io_v1_customresourcedefinition_resourcereferences.formance.com.yaml` is excluded by `!**/*.yaml` * `components/operator/helm/crds/templates/crds/apiextensions.k8s.io_v1_customresourcedefinition_settings.formance.com.yaml` is excluded by `!**/*.yaml` * `components/operator/internal/tests/testdata/resources/gateway-controller/configmap-with-audit.yaml` is excluded by `!**/*.yaml` * `components/operator/internal/tests/testdata/resources/gateway-controller/configmap-with-ledger-and-another-service.yaml` is excluded by `!**/*.yaml` * `components/operator/internal/tests/testdata/resources/gateway-controller/configmap-with-ledger-and-auth.yaml` is excluded by `!**/*.yaml` * `components/operator/internal/tests/testdata/resources/gateway-controller/configmap-with-ledger-only.yaml` is excluded by `!**/*.yaml` * `components/operator/internal/tests/testdata/resources/gateway-controller/configmap-with-opentelemetry.yaml` is excluded by `!**/*.yaml`
Files selected for processing (28) * components/operator/api/formance.com/v1beta1/auth_types.go (2 hunks) * components/operator/api/formance.com/v1beta1/database_types.go (2 hunks) * components/operator/api/formance.com/v1beta1/ledger_types.go (1 hunks) * components/operator/api/formance.com/v1beta1/resourcereference_types.go (1 hunks) * components/operator/api/formance.com/v1beta1/settings_types.go (6 hunks) * components/operator/api/formance.com/v1beta1/stack_types.go (1 hunks) * components/operator/api/stack.formance.com/v1beta3/stack_types.go (1 hunks) * components/operator/docs/09-Configuration reference/02-Custom Resource Definitions.md (8 hunks) * components/operator/internal/core/reconciler.go (1 hunks) * components/operator/internal/resources/auths/deployment.go (1 hunks) * components/operator/internal/resources/benthos/controller.go (1 hunks) * components/operator/internal/resources/brokerconsumers/controller.go (1 hunks) * components/operator/internal/resources/brokers/reconcile.go (1 hunks) * components/operator/internal/resources/brokers/utils.go (1 hunks) * components/operator/internal/resources/brokers/watch.go (1 hunks) * components/operator/internal/resources/caddy/caddy.go (1 hunks) * components/operator/internal/resources/databases/env.go (2 hunks) * components/operator/internal/resources/gateways/Caddyfile.gotpl (1 hunks) * components/operator/internal/resources/gateways/caddyfile.go (1 hunks) * components/operator/internal/resources/gateways/init.go (1 hunks) * components/operator/internal/resources/ledgers/assets/Caddyfile.gotpl (1 hunks) * components/operator/internal/resources/ledgers/init.go (1 hunks) * components/operator/internal/resources/orchestrations/deployments.go (1 hunks) * components/operator/internal/resources/searches/init.go (1 hunks) * components/operator/internal/resources/webhooks/deployment.go (1 hunks) * components/operator/internal/tests/database_controller_test.go (1 hunks) * components/operator/internal/tests/gateway_controller_test.go (1 hunks) * components/operator/internal/tests/orchestration_controller_test.go (1 hunks)
Files skipped from review due to trivial changes (16) * components/operator/api/formance.com/v1beta1/auth_types.go * components/operator/api/formance.com/v1beta1/database_types.go * components/operator/api/formance.com/v1beta1/resourcereference_types.go * components/operator/api/formance.com/v1beta1/settings_types.go * components/operator/api/formance.com/v1beta1/stack_types.go * components/operator/api/stack.formance.com/v1beta3/stack_types.go * components/operator/internal/core/reconciler.go * components/operator/internal/resources/brokerconsumers/controller.go * components/operator/internal/resources/brokers/utils.go * components/operator/internal/resources/brokers/watch.go * components/operator/internal/resources/databases/env.go * components/operator/internal/resources/gateways/caddyfile.go * components/operator/internal/resources/gateways/init.go * components/operator/internal/resources/webhooks/deployment.go * components/operator/internal/tests/gateway_controller_test.go * components/operator/internal/tests/orchestration_controller_test.go
Files skipped from review as they are similar to previous changes (11) * components/operator/api/formance.com/v1beta1/ledger_types.go * components/operator/internal/resources/auths/deployment.go * components/operator/internal/resources/benthos/controller.go * components/operator/internal/resources/brokers/reconcile.go * components/operator/internal/resources/caddy/caddy.go * components/operator/internal/resources/gateways/Caddyfile.gotpl * components/operator/internal/resources/ledgers/assets/Caddyfile.gotpl * components/operator/internal/resources/ledgers/init.go * components/operator/internal/resources/orchestrations/deployments.go * components/operator/internal/resources/searches/init.go * components/operator/internal/tests/database_controller_test.go
Additional context used
Markdownlint
components/operator/docs/09-Configuration reference/02-Custom Resource Definitions.md
171-171: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 177-177: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 178-178: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 179-179: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 180-180: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 202-202: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 208-208: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 209-209: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 210-210: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 211-211: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 224-224: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 230-230: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 231-231: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 232-232: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 233-233: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 262-262: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 268-268: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 269-269: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 270-270: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 271-271: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 288-288: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 289-289: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 290-290: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 291-291: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 292-292: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 313-313: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 319-319: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 320-320: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 321-321: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 322-322: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 754-754: Expected: 0; Actual: 2 Unordered list indentation (MD007, ul-indent) --- 755-755: Expected: 0; Actual: 2 Unordered list indentation (MD007, ul-indent) --- 2413-2413: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2414-2414: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2415-2415: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2416-2416: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2417-2417: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2418-2418: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2419-2419: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2420-2420: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2426-2426: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2427-2427: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2428-2428: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2429-2429: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2430-2430: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2431-2431: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2437-2437: Column: 1 Hard tabs (MD010, no-hard-tabs)
LanguageTool
components/operator/docs/09-Configuration reference/02-Custom Resource Definitions.md
[grammar] ~756-~756: “Operator” is a singular noun. It appears that the verb form is incorrect. Context: ... mode. Under the hood, the operator create two deployments and force the scaling o... (PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)
Additional comments not posted (1)
components/operator/docs/09-Configuration reference/02-Custom Resource Definitions.md (1)
Line range hint `169-2439`: **LGTM!** The formatting changes to the YAML code blocks in the documentation enhance readability and maintain consistency. The adjustments to indentation and spacing do not alter the underlying functionality or correctness of the settings described. Great job on improving the documentation!
Tools
Markdownlint
2413-2413: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2414-2414: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2415-2415: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2416-2416: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2417-2417: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2418-2418: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2419-2419: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2420-2420: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2426-2426: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2427-2427: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2428-2428: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2429-2429: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2430-2430: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2431-2431: Column: 1 Hard tabs (MD010, no-hard-tabs) --- 2437-2437: Column: 1 Hard tabs (MD010, no-hard-tabs)
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.