add CreateExecutionSpaceSucceed and RemoveExecutionSpaceSucceed event
Signed-off-by: Poor12 <shentiecheng@huawei.com>
This commit is contained in:
parent
77a06e1c96
commit
e438cfcf75
|
@ -1,11 +1,15 @@
|
|||
package v1alpha1
|
||||
|
||||
// Define events for execute space objects.
|
||||
// Define events for cluster objects.
|
||||
const (
|
||||
// EventReasonCreateExecutionSpaceFailed indicates that create execution space failed.
|
||||
EventReasonCreateExecutionSpaceFailed = "CreateExecutionSpaceFailed"
|
||||
// EventReasonCreateExecutionSpaceSucceed indicates that create execution space succeed.
|
||||
EventReasonCreateExecutionSpaceSucceed = "CreateExecutionSpaceSucceed"
|
||||
// EventReasonRemoveExecutionSpaceFailed indicates that remove execution space failed.
|
||||
EventReasonRemoveExecutionSpaceFailed = "RemoveExecutionSpaceFailed"
|
||||
// EventReasonRemoveExecutionSpaceSucceed indicates that remove execution space succeed.
|
||||
EventReasonRemoveExecutionSpaceSucceed = "RemoveExecutionSpaceSucceed"
|
||||
// EventReasonTaintClusterByConditionFailed indicates that taint cluster by condition failed.
|
||||
EventReasonTaintClusterByConditionFailed = "TaintClusterByConditionFailed"
|
||||
// EventReasonRemoveTargetClusterFailed indicates that failed to remove target cluster from binding.
|
||||
|
|
|
@ -243,6 +243,8 @@ func (c *Controller) removeCluster(ctx context.Context, cluster *clusterv1alpha1
|
|||
c.EventRecorder.Event(cluster, corev1.EventTypeWarning, clusterv1alpha1.EventReasonRemoveExecutionSpaceFailed, err.Error())
|
||||
return controllerruntime.Result{Requeue: true}, err
|
||||
}
|
||||
msg := fmt.Sprintf("Removed execution space for cluster(%s).", cluster.Name)
|
||||
c.EventRecorder.Event(cluster, corev1.EventTypeNormal, clusterv1alpha1.EventReasonRemoveExecutionSpaceSucceed, msg)
|
||||
|
||||
if exist, err := c.ExecutionSpaceExistForCluster(cluster.Name); err != nil {
|
||||
klog.Errorf("Failed to check weather the execution space exist in the given member cluster or not, error is: %v", err)
|
||||
|
@ -392,7 +394,9 @@ func (c *Controller) createExecutionSpace(cluster *clusterv1alpha1.Cluster) erro
|
|||
klog.Errorf("Failed to create execution space for cluster(%s): %v", cluster.Name, err)
|
||||
return err
|
||||
}
|
||||
klog.V(2).Infof("Created execution space(%s) for cluster(%s).", executionSpaceName, cluster.Name)
|
||||
msg := fmt.Sprintf("Created execution space(%s) for cluster(%s).", executionSpaceName, cluster.Name)
|
||||
klog.V(2).Info(msg)
|
||||
c.EventRecorder.Event(cluster, corev1.EventTypeNormal, clusterv1alpha1.EventReasonCreateExecutionSpaceSucceed, msg)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue