in pkg/resources/statefulset/ndb_statefulset_interface.go [141:182]
func (bss *baseStatefulSet) getDefaultInitContainers(nc *v1.NdbCluster) []corev1.Container {
// The ndb-pod-initializer is tool is the only default container to be run
cmdAndArgs := []string{
"ndb-pod-initializer",
}
// Load just the work dir volume mount
volumeMounts := []corev1.VolumeMount{
bss.getWorkDirVolumeMount(),
}
container := bss.createContainer(nc, "ndb-pod-init-container", cmdAndArgs, volumeMounts, nil)
// Export connection pool size to env for MySQL type pods
if bss.GetTypeName() == constants.NdbNodeTypeMySQLD {
container.Env = append(container.Env, corev1.EnvVar{
Name: "NDB_CONNECTION_POOL_SIZE",
Value: strconv.Itoa(int(nc.GetMySQLServerConnectionPoolSize())),
})
}
// Append the NDB operator password to the env variable of the ndb-pod-init-container
container.Env = append(container.Env, corev1.EnvVar{
Name: "NDB_OPERATOR_PASSWORD",
ValueFrom: &corev1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: resources.GetMySQLNDBOperatorPasswordSecretName(nc),
},
Key: corev1.BasicAuthPasswordKey,
},
},
})
// Use the current ndb operator image name in the container
ndbOperatorImageName := os.Getenv("NDB_OPERATOR_IMAGE")
container.Image = ndbOperatorImageName
container.ImagePullPolicy = corev1.PullIfNotPresent
return []corev1.Container{container}
}