nats-io / nats.py

Python3 client for NATS
https://nats-io.github.io/nats.py/
Apache License 2.0
872 stars 180 forks source link

Placement setting has no effect when creating a new key-value bucket #538

Open hungiito opened 7 months ago

hungiito commented 7 months ago

Observed behavior

placement parameter has no effect when creating new key-value bucket. For example:

Expected behavior

Key-value bucket to be placed in expected regions (specified by placement tags)

I tried adding placement=config.placement here and successfully created the bucket in the correct region.

Server and client version

Host environment

No response

Steps to reproduce

Script to create new key-value bucket

client = ...
key_value = await client.jetstream.create_key_value(
    bucket="system",
    placement=Placement(tags=["geo:us-west", "cloud:aws"]),
)

nats kv info says that the stream is in another region (eu-west-1 in my case)

$ nats kv info system
Information for Key-Value Store Bucket system created 2024-02-21T20:45:03+01:00

Configuration:

          Bucket Name: system
         History Kept: 1
        Values Stored: 0
   Backing Store Kind: JetStream
          Description: System key value store
          Bucket Size: 0 B
  Maximum Bucket Size: 1.0 GiB
   Maximum Value Size: 2.0 MiB
          Maximum Age: 1m0s
     JetStream Stream: KV_system
              Storage: File

Cluster Information:

                 Name: ngsprod-aws-euwest1
               Leader: aws-euwest1-natscj1-2
wallyqs commented 6 months ago

@hungiito feel free to send PR with your patch and can include in the next release