Skip to content

Commit

Permalink
Do not parse the version twice. (#8005)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Montgomery <mmontg1@gmail.com>
  • Loading branch information
naemono authored Aug 15, 2024
1 parent b5ad83d commit 3ab33e8
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pkg/controller/elasticsearch/nodespec/podspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,17 @@ func BuildPodTemplateSpec(
}
}

v, err := version.Parse(es.Spec.Version)
if err != nil {
return corev1.PodTemplateSpec{}, err // error unlikely and should have been caught during validation
}

// build the podTemplate until we have the effective resources configured
builder = builder.
WithLabels(labels).
WithAnnotations(annotations).
WithDockerImage(es.Spec.Image, container.ImageRepository(container.ElasticsearchImage, v)).
WithDockerImage(es.Spec.Image, container.ImageRepository(container.ElasticsearchImage, ver)).
WithResources(DefaultResources).
WithTerminationGracePeriod(DefaultTerminationGracePeriodSeconds).
WithPorts(defaultContainerPorts).
WithReadinessProbe(*NewReadinessProbe(v)).
WithReadinessProbe(*NewReadinessProbe(ver)).
WithAffinity(DefaultAffinity(es.Name)).
WithEnv(DefaultEnvVars(v, es.Spec.HTTP, headlessServiceName)...).
WithEnv(DefaultEnvVars(ver, es.Spec.HTTP, headlessServiceName)...).
WithVolumes(volumes...).
WithVolumeMounts(volumeMounts...).
WithInitContainers(initContainers...).
Expand Down

0 comments on commit 3ab33e8

Please sign in to comment.