public static boolean booleanLabel(HasMetadata resource, String label, boolean defaultValue) {
        if (resource != null
                && resource.getMetadata() != null
                && resource.getMetadata().getLabels() != null)  {
            String value = resource.getMetadata().getLabels().get(label);
            return value != null ? parseBoolean(value) : defaultValue;
        } else {
            return defaultValue;
        }
    }
@Test
    public void testBooleanLabel()  {
        final String label = "my-label";

        assertThat(Labels.booleanLabel(null, label, true), is(true));
        assertThat(Labels.booleanLabel(new PodBuilder().build(), label, true), is(true));
        assertThat(Labels.booleanLabel(new PodBuilder().withNewMetadata().withName("my-pod").endMetadata().build(), label, true), is(true));
        assertThat(Labels.booleanLabel(new PodBuilder().withNewMetadata().withName("my-pod").addToLabels("not-my-label", "false").endMetadata().build(), label, true), is(true));
        assertThat(Labels.booleanLabel(new PodBuilder().withNewMetadata().withName("my-pod").addToLabels(label, null).endMetadata().build(), label, true), is(true));
        assertThat(Labels.booleanLabel(new PodBuilder().withNewMetadata().withName("my-pod").addToLabels(label, "true").endMetadata().build(), label, true), is(true));
        assertThat(Labels.booleanLabel(new PodBuilder().withNewMetadata().withName("my-pod").addToLabels(label, "potato").endMetadata().build(), label, true), is(false));
        assertThat(Labels.booleanLabel(new PodBuilder().withNewMetadata().withName("my-pod").addToLabels(label, "false").endMetadata().build(), label, true), is(false));
    }