diff --git a/src/main/java/de/koudingspawn/vault/kubernetes/KubernetesConnection.java b/src/main/java/de/koudingspawn/vault/kubernetes/KubernetesConnection.java index bddff1e..0dd838d 100644 --- a/src/main/java/de/koudingspawn/vault/kubernetes/KubernetesConnection.java +++ b/src/main/java/de/koudingspawn/vault/kubernetes/KubernetesConnection.java @@ -3,11 +3,12 @@ import de.koudingspawn.vault.crd.Vault; import de.koudingspawn.vault.crd.VaultList; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition; -import io.fabric8.kubernetes.client.*; +import io.fabric8.kubernetes.client.Config; +import io.fabric8.kubernetes.client.ConfigBuilder; +import io.fabric8.kubernetes.client.KubernetesClient; +import io.fabric8.kubernetes.client.KubernetesClientBuilder; import io.fabric8.kubernetes.client.dsl.MixedOperation; import io.fabric8.kubernetes.client.dsl.Resource; -import io.fabric8.kubernetes.internal.KubernetesDeserializer; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -38,15 +39,8 @@ public KubernetesClient client() { @Bean public MixedOperation> customResource( KubernetesClient client, - KubernetesDeserializer kubernetesDeserializer, @Value("${kubernetes.crd.name}") String crdName) { Resource crdResource = client.apiextensions().v1().customResourceDefinitions().withName(crdName); - - // Hack for bug in Kubernetes-Client for CRDs https://github.com/fabric8io/kubernetes-client/issues/1099 - String kind = "Vault"; - String version = StringUtils.substringAfter(crdName, ".") + "/v1"; - kubernetesDeserializer.registerCustomKind(version, kind, Vault.class); - CustomResourceDefinition customResourceDefinition = crdResource.get(); if (customResourceDefinition == null) { log.error("Please first apply custom resource definition and then restart vault-crd"); @@ -55,10 +49,4 @@ public MixedOperation> customResource( return client.resources(Vault.class, VaultList.class); } - - @Bean - public KubernetesDeserializer kubernetesDeserializer() { - return new KubernetesDeserializer(); - } - } diff --git a/src/test/java/de/koudingspawn/vault/admissionreview/AdmissionReviewTest.java b/src/test/java/de/koudingspawn/vault/admissionreview/AdmissionReviewTest.java index e6ac2bd..b7850fb 100644 --- a/src/test/java/de/koudingspawn/vault/admissionreview/AdmissionReviewTest.java +++ b/src/test/java/de/koudingspawn/vault/admissionreview/AdmissionReviewTest.java @@ -7,9 +7,6 @@ import de.koudingspawn.vault.vault.communication.SecretNotAccessibleException; import io.fabric8.kubernetes.client.dsl.MixedOperation; import io.fabric8.kubernetes.client.dsl.Resource; -import io.fabric8.kubernetes.internal.KubernetesDeserializer; -import org.apache.commons.lang3.StringUtils; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; @@ -49,14 +46,6 @@ public class AdmissionReviewTest { @Autowired private MockMvc mvc; - @Before - public void setup() { - KubernetesDeserializer kubernetesDeserializer = new KubernetesDeserializer(); - String version = StringUtils.substringAfter("vault.koudingspawn.de", ".") + "/v1"; - String kind = "Vault"; - kubernetesDeserializer.registerCustomKind(version, kind, Vault.class); - } - @Test public void shouldFailWithInvalidRequest() throws Exception { SecretNotAccessibleException secretException = new SecretNotAccessibleException("Secret is not accessible"); diff --git a/src/test/java/de/koudingspawn/vault/kubernetes/KubernetesServiceTest.java b/src/test/java/de/koudingspawn/vault/kubernetes/KubernetesServiceTest.java index 7153969..6a6e010 100644 --- a/src/test/java/de/koudingspawn/vault/kubernetes/KubernetesServiceTest.java +++ b/src/test/java/de/koudingspawn/vault/kubernetes/KubernetesServiceTest.java @@ -4,7 +4,6 @@ import de.koudingspawn.vault.kubernetes.cache.SecretCache; import de.koudingspawn.vault.vault.VaultSecret; import io.fabric8.kubernetes.api.model.*; -import io.fabric8.kubernetes.client.DefaultKubernetesClient; import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.KubernetesClientBuilder; import org.junit.After;