@Override
    public boolean patch(ApiClient apiClient, String name, String namespace, V1ConfigMap target)
            throws HyscaleException {
        if (target == null) {
            LOGGER.debug("Cannot patch null configmap");
            return false;
        }
        CoreV1Api coreV1Api = new CoreV1Api(apiClient);
        target.getMetadata().putAnnotationsItem(AnnotationKey.K8S_HYSCALE_LAST_APPLIED_CONFIGURATION.getAnnotation(),
                GsonProviderUtil.getPrettyGsonBuilder().toJson(target));
        V1ConfigMap sourceConfigMap = null;
        try {
            sourceConfigMap = get(apiClient, name, namespace);
        } catch (HyscaleException e) {
            LOGGER.debug("Error while getting ConfigMap {} in namespace {} for Patch, creating new", name, namespace);
            V1ConfigMap configMap = create(apiClient, target, namespace);
            return configMap != null;
        }
        WorkflowLogger.startActivity(DeployerActivity.DEPLOYING_CONFIGMAP);
        String lastAppliedConfig = sourceConfigMap.getMetadata().getAnnotations()
                .get(AnnotationKey.K8S_HYSCALE_LAST_APPLIED_CONFIGURATION.getAnnotation());
        Object patchObject = null;
        try {
            patchObject = K8sResourcePatchUtil.getJsonPatch(GsonProviderUtil.getPrettyGsonBuilder().fromJson(lastAppliedConfig, V1ConfigMap.class), target,
                    V1ConfigMap.class);
            V1Patch v1Patch = new V1Patch(patchObject.toString());
            coreV1Api.patchNamespacedConfigMap(name, namespace, v1Patch, DeployerConstants.TRUE, null, null, null);
        } catch (HyscaleException e) {
            LOGGER.error("Error while creating patch for ConfigMap {}, source {}, target {}", name, sourceConfigMap,
                    target);
            WorkflowLogger.endActivity(Status.FAILED);
            throw e;
        } catch (ApiException e) {
            HyscaleException ex = new HyscaleException(e, DeployerErrorCodes.FAILED_TO_PATCH_RESOURCE,
                    ExceptionHelper.getExceptionMessage(getKind(), e, ResourceOperation.PATCH));
            LOGGER.error("Error while patching ConfigMap {} in namespace {} , error {}", name, namespace,
                    ex.toString());
            WorkflowLogger.endActivity(Status.FAILED);
            throw ex;
        }
        WorkflowLogger.endActivity(Status.DONE);
        return true;
    }
Fetch existing resource, create diff, call patch api with diff
deployer/deployer-services/src/main/java/io/hyscale/deployer/services/handler/impl/V1ConfigMapHandler.java