@@ -11,24 +11,24 @@ import (
1111 "k8s.io/client-go/kubernetes"
1212)
1313
14- // Labels contains the metadata information needed for reporting to Agent
14+ // Labels contains the metadata information needed for reporting to Agent v3
1515type Labels struct {
16- ProductName string `json:"product_name "`
17- ProductVersion string `json:"product_version "`
18- ClusterID string `json:"cluster_id "`
19- DeploymentName string `json:"deployment_name "`
20- DeploymentID string `json:"deployment_id "`
21- DeploymentNamespace string `json:"deployment_namespace "`
16+ ProductType string `json:"product-type "`
17+ ProductVersion string `json:"product-version "`
18+ ClusterID string `json:"cluster-id "`
19+ InstallationName string `json:"installation-name "`
20+ InstallationID string `json:"installation-id "`
21+ InstallationNamespace string `json:"installation-namespace "`
2222}
2323
24- func newMetadataInfo (deploymentNamespace , clusterID , deploymentID , productVersion , deploymentName string ) * Labels {
24+ func newMetadataInfo (installationNamespace , clusterID , installationID , productVersion , installationName string ) * Labels {
2525 return & Labels {
26- ProductName : "nic" ,
27- ProductVersion : productVersion ,
28- ClusterID : clusterID ,
29- DeploymentID : deploymentID ,
30- DeploymentName : deploymentName ,
31- DeploymentNamespace : deploymentNamespace ,
26+ ProductType : "nic" ,
27+ ProductVersion : productVersion ,
28+ ClusterID : clusterID ,
29+ InstallationID : installationID ,
30+ InstallationName : installationName ,
31+ InstallationNamespace : installationNamespace ,
3232 }
3333}
3434
@@ -52,19 +52,19 @@ func NewMetadataReporter(client kubernetes.Interface, pod *api_v1.Pod, version s
5252
5353// CollectAndWrite collects the metadata information and returns a Labels struct
5454func (md * Metadata ) CollectAndWrite (ctx context.Context ) (* Labels , error ) {
55- deploymentNamespace := md .PodNSName .Namespace
55+ installationNamespace := md .PodNSName .Namespace
5656 clusterID , err := clusterInfo .GetClusterID (ctx , md .K8sClientReader )
5757 if err != nil {
5858 return nil , fmt .Errorf ("error collecting ClusterID: %w" , err )
5959 }
60- deploymentID , err := clusterInfo .GetInstallationID (ctx , md .K8sClientReader , md .PodNSName )
60+ installationID , err := clusterInfo .GetInstallationID (ctx , md .K8sClientReader , md .PodNSName )
6161 if err != nil {
6262 return nil , fmt .Errorf ("error collecting InstallationID: %w" , err )
6363 }
64- deploymentName , err := clusterInfo .GetDeploymentName (ctx , md .K8sClientReader , md .PodNSName )
64+ installationName , err := clusterInfo .GetInstallationName (ctx , md .K8sClientReader , md .PodNSName )
6565 if err != nil {
66- return nil , fmt .Errorf ("error collecting DeploymentName : %w" , err )
66+ return nil , fmt .Errorf ("error collecting InstallationName : %w" , err )
6767 }
68- info := newMetadataInfo (deploymentNamespace , clusterID , deploymentID , md .NICVersion , deploymentName )
68+ info := newMetadataInfo (installationNamespace , clusterID , installationID , md .NICVersion , installationName )
6969 return info , nil
7070}
0 commit comments