Skip to content

Commit

Permalink
Merge "nodepool-builder: add the Zuul SSH public key on pod filesystem"
Browse files Browse the repository at this point in the history
  • Loading branch information
Microzuul CI authored and Gerrit Code Review committed Oct 25, 2023
2 parents c11e655 + 3c08bc4 commit 7f51e92
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 22 additions & 1 deletion controllers/nodepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ var configScriptVolumeMount = apiv1.VolumeMount{
Name: "nodepool-tooling-vol",
SubPath: "generate-config.sh",
MountPath: "/usr/local/bin/generate-config.sh",
ReadOnly: true,
}

func (r *SFController) setNodepoolTooling() {
Expand Down Expand Up @@ -359,6 +360,19 @@ func (r *SFController) DeployNodepoolBuilder(statsdExporterVolume apiv1.Volume,
},
},
},
{
Name: "zuul-ssh-key",
VolumeSource: apiv1.VolumeSource{
Secret: &apiv1.SecretVolumeSource{
SecretName: "zuul-ssh-key",
Items: []apiv1.KeyToPath{{
Key: "pub",
Path: "pub",
}},
DefaultMode: &mod,
},
},
},
base.MkVolumeCM("nodepool-builder-extra-config-vol",
"nodepool-builder-extra-config-config-map"),
statsdExporterVolume,
Expand All @@ -383,12 +397,18 @@ func (r *SFController) DeployNodepoolBuilder(statsdExporterVolume apiv1.Volume,
Name: "nodepool-tooling-vol",
SubPath: "dib-ansible.py",
MountPath: "/usr/local/bin/dib-ansible",
ReadOnly: true,
},
{
Name: "nodepool-builder-ssh-key",
MountPath: "/var/lib/nodepool-ssh-key",
ReadOnly: true,
},
{
Name: "zuul-ssh-key",
MountPath: "/var/lib/zuul-ssh-key",
ReadOnly: true,
},
{
Name: "nodepool-tooling-vol",
SubPath: "ssh_config",
Expand All @@ -399,6 +419,7 @@ func (r *SFController) DeployNodepoolBuilder(statsdExporterVolume apiv1.Volume,
Name: "nodepool-builder-extra-config-vol",
SubPath: "logging.yaml",
MountPath: "/etc/nodepool-logging/logging.yaml",
ReadOnly: true,
},
}

Expand All @@ -416,7 +437,7 @@ func (r *SFController) DeployNodepoolBuilder(statsdExporterVolume apiv1.Volume,
"statsd_mapping": utils.Checksum([]byte(nodepoolStatsdMappingConfig)),
// When the Secret ResourceVersion field change (when edited) we force a nodepool-builder restart
"nodepool-providers-secrets": string(nodepoolProvidersSecrets.ResourceVersion),
"serial": "9",
"serial": "10",
}

initContainer := base.MkContainer("nodepool-builder-init", base.BusyboxImage)
Expand Down
3 changes: 3 additions & 0 deletions doc/user/nodepool_config_repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ Here are the available variables and their meaning:
- qcow2_type: is a boolean specifying if the built image format is `qcow2`.
- raw_type: is a boolean specifying if the built image format is `raw`.

> Zuul needs to authenticate via SSH onto Virtual Machines spawned from built cloud images. Thus, the Zuul SSH public key should be added as
an authorized key for the user Zuul will connect to. The Zuul SSH public key is available on the `nodepool-builder` into the file
`/var/lib/zuul-ssh-key/pub`. A cloud image build playbook can read that file to prepare a cloud image.

Finally we need an `inventory.yaml` file. It must be defined into `nodepool/dib-ansible/inventory.yaml`:

Expand Down

0 comments on commit 7f51e92

Please sign in to comment.