From f54748ce5050ca84b0243cc05cde2f152a436fe3 Mon Sep 17 00:00:00 2001 From: Rajaditya Chauhan Date: Tue, 17 Sep 2024 18:59:46 +0530 Subject: [PATCH 1/9] Export: adding export db args in args.py --- opl/args.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opl/args.py b/opl/args.py index d63b61a..1b4dd69 100644 --- a/opl/args.py +++ b/opl/args.py @@ -86,6 +86,10 @@ def add_ros_db_opts(parser): _add_generic_db_opts(parser, "ros") +def add_export_db_opts(parser): + _add_generic_db_opts(parser, "export") + + def add_kafka_opts(parser): parser.add_argument( "--kafka-host", From c8f79ec543950a68334351b35c33e2b9d8923fb1 Mon Sep 17 00:00:00 2001 From: Jan Hutar Date: Thu, 19 Sep 2024 09:18:47 +0200 Subject: [PATCH 2/9] chore: Attempt to create a Backstage yaml file --- catalog-info.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 catalog-info.yaml diff --git a/catalog-info.yaml b/catalog-info.yaml new file mode 100644 index 0000000..049da76 --- /dev/null +++ b/catalog-info.yaml @@ -0,0 +1,13 @@ +apiVersion: backstage.io/v1alpha1 +kind: Component +metadata: + name: opl + namespace: default + description: MBU products perf&scale library +spec: + type: library + lifecycle: production + owner: hce-perfscale-team + system: hce-perfscale + dependencyOf: + - component:default/iperf From a038d988e4f7d347a481b439ef0deccc318dff21 Mon Sep 17 00:00:00 2001 From: Jan Hutar Date: Thu, 19 Sep 2024 10:32:52 +0200 Subject: [PATCH 3/9] chore: Try to define perf-dept domain --- catalog-info.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/catalog-info.yaml b/catalog-info.yaml index 049da76..1a63377 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -1,3 +1,12 @@ +--- +apiVersion: backstage.io/v1alpha1 +kind: Domain +metadata: + name: perf-dept + description: Performance and Scale department +spec: + owner: perf-dept-team +--- apiVersion: backstage.io/v1alpha1 kind: Component metadata: From 168112dc651d1dfc3f7939ed80d191f1b74aa20c Mon Sep 17 00:00:00 2001 From: Jan Hutar Date: Tue, 24 Sep 2024 15:41:14 +0200 Subject: [PATCH 4/9] chore: Remove domain definition --- catalog-info.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/catalog-info.yaml b/catalog-info.yaml index 1a63377..f28ae9a 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -1,13 +1,5 @@ --- apiVersion: backstage.io/v1alpha1 -kind: Domain -metadata: - name: perf-dept - description: Performance and Scale department -spec: - owner: perf-dept-team ---- -apiVersion: backstage.io/v1alpha1 kind: Component metadata: name: opl From 6d2e98905feab5f06d07765a33f27171e180adc3 Mon Sep 17 00:00:00 2001 From: Jan Hutar Date: Thu, 26 Sep 2024 10:08:25 +0200 Subject: [PATCH 5/9] chore: Update RHDH config --- catalog-info.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/catalog-info.yaml b/catalog-info.yaml index f28ae9a..dbd90e4 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -3,12 +3,15 @@ apiVersion: backstage.io/v1alpha1 kind: Component metadata: name: opl - namespace: default + namespace: perfscale description: MBU products perf&scale library spec: type: library lifecycle: production - owner: hce-perfscale-team - system: hce-perfscale + domain: domain:perfscale/perf-dept + owner: group:redhat/hce-perfscale + system: system:perfscale/consoledot-testing dependencyOf: - - component:default/iperf + - component:perfscale/iperf + tags: + - consoledot From edad1e5e3dc49bd42334fad8270200d670a444aa Mon Sep 17 00:00:00 2001 From: Jan Hutar Date: Thu, 26 Sep 2024 11:39:24 +0200 Subject: [PATCH 6/9] chore: Fix repo name --- catalog-info.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog-info.yaml b/catalog-info.yaml index dbd90e4..3880d58 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -2,7 +2,7 @@ apiVersion: backstage.io/v1alpha1 kind: Component metadata: - name: opl + name: OPL namespace: perfscale description: MBU products perf&scale library spec: From b504b6b26f0fd2c16283433600351783ccebb2ec Mon Sep 17 00:00:00 2001 From: Jan Hutar Date: Thu, 26 Sep 2024 11:51:14 +0200 Subject: [PATCH 7/9] chore: Fix name --- catalog-info.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/catalog-info.yaml b/catalog-info.yaml index 3880d58..d7c27af 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -2,7 +2,8 @@ apiVersion: backstage.io/v1alpha1 kind: Component metadata: - name: OPL + title: OPL + name: opl namespace: perfscale description: MBU products perf&scale library spec: From 111ba7fad2485fd87917f0d78f547f67a43211ed Mon Sep 17 00:00:00 2001 From: Rahul Shetty Date: Thu, 10 Oct 2024 17:00:34 +0530 Subject: [PATCH 8/9] KONFLUX-4956 redact sensitive header info from logging --- core/opl/cluster_read.py | 17 +++++++++++++++-- opl/cluster_read.py | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/core/opl/cluster_read.py b/core/opl/cluster_read.py index 9078367..b89e57b 100755 --- a/core/opl/cluster_read.py +++ b/core/opl/cluster_read.py @@ -36,14 +36,27 @@ def execute(command): return result +def redact_sensitive_headers(data: dict): + # Lower-case list of sensitive data in header + sensitive_headers = ['authorization', 'set-cookie', 'x-api-key', 'cookie'] + + redacted_headers = {} + for header, value in data.items(): + if header.lower() in sensitive_headers: + redacted_headers[header] = '' + else: + redacted_headers[header] = value + return redacted_headers + + def _debug_response(r): """ Print various info about the requests response. Should be called when request failed """ logging.error("URL = %s" % r.url) - logging.error("Request headers = %s" % r.request.headers) - logging.error("Response headers = %s" % r.headers) + logging.error("Request headers = %s" % redact_sensitive_headers(r.request.headers)) + logging.error("Response headers = %s" % redact_sensitive_headers(r.headers)) logging.error("Response status code = %s" % r.status_code) logging.error("Response content = %s" % r.content[:500]) raise Exception("Request failed") diff --git a/opl/cluster_read.py b/opl/cluster_read.py index 9078367..b89e57b 100755 --- a/opl/cluster_read.py +++ b/opl/cluster_read.py @@ -36,14 +36,27 @@ def execute(command): return result +def redact_sensitive_headers(data: dict): + # Lower-case list of sensitive data in header + sensitive_headers = ['authorization', 'set-cookie', 'x-api-key', 'cookie'] + + redacted_headers = {} + for header, value in data.items(): + if header.lower() in sensitive_headers: + redacted_headers[header] = '' + else: + redacted_headers[header] = value + return redacted_headers + + def _debug_response(r): """ Print various info about the requests response. Should be called when request failed """ logging.error("URL = %s" % r.url) - logging.error("Request headers = %s" % r.request.headers) - logging.error("Response headers = %s" % r.headers) + logging.error("Request headers = %s" % redact_sensitive_headers(r.request.headers)) + logging.error("Response headers = %s" % redact_sensitive_headers(r.headers)) logging.error("Response status code = %s" % r.status_code) logging.error("Response content = %s" % r.content[:500]) raise Exception("Request failed") From 7d7c71bdca5ba8abd2b05fa1b19635310bf5ba59 Mon Sep 17 00:00:00 2001 From: Rahul Shetty Date: Thu, 10 Oct 2024 17:25:42 +0530 Subject: [PATCH 9/9] fix lint --- core/opl/cluster_read.py | 4 ++-- opl/cluster_read.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/opl/cluster_read.py b/core/opl/cluster_read.py index b89e57b..203df7f 100755 --- a/core/opl/cluster_read.py +++ b/core/opl/cluster_read.py @@ -38,12 +38,12 @@ def execute(command): def redact_sensitive_headers(data: dict): # Lower-case list of sensitive data in header - sensitive_headers = ['authorization', 'set-cookie', 'x-api-key', 'cookie'] + sensitive_headers = ["authorization", "set-cookie", "x-api-key", "cookie"] redacted_headers = {} for header, value in data.items(): if header.lower() in sensitive_headers: - redacted_headers[header] = '' + redacted_headers[header] = "" else: redacted_headers[header] = value return redacted_headers diff --git a/opl/cluster_read.py b/opl/cluster_read.py index b89e57b..203df7f 100755 --- a/opl/cluster_read.py +++ b/opl/cluster_read.py @@ -38,12 +38,12 @@ def execute(command): def redact_sensitive_headers(data: dict): # Lower-case list of sensitive data in header - sensitive_headers = ['authorization', 'set-cookie', 'x-api-key', 'cookie'] + sensitive_headers = ["authorization", "set-cookie", "x-api-key", "cookie"] redacted_headers = {} for header, value in data.items(): if header.lower() in sensitive_headers: - redacted_headers[header] = '' + redacted_headers[header] = "" else: redacted_headers[header] = value return redacted_headers