Move email and uuid to labels

This commit is contained in:
Nikolai Rodionov 2024-04-30 17:39:11 +02:00
parent bdd9206c92
commit 89dbe6120a
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
2 changed files with 9 additions and 4 deletions

View File

@ -72,10 +72,12 @@ func (acc *Account) Create(ctx context.Context) error {
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: acc.Data.Username, Name: acc.Data.Username,
Namespace: "softplayer-accounts", Namespace: "softplayer-accounts",
Labels: map[string]string{
"softplayer.net/email": acc.Data.Email,
"softplayer.net/uuid": acc.Data.UUID,
},
}, },
StringData: map[string]string{ StringData: map[string]string{
"uuid": acc.Data.UUID,
"email": acc.Data.Email,
"password": passwordHash, "password": passwordHash,
}, },
} }
@ -187,7 +189,7 @@ func (acc *Account) Login(ctx context.Context) error {
return err return err
} }
acc.Data.UUID = string(sec.Data["uuid"]) acc.Data.UUID = string(sec.ObjectMeta.Labels["uuid"])
tokenName := fmt.Sprintf("sa-%s", acc.Data.UUID) tokenName := fmt.Sprintf("sa-%s", acc.Data.UUID)
saSec := &corev1.Secret{ saSec := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{

View File

@ -26,6 +26,7 @@ type Environemnt struct {
type EnvironemntData struct { type EnvironemntData struct {
Name string Name string
FmtName string
Description string Description string
Provider string Provider string
Kubernetes string Kubernetes string
@ -39,12 +40,14 @@ SP_PROVIDER=%s
SP_KUBERNETES=%s SP_KUBERNETES=%s
SP_SERVER_TYPE=%s SP_SERVER_TYPE=%s
SP_SERVER_LOCATION=%s SP_SERVER_LOCATION=%s
SP_DESCRIPTION=%s`, SP_DESCRIPTION=%s
SP_NAME=%s`,
e.Provider, e.Provider,
e.Kubernetes, e.Kubernetes,
e.ServerType, e.ServerType,
e.Location, e.Location,
e.Description, e.Description,
e.Name,
) )
return vars, nil return vars, nil