diff --git a/controllers/devbox/internal/controller/devbox_controller.go b/controllers/devbox/internal/controller/devbox_controller.go index b1bac8aa29e..79fe79cb80d 100644 --- a/controllers/devbox/internal/controller/devbox_controller.go +++ b/controllers/devbox/internal/controller/devbox_controller.go @@ -179,6 +179,14 @@ func (r *DevboxReconciler) syncSecret(ctx context.Context, devbox *devboxv1alpha return fmt.Errorf("failed to update secret: %w", err) } } + + if _, ok := devboxSecret.Data["SEALOS_DEVBOX_AUTHORIZED_KEYS"]; !ok { + devboxSecret.Data["SEALOS_DEVBOX_AUTHORIZED_KEYS"] = devboxSecret.Data["SEALOS_DEVBOX_PUBLIC_KEY"] + if err := r.Update(ctx, devboxSecret); err != nil { + return fmt.Errorf("failed to update secret: %w", err) + } + } + return nil } if client.IgnoreNotFound(err) != nil {