public void removeMetricsForCertificates(Predicate<CertificateMetricKey> shouldDelete) {
        final List<CertificateMetricKey> removedKeys = new ArrayList<>();

        certificateExpirationMap.keySet().stream()
                .map(CertificateMetricKey.class::cast)
                .filter(shouldDelete)
                .forEach(key -> {
                    Tags tags = MetricsUtils.getAllMetricTags(key.getNamespace(), key.getKind(), Optional.empty(),
                            Tag.of("cluster", key.getClusterName()),
                            Tag.of("type", key.getCaType()));
                    removeMetric(METRICS_CERTIFICATE_EXPIRATION_MS, tags);
                    removedKeys.add(key);
                });

        removedKeys.forEach(certificateExpirationMap::remove);
    }
@Test
    @DisplayName("Should not remove certificate metrics for cluster CA type")
    void shouldNotRemoveCertificateMetricsForClusterCaType() {
        Predicate<CertificateMetricKey> predicate = key -> matchCaTypes(key.getCaType(), CertificateMetricKey.Type.CLIENT_CA);
        metricsHolder.removeMetricsForCertificates(predicate);

        boolean hasClusterCaMetric = metricsHolder.certificateExpirationMap.keySet().stream()
                .anyMatch(key -> matchCaTypes(((CertificateMetricKey) key).getCaType(), CertificateMetricKey.Type.CLUSTER_CA));

        assertTrue(hasClusterCaMetric, "Cluster CA metric should not be removed");
    }