Skip to content

Commit 12a37be

Browse files
author
lamai93
committed
Pass version to createReadynessProbe.
1 parent b4225aa commit 12a37be

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

pkg/deployment/resources/pod_creator.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"sync"
3636
"time"
3737

38+
driver "github.com/arangodb/go-driver"
3839
"github.com/arangodb/go-driver/jwt"
3940
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1alpha"
4041
"github.com/arangodb/kube-arangodb/pkg/util/constants"
@@ -353,7 +354,7 @@ func (r *Resources) createLivenessProbe(spec api.DeploymentSpec, group api.Serve
353354
}
354355

355356
// createReadinessProbe creates configuration for a readiness probe of a server in the given group.
356-
func (r *Resources) createReadinessProbe(spec api.DeploymentSpec, group api.ServerGroup) (*k8sutil.HTTPProbeConfig, error) {
357+
func (r *Resources) createReadinessProbe(spec api.DeploymentSpec, group api.ServerGroup, version driver.Version) (*k8sutil.HTTPProbeConfig, error) {
357358
if group != api.ServerGroupSingle && group != api.ServerGroupCoordinators {
358359
return nil, nil
359360
}
@@ -380,14 +381,8 @@ func (r *Resources) createReadinessProbe(spec api.DeploymentSpec, group api.Serv
380381
probeCfg.LocalPath = "/_admin/echo"
381382
}
382383

383-
status, _ := r.context.GetStatus()
384-
currentImage := status.CurrentImage
385-
if currentImage == nil {
386-
return nil, fmt.Errorf("CurrentImage is nil when creating a pod")
387-
}
388-
389384
// /_admin/server/availability is the way to go, it is available since 3.3.9
390-
if currentImage.ArangoDBVersion.CompareTo("3.3.9") >= 0 {
385+
if version.CompareTo("3.3.9") >= 0 {
391386
probeCfg.LocalPath = "/_admin/server/availability"
392387
}
393388

@@ -498,7 +493,7 @@ func (r *Resources) createPodForMember(spec api.DeploymentSpec, memberID string,
498493
if err != nil {
499494
return maskAny(err)
500495
}
501-
readinessProbe, err := r.createReadinessProbe(spec, group)
496+
readinessProbe, err := r.createReadinessProbe(spec, group, imageInfo.ArangoDBVersion)
502497
if err != nil {
503498
return maskAny(err)
504499
}

0 commit comments

Comments
 (0)