Skip to content

Commit

Permalink
Report embedded cluster version (#4447)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgalsaleh authored Feb 15, 2024
1 parent 1139997 commit 8d3393a
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions migrations/tables/instance-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ spec:
type: text
- name: embedded_cluster_id
type: text
- name: embedded_cluster_version
type: text
- name: is_gitops_enabled
type: integer
- name: gitops_provider
Expand Down
1 change: 1 addition & 0 deletions pkg/api/reporting/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type ReportingInfo struct {
KOTSInstallID string `json:"kots_install_id"`
KURLInstallID string `json:"kurl_install_id"`
EmbeddedClusterID string `json:"embedded_cluster_id"`
EmbeddedClusterVersion string `json:"embedded_cluster_version"`
IsGitOpsEnabled bool `json:"is_gitops_enabled"`
GitOpsProvider string `json:"gitops_provider"`
SnapshotProvider string `json:"snapshot_provider"`
Expand Down
11 changes: 6 additions & 5 deletions pkg/reporting/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,12 @@ func GetReportingInfo(appID string) *types.ReportingInfo {
}

r := types.ReportingInfo{
InstanceID: appID,
KOTSInstallID: os.Getenv("KOTS_INSTALL_ID"),
KURLInstallID: os.Getenv("KURL_INSTALL_ID"),
EmbeddedClusterID: os.Getenv("EMBEDDED_CLUSTER_ID"),
UserAgent: buildversion.GetUserAgent(),
InstanceID: appID,
KOTSInstallID: os.Getenv("KOTS_INSTALL_ID"),
KURLInstallID: os.Getenv("KURL_INSTALL_ID"),
EmbeddedClusterID: os.Getenv("EMBEDDED_CLUSTER_ID"),
EmbeddedClusterVersion: os.Getenv("EMBEDDED_CLUSTER_VERSION"),
UserAgent: buildversion.GetUserAgent(),
}

cfg, err := k8sutil.GetClusterConfig()
Expand Down
1 change: 1 addition & 0 deletions pkg/reporting/app_airgap.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func BuildInstanceReport(licenseID string, reportingInfo *types.ReportingInfo) *
KotsInstallID: reportingInfo.KOTSInstallID,
KurlInstallID: reportingInfo.KURLInstallID,
EmbeddedClusterID: reportingInfo.EmbeddedClusterID,
EmbeddedClusterVersion: reportingInfo.EmbeddedClusterVersion,
IsGitOpsEnabled: reportingInfo.IsGitOpsEnabled,
GitOpsProvider: reportingInfo.GitOpsProvider,
SnapshotProvider: reportingInfo.SnapshotProvider,
Expand Down
1 change: 1 addition & 0 deletions pkg/reporting/instance_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type InstanceReportEvent struct {
KotsInstallID string `json:"kots_install_id,omitempty"`
KurlInstallID string `json:"kurl_install_id,omitempty"`
EmbeddedClusterID string `json:"embedded_cluster_id,omitempty"`
EmbeddedClusterVersion string `json:"embedded_cluster_version,omitempty"`
IsGitOpsEnabled bool `json:"is_gitops_enabled"`
GitOpsProvider string `json:"gitops_provider"`
SnapshotProvider string `json:"snapshot_provider"`
Expand Down
1 change: 1 addition & 0 deletions pkg/reporting/report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ func createTestInstanceEvent(reportedAt int64) InstanceReportEvent {
KotsInstallID: "test-kots-install-id",
KurlInstallID: "test-kurl-install-id",
EmbeddedClusterID: "test-embedded-cluster-id",
EmbeddedClusterVersion: "test-embedded-cluster-version",
IsGitOpsEnabled: true,
GitOpsProvider: "test-gitops-provider",
SnapshotProvider: "test-snapshot-provider",
Expand Down
3 changes: 3 additions & 0 deletions pkg/reporting/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ func GetReportingInfoHeaders(reportingInfo *types.ReportingInfo) map[string]stri
if reportingInfo.EmbeddedClusterID != "" {
headers["X-Replicated-EmbeddedClusterID"] = reportingInfo.EmbeddedClusterID
}
if reportingInfo.EmbeddedClusterVersion != "" {
headers["X-Replicated-EmbeddedClusterVersion"] = reportingInfo.EmbeddedClusterVersion
}

headers["X-Replicated-KurlNodeCountTotal"] = strconv.Itoa(reportingInfo.KurlNodeCountTotal)
headers["X-Replicated-KurlNodeCountReady"] = strconv.Itoa(reportingInfo.KurlNodeCountReady)
Expand Down

0 comments on commit 8d3393a

Please sign in to comment.