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

Fix panic when tracking managed cluster heartbeat #798

Merged
merged 1 commit into from
Dec 16, 2024
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 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
Loading