Skip to content

Commit

Permalink
Don't set IP options on kernel command line twice
Browse files Browse the repository at this point in the history
We only want to pass the IP_OPTIONS environment variable to the
machine-os-downloader container in the metal3 Deployment, not the ones
in the metal3-image-cache DaemonSet.

If we pass it to both then the options get added twice on some cache
Pods (the ones not running on the Node that has the API VIP), with the
result that the checksum will be different depending where the API VIP
is pointing.
  • Loading branch information
zaneb committed Jun 16, 2021
1 parent d5d2cee commit 7b0093d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions provisioning/baremetal_pod.go
Expand Up @@ -229,7 +229,7 @@ func setIronicHtpasswdHash(name string, secretName string) corev1.EnvVar {
func newMetal3InitContainers(info *ProvisioningInfo) []corev1.Container {
initContainers := []corev1.Container{
createInitContainerIpaDownloader(info.Images),
createInitContainerMachineOsDownloader(info),
createInitContainerMachineOsDownloader(info, true),
}

// If the provisioning network is disabled, and the user hasn't requested a
Expand Down Expand Up @@ -276,7 +276,17 @@ func ipOptionForMachineOsDownloader(info *ProvisioningInfo) string {
return optionValue
}

func createInitContainerMachineOsDownloader(info *ProvisioningInfo) corev1.Container {
func createInitContainerMachineOsDownloader(info *ProvisioningInfo, setIpOptions bool) corev1.Container {
env := []corev1.EnvVar{
buildEnvVar(machineImageUrl, &info.ProvConfig.Spec),
}
if setIpOptions {
env = append(env,
corev1.EnvVar{
Name: ipOptions,
Value: ipOptionForMachineOsDownloader(info),
})
}
initContainer := corev1.Container{
Name: "metal3-machine-os-downloader",
Image: info.Images.MachineOsDownloader,
Expand All @@ -286,13 +296,7 @@ func createInitContainerMachineOsDownloader(info *ProvisioningInfo) corev1.Conta
Privileged: pointer.BoolPtr(true),
},
VolumeMounts: []corev1.VolumeMount{imageVolumeMount},
Env: []corev1.EnvVar{
buildEnvVar(machineImageUrl, &info.ProvConfig.Spec),
{
Name: ipOptions,
Value: ipOptionForMachineOsDownloader(info),
},
},
Env: env,
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("10m"),
Expand Down
2 changes: 1 addition & 1 deletion provisioning/image_cache.go
Expand Up @@ -198,7 +198,7 @@ func newImageCachePodTemplateSpec(info *ProvisioningInfo) (*corev1.PodTemplateSp
},
InitContainers: injectProxyAndCA([]corev1.Container{
createInitContainerMachineOsDownloader(info),
createInitContainerIpaDownloader(info.Images),
createInitContainerIpaDownloader(info.Images, false),
}, info.Proxy),
Containers: containers,
HostNetwork: true,
Expand Down

0 comments on commit 7b0093d

Please sign in to comment.