Skip to content

Commit a7af80d

Browse files
committed
Fix eventtype when recording event on pod.
1 parent 0b2da4f commit a7af80d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

pkg/apis/mysql/v1alpha1/status.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ const (
159159

160160
// Event types
161161
const (
162-
EventNormal = "Normal"
163-
EventWarning = "Warning"
162+
EventNormal = core.EventTypeNormal
163+
EventWarning = core.EventTypeWarning
164164
)
165165

166166
func (ns *NodeStatus) UpdateNodeCondition(cType NodeConditionType,

pkg/mysqlcluster/orc_reconciliation.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ func (f *cFactory) SyncOrchestratorStatus(ctx context.Context) error {
6464
r.Id, err,
6565
)
6666
}
67-
f.rec.Event(f.cluster, "RecoveryAcked", "acked", fmt.Sprintf("Recovery with id %d was acked.", r.Id))
67+
f.rec.Event(f.cluster, core.EventTypeNormal, "RecoveryAcked",
68+
fmt.Sprintf("Recovery with id %d was acked.", r.Id))
6869
}
6970
}
7071

@@ -211,19 +212,19 @@ func (f *cFactory) updateNodeCondition(host string, cType api.NodeConditionType,
211212
switch cType {
212213
case api.NodeConditionMaster:
213214
if status == core.ConditionTrue {
214-
f.rec.Event(pod, "PromoteMaster", "orc", "")
215+
f.rec.Event(pod, core.EventTypeWarning, "PromoteMaster", "Promoted as master by orchestrator")
215216
} else if status == core.ConditionFalse {
216-
f.rec.Event(pod, "DemoteMaster", "orc", "")
217+
f.rec.Event(pod, core.EventTypeWarning, "DemoteMaster", "Demoted as master by orchestrator")
217218
}
218219
case api.NodeConditionLagged:
219220
if status == core.ConditionTrue {
220-
f.rec.Event(pod, "LagDetected", "orc", "")
221+
f.rec.Event(pod, core.EventTypeNormal, "LagDetected", "This node has lag. Lag was detected.")
221222
}
222223
case api.NodeConditionReplicating:
223224
if status == core.ConditionTrue {
224-
f.rec.Event(pod, "ReplicationRunning", "orc", "")
225+
f.rec.Event(pod, core.EventTypeNormal, "ReplicationRunning", "Replication is running")
225226
} else if status == core.ConditionFalse {
226-
f.rec.Event(pod, "ReplicationStopped", "orc", "")
227+
f.rec.Event(pod, core.EventTypeWarning, "ReplicationStopped", "Replication is stopped")
227228
}
228229
}
229230
}

0 commit comments

Comments
 (0)