Skip to content

Commit

Permalink
Adding usedCapacity for storage consumer api
Browse files Browse the repository at this point in the history
Signed-off-by: rchikatw <[email protected]>
  • Loading branch information
rchikatw committed Oct 8, 2024
1 parent cfe597a commit 8c3ef57
Show file tree
Hide file tree
Showing 14 changed files with 183 additions and 116 deletions.
4 changes: 4 additions & 0 deletions api/v1alpha1/storageconsumer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ type ClientStatus struct {
// Name is the name of connected storageclient
// +optional
Name string `json:"name,omitempty"`

// StorageQuotaUtilizationRatio is the ratio of utilized quota of connected client
// +optional
StorageQuotaUtilizationRatio string `json:"storageQuotaUtilizationRatio,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/ocs.openshift.io_storageconsumers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ spec:
platformVersion:
description: StorageClient Platform Version
type: string
storageQuotaUtilizationRatio:
description: StorageQuotaUtilizationRatio is the ratio of utilized
quota of connected client
type: string
type: object
lastHeartbeat:
description: Timestamp of last heartbeat received from consumer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ spec:
platformVersion:
description: StorageClient Platform Version
type: string
storageQuotaUtilizationRatio:
description: StorageQuotaUtilizationRatio is the ratio of utilized
quota of connected client
type: string
type: object
lastHeartbeat:
description: Timestamp of last heartbeat received from consumer
Expand Down
4 changes: 4 additions & 0 deletions deploy/ocs-operator/manifests/storageconsumer.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ spec:
platformVersion:
description: StorageClient Platform Version
type: string
storageQuotaUtilizationRatio:
description: StorageQuotaUtilizationRatio is the ratio of utilized
quota of connected client
type: string
type: object
lastHeartbeat:
description: Timestamp of last heartbeat received from consumer
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions services/provider/api/interfaces/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ type StorageClientStatus interface {
GetClusterID() string
GetClusterName() string
GetClientName() string
GetStorageQuotaUtilizationRatio() string

SetPlatformVersion(string) StorageClientStatus
SetOperatorVersion(string) StorageClientStatus
SetClusterID(string) StorageClientStatus
SetClusterName(string) StorageClientStatus
SetClientName(string) StorageClientStatus
SetStorageQuotaUtilizationRatio(string) StorageClientStatus
}

type StorageClientOnboarding interface {
Expand Down
129 changes: 71 additions & 58 deletions services/provider/api/provider.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions services/provider/api/storageclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ func (r *ReportStatusRequest) SetClusterName(clusterName string) ifaces.StorageC
return r
}

func (r *ReportStatusRequest) SetStorageQuotaUtilizationRatio(storageQuotaUtilizationRatio string) ifaces.StorageClientStatus {
r.StorageQuotaUtilizationRatio = storageQuotaUtilizationRatio
return r
}

// ensure OnboardConsumerRequest satisfies StorageClientOnboarding interface
var _ ifaces.StorageClientOnboarding = &OnboardConsumerRequest{}

Expand Down
2 changes: 2 additions & 0 deletions services/provider/proto/provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ message ReportStatusRequest{
string clusterName = 5;
// clientName is the name of the connected storageclient
string clientName = 6;
// storageQuotaUtilizationRatio is the ratio of utilized quota of connected client
string storageQuotaUtilizationRatio = 7;

}

Expand Down
1 change: 1 addition & 0 deletions services/provider/server/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ func (c *ocsConsumerManager) UpdateConsumerStatus(ctx context.Context, id string
consumerObj.Status.Client.ClusterID = status.GetClusterID()
consumerObj.Status.Client.Name = status.GetClientName()
consumerObj.Status.Client.ClusterName = status.GetClusterName()
consumerObj.Status.Client.StorageQuotaUtilizationRatio = status.GetStorageQuotaUtilizationRatio()

if err := c.client.Status().Update(ctx, consumerObj); err != nil {
return fmt.Errorf("Failed to patch Status for StorageConsumer %v: %v", consumerObj.Name, err)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8c3ef57

Please sign in to comment.