nats-io / nack

NATS Controllers for Kubernetes (NACK)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for UserCredentials for consumer

eugenestarchenko opened this issue · comments

Sadly NACK does not work for jetstream consumers the way we use it 😔
the piece of code that looks up the credentials from the account object is missing for the consumer

// FIXME: Add support for UserCredentials for consumer.

here is the equivalent piece for the stream object (which works fine)
// Lookup the UserCredentials.
if acc.Spec.Creds != nil {
secretName := acc.Spec.Creds.Secret.Name
secret, err := c.ki.Secrets(ns).Get(c.ctx, secretName, k8smeta.GetOptions{})
if err != nil {
return err
}
// Write the user credentials to the cache dir.
accDir := filepath.Join(c.cacheDir, ns, spec.Account)
if err := os.MkdirAll(accDir, 0755); err != nil {
return err
}
for k, v := range secret.Data {
if k == acc.Spec.Creds.File {
accUserCreds = filepath.Join(c.cacheDir, ns, spec.Account, k)
if err := os.WriteFile(filepath.Join(accDir, k), v, 0644); err != nil {
return err
}
}
}
}
}

https://github.com/nats-io/nack/blob/main/controllers/jetstream/consumer.go#LL95C29-L95C44

Do you have a possible ETA for this case?
Thank you!

This should be fixed in #128