Adapt HelmRelease revision to API v2

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
pull/4775/head
Stefan Prodan 8 months ago
parent b85d34644b
commit 472396728b
No known key found for this signature in database
GPG Key ID: 3299AEB0E4085BAF

@ -309,7 +309,7 @@ func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
}
logger.Successf("HelmRelease %s is ready", name)
logger.Successf("applied revision %s", helmRelease.Status.LastAppliedRevision)
logger.Successf("applied revision %s", getHelmReleaseRevision(helmRelease))
return nil
}

@ -72,9 +72,16 @@ func init() {
getCmd.AddCommand(getHelmReleaseCmd)
}
func getHelmReleaseRevision(helmRelease helmv2.HelmRelease) string {
if helmRelease.Status.History != nil && len(helmRelease.Status.History) > 0 {
return helmRelease.Status.History[0].ChartVersion
}
return helmRelease.Status.LastAttemptedRevision
}
func (a helmReleaseListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
item := a.Items[i]
revision := item.Status.LastAppliedRevision
revision := getHelmReleaseRevision(item)
status, msg := statusAndMessage(item.Status.Conditions)
return append(nameColumns(&item, includeNamespace, includeKind),
revision, cases.Title(language.English).String(strconv.FormatBool(item.Spec.Suspend)), status, msg)

@ -55,7 +55,7 @@ func (obj helmReleaseAdapter) setUnsuspended() {
}
func (obj helmReleaseAdapter) successMessage() string {
return fmt.Sprintf("applied revision %s", obj.Status.LastAppliedRevision)
return fmt.Sprintf("applied revision %s", getHelmReleaseRevision(*obj.HelmRelease))
}
func (a helmReleaseListAdapter) resumeItem(i int) resumable {

@ -59,11 +59,9 @@ status:
status: "True"
type: Ready
helmChart: {{ .fluxns }}/podinfo-podinfo
lastAppliedRevision: 6.3.5
lastAttemptedRevision: 6.3.5
lastAttemptedValuesChecksum: c31db75d05b7515eba2eef47bd71038c74b2e531
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmChart
metadata:
name: podinfo-podinfo
@ -90,7 +88,7 @@ status:
type: Ready
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
labels:
@ -126,7 +124,6 @@ spec:
sourceRef:
kind: GitRepository
name: flux-system
validation: client
interval: 5m
prune: true
status:

@ -448,7 +448,7 @@ Namespace: {{.HelmRelease.Namespace}}
{{- if .HelmRelease.Spec.TargetNamespace }}
Target: {{.HelmRelease.Spec.TargetNamespace}}
{{- end }}
Revision: {{.HelmRelease.Status.LastAppliedRevision}}
Revision: {{.HelmRelease.Status.LastAttemptedRevision}}
{{- if .HelmReleaseReady }}
Status: Last reconciled at {{.HelmReleaseReady.LastTransitionTime}}
Message: {{.HelmReleaseReady.Message}}

Loading…
Cancel
Save