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

add owner tags for jobs and pods #1064

Merged
merged 7 commits into from
Oct 10, 2023

Conversation

shubhindia
Copy link
Contributor

Problem

Currently, komiser doesn't support listing cronJobs

Solution

This PR adds support for listing cronJobs and their pricing as well

Changes Made

  • Added separate function to fetch cronJobs
  • Fixed incorrect log line in Jobs

How to Test

komiser start --config=config.toml

Screenshots

Screenshot 2023-10-10 at 11 54 29 AM

Checklist

  • Code follows the contributing guidelines
  • Changes have been thoroughly tested
  • Documentation has been updated, if necessary
  • Any dependencies have been added to the project, if necessary

Signed-off-by: shubhindia <shubhindia123@gmail.com>
Signed-off-by: shubhindia <shubhindia123@gmail.com>
@shubhindia
Copy link
Contributor Author

shubhindia commented Oct 10, 2023

QQ here, should we have tags based on ownerReference? A cronJob can create multiple jobs and then it would be easy to filter based on owner of that job. Something like this. Same can be done for others as well like pods (most of the objects can/will have ownerReferences and it will be easier to group them by their ownerReference). Let me know if I should add it or not?
Screenshot 2023-10-10 at 12 12 38 PM

Copy link
Collaborator

@Azanul Azanul left a comment

Choose a reason for hiding this comment

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

opencost currently classifies jobs and cronjobs under jobs, ref: https://github.com/opencost/opencost/blob/26b5ba12ac73e612b5328969debf2056478ef0d7/pkg/costmodel/costmodel.go#L128C1-L138C1

There is no separate aggregation by cronjob.

@Azanul
Copy link
Collaborator

Azanul commented Oct 10, 2023

@mlabouardy What kind of coverage are we looking for regarding k8s cron jobs?

@shubhindia
Copy link
Contributor Author

opencost currently classifies jobs and cronjobs under jobs, ref: https://github.com/opencost/opencost/blob/26b5ba12ac73e612b5328969debf2056478ef0d7/pkg/costmodel/costmodel.go#L128C1-L138C1

There is no separate aggregation by cronjob.

My bad. I didn't check the opencost price aggregation. So, I think here it makes more sense to just add owner tags than having a separate service for cronJob? Or we can continue having cronJobs without cost?

@mlabouardy
Copy link
Collaborator

@mlabouardy What kind of coverage are we looking for regarding k8s cron jobs?

as they belong to jobs, I would say collecting the owner tag would be enough

@Azanul
Copy link
Collaborator

Azanul commented Oct 10, 2023

@mlabouardy What kind of coverage are we looking for regarding k8s cron jobs?

as they belong to jobs, I would say collecting the owner tag would be enough

@shubhindia They you go

Signed-off-by: shubhindia <shubhindia123@gmail.com>
@shubhindia shubhindia changed the title add cronJob support add owner tags for jobs Oct 10, 2023
@shubhindia
Copy link
Contributor Author

@Azanul pushed the changes. I think same can be done for pods as well. Tags can help group them together

providers/k8s/core/jobs.go Outdated Show resolved Hide resolved
Signed-off-by: shubhindia <shubhindia123@gmail.com>
@Azanul
Copy link
Collaborator

Azanul commented Oct 10, 2023

@Azanul pushed the changes. I think same can be done for pods as well. Tags can help group them together

Feel free to do the same in this PR only as I don't think it's that big of a change. Also, do update the PR title and description accordingly

Signed-off-by: shubhindia <shubhindia123@gmail.com>
@shubhindia shubhindia changed the title add owner tags for jobs add owner tags for jobs and pods Oct 10, 2023
@Azanul Azanul merged commit 476b273 into tailwarden:develop Oct 10, 2023
2 checks passed
@shubhindia shubhindia deleted the feature/add-cronjob branch October 11, 2023 03:49
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.

3 participants