snowdrop / istio-java-api

A Java API to generate Istio descriptors, inspired by Fabric8's kubernetes-model.
Apache License 2.0
112 stars 33 forks source link

1.6.2-Alpha2 is incompatible with latest fabric8 libraries #94

Closed FWiesner closed 4 years ago

FWiesner commented 4 years ago

Hi,

when trying to creating ServiceEntry, the code fails as the Istio client seems to treat ServiceEntry as non-namespaced resource type:

io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://10.175.80.197:6443/apis/networking.istio.io/v1beta1/serviceentries. Message: 404 page not found

I'm using the latest master code

FWiesner commented 4 years ago
final var resourceClient = istioClient.v1beta1ServiceEntry();
final var se = resourceClient.inNamespace("istio-trials").list().getItems().get(0);
resourceClient.inNamespace("istio-trials").createOrReplace(se);

I'm btw on Istio 1.6.2 with Kubernetes 1.18.4

FWiesner commented 4 years ago

I tried with DestinationRule as well. Namespaces don't properly work there as well (here the inNamespace is fully ignored):

var istioClient = k8sClient.adapt(IstioClient.class);

var rule = istioClient.v1beta1DestinationRule().inNamespace("istio-trials").list().getItems().get(0);
log.atInfo().log("DestinationRule: %s", rule);
istioClient.v1beta1DestinationRule().inNamespace("istio-trials").createOrReplace(rule);

This throws Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: io.fabric8.kubernetes.client.KubernetesClientException: Namespace mismatch. Item namespace:istio-system. Operation namespace:istio-trials. at io.fabric8.kubernetes.client.dsl.base.OperationSupport.checkNamespace(OperationSupport.java:184) at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleCreate(OperationSupport.java:250) at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleCreate(BaseOperation.java:844) at io.fabric8.kubernetes.client.dsl.base.BaseOperation.create(BaseOperation.java:352) at io.fabric8.kubernetes.client.dsl.base.BaseOperation.createOrReplace(BaseOperation.java:413) at io.fabric8.kubernetes.client.dsl.base.BaseOperation.createOrReplace(BaseOperation.java:79) at io.fabric8.kubernetes.client.dsl.base.BaseOperation.createOrReplace(BaseOperation.java:410) at io.fabric8.kubernetes.client.dsl.base.BaseOperation.createOrReplace(BaseOperation.java:79)

FWiesner commented 4 years ago

makes no difference whether I use v1alpha3 or v1beta1 alternatives

FWiesner commented 4 years ago

Another update: it seems this is caused because of recent changes in the fabric8.io client integrating a new interface io.fabric8.kubernetes.api.model.Namespaced that all model elements seem to have to implement

FWiesner commented 4 years ago

switching back to 4.9.0 solves the problem

metacosm commented 4 years ago

Thank you for the investigation and fix! I will also address the TLS enum issue as this is actually an error that got through the go-to-java conversion process…