Skip to content

Commit 616a196

Browse files
authored
Merge pull request #91 from naved001/bucket-names
2 parents ef4e830 + 168193b commit 616a196

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

openshift_metrics/merge.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Merges metrics from files and produces reports by pod and by namespace
33
"""
44

5+
import os
56
import argparse
67
from datetime import datetime, UTC
78
import json
@@ -145,23 +146,24 @@ def main():
145146
utils.write_metrics_by_pod(condensed_metrics_dict, pod_report_file, ignore_hours)
146147

147148
if args.upload_to_s3:
149+
bucket_name = os.environ.get("S3_INVOICE_BUCKET", "nerc-invoicing")
148150
primary_location = (
149151
f"Invoices/{report_month}/"
150152
f"Service Invoices/NERC OpenShift {report_month}.csv"
151153
)
152-
utils.upload_to_s3(invoice_file, "nerc-invoicing", primary_location)
154+
utils.upload_to_s3(invoice_file, bucket_name, primary_location)
153155

154156
timestamp = datetime.utcnow().strftime('%Y%m%dT%H%M%SZ')
155157
secondary_location = (
156158
f"Invoices/{report_month}/"
157159
f"Archive/NERC OpenShift {report_month} {timestamp}.csv"
158160
)
159-
utils.upload_to_s3(invoice_file, "nerc-invoicing", secondary_location)
161+
utils.upload_to_s3(invoice_file, bucket_name, secondary_location)
160162
pod_report_location = (
161163
f"Invoices/{report_month}/"
162164
f"Archive/Pod-NERC OpenShift {report_month} {timestamp}.csv"
163165
)
164-
utils.upload_to_s3(pod_report_file, "nerc-invoicing", pod_report_location)
166+
utils.upload_to_s3(pod_report_file, bucket_name, pod_report_location)
165167

166168
if __name__ == "__main__":
167169
main()

openshift_metrics/openshift_prometheus_metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def main():
111111
json.dump(metrics_dict, file)
112112

113113
if args.upload_to_s3:
114-
utils.upload_to_s3(output_file, "openshift-metrics", s3_location)
115-
114+
bucket_name = os.environ.get("S3_METRICS_BUCKET", "openshift_metrics")
115+
utils.upload_to_s3(output_file, bucket_name, s3_location)
116116

117117
if __name__ == "__main__":
118118
main()

0 commit comments

Comments
 (0)