Add event for cluster controller
Signed-off-by: pigletfly <wangbing.adam@gmail.com>
This commit is contained in:
parent
b961a7e976
commit
3e1d4473e5
|
@ -33,7 +33,9 @@ const (
|
||||||
// sleep between retrying cluster health updates.
|
// sleep between retrying cluster health updates.
|
||||||
MonitorRetrySleepTime = 20 * time.Millisecond
|
MonitorRetrySleepTime = 20 * time.Millisecond
|
||||||
// HealthUpdateRetry controls the number of retries of writing cluster health update.
|
// HealthUpdateRetry controls the number of retries of writing cluster health update.
|
||||||
HealthUpdateRetry = 5
|
HealthUpdateRetry = 5
|
||||||
|
eventReasonCreateExecutionNamespaceFailed = "CreateExecutionNamespaceFailed"
|
||||||
|
eventReasonRemoveExecutionNamespaceFailed = "RemoveExecutionNamespaceFailed"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Controller is to sync Cluster.
|
// Controller is to sync Cluster.
|
||||||
|
@ -113,6 +115,7 @@ func (c *Controller) syncCluster(cluster *clusterv1alpha1.Cluster) (controllerru
|
||||||
// create execution space
|
// create execution space
|
||||||
err := c.createExecutionSpace(cluster)
|
err := c.createExecutionSpace(cluster)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
c.EventRecorder.Event(cluster, corev1.EventTypeWarning, fmt.Sprintf("Failed %s", eventReasonRemoveExecutionNamespaceFailed), err.Error())
|
||||||
return controllerruntime.Result{Requeue: true}, err
|
return controllerruntime.Result{Requeue: true}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +130,7 @@ func (c *Controller) removeCluster(cluster *clusterv1alpha1.Cluster) (controller
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("Failed to remove execution space %v, err is %v", cluster.Name, err)
|
klog.Errorf("Failed to remove execution space %v, err is %v", cluster.Name, err)
|
||||||
|
c.EventRecorder.Event(cluster, corev1.EventTypeWarning, fmt.Sprintf("Failed %s", eventReasonCreateExecutionNamespaceFailed), err.Error())
|
||||||
return controllerruntime.Result{Requeue: true}, err
|
return controllerruntime.Result{Requeue: true}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue