Skip to content

Commit

Permalink
Fix panic when tracking managed cluster heartbeat (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
eromanova authored Dec 16, 2024
1 parent ef63114 commit 7c83fbc
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions api/v1alpha1/templates_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ type TemplateStatusCommon struct {
// ChartRef is a reference to a source controller resource containing the
// Helm chart representing the template.
ChartRef *helmcontrollerv2.CrossNamespaceSourceReference `json:"chartRef,omitempty"`
// ChartVersion represents the version of the Helm Chart associated with this template.
ChartVersion string `json:"chartVersion,omitempty"`
// Description contains information about the template.
Description string `json:"description,omitempty"`

Expand Down
2 changes: 2 additions & 0 deletions internal/controller/template_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ func (r *TemplateReconciler) ReconcileTemplate(ctx context.Context, template tem
Name: hcChart.Name,
Namespace: hcChart.Namespace,
}
status.ChartVersion = hcChart.Spec.Version

if reportStatus, err := helm.ArtifactReady(hcChart); err != nil {
l.Info("HelmChart Artifact is not ready")
if reportStatus {
Expand Down
2 changes: 1 addition & 1 deletion internal/telemetry/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (t *Tracker) trackManagedClusterHeartbeat(ctx context.Context) error {
string(managedCluster.UID),
clusterID,
managedCluster.Spec.Template,
template.Spec.Helm.ChartSpec.Version,
template.Status.ChartVersion,
template.Status.Providers,
)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ spec:
- kind
- name
type: object
chartVersion:
description: ChartVersion represents the version of the Helm Chart
associated with this template.
type: string
config:
description: |-
Config demonstrates available parameters for template customization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ spec:
- kind
- name
type: object
chartVersion:
description: ChartVersion represents the version of the Helm Chart
associated with this template.
type: string
config:
description: |-
Config demonstrates available parameters for template customization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ spec:
- kind
- name
type: object
chartVersion:
description: ChartVersion represents the version of the Helm Chart
associated with this template.
type: string
config:
description: |-
Config demonstrates available parameters for template customization,
Expand Down

0 comments on commit 7c83fbc

Please sign in to comment.