From 70727a5c1b505af7b16fd75d3f665e61c7441322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20D=C3=B6ll?= Date: Thu, 5 Dec 2024 13:35:24 +0000 Subject: [PATCH] chore: add creds --- controllers/const.go | 2 +- controllers/natsuser_controller.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/controllers/const.go b/controllers/const.go index c803a19..0e5221c 100644 --- a/controllers/const.go +++ b/controllers/const.go @@ -4,7 +4,7 @@ const ( OPERATOR_SEED_KEY = "seed.nk" OPERATOR_PUBLIC_KEY = "key.pub" OPERATOR_JWT = "key.jwt" - OPERATOR_CREDS = "user.creds" + USER_CREDS = "user.creds" OPERATOR_CONFIG_FILE = "auth.conf" AUTH_CONFIG_TEMPLATE = `operator: %s system_account: %s diff --git a/controllers/natsuser_controller.go b/controllers/natsuser_controller.go index 6ee53ee..5c713df 100644 --- a/controllers/natsuser_controller.go +++ b/controllers/natsuser_controller.go @@ -2,6 +2,7 @@ package controllers import ( "context" + "fmt" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -264,6 +265,7 @@ func (r *NatsUserReconciler) reconcileSecret(ctx context.Context, user *natsv1al return err } data[OPERATOR_JWT] = []byte(jwt) + data[USER_CREDS] = []byte(fmt.Sprintf(ACCOUNT_TEMPLATE, jwt, seed)) secret.Namespace = user.Namespace secret.Name = secretName.Name