make metal3 container list construction more concise
@@ -97,12 +97,11 @@ func buildEnvVar(name string, baremetalProvisioningConfig BaremetalProvisioningC
Name: name,
Value: *value,
}
- } else {
+ }
return corev1.EnvVar{
Name: name,
}
}
-}
func setMariadbPassword() corev1.EnvVar {
return corev1.EnvVar{
@@ -395,10 +394,8 @@ func createInitContainerStaticIpSet(config *OperatorConfig, baremetalProvisionin
return initContainer
}
-func newMetal3Containers(config *OperatorConfig, baremetalProvisioningConfig BaremetalProvisioningConfig) []corev1.Container {
- //Starting off with the metal3-baremetal-operator container
- containers := []corev1.Container{
- {
+func createContainerMetal3BareMetalOperator(config *OperatorConfig, baremetalProvisioningConfig BaremetalProvisioningConfig) corev1.Container {
+ return corev1.Container{
Name: "metal3-baremetal-operator",
Image: config.BaremetalControllers.BaremetalOperator,
Ports: []corev1.ContainerPort{
@@ -443,17 +440,23 @@ func newMetal3Containers(config *OperatorConfig, baremetalProvisioningConfig Bar
Value: metal3AuthRootDir,
},
},
- },
+ }
+}
+
+func newMetal3Containers(config *OperatorConfig, baremetalProvisioningConfig BaremetalProvisioningConfig) []corev1.Container {
+ containers := []corev1.Container{
+ createContainerMetal3BareMetalOperator(config, baremetalProvisioningConfig),
+ createContainerMetal3Mariadb(config),
+ createContainerMetal3Httpd(config, baremetalProvisioningConfig),
+ createContainerMetal3IronicConductor(config, baremetalProvisioningConfig),
+ createContainerMetal3IronicApi(config, baremetalProvisioningConfig),
+ createContainerMetal3IronicInspector(config, baremetalProvisioningConfig),
+ createContainerMetal3StaticIpManager(config, baremetalProvisioningConfig),
}
if baremetalProvisioningConfig.ProvisioningNetwork != provisioningNetworkDisabled {
containers = append(containers, createContainerMetal3Dnsmasq(config, baremetalProvisioningConfig))
}
- containers = append(containers, createContainerMetal3Mariadb(config))
- containers = append(containers, createContainerMetal3Httpd(config, baremetalProvisioningConfig))
- containers = append(containers, createContainerMetal3IronicConductor(config, baremetalProvisioningConfig))
- containers = append(containers, createContainerMetal3IronicApi(config, baremetalProvisioningConfig))
- containers = append(containers, createContainerMetal3IronicInspector(config, baremetalProvisioningConfig))
- containers = append(containers, createContainerMetal3StaticIpManager(config, baremetalProvisioningConfig))
+
return containers
}
