Skip to content

Commit 0cc576e

Browse files
authored
Merge pull request #283 from arangodb/bug-fix/readiness-upgrade-fix
Bug fix/readiness upgrade fix
2 parents 302e2bb + 10efbda commit 0cc576e

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

pkg/deployment/resources/pod_creator.go

+14-3
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
}
@@ -369,12 +370,22 @@ func (r *Resources) createReadinessProbe(spec api.DeploymentSpec, group api.Serv
369370
}
370371
}
371372
probeCfg := &k8sutil.HTTPProbeConfig{
372-
LocalPath: "/_admin/server/availability",
373+
LocalPath: "/_api/version",
373374
Secure: spec.IsSecure(),
374375
Authorization: authorization,
375376
InitialDelaySeconds: 2,
376377
PeriodSeconds: 2,
377378
}
379+
switch spec.GetMode() {
380+
case api.DeploymentModeActiveFailover:
381+
probeCfg.LocalPath = "/_admin/echo"
382+
}
383+
384+
// /_admin/server/availability is the way to go, it is available since 3.3.9
385+
if version.CompareTo("3.3.9") >= 0 {
386+
probeCfg.LocalPath = "/_admin/server/availability"
387+
}
388+
378389
return probeCfg, nil
379390
}
380391

@@ -482,7 +493,7 @@ func (r *Resources) createPodForMember(spec api.DeploymentSpec, memberID string,
482493
if err != nil {
483494
return maskAny(err)
484495
}
485-
readinessProbe, err := r.createReadinessProbe(spec, group)
496+
readinessProbe, err := r.createReadinessProbe(spec, group, imageInfo.ArangoDBVersion)
486497
if err != nil {
487498
return maskAny(err)
488499
}

0 commit comments

Comments
 (0)