public <T> void update(ResourceLifeCycleHandler<T> lifeCycleHandler, KubernetesResource kubernetesResource, ResourceUpdatePolicy updatePolicy) throws HyscaleException {
        if (kubernetesResource == null || kubernetesResource.getV1ObjectMeta() == null) {
            return;
        }
        V1ObjectMeta objectMeta = kubernetesResource.getV1ObjectMeta();
        T obj = (T) kubernetesResource.getResource();
        String resourceNamespace = kubernetesResource.getV1ObjectMeta().getNamespace();
        switch (updatePolicy) {
            case PATCH:
                try {
                    boolean isPatched = lifeCycleHandler.patch(apiClient, objectMeta.getName(), resourceNamespace, obj);
                    if (!isPatched) {
                        // Fallback to delete and create if patch fails to apply
                        lifeCycleHandler.delete(apiClient, objectMeta.getName(), resourceNamespace, true);
                        lifeCycleHandler.create(apiClient, obj, resourceNamespace);

                    }
                } catch (HyscaleException e) {
                    // Fallback to delete and create if patch fails to apply
                    lifeCycleHandler.delete(apiClient, objectMeta.getName(), resourceNamespace, true);
                    lifeCycleHandler.create(apiClient, obj, resourceNamespace);
                }
                break;
            case UPDATE:
                lifeCycleHandler.update(apiClient, obj, resourceNamespace);
                break;
            case DELETE_AND_CREATE:
                lifeCycleHandler.delete(apiClient, objectMeta.getName(), resourceNamespace, true);
                lifeCycleHandler.create(apiClient, obj, resourceNamespace);
                break;
        }
    }
Handle resource update based on update policy
deployer/deployer-services/src/main/java/io/hyscale/deployer/services/broker/K8sResourceBroker.java