Skip to content

Commit

Permalink
Merge pull request #2504 from raaizik/rdr-odfinfo-server
Browse files Browse the repository at this point in the history
RDR: exporting client info
  • Loading branch information
openshift-merge-bot[bot] authored Mar 21, 2024
2 parents 8f94626 + 95dc675 commit 62071d9
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 62 deletions.
4 changes: 4 additions & 0 deletions api/v1alpha1/storageconsumer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ type ClientStatus struct {
PlatformVersion string `json:"platformVersion"`
// StorageClient Operator Version
OperatorVersion string `json:"operatorVersion"`
// ClusterID is the id of the openshift cluster
ClusterID string `json:"clusterId"`
// NamespacedName is the name and namespace of the StorageClient
NamespacedName string `json:"namespacedName"`
}

//+kubebuilder:object:root=true
Expand Down
8 changes: 8 additions & 0 deletions config/crd/bases/ocs.openshift.io_storageconsumers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,21 @@ spec:
client:
description: Information of storage client received from consumer
properties:
clusterId:
description: ClusterID is the id of the openshift cluster
type: string
namespacedName:
description: NamespacedName is the name and namespace of the StorageClient
type: string
operatorVersion:
description: StorageClient Operator Version
type: string
platformVersion:
description: StorageClient Platform Version
type: string
required:
- clusterId
- namespacedName
- operatorVersion
- platformVersion
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,21 @@ spec:
client:
description: Information of storage client received from consumer
properties:
clusterId:
description: ClusterID is the id of the openshift cluster
type: string
namespacedName:
description: NamespacedName is the name and namespace of the StorageClient
type: string
operatorVersion:
description: StorageClient Operator Version
type: string
platformVersion:
description: StorageClient Platform Version
type: string
required:
- clusterId
- namespacedName
- operatorVersion
- platformVersion
type: object
Expand Down
8 changes: 8 additions & 0 deletions deploy/ocs-operator/manifests/storageconsumer.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,21 @@ spec:
client:
description: Information of storage client received from consumer
properties:
clusterId:
description: ClusterID is the id of the openshift cluster
type: string
namespacedName:
description: NamespacedName is the name and namespace of the StorageClient
type: string
operatorVersion:
description: StorageClient Operator Version
type: string
platformVersion:
description: StorageClient Platform Version
type: string
required:
- clusterId
- namespacedName
- operatorVersion
- platformVersion
type: object
Expand Down
4 changes: 4 additions & 0 deletions services/provider/interfaces/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ type StorageClientStatus interface {
// no client is using it
GetPlatformVersion() string
GetOperatorVersion() string
GetClusterID() string
GetNamespacedName() string

SetPlatformVersion(string) StorageClientStatus
SetOperatorVersion(string) StorageClientStatus
SetClusterID(string) StorageClientStatus
SetNamespacedName(string) StorageClientStatus
}

type StorageClientOnboarding interface {
Expand Down
140 changes: 81 additions & 59 deletions services/provider/pb/provider.pb.go

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

10 changes: 10 additions & 0 deletions services/provider/pb/storageclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ func (r *ReportStatusRequest) SetOperatorVersion(version string) ifaces.StorageC
return r
}

func (r *ReportStatusRequest) SetClusterID(clusterID string) ifaces.StorageClientStatus {
r.ClusterID = clusterID
return r
}

func (r *ReportStatusRequest) SetNamespacedName(namespacedName string) ifaces.StorageClientStatus {
r.NamespacedName = namespacedName
return r
}

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

Expand Down
4 changes: 4 additions & 0 deletions services/provider/proto/provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ message ReportStatusRequest{
string storageConsumerUUID = 1;
string clientPlatformVersion = 2;
string clientOperatorVersion = 3;
// clusterID is the id of the openshift cluster
string clusterID = 4;
// NamespacedName is the name and namespace of the StorageClient
string NamespacedName = 5;
}

message ReportStatusResponse{
Expand Down
2 changes: 2 additions & 0 deletions services/provider/server/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ func (c *ocsConsumerManager) UpdateConsumerStatus(ctx context.Context, id string
consumerObj.Status.LastHeartbeat = metav1.Now()
consumerObj.Status.Client.PlatformVersion = status.GetPlatformVersion()
consumerObj.Status.Client.OperatorVersion = status.GetOperatorVersion()
consumerObj.Status.Client.ClusterID = status.GetClusterID()
consumerObj.Status.Client.NamespacedName = status.GetNamespacedName()

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
Loading

0 comments on commit 62071d9

Please sign in to comment.