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

Report embedded cluster version #4447

Merged
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
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this table is not used. won't hurt to add this, but the table is generally outdated now (some missing datapoints). should we consider removing it?

- 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
Loading