Skip to content

Commit

Permalink
Removed configdb support from Ruler and Alertmanager backends (#15)
Browse files Browse the repository at this point in the history
* Removed configdb support from Ruler and Alertmanager backends

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Fixed formatting

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* go mod tidy and remove configdb integration tests

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* go mod vendor

Signed-off-by: Marco Pracucci <marco@pracucci.com>
  • Loading branch information
pracucci authored Jul 19, 2021
1 parent 66cbf91 commit 8e45a7b
Show file tree
Hide file tree
Showing 196 changed files with 26 additions and 28,361 deletions.
1 change: 0 additions & 1 deletion .github/workflows-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ test-build-deploy.yml specifies a workflow that runs all Cortex continuous integ
|------------------------|-------------------------------------------------------------------------------------------------------------------------------|------|
| lint | Runs linting and ensures vendor directory, protos and generated documentation are consistent. | CI |
| test | Runs units tests on Cassandra testing framework. | CI |
| integration-configs-db | Integration tests for database configurations. | CI |
| integration | Runs integration tests after upgrading golang, pulling necessary docker images and downloading necessary module dependencies. | CI |
| build | Builds and saves an up-to-date Cortex image and website. | CI |
| deploy_website | Deploys the latest version of Cortex website to gh-pages branch. Triggered within workflow. | CD |
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/test-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,24 +145,3 @@ jobs:
go test -tags=requires_docker -timeout 2400s -v -count=1 ./integration/...
env:
IMAGE_PREFIX: ${{ secrets.IMAGE_PREFIX }}

integration-configs-db:
needs: build
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install Docker Client
run: sudo ./.github/workflows/scripts/install-docker.sh
- name: Download Docker Images Artifact
uses: actions/download-artifact@v2
with:
name: Docker Images
- name: Extract Docker Images Archive
run: tar -xvf images.tar -C /
- name: Run Integration Configs Tests
# Github Actions does not support TTY in their default runners yet
run: |
touch build-image/.uptodate
MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations
make BUILD_IMAGE=quay.io/cortexproject/build-image:20210713_update-go-1.16.6-178ab0c4f TTY='' configs-integration-test
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Mimir - master / unreleased

* [CHANGE] Removed `configdb` support from Ruler and Alertmanager backend storages. #15
* [CHANGE] Changed `-ruler.storage.type` default value from `configdb` to `local`. #15
* [CHANGE] Changed `-alertmanager.storage.type` default value from `configdb` to `local`. #15

## master / unreleased
* [FEATURE] Ruler: Add new `-ruler.query-stats-enabled` which when enabled will report the `cortex_ruler_query_seconds_total` as a per-user metric that tracks the sum of the wall time of executing queries in the ruler in seconds. #4317

Expand Down
20 changes: 0 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ pkg/alertmanager/alertspb/alerts.pb.go: pkg/alertmanager/alertspb/alerts.proto
all: $(UPTODATE_FILES)
test: protos
mod-check: protos
configs-integration-test: protos
lint: protos
build-image/$(UPTODATE): build-image/*

Expand Down Expand Up @@ -140,22 +139,6 @@ exes $(EXES) protos $(PROTO_GOS) lint test cover shell mod-check check-protos we
@echo ">>>> Entering build container: $@"
@$(SUDO) time docker run --rm $(TTY) -i $(GOVOLUMES) $(BUILD_IMAGE) $@;

configs-integration-test: build-image/$(UPTODATE)
@mkdir -p $(shell pwd)/.pkg
@mkdir -p $(shell pwd)/.cache
@DB_CONTAINER="$$(docker run -d -e 'POSTGRES_DB=configs_test' postgres:9.6.16)"; \
echo ; \
echo ">>>> Entering build container: $@"; \
$(SUDO) docker run --rm $(TTY) -i $(GOVOLUMES) \
-v $(shell pwd)/cmd/cortex/migrations:/migrations:z \
--workdir /go/src/github.com/cortexproject/cortex \
--link "$$DB_CONTAINER":configs-db.cortex.local \
-e DB_ADDR=configs-db.cortex.local \
$(BUILD_IMAGE) $@; \
status=$$?; \
docker rm -f "$$DB_CONTAINER"; \
exit $$status

else

exes: $(EXES)
Expand Down Expand Up @@ -226,9 +209,6 @@ cover:
shell:
bash

configs-integration-test:
/bin/bash -c "go test -v -tags 'netgo integration' -timeout 30s ./pkg/configs/... ./pkg/ruler/..."

mod-check:
GO111MODULE=on go mod download
GO111MODULE=on go mod verify
Expand Down
109 changes: 6 additions & 103 deletions docs/configuration/config-file-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ tenant_federation:
# The ruler_storage_config configures the Cortex ruler storage backend.
[ruler_storage: <ruler_storage_config>]

# The configs_config configures the Cortex Configs DB and API.
[configs: <configs_config>]

# The alertmanager_config configures the Cortex alertmanager.
[alertmanager: <alertmanager_config>]

Expand Down Expand Up @@ -1232,15 +1229,9 @@ ruler_client:
# Deprecated. Use -ruler-storage.* CLI flags and their respective YAML config
# options instead.
storage:
# Method to use for backend rule storage (configdb, azure, gcs, s3, swift,
# local)
# Method to use for backend rule storage (azure, gcs, s3, swift, local)
# CLI flag: -ruler.storage.type
[type: <string> | default = "configdb"]
# The configstore_config configures the config database storing rules and
# alerts, and is used by the Cortex alertmanager.
# The CLI flags prefix for this block config is: ruler
[configdb: <configstore_config>]
[type: <string> | default = "local"]
azure:
# Azure Cloud environment. Supported values are: AzureGlobal,
Expand Down Expand Up @@ -1630,7 +1621,7 @@ The `ruler_storage_config` configures the Cortex ruler storage backend.

```yaml
# Backend storage to use. Supported backends are: s3, gcs, azure, swift,
# filesystem, configdb, local.
# filesystem, local.
# CLI flag: -ruler-storage.backend
[backend: <string> | default = "s3"]
Expand Down Expand Up @@ -1826,11 +1817,6 @@ filesystem:
# CLI flag: -ruler-storage.filesystem.dir
[dir: <string> | default = ""]
# The configstore_config configures the config database storing rules and
# alerts, and is used by the Cortex alertmanager.
# The CLI flags prefix for this block config is: ruler-storage
[configdb: <configstore_config>]
local:
# Directory to scan for rules
# CLI flag: -ruler-storage.local.directory
Expand Down Expand Up @@ -1946,14 +1932,9 @@ sharding_ring:
# config options instead.
storage:
# Type of backend to use to store alertmanager configs. Supported values are:
# "configdb", "gcs", "s3", "local".
# "gcs", "s3", "local".
# CLI flag: -alertmanager.storage.type
[type: <string> | default = "configdb"]
# The configstore_config configures the config database storing rules and
# alerts, and is used by the Cortex alertmanager.
# The CLI flags prefix for this block config is: alertmanager
[configdb: <configstore_config>]
[type: <string> | default = "local"]
azure:
# Azure Cloud environment. Supported values are: AzureGlobal,
Expand Down Expand Up @@ -2174,7 +2155,7 @@ The `alertmanager_storage_config` configures the Cortex alertmanager storage bac

```yaml
# Backend storage to use. Supported backends are: s3, gcs, azure, swift,
# filesystem, configdb, local.
# filesystem, local.
# CLI flag: -alertmanager-storage.backend
[backend: <string> | default = "s3"]
Expand Down Expand Up @@ -2370,11 +2351,6 @@ filesystem:
# CLI flag: -alertmanager-storage.filesystem.dir
[dir: <string> | default = ""]
# The configstore_config configures the config database storing rules and
# alerts, and is used by the Cortex alertmanager.
# The CLI flags prefix for this block config is: alertmanager-storage
[configdb: <configstore_config>]
local:
# Path at which alertmanager configurations are stored.
# CLI flag: -alertmanager-storage.local.path
Expand Down Expand Up @@ -4394,79 +4370,6 @@ The `fifo_cache_config` configures the local in-memory cache. The supported CLI
[size: <int> | default = 0]
```

### `configs_config`

The `configs_config` configures the Cortex Configs DB and API.

```yaml
database:
# URI where the database can be found (for dev you can use memory://)
# CLI flag: -configs.database.uri
[uri: <string> | default = "postgres://postgres@configs-db.weave.local/configs?sslmode=disable"]
# Path where the database migration files can be found
# CLI flag: -configs.database.migrations-dir
[migrations_dir: <string> | default = ""]
# File containing password (username goes in URI)
# CLI flag: -configs.database.password-file
[password_file: <string> | default = ""]
api:
notifications:
# Disable Email notifications for Alertmanager.
# CLI flag: -configs.notifications.disable-email
[disable_email: <boolean> | default = false]
# Disable WebHook notifications for Alertmanager.
# CLI flag: -configs.notifications.disable-webhook
[disable_webhook: <boolean> | default = false]
```

### `configstore_config`

The `configstore_config` configures the config database storing rules and alerts, and is used by the Cortex alertmanager. The supported CLI flags `<prefix>` used to reference this config block are:

- `alertmanager`
- `alertmanager-storage`
- `ruler`
- `ruler-storage`

&nbsp;

```yaml
# URL of configs API server.
# CLI flag: -<prefix>.configs.url
[configs_api_url: <url> | default = ]
# Timeout for requests to Weave Cloud configs service.
# CLI flag: -<prefix>.configs.client-timeout
[client_timeout: <duration> | default = 5s]
# Path to the client certificate file, which will be used for authenticating
# with the server. Also requires the key path to be configured.
# CLI flag: -<prefix>.configs.tls-cert-path
[tls_cert_path: <string> | default = ""]
# Path to the key file for the client certificate. Also requires the client
# certificate to be configured.
# CLI flag: -<prefix>.configs.tls-key-path
[tls_key_path: <string> | default = ""]
# Path to the CA certificates file to validate server certificate against. If
# not set, the host's root CA certificates are used.
# CLI flag: -<prefix>.configs.tls-ca-path
[tls_ca_path: <string> | default = ""]
# Override the expected name on the server certificate.
# CLI flag: -<prefix>.configs.tls-server-name
[tls_server_name: <string> | default = ""]
# Skip validating server certificate.
# CLI flag: -<prefix>.configs.tls-insecure-skip-verify
[tls_insecure_skip_verify: <boolean> | default = false]
```

### `blocks_storage_config`

The `blocks_storage_config` configures the blocks storage.
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/alert-manager-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Cortex Alertmanager notification setup follow mostly the syntax of Prometheus Al

With the introduction of Cortex 1.8 the storage backend config option shifted to the new pattern [#3888](https://github.com/cortexproject/cortex/pull/3888). You can find the new configuration [here](../configuration/config-file-reference.md#alertmanager_storage_config)

Note that when using `-alertmanager.sharding-enabled=true`, the following storage backends are not supported: `local`, `configdb`.
Note that when using `-alertmanager.sharding-enabled=true`, the following storage backends are not supported: `local`.

When using the new configuration pattern it is important that any of the old configuration pattern flags are unset (`-alertmanager.storage`), as well as `-<prefix>.configs.url`. This is because the old pattern still takes precedence over the new one. The old configuration pattern (`-alertmanager.storage`) is marked as deprecated and will be removed by Cortex version 1.11. However this change doesn't apply to `-alertmanager.storage.path` and `-alertmanager.storage.retention`.
When using the new configuration pattern it is important that any of the old configuration pattern flags are unset (`-alertmanager.storage`). This is because the old pattern still takes precedence over the new one. The old configuration pattern (`-alertmanager.storage`) is marked as deprecated and will be removed by Cortex version 1.11. However this change doesn't apply to `-alertmanager.storage.path` and `-alertmanager.storage.retention`.

### Cortex Alertmanager configuration

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/sharded_ruler.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Unlike ingesters, rulers do not hand over responsibility: all rules are re-shard

## Ruler Storage

The ruler supports six kinds of storage (configdb, azure, gcs, s3, swift, local). Most kinds of storage work with the sharded ruler configuration in an obvious way. i.e. configure all rulers to use the same backend.
The ruler supports six kinds of storage (azure, gcs, s3, swift, local). Most kinds of storage work with the sharded ruler configuration in an obvious way. i.e. configure all rulers to use the same backend.

The local implementation reads [Prometheus recording rules](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/) off of the local filesystem. This is a read only backend that does not support the creation and deletion of rules through [the API](../api/_index.md#ruler). Despite the fact that it reads the local filesystem this method can still be used in a sharded ruler configuration if the operator takes care to load the same rules to every ruler. For instance this could be accomplished by mounting a [Kubernetes ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) onto every ruler pod.

Expand Down
12 changes: 0 additions & 12 deletions docs/guides/tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,6 @@ through the following config parameters:

Client flags are component specific.

For an HTTP client in the Alertmanager:
```
# Path to the TLS Cert for the HTTP Client
-alertmanager.configs.tls-cert-path=/path/to/client.crt
# Path to the TLS Key for the HTTP Client
-alertmanager.configs.tls-key-path=/path/to/client.key
# Path to the TLS CA for the HTTP Client
-alertmanager.configs.tls-ca-path=/path/to/root.crt
```

For a GRPC client in the Querier:
```
# Path to the TLS Cert for the GRPC Client
Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
cloud.google.com/go/storage v1.10.0
github.com/Azure/azure-pipeline-go v0.2.2
github.com/Azure/azure-storage-blob-go v0.8.0
github.com/Masterminds/squirrel v0.0.0-20161115235646-20f192218cf5
github.com/NYTimes/gziphandler v1.1.1
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15
github.com/alicebob/miniredis/v2 v2.14.3
Expand All @@ -26,7 +25,6 @@ require (
github.com/gocql/gocql v0.0.0-20200526081602-cd04bd7f22a7
github.com/gogo/protobuf v1.3.2
github.com/gogo/status v1.0.3
github.com/golang-migrate/migrate/v4 v4.7.0
github.com/golang/protobuf v1.5.2
github.com/golang/snappy v0.0.3
github.com/gorilla/mux v1.7.3
Expand All @@ -36,7 +34,6 @@ require (
github.com/hashicorp/go-sockaddr v1.0.2
github.com/hashicorp/memberlist v0.2.3
github.com/json-iterator/go v1.1.11
github.com/lib/pq v1.3.0
github.com/minio/minio-go/v7 v7.0.10
github.com/mitchellh/go-wordwrap v1.0.0
github.com/ncw/swift v1.0.52
Expand Down
Loading

0 comments on commit 8e45a7b

Please sign in to comment.