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

Run a cronjob that generates monthly openshift usage report. #45

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

naved001
Copy link
Collaborator

@naved001 naved001 commented Mar 4, 2024

The k8s cronjob uses an init container that downloads the metrics from the previous month and then the main container generates the report and uploads it to our B2 bucket.

The k8s cronjob uses an init container that downloads the metrics from the
previous month and then the main container generates the report and uploads
it to our B2 bucket.
@naved001 naved001 requested a review from knikolla March 4, 2024 19:22
name: metrics-downloader
data:
script.sh: |
DIRECTORY_NAME=$(date --date="$(date +%Y-%m-15) -1 month" +'data_%Y-%m')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Date command document says this (run info date):

The fuzz in units can cause problems with relative items. For
example, '2003-07-31 -1 month' might evaluate to 2003-07-01, because
2003-06-31 is an invalid date. To determine the previous month more
reliably, you can ask for the month before the 15th of the current
month. For example:

 $ date -R
 Thu, 31 Jul 2003 13:02:39 -0700
 $ date --date='-1 month' +'Last month was %B?'
 Last month was July?
 $ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!'
 Last month was June!

@naved001 naved001 merged commit 79126e0 into CCI-MOC:main Mar 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants