hnaderi / scala-k8s

Kubernetes client, data models and typesafe manifest generation for scala, scalajs, and scala native

Home Page:http://projects.hnaderi.dev/scala-k8s/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

list deployments matching labelSelector doesn't appear to work

a01fe opened this issue · comments

I'm trying to do the equivalent of kubectl get deployment -A -l app=foolish based on the sttp client example. It appears to be returning all deployments, not just deployments with an app=foolish label.

import io.circe.Json
import dev.hnaderi.k8s.circe._
import dev.hnaderi.k8s.client.APIs
import dev.hnaderi.k8s.client.SttpJdkURLClientBuilder
import sttp.client3.circe._

val client = SttpJdkURLClientBuilder.load((os.home / ".kube" / "scratch-config.yaml").toNIO)

val p1 = APIs.deployments.list(labelSelector = List("app=foolish")).send(client)
p1.body.items.flatMap(_.metadata).flatMap(_.labels).flatMap(_.get("app")).map(println)
// res0: Seq[Unit] = List((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())
// authelia
// tivan
// cert-manager
// cainjector
// webhook
// azure-policy
// azure-policy-webhook
// csi-blob-controller
// kube-prometheus-stack-operator
// foolish
// foolish
// nox-dox
// nox-dox
// nox-dox
// redirector-test
// selenium-chrome-node
// selenium-edge-node
// selenium-firefox-node
// selenium-hub

Thank you for submitting this issue and welcome!
We are glad that you are here and we appreciate your contributions.

Thank you for the bug report, I'll investigate the problem tomorrow.

@a01fe I forgot to mention here, this issue is fixed and published in the latest release.

That fixed it, thanks!