Skip to content

Commit

Permalink
Merge "zuul - add ssh_config on the scheduler pod to avoid 'ssh -i'"
Browse files Browse the repository at this point in the history
  • Loading branch information
Microzuul CI authored and Gerrit Code Review committed Dec 8, 2023
2 parents 10e3e73 + ef43080 commit 79f6aae
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions controllers/static/zuul/ssh_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Host *
IdentityFile /var/lib/zuul-ssh/priv
UserKnownHostsFile /var/lib/zuul/known_hosts
16 changes: 16 additions & 0 deletions controllers/zuul.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ var (
// Common config sections for all Zuul components
commonIniConfigSections = []string{"zookeeper", "keystore", "database"}

//go:embed static/zuul/ssh_config
sshConfig string

zuulFluentBitLabels = []logging.FluentBitLabel{
{
Key: "COMPONENT",
Expand Down Expand Up @@ -130,6 +133,12 @@ func (r *SFController) mkZuulContainer(service string) []apiv1.Container {
Name: "tooling-vol",
SubPath: "generate-zuul-tenant-yaml.sh",
MountPath: "/usr/local/bin/generate-zuul-tenant-yaml.sh"},
apiv1.VolumeMount{
Name: "extra-config",
SubPath: "ssh_config",
MountPath: "/var/lib/zuul/.ssh/config",
ReadOnly: true,
},
)
envs = append(envs, r.getTenantsEnvs()...)
}
Expand Down Expand Up @@ -169,6 +178,7 @@ func mkZuulVolumes(service string, r *SFController) []apiv1.Volume {
},
},
base.MkVolumeCM("statsd-config", "zuul-statsd-config-map"),
base.MkVolumeCM("extra-config", "zuul-extra-config-map"),
}
if !isStatefulset(service) {
// statefulset already has a PV for the service-name,
Expand Down Expand Up @@ -325,6 +335,7 @@ func (r *SFController) EnsureZuulScheduler(cfg *ini.File) bool {
"statsd_mapping": utils.Checksum([]byte(zuulStatsdMappingConfig)),
"serial": "3",
"zuul-logging": utils.Checksum([]byte(r.getZuulLoggingString("zuul-scheduler"))),
"zuul-extra": utils.Checksum([]byte(sshConfig)),
"zuul-connections": utils.IniSectionsChecksum(cfg, utils.IniGetSectionNamesByPrefix(cfg, "connection")),
}

Expand Down Expand Up @@ -926,6 +937,11 @@ func (r *SFController) DeployZuul() bool {
monitoring.StatsdExporterConfigFile: zuulStatsdMappingConfig,
})

// create extra config config map
r.EnsureConfigMap("zuul-extra", map[string]string{
"ssh_config": sshConfig,
})

// Update base config to add connections
cfgINI := LoadConfigINI(zuulDotconf)
for _, conn := range r.cr.Spec.Zuul.GerritConns {
Expand Down
4 changes: 2 additions & 2 deletions doc/deployment/nodepool.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Nodepool
# Nodepool

Here you will find information about managing the Nodepool service when deployed with the SF Operator.
It does not replace [Nodepool's documentation](https://zuul-ci.org/docs/nodepool/latest/),
Expand Down Expand Up @@ -155,7 +155,7 @@ $ kubectl exec -ti nodepool-launcher-$uuid -c launcher -- nodepool list
Look for the node's IP address then from the Zuul executor pod, run:

```sh
$kubectl exec -ti zuul-executor-0 -- ssh -o "StrictHostKeyChecking no" -i /var/lib/zuul-ssh/..data/priv <user>@<ip>
$ kubectl exec -ti zuul-executor-0 -- ssh -o "StrictHostKeyChecking no" <user>@<ip>
Warning: Permanently added '$public_ip' (ED25519) to the list of known hosts.
$ hostname
np0000000001
Expand Down

0 comments on commit 79f6aae

Please sign in to comment.