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

api: adding role and set correct name to get CRQ #268

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

rchikatw
Copy link
Contributor

  • Adding a cluster role to get the cluster resource quota from a status reporter
  • the name of CRQ is not always same as storage client so changing the logic as per the format

@@ -207,7 +207,7 @@ func setClusterInformation(ctx context.Context, cl client.Client, status interfa

func setStorageQuotaUtilizationRatio(ctx context.Context, cl client.Client, status interfaces.StorageClientStatus) {
clusterResourceQuota := &quotav1.ClusterResourceQuota{}
clusterResourceQuota.Name = status.GetClientName()
clusterResourceQuota.Name = fmt.Sprintf("storage-client-%s-resourceqouta", utils.GetMD5Hash(status.GetClientName()))
Copy link
Member

Choose a reason for hiding this comment

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

please use helper function to get the Name so that we will have single source of truth to generate names, if not we are going to get into the problems where we are generating names in different places with strings

- clusterresourcequotas
verbs:
- get
- list
Copy link
Member

Choose a reason for hiding this comment

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

why do we need list access?

@@ -166,3 +166,7 @@ func mutate(f controllerutil.MutateFn, key client.ObjectKey, obj client.Object)
}
return nil
}

func GetClusterResourceQuotaName(name string) string {
return fmt.Sprintf("storage-client-%s-resourceqouta", GetMD5Hash(name))
Copy link
Member

Choose a reason for hiding this comment

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

typo in qouta its quota

btw why did we need resoucequota in the name as its already ClusterResourceQuota.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I cannot change the name of the resource right now because it has inherited from version 4.17. If I change it, I will need to conduct tests for the upgrade and some other scenarios. I will create a new task for this and work on it. Thank you for eyeing on that.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link

openshift-ci bot commented Nov 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Madhu-1, rchikatw

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 284e512 into red-hat-storage:main Nov 13, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants