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

Update Redis Enterprise to set tls_verify to true by default in check code (ECOINT-109) #2607

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions redis_enterprise/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG - Redis Enterprise

## 1.1.2 / 2025-02-28

***Changed***:

* Update `tls_verify` handling in check code to ensure default is set to 'True'

## 1.1.1 / 2025-01-21

***Changed***:
Expand Down
2 changes: 1 addition & 1 deletion redis_enterprise/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ For a full list of supported metrics, see the [Metrics](#metrics) section below.

1. Run the following command to install the Agent integration:
```shell
datadog-agent integration install -t datadog-redis_enterprise==1.1.1
datadog-agent integration install -t datadog-redis_enterprise==1.1.2
```

2. Configure the integration by setting the `openmetrics_endpoint` to your cluster's master node. See [Integration][2] for further information.
Expand Down
1 change: 1 addition & 0 deletions redis_enterprise/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ files:
The endpoint should be the URL of the metric exporter of the enterprise instance
openmetrics_endpoint.display_priority: 3
tls_verify.value.example: false
tls_verify.value.display_default: true
tls_verify.enabled: true
tls_verify.display_priority: 1
extra_metrics.value.example: [ foo, bar ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.1.1'
__version__ = '1.1.2'
2 changes: 2 additions & 0 deletions redis_enterprise/datadog_checks/redis_enterprise/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self, name, init_config, instances):
def _parse_config(self):
self.scraper_configs = []
metrics_endpoint = self.instance.get('openmetrics_endpoint')
tls_verify = self.instance.get("tls_verify", True)
metrics = self.get_default_config()

additional = []
Expand Down Expand Up @@ -46,6 +47,7 @@ def _parse_config(self):
'namespace': self.__NAMESPACE__,
'metrics': metrics,
'metadata_label_map': {'version': 'version'},
'tls_verify': tls_verify,
}

config.update(self.instance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def instance_tls_use_host_header():


def instance_tls_verify():
return False
return True


def instance_use_latest_spec():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## All options defined here are available to all instances.

Check failure on line 1 in redis_enterprise/datadog_checks/redis_enterprise/data/conf.yaml.example

View workflow job for this annotation

GitHub Actions / run / Validate

File `conf.yaml.example` is not in sync, run "ddev validate config redis_enterprise -s"
#
init_config:

Expand All @@ -18,7 +18,7 @@
#
- openmetrics_endpoint: https://<host>:8070/metrics

## @param tls_verify - boolean - optional - default: false
## @param tls_verify - boolean - optional - default: true
## Instructs the check to validate the TLS certificate of services.
#
tls_verify: false
Expand Down
2 changes: 2 additions & 0 deletions redis_enterprise/tests/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

ERSATZ_INSTANCE = {'openmetrics_endpoint': "https://localhost:8071/metrics", 'tags': ['instance']}

SSL_INSTANCE = {"openmetrics_endpoint": "https://localhost:8071/metrics", "tls_verify": True}

EPHEMERAL = [
"rdse.bdb_avg_latency",
"rdse.bdb_avg_latency_max",
Expand Down
15 changes: 14 additions & 1 deletion redis_enterprise/tests/test_redis_enterprise.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# from datadog_checks.dev.utils import get_metadata_metrics
from datadog_checks.redis_enterprise.check import RedisEnterpriseCheck

from .support import CHECK, DEFAULT_METRICS, EPHEMERAL, ERSATZ_INSTANCE, INSTANCE, METRICS_MAP
from .support import CHECK, DEFAULT_METRICS, EPHEMERAL, ERSATZ_INSTANCE, INSTANCE, METRICS_MAP, SSL_INSTANCE

ssl._create_default_https_context = ssl._create_unverified_context

Expand Down Expand Up @@ -116,3 +116,16 @@ def test_invalid_instance(aggregator, dd_run_check, mock_http_response):
assert True

aggregator.assert_service_check(f'{RedisEnterpriseCheck.__NAMESPACE__}.node_imaginary', count=0)


@pytest.mark.unit
def test_invalid_ssl_instance(aggregator, dd_run_check, mock_http_response):
# Create instance with tls_verify: True
instance = deepcopy(SSL_INSTANCE)
instance.pop('tls_verify') # Simulating missing tls_verify in config

check = RedisEnterpriseCheck(CHECK, {}, [instance])
dd_run_check(check)

# Ensure tls_verify defaults to True
assert check.scraper_configs[0]["tls_verify"] is True, "tls_verify should default to True"
Loading