Skip to content

Commit

Permalink
feat: delete password, add authorized_key.
Browse files Browse the repository at this point in the history
  • Loading branch information
lingdie committed Nov 7, 2024
1 parent e0bba03 commit 5bff8e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
8 changes: 4 additions & 4 deletions controllers/devbox/internal/controller/devbox_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}

Expand Down
15 changes: 4 additions & 11 deletions controllers/devbox/internal/controller/helper/devbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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",
},
},
},
},
Expand Down

0 comments on commit 5bff8e1

Please sign in to comment.