def rollout_restart(event: KubernetesResourceEvent):
    """
    Performs rollout restart on a kubernetes workload.
    Supports deployments, deploymentconfig, daemonsets and statefulsets related events.
    """
    resource = event.get_resource()
    if not resource:
        raise ActionException(ErrorCodes.RESOURCE_NOT_FOUND, "Couldn't found resource")

    name = resource.metadata.name
    namespace = resource.metadata.namespace
    try:
        if isinstance(resource, (Deployment, DeploymentConfig)):
            if resource.spec.paused:
                event.add_enrichment(
                    [MarkdownBlock(f"can't restart paused deployment/{namespace}/{name} (run rollout resume first).")]
                )
                return

        now: str = datetime.datetime.utcnow().replace(tzinfo=pytz.UTC).isoformat()
        if isinstance(resource, Rollout):
            resource.spec.restartAt = now
            resource.update()
            return

        if isinstance(resource, DeploymentConfig):
            resource.spec.template.metadata.annotations["robusta.kubernetes.io/restartedAt"] = now
            resource.update()
            return

        if isinstance(resource, (CRDBase)):
            CustomObjectsApi().patch_namespaced_custom_object(
                group=resource.group,
                version=resource.version,
                namespace=namespace,
                plural=resource.plural,
                name=name,
                body=resource.rollout_restart_patch()
            )
            return

        if isinstance(resource, Deployment):
            func_name = "patch_namespaced_deployment"
        elif isinstance(resource, StatefulSet):
            func_name = "patch_namespaced_stateful_set"
        elif isinstance(resource, DaemonSet):
            func_name = "patch_namespaced_daemon_set"
        else:
            raise ActionException(
                ErrorCodes.RESOURCE_NOT_SUPPORTED, f"Rollout restart is not supported for resource {resource.kind}"
            )

        api = AppsV1Api()
        body = {"spec": {"template": {"metadata": {"annotations": {"robusta.kubernetes.io/restartedAt": now}}}}}
        patch_func = getattr(api, func_name)
        patch_func(name=name, namespace=namespace, body=body)
        event.add_enrichment([MarkdownBlock(f"{resource.kind}/{namespace}/{name} restarted")])

    except Exception as e:
        raise ActionException(
            ErrorCodes.ACTION_UNEXPECTED_ERROR, f"Failed to rollout restart {resource.kind}/{namespace}/{name}\n {e}"
        )

    Performs rollout restart on a kubernetes workload.
    Supports deployments, deploymentconfig, daemonsets and statefulsets related events.
    
playbooks/robusta_playbooks/workload_actions.py