Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: known_hosts support for initial cloning #701

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions api/v1alpha1/amaltheasession_children.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const servicePortName string = prefix + "http"
const servicePort int32 = 80
const sessionVolumeName string = prefix + "volume"
const shmVolumeName string = prefix + "dev-shm"
const sshKnownHostsName string = "ssh-known-hosts"

// StatefulSet returns a AmaltheaSession StatefulSet object
func (cr *AmaltheaSession) StatefulSet() appsv1.StatefulSet {
Expand Down Expand Up @@ -371,6 +372,32 @@ func (cr *AmaltheaSession) initClones() ([]v1.Container, []v1.Volume) {
vols := []v1.Volume{}
containers := []v1.Container{}

vols = append(
vols,
v1.Volume{
Name: sshKnownHostsName,
VolumeSource: v1.VolumeSource{
ConfigMap: &v1.ConfigMapVolumeSource{
LocalObjectReference: v1.LocalObjectReference{
Name: sshKnownHostsName,
},
Items: []v1.KeyToPath{
{
Key: "known_hosts",
Path: "ssh_known_hosts",
},
},
Optional: ptr.To(true),
},
},
},
)
volMounts = append(volMounts, v1.VolumeMount{
Name: sshKnownHostsName,
MountPath: "/etc/ssh",
},
)

for irepo, repo := range cr.Spec.CodeRepositories {
args := []string{"clone", "--remote", repo.Remote, "--path", cr.Spec.Session.Storage.MountPath + "/" + repo.ClonePath}

Expand Down
Loading