-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from razo7/events-maintenance
Add Events for the Maintenance Process
- Loading branch information
Showing
6 changed files
with
262 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package utils | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/client-go/tools/record" | ||
) | ||
|
||
const ( | ||
// events reasons | ||
EventReasonBeginMaintenance = "BeginMaintenance" | ||
EventReasonFailedMaintenance = "FailedMaintenance" | ||
EventReasonSucceedMaintenance = "SucceedMaintenance" | ||
EventReasonUncordonNode = "UncordonNode" | ||
EventReasonRemovedMaintenance = "RemovedMaintenance" | ||
|
||
// events messages | ||
EventMessageBeginMaintenance = "Begin a node maintenance" | ||
EventMessageFailedMaintenance = "Failed a node maintenance" | ||
EventMessageSucceedMaintenance = "Node maintenance was succeeded" | ||
EventMessageUncordonNode = "Uncordon a node" | ||
EventMessageRemovedMaintenance = "Removed a node maintenance" | ||
) | ||
|
||
// NormalEvent will record an event with type Normal and fixed message. | ||
func NormalEvent(recorder record.EventRecorder, object runtime.Object, reason, message string) { | ||
recorder.Event(object, corev1.EventTypeNormal, reason, message) | ||
} | ||
|
||
// WarningEvent will record an event with type Warning and fixed message. | ||
func WarningEvent(recorder record.EventRecorder, object runtime.Object, reason, message string) { | ||
recorder.Event(object, corev1.EventTypeWarning, reason, message) | ||
} |
Oops, something went wrong.