From 5bff8e1e7cf2926502106653d2645f02dca1e9e8 Mon Sep 17 00:00:00 2001 From: yy Date: Thu, 7 Nov 2024 17:55:50 +0800 Subject: [PATCH] feat: delete password, add authorized_key. --- .../internal/controller/devbox_controller.go | 8 ++++---- .../devbox/internal/controller/helper/devbox.go | 15 ++++----------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/controllers/devbox/internal/controller/devbox_controller.go b/controllers/devbox/internal/controller/devbox_controller.go index 0de5776e765..b1bac8aa29e 100644 --- a/controllers/devbox/internal/controller/devbox_controller.go +++ b/controllers/devbox/internal/controller/devbox_controller.go @@ -194,10 +194,10 @@ func (r *DevboxReconciler) syncSecret(ctx context.Context, devbox *devboxv1alpha secret := &corev1.Secret{ ObjectMeta: objectMeta, Data: map[string][]byte{ - "SEALOS_DEVBOX_PASSWORD": []byte(rand.String(12)), - "SEALOS_DEVBOX_JWT_SECRET": []byte(rand.String(32)), - "SEALOS_DEVBOX_PUBLIC_KEY": publicKey, - "SEALOS_DEVBOX_PRIVATE_KEY": privateKey, + "SEALOS_DEVBOX_JWT_SECRET": []byte(rand.String(32)), + "SEALOS_DEVBOX_PUBLIC_KEY": publicKey, + "SEALOS_DEVBOX_PRIVATE_KEY": privateKey, + "SEALOS_DEVBOX_AUTHORIZED_KEYS": publicKey, }, } diff --git a/controllers/devbox/internal/controller/helper/devbox.go b/controllers/devbox/internal/controller/helper/devbox.go index eb969bc56f0..ac6e0356a3a 100644 --- a/controllers/devbox/internal/controller/helper/devbox.go +++ b/controllers/devbox/internal/controller/helper/devbox.go @@ -301,17 +301,6 @@ func GenerateDevboxEnvVars(devbox *devboxv1alpha1.Devbox, nextCommitHistory *dev Name: "SEALOS_DEVBOX_NAME", Value: devbox.Namespace + "-" + devbox.Name, }, - { - Name: "SEALOS_DEVBOX_PASSWORD", - ValueFrom: &corev1.EnvVarSource{ - SecretKeyRef: &corev1.SecretKeySelector{ - Key: "SEALOS_DEVBOX_PASSWORD", - LocalObjectReference: corev1.LocalObjectReference{ - Name: devbox.Name, - }, - }, - }, - }, { Name: "SEALOS_DEVBOX_POD_UID", ValueFrom: &corev1.EnvVarSource{ @@ -375,6 +364,10 @@ func GenerateSSHVolume(devbox *devboxv1alpha1.Devbox) corev1.Volume { Key: "SEALOS_DEVBOX_PUBLIC_KEY", Path: "id.pub", }, + { + Key: "SEALOS_DEVBOX_AUTHORIZED_KEYS", + Path: "authorized_keys", + }, }, }, },