Skip to content

Commit

Permalink
Merge pull request #32 from cortexproject/governance
Browse files Browse the repository at this point in the history
Documentation
  • Loading branch information
dogukanteber committed Jun 27, 2023
2 parents 9841cb4 + 03f0996 commit 33d08f7
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## `auth-gateway` Community Code of Conduct

`auth-gateway` follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Contributing

Welcome!
We are excited that you are interested in contributing.
`auth-gateway` is an extention project of [Cortex](https://github.com/cortexproject/cortex/), and we follow the same [contributing guidelines](https://cortexmetrics.io/docs/contributing/) as Cortex.
Everything you read on that page applies to `auth-gateway` as well except the documentation part since we do not have any documentation yet.
33 changes: 33 additions & 0 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# `auth-gateway` Governance

This document defines project governance for the project.

## Voting

In the event of an important decision that needs to be taken, both maintainers must come to a consensus for the decision to be approved.
If a consensus cannot be reached, the matter shall be put on hold until such a time where a consensus can be agreed upon.

## Changes in Maintainership

Contributors who are interested in becoming a maintainer, if performing relevant responsibilities, should discuss their interest with the existing maintainers.
New maintainers must be nominated by an existing maintainer and unanimously approved by the current maintainers.

We do not expect anyone to make a permanent commitment to be a `auth-gateway` maintainer forever.
Circumstances change, people get new jobs, new interests, and may not be able to continue contributing to the project.
However, to maintain effective governance, we need to keep the list of maintainers current.
People may be removed from the current list of maintainers via one of the following ways:

* They can resign
* If they stop contributing to the project for a period of 6 months or more
* By unanimous agreement of the other active maintainers

Former maintainers are recognized with an honorary *Emeritus Maintainer* status, and have their names permanently listed in the README as a form of gratitude for their contributions.

## Approving PRs

PRs may be merged after receiving approval from both maintainers.
If the PR author is a maintainer, the approval of the other maintainer is required.

## Changes in Governance

All changes in Governance require unanimous agreement of the maintainers.
2 changes: 2 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Friedrich Gonzalez, Adobe <[email protected]> (@friedrichg)
Doğukan Teber, <[email protected]> (@dogukanteber)
146 changes: 145 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,145 @@
# auth-gateway
<p align="center"><img src="images/logo.png" alt="auth-gateway Logo"></p>

[![CI](https://github.com/cortexproject/auth-gateway/workflows/ci/badge.svg)](https://github.com/cortexproject/auth-gateway/actions)
[![GoDoc](https://godoc.org/github.com/cortexproject/auth-gateway?status.svg)](https://godoc.org/github.com/cortexproject/auth-gateway)
<a href="https://goreportcard.com/report/github.com/cortexproject/auth-gateway"><img src="https://goreportcard.com/badge/github.com/cortexproject/auth-gateway" alt="Go Report Card" /></a>
<a href="https://cloud-native.slack.com/messages/cortex/"><img src="https://img.shields.io/badge/join%20slack-%23cortex-brightgreen.svg" alt="Slack" /></a>
<!-- <a href="https://bestpractices.coreinfrastructure.org/projects/6681"><img src="https://bestpractices.coreinfrastructure.org/projects/6681/badge"></a> -->

# auth-gateway: Microservice that helps you debugistrating and operating your [Cortex](https://github.com/cortexproject/cortex) cluster in multi-tenant environments

`auth-gateway` is an entry point for all requests towards Cortex.
This gateway is responsible for handling multi-tenancy features without complicated proxy configuration.

## What problem does `auth-gateway` solve?

When operating Cortex with numerous tenants, it's crucial to distinguish your tenants each time they make requests to a specific component.
This differentiation is essential to ensure that each component processes its own requests independently.

To achieve this, Cortex microservices necessitate the inclusion of a header named `X-Scope-OrgID` in each request.
According to the Cortex Kubernetes (k8s) manifests, it's recommended to implement an NGINX server (eg. [nginx-config.yaml](https://github.com/cortexproject/cortex-helm-chart/blob/master/templates/nginx/nginx-config.yaml)) within each tenant's infrastructure, serving as a reverse proxy.

The primary function of this server is to route the traffic and establish the `X-Scope-OrgID` header for the corresponding tenant
However, setting up an NGINX server for each tenant is complex and has limitations.
For instance, you cannot define custom timeouts separately for each tenant.

So, we created `auth-gateway`, a microservice that helps you debugistrating and operating your Cortex cluster in multi-tenant environments with just a simple configuration.

[//]: <> (diagram url -> https://viewer.diagrams.net/?tags=%7B%7D&highlight=0000ff&edit=_blank&layers=1&nav=1&title=#R7V1pd6o6F%2F41Xeu%2BH8piHj461I6eDh572vvlLMSIVCSWwaG%2F%2Fk0QrCSpIkWLve096yoBI%2B797J09hhOpMZ6f%2B%2BZk2IZ94J6IfH9%2BIjVPRFGQZBW94JFFMqLhQzxi%2B04%2FGXsf6DhvIBnkk9HI6YMgc2EIoRs6k%2BygBT0PWGFmzPR9OMteNoBu9lsnpg2ogY5luvToH6cfDpNRgeffT1wAxx4mX60ryYmxmV6cDARDsw9na0PS2YnU8CEMl%2B%2FG8wZwMfVSuiw%2F1%2Frg7OrGfOCFeT5gv9mP9ftLf6h2W%2FB5Lrhv0%2BtTSVpOMzXdKPnFyd2Gi5QEaBpEbXRQRz9hggctF0Zo1vps6ISgMzEtPDhDCEBjw3DsoiMBXz4CoYWJwONx0xpGPjjHFzVlNPDi2Hb8FYgS9QH0wpY5dlyMkwYcOxa6h47pBeil3UkuSNAhqOiY%2FvUJQabAD8F8bSihxjmAYxD6C3RJgsXTFGOzNcbqydhwjaeCnAyaCZjs1Vzv9EZvEpKzyT%2F1vLO%2BaV8rjt7RBOO8PZpEp5qcg%2Fxev4aBHNPdDAJEmgyVfRh5fdBPjkg6gbkTPiXn8PvnhB34fXO%2BfrBIDzz0y57WD%2BLPcKqgpAPvH4yP0k%2F2zWC4upEg9OEINKAL%2Ffh3SPX4v9WZVJrEdJo74DuIqsBPZtsKiRW8hE14CGDkW2ADD1Q9USumb4Nw04XL60A%2FozFoeK3BSWGgKR3zgWuGzjSrZ1gIS77hDjrop4l8im0tmSdBsygRIF3%2B8ORT63qBmEg2shNJkpKdaEkYaiIESnOxdtkEXxBQIrEiTHEpSSX7XUiaDgKR04tCBC5SXrLysEVFkeJSEuhyKKHkrC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4ZOLRn8wLSyn2kgxDtxXvwXmNGry2%2FgmfG31dZ3o6SWlexqU8noSAlrkKhk%2BZ4uSWu6y9hT%2FCJdYKoCh%2FoPHERdVDk9G9BmFEyUhAh06EPMi3d9gvcVacM%2B1vRn%2Fwc%3D)

![auth-gateway architecture](images/architecture.png)

## Features

* Enabling multi-tenancy feature of Cortex with just a simple configuration
* Supporting HTTP basic authentication
* Defining custom timeouts for each of your components
* Load balancing

## Configuration

### Generic Placeholders

* `<int>`: any integer matching the regular expression [1-9]+[0-9]*
* `<duration>`: a duration matching the regular expression [0-9]+(ns|us|µs|ms|s|m|h|d|w|y) where y = 365 days.
* `<string>`: a regular string
* `<url>`: a URL

```yaml

# The main server that auth-gateway will listen on. Any request that comes to this server will be forwarded to the corresponding component. Requires authentication.
server: <server_config>

# A supporting server that exposes metrics, ready and pprof endpoints. Does not require authentication.
debug: <server_config>

# List of all tenants that auth-gateway will serve.
tenants: <tenant_config>

distributor: <component_config>

frontend: <component_config>

alertmanager: <component_config>

ruler: <component_config>

```
### server_config
The `server_config` configures the servers.

```yaml
# hostname or IP address that auth-gateway will listen on, not a url
address: <string>
port: <int>
http_server_read_timeout: <duration> | default = 30s
http_server_write_timeout: <duration> | default = 30s
http_server_idle_timeout: <duration> | default = 120s
```

### tenant_config

The `tenant_config` configures the tenants.

```yaml
- authentication: basic
username: <string>
password: <string>
id: <string>
- ... # more tenants
```

### component_config
The `component_config` configures the components.
Although the default timeout values are defined below, these default values differ depending on the component.
To learn each component's timeout values, please refer to the [default timeout values](#default_timeout_values) section.

```yaml
url: <url>
dns_refresh_interval: <duration> | default = 1s
paths:
- <string>
- <string>
http_client_timeout: <duration> | default = 15s
http_client_dialer_timeout: <duration> | default = 5s
http_client_tls_handshake_timeout: <duration> | default = 5s
http_client_response_header_timeout: <duration> | default = 5s
```

### <a name="default_timeout_values"></a> Default Timeout Values

Each component in the `component_config` has different default timeout values.
They are as follows:

| Component | `http_client_timeout` | `http_client_dialer_timeout` | `http_client_tls_handshake_timeout` | `http_client_response_header_timeout` |
| ------------ | --------------------- | ---------------------------- | ----------------------------------- | ------------------------------------- |
| Distributor | 15s | 5s | 5s | 5s |
| Frontend | 1m | 5s | 5s | 5s |
| Alertmanager | 15s | 5s | 5s | 5s |
| Ruler | 15s | 5s | 5s | 5s |

You can override these default values by specifying your desired timeout values in the `component_config` for each component.

## Contributing

We welcome contributions.
Please follow the [contributing guidelines](CONTRIBUTING.md).

## <a name="help"></a> Getting Help

If you have any questions about `auth-gateway`:

- Ask a question on the [Cortex Slack channel](https://cloud-native.slack.com/messages/cortex/).
To invite yourself to the CNCF Slack, visit http://slack.cncf.io/.
- <a href="https://github.com/cortexproject/auth-gateway/issues/new">File an issue.</a>
- Send an email to <a href="mailto:[email protected]">[email protected]</a>

Your feedback is always welcomed!
Binary file added images/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 33d08f7

Please sign in to comment.