Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reconcile: tweak event messages
Browse files Browse the repository at this point in the history
This in an attempt to maintain compatability with earlier documented
inclusion and exclusion lists for Alerts, like the following:

```
  eventSources:
    - kind: HelmRelease
      name: demo
  inclusionList:
    - ".*.upgrade.*succeeded.*"
```

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
hiddeco committed Sep 22, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
hiddeco Hidde Beydals
1 parent 92ff87b commit 9e467fb
Showing 14 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion internal/reconcile/atomic_release_test.go
Original file line number Diff line number Diff line change
@@ -177,7 +177,7 @@ func TestAtomicRelease_Reconcile(t *testing.T) {
Type: v2.ReleasedCondition,
Status: metav1.ConditionTrue,
Reason: v2.InstallSucceededReason,
Message: "Installed release",
Message: "Helm install succeeded",
},
{
Type: v2.TestSuccessCondition,
4 changes: 2 additions & 2 deletions internal/reconcile/install.go
Original file line number Diff line number Diff line change
@@ -108,9 +108,9 @@ func (r *Install) Type() ReconcilerType {

const (
// fmtInstallFailure is the message format for an installation failure.
fmtInstallFailure = "Install of release %s/%s with chart %s@%s failed: %s"
fmtInstallFailure = "Helm install failed for release %s/%s with chart %s@%s: %s"
// fmtInstallSuccess is the message format for a successful installation.
fmtInstallSuccess = "Installed release %s with chart %s"
fmtInstallSuccess = "Helm install succeeded for release %s with chart %s"
)

// failure records the failure of a Helm installation action in the status of
12 changes: 6 additions & 6 deletions internal/reconcile/install_test.go
Original file line number Diff line number Diff line change
@@ -89,9 +89,9 @@ func TestInstall_Reconcile(t *testing.T) {
chart: testutil.BuildChart(),
expectConditions: []metav1.Condition{
*conditions.TrueCondition(meta.ReadyCondition, v2.InstallSucceededReason,
"Installed release"),
"Helm install succeeded"),
*conditions.TrueCondition(v2.ReleasedCondition, v2.InstallSucceededReason,
"Installed release"),
"Helm install succeeded"),
},
expectCurrent: func(releases []*helmrelease.Release) *v2.Snapshot {
return release.ObservedToSnapshot(release.ObserveRelease(releases[0]))
@@ -159,9 +159,9 @@ func TestInstall_Reconcile(t *testing.T) {
chart: testutil.BuildChart(),
expectConditions: []metav1.Condition{
*conditions.TrueCondition(meta.ReadyCondition, v2.InstallSucceededReason,
"Installed release"),
"Helm install succeeded"),
*conditions.TrueCondition(v2.ReleasedCondition, v2.InstallSucceededReason,
"Installed release"),
"Helm install succeeded"),
},
expectCurrent: func(releases []*helmrelease.Release) *v2.Snapshot {
return release.ObservedToSnapshot(release.ObserveRelease(releases[1]))
@@ -188,9 +188,9 @@ func TestInstall_Reconcile(t *testing.T) {
chart: testutil.BuildChart(),
expectConditions: []metav1.Condition{
*conditions.TrueCondition(meta.ReadyCondition, v2.InstallSucceededReason,
"Installed release"),
"Helm install succeeded"),
*conditions.TrueCondition(v2.ReleasedCondition, v2.InstallSucceededReason,
"Installed release"),
"Helm install succeeded"),
},
expectCurrent: func(releases []*helmrelease.Release) *v2.Snapshot {
return release.ObservedToSnapshot(release.ObserveRelease(releases[0]))
4 changes: 2 additions & 2 deletions internal/reconcile/rollback_remediation.go
Original file line number Diff line number Diff line change
@@ -125,10 +125,10 @@ func (r *RollbackRemediation) Type() ReconcilerType {
const (
// fmtRollbackRemediationFailure is the message format for a rollback
// remediation failure.
fmtRollbackRemediationFailure = "Rollback to previous release %s with chart %s failed: %s"
fmtRollbackRemediationFailure = "Helm rollback to previous release %s with chart %s failed: %s"
// fmtRollbackRemediationSuccess is the message format for a successful
// rollback remediation.
fmtRollbackRemediationSuccess = "Rolled back to previous release %s with chart %s"
fmtRollbackRemediationSuccess = "Helm rollback to previous release %s with chart %s succeeded"
)

// failure records the failure of a Helm rollback action in the status of the
4 changes: 2 additions & 2 deletions internal/reconcile/rollback_remediation_test.go
Original file line number Diff line number Diff line change
@@ -113,8 +113,8 @@ func TestRollbackRemediation_Reconcile(t *testing.T) {
}
},
expectConditions: []metav1.Condition{
*conditions.FalseCondition(meta.ReadyCondition, v2.RollbackSucceededReason, "Rolled back to"),
*conditions.TrueCondition(v2.RemediatedCondition, v2.RollbackSucceededReason, "Rolled back to"),
*conditions.FalseCondition(meta.ReadyCondition, v2.RollbackSucceededReason, "succeeded"),
*conditions.TrueCondition(v2.RemediatedCondition, v2.RollbackSucceededReason, "succeeded"),
},
expectCurrent: func(releases []*helmrelease.Release) *v2.Snapshot {
return release.ObservedToSnapshot(release.ObserveRelease(releases[2]))
6 changes: 3 additions & 3 deletions internal/reconcile/test.go
Original file line number Diff line number Diff line change
@@ -121,11 +121,11 @@ func (r *Test) Type() ReconcilerType {

const (
// fmtTestPending is the message format used when awaiting tests to be run.
fmtTestPending = "Release %s with chart %s is awaiting tests"
fmtTestPending = "Helm release %s with chart %s is awaiting tests"
// fmtTestFailure is the message format for a test failure.
fmtTestFailure = "Test for release %s with chart %s failed: %s"
fmtTestFailure = "Helm test failed for release %s with chart %s: %s"
// fmtTestSuccess is the message format for a successful test.
fmtTestSuccess = "Tests for release %s with chart %s succeeded: %s"
fmtTestSuccess = "Helm test succeeded for release %s with chart %s: %s"
)

// failure records the failure of a Helm test action in the status of the given
4 changes: 2 additions & 2 deletions internal/reconcile/uninstall.go
Original file line number Diff line number Diff line change
@@ -142,9 +142,9 @@ func (r *Uninstall) Type() ReconcilerType {

const (
// fmtUninstallFailed is the message format for an uninstall failure.
fmtUninstallFailure = "Uninstall of release %s with chart %s failed: %s"
fmtUninstallFailure = "Helm uninstall failed for release %s with chart %s: %s"
// fmtUninstallSuccess is the message format for a successful uninstall.
fmtUninstallSuccess = "Uninstalled release %s with chart %s"
fmtUninstallSuccess = "Helm uninstall succeeded for release %s with chart %s"
)

// failure records the failure of a Helm uninstall action in the status of the
4 changes: 2 additions & 2 deletions internal/reconcile/uninstall_remediation.go
Original file line number Diff line number Diff line change
@@ -132,10 +132,10 @@ func (r *UninstallRemediation) Type() ReconcilerType {
const (
// fmtUninstallRemediationFailure is the message format for an uninstall
// remediation failure.
fmtUninstallRemediationFailure = "Uninstall remediation for release %s with chart %s failed: %s"
fmtUninstallRemediationFailure = "Helm uninstall remediation for release %s with chart %s failed: %s"
// fmtUninstallRemediationSuccess is the message format for a successful
// uninstall remediation.
fmtUninstallRemediationSuccess = "Uninstall remediation for release %s with chart %s succeeded"
fmtUninstallRemediationSuccess = "Helm uninstall remediation for release %s with chart %s succeeded"
)

// success records the success of a Helm uninstall remediation action in the
2 changes: 1 addition & 1 deletion internal/reconcile/uninstall_remediation_test.go
Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@ func TestUninstallRemediation_Reconcile(t *testing.T) {
},
expectConditions: []metav1.Condition{
*conditions.TrueCondition(v2.RemediatedCondition, v2.UninstallSucceededReason,
"Uninstall remediation for release"),
"succeeded"),
},
expectCurrent: func(releases []*helmrelease.Release) *v2.Snapshot {
return release.ObservedToSnapshot(release.ObserveRelease(releases[0]))
4 changes: 2 additions & 2 deletions internal/reconcile/uninstall_test.go
Original file line number Diff line number Diff line change
@@ -107,9 +107,9 @@ func TestUninstall_Reconcile(t *testing.T) {
},
expectConditions: []metav1.Condition{
*conditions.FalseCondition(meta.ReadyCondition, v2.UninstallSucceededReason,
"Uninstalled release"),
"succeeded"),
*conditions.FalseCondition(v2.ReleasedCondition, v2.UninstallSucceededReason,
"Uninstalled release"),
"succeeded"),
},
expectCurrent: func(releases []*helmrelease.Release) *v2.Snapshot {
return release.ObservedToSnapshot(release.ObserveRelease(releases[0]))
4 changes: 2 additions & 2 deletions internal/reconcile/unlock.go
Original file line number Diff line number Diff line change
@@ -115,9 +115,9 @@ func (r *Unlock) Type() ReconcilerType {

const (
// fmtUnlockFailure is the message format for an unlock failure.
fmtUnlockFailure = "Unlock of release %s with chart %s in %s state failed: %s"
fmtUnlockFailure = "Unlock of Helm release %s with chart %s in %s state failed: %s"
// fmtUnlockSuccess is the message format for a successful unlock.
fmtUnlockSuccess = "Unlocked release %s with chart %s in %s state"
fmtUnlockSuccess = "Unlocked Helm release %s with chart %s in %s state"
)

// failure records the failure of an unlock action in the status of the given
8 changes: 4 additions & 4 deletions internal/reconcile/unlock_test.go
Original file line number Diff line number Diff line change
@@ -104,8 +104,8 @@ func TestUnlock_Reconcile(t *testing.T) {
}
},
expectConditions: []metav1.Condition{
*conditions.FalseCondition(meta.ReadyCondition, "PendingRelease", "Unlocked release"),
*conditions.FalseCondition(v2.ReleasedCondition, "PendingRelease", "Unlocked release"),
*conditions.FalseCondition(meta.ReadyCondition, "PendingRelease", "Unlocked Helm release"),
*conditions.FalseCondition(v2.ReleasedCondition, "PendingRelease", "Unlocked Helm release"),
},
expectCurrent: func(releases []*helmrelease.Release) *v2.Snapshot {
return release.ObservedToSnapshot(release.ObserveRelease(releases[0]))
@@ -139,8 +139,8 @@ func TestUnlock_Reconcile(t *testing.T) {
},
wantErr: mockUpdateErr,
expectConditions: []metav1.Condition{
*conditions.FalseCondition(meta.ReadyCondition, "PendingRelease", "Unlock of release"),
*conditions.FalseCondition(v2.ReleasedCondition, "PendingRelease", "Unlock of release"),
*conditions.FalseCondition(meta.ReadyCondition, "PendingRelease", "in pending-rollback state failed: storage update error"),
*conditions.FalseCondition(v2.ReleasedCondition, "PendingRelease", "in pending-rollback state failed: storage update error"),
},
expectCurrent: func(releases []*helmrelease.Release) *v2.Snapshot {
return release.ObservedToSnapshot(release.ObserveRelease(releases[0]))
4 changes: 2 additions & 2 deletions internal/reconcile/upgrade.go
Original file line number Diff line number Diff line change
@@ -108,9 +108,9 @@ func (r *Upgrade) Type() ReconcilerType {

const (
// fmtUpgradeFailure is the message format for an upgrade failure.
fmtUpgradeFailure = "Upgrade of release %s/%s with chart %s@%s failed: %s"
fmtUpgradeFailure = "Helm upgrade failed for release %s/%s with chart %s@%s: %s"
// fmtUpgradeSuccess is the message format for a successful upgrade.
fmtUpgradeSuccess = "Upgraded release %s with chart %s"
fmtUpgradeSuccess = "Helm upgrade succeeded for release %s with chart %s"
)

// failure records the failure of a Helm upgrade action in the status of the
12 changes: 6 additions & 6 deletions internal/reconcile/upgrade_test.go
Original file line number Diff line number Diff line change
@@ -111,8 +111,8 @@ func TestUpgrade_Reconcile(t *testing.T) {
}
},
expectConditions: []metav1.Condition{
*conditions.TrueCondition(meta.ReadyCondition, v2.UpgradeSucceededReason, "Upgraded release"),
*conditions.TrueCondition(v2.ReleasedCondition, v2.UpgradeSucceededReason, "Upgraded release"),
*conditions.TrueCondition(meta.ReadyCondition, v2.UpgradeSucceededReason, "Helm upgrade succeeded"),
*conditions.TrueCondition(v2.ReleasedCondition, v2.UpgradeSucceededReason, "Helm upgrade succeeded"),
},
expectCurrent: func(releases []*helmrelease.Release) *v2.Snapshot {
return release.ObservedToSnapshot(release.ObserveRelease(releases[1]))
@@ -261,8 +261,8 @@ func TestUpgrade_Reconcile(t *testing.T) {
}
},
expectConditions: []metav1.Condition{
*conditions.TrueCondition(meta.ReadyCondition, v2.UpgradeSucceededReason, "Upgraded release"),
*conditions.TrueCondition(v2.ReleasedCondition, v2.UpgradeSucceededReason, "Upgraded release"),
*conditions.TrueCondition(meta.ReadyCondition, v2.UpgradeSucceededReason, "Helm upgrade succeeded"),
*conditions.TrueCondition(v2.ReleasedCondition, v2.UpgradeSucceededReason, "Helm upgrade succeeded"),
},
expectCurrent: func(releases []*helmrelease.Release) *v2.Snapshot {
return release.ObservedToSnapshot(release.ObserveRelease(releases[1]))
@@ -303,9 +303,9 @@ func TestUpgrade_Reconcile(t *testing.T) {
},
expectConditions: []metav1.Condition{
*conditions.TrueCondition(meta.ReadyCondition, v2.UpgradeSucceededReason,
"Upgraded release"),
"Helm upgrade succeeded"),
*conditions.TrueCondition(v2.ReleasedCondition, v2.UpgradeSucceededReason,
"Upgraded release"),
"Helm upgrade succeeded"),
},
expectCurrent: func(releases []*helmrelease.Release) *v2.Snapshot {
return release.ObservedToSnapshot(release.ObserveRelease(releases[2]))

0 comments on commit 9e467fb

Please sign in to comment.