coralogix / zio-k8s

An idiomatic ZIO client for the Kubernetes API.
Apache License 2.0
97 stars 19 forks source link

DeserializationFailure when performing service delete in K8s 1.23+ #399

Open paul-lysak opened 2 years ago

paul-lysak commented 2 years ago

Having com.coralogix.zio.k8s.client.kubernetes.Kubernetes instance in k8s variable try to delete any Service object in Kubernetes 1.23.0 or newer:

k8s.v1.services.delete(name = "someService", namespace = K8sNamespace("someNamespace"), deleteOptions = DeleteOptions(), propagationPolicy = Option(PropagationPolicy.Background))

The service is deleted, but the call returns an error:

DeserializationFailure(K8sRequestInfo(K8sResourceType(services,,v1),delete,Some(K8sNamespace(wssaas-165339d4-d035-46f2-9c2a-fd555ef2d2c3)),None,None,Some(ws-oqbpwsaj)),NonEmptyList(DecodingFailure(Got value '{"loadBalancer":{"ingress":[{"ip":"10.96.173.240"}]}}' with wrong type, expecting string, List(DownField(status)))))

The reason is that starting from release v1.23.0-alpha.2 K8s API has changed response type for service delete from #/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Status to #/definitions/io.k8s.api.core.v1.Service. (compare https://raw.githubusercontent.com/kubernetes/kubernetes/v1.23.0-alpha.1/api/openapi-spec/swagger.json vs https://raw.githubusercontent.com/kubernetes/kubernetes/v1.23.0-alpha.2/api/openapi-spec/swagger.json).

vigoo commented 2 years ago

Maybe we should start releasing multiple versions for different K8s versions.. @iravid @jkobejs what do you think?

iravid commented 2 years ago

I can probably dig up a Slack message from last year in which I suggested that 😂 definitely agree we should do that