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

client: use storageclient k8s id as the client id #2891

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/v1alpha1/storageconsumer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ type ClientStatus struct {
// StorageQuotaUtilizationRatio is the ratio of utilized quota of connected client
// +optional
StorageQuotaUtilizationRatio float64 `json:"storageQuotaUtilizationRatio,omitempty"`

// ID is the k8s UID of connected storageclient
// +optional
ID string `json:"clientId,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/ocs.openshift.io_storageconsumers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ spec:
client:
description: Information of storage client received from consumer
properties:
clientId:
description: ID is the k8s UID of connected storageclient
type: string
clusterId:
description: ClusterID is the id of the openshift cluster
type: string
Expand Down
2 changes: 1 addition & 1 deletion controllers/storagecluster/odfinfoconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func getConnectedClients(r *StorageClusterReconciler, storageCluster *ocsv1.Stor
newConnectedClient := ocsv1a1.ConnectedClient{
Name: name,
ClusterID: clusterID,
ClientID: string(storageConsumer.UID),
ClientID: storageConsumer.Status.Client.ID,
}
connectedClients = append(connectedClients, newConnectedClient)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ spec:
client:
description: Information of storage client received from consumer
properties:
clientId:
description: ID is the k8s UID of connected storageclient
type: string
clusterId:
description: ClusterID is the id of the openshift cluster
type: string
Expand Down
3 changes: 3 additions & 0 deletions deploy/ocs-operator/manifests/storageconsumer.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ spec:
client:
description: Information of storage client received from consumer
properties:
clientId:
description: ID is the k8s UID of connected storageclient
type: string
clusterId:
description: ClusterID is the id of the openshift cluster
type: string
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,13 +9,15 @@ type StorageClientStatus interface {
GetClusterID() string
GetClusterName() string
GetClientName() string
GetClientID() string
GetStorageQuotaUtilizationRatio() float64

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

Expand Down
158 changes: 84 additions & 74 deletions services/provider/api/provider.pb.go

Large diffs are not rendered by default.

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) SetClientID(clientID string) ifaces.StorageClientStatus {
r.ClientID = clientID
return r
}

func (r *ReportStatusRequest) SetStorageQuotaUtilizationRatio(storageQuotaUtilizationRatio float64) ifaces.StorageClientStatus {
r.StorageQuotaUtilizationRatio = storageQuotaUtilizationRatio
return r
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 @@ -178,6 +178,8 @@ message ReportStatusRequest{
string clientName = 6;
// storageQuotaUtilizationRatio is the ratio of utilized quota of connected client
double storageQuotaUtilizationRatio = 7;
// clientID is the k8s UID of storageClient
string clientID = 8;

}

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 @@ -218,6 +218,7 @@ func (c *ocsConsumerManager) UpdateConsumerStatus(ctx context.Context, id string
consumerObj.Status.Client.OperatorVersion = status.GetOperatorVersion()
consumerObj.Status.Client.ClusterID = status.GetClusterID()
consumerObj.Status.Client.Name = status.GetClientName()
consumerObj.Status.Client.ID = status.GetClientID()
consumerObj.Status.Client.ClusterName = status.GetClusterName()
consumerObj.Status.Client.StorageQuotaUtilizationRatio = status.GetStorageQuotaUtilizationRatio()

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
Loading