Skip to content

Commit 16614a2

Browse files
authored
[Feature] Cluster IP communication (#728)
1 parent e3ac5e6 commit 16614a2

22 files changed

+492
-132
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Change Log
22

33
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
4+
- Add IP, DNS, ShortDNS, HeadlessService (Default) communication methods
45

56
## [1.1.8](https://github.com/arangodb/kube-arangodb/tree/1.1.8) (2021-04-21)
67
- Prevent Single member recreation

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ dashboard/assets.go: $(DASHBOARDSOURCES) $(DASHBOARDDIR)/Dockerfile.build
229229
-v $(DASHBOARDDIR)/public:/usr/code/public:ro \
230230
-v $(DASHBOARDDIR)/src:/usr/code/src:ro \
231231
$(DASHBOARDBUILDIMAGE)
232-
go run github.com/jessevdk/go-assets-builder -s /dashboard/build/ -o dashboard/assets.go -p dashboard dashboard/build
232+
$(GOPATH)/bin/go-assets-builder -s /dashboard/build/ -o dashboard/assets.go -p dashboard dashboard/build
233233

234234
.PHONY: bin
235235
bin: $(BIN)
@@ -418,6 +418,8 @@ tools: update-vendor
418418
@go get golang.org/x/tools/cmd/goimports@0bb7e5c47b1a31f85d4f173edc878a8e049764a5
419419
@echo ">> Fetching license check"
420420
@go get github.com/google/addlicense@6d92264d717064f28b32464f0f9693a5b4ef0239
421+
@echo ">> Fetching GO Assets Builder"
422+
@go get github.com/jessevdk/go-assets-builder@b8483521738fd2198ecfc378067a4e8a6079f8e5
421423

422424
.PHONY: vendor
423425
vendor:

dashboard/assets.go

Lines changed: 58 additions & 58 deletions
Large diffs are not rendered by default.

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/arangodb/kube-arangodb
33
go 1.16
44

55
replace (
6-
github.com/arangodb/go-driver => github.com/arangodb/go-driver v0.0.0-20200617115956-9dac4c7fed22
6+
github.com/arangodb/go-driver => github.com/arangodb/go-driver v0.0.0-20210518064911-4985e8be3d90
77
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring => github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.46.0
88
github.com/prometheus-operator/prometheus-operator/pkg/client => github.com/prometheus-operator/prometheus-operator/pkg/client v0.46.0
99
github.com/stretchr/testify => github.com/stretchr/testify v1.5.1
@@ -42,6 +42,7 @@ require (
4242
github.com/jessevdk/go-assets v0.0.0-20160921144138-4f4301a06e15
4343
github.com/jessevdk/go-assets-builder v0.0.0-20130903091706-b8483521738f // indirect
4444
github.com/jessevdk/go-flags v1.4.0 // indirect
45+
github.com/json-iterator/go v1.1.10
4546
github.com/julienschmidt/httprouter v1.3.0
4647
github.com/kevinburke/rest v0.0.0-20210222204520-f7a2e216372f // indirect
4748
github.com/magiconair/properties v1.8.0
@@ -52,15 +53,14 @@ require (
5253
github.com/prometheus-operator/prometheus-operator/pkg/client v0.0.0-00010101000000-000000000000
5354
github.com/prometheus/client_golang v1.7.1
5455
github.com/robfig/cron v1.2.0
55-
github.com/rs/zerolog v1.14.3
56+
github.com/rs/zerolog v1.19.0
5657
github.com/spf13/cobra v1.0.0
5758
github.com/spf13/pflag v1.0.5
5859
github.com/stretchr/testify v1.5.1
5960
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect
6061
github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 // indirect
6162
github.com/voxelbrain/goptions v0.0.0-20180630082107-58cddc247ea2 // indirect
6263
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
63-
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 // indirect
6464
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57
6565
golang.org/x/tools v0.1.1-0.20210504181558-0bb7e5c47b1a // indirect
6666
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect

go.sum

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ github.com/arangodb/arangosync-client v0.6.3 h1:CJL9IxjCNVci2HNuWncZdVzHBeYTz0Ce
5252
github.com/arangodb/arangosync-client v0.6.3/go.mod h1:C0DmhtoPKJGm2PO18FrfZf4mVWcG7qW2YPBTFMR2P1g=
5353
github.com/arangodb/go-driver v0.0.0-20200617115956-9dac4c7fed22 h1:3Ken6Y1Qs+VLCTEiv1+807Gx2ToiuRCo8Dd1mPE5FC0=
5454
github.com/arangodb/go-driver v0.0.0-20200617115956-9dac4c7fed22/go.mod h1:JG79qtPYRxUB6CdGWSH1XwpolSBjthuZX+Iaz/H38rA=
55+
github.com/arangodb/go-driver v0.0.0-20210517114204-8cc084268066 h1:NneOFWxfa7rhNXIfEYWgxytudmgj2KPZfYSnKXSVGcw=
56+
github.com/arangodb/go-driver v0.0.0-20210517114204-8cc084268066/go.mod h1:3NUekcRLpgheFIGEwcOvxilEW73MV1queNKW58k7sdc=
57+
github.com/arangodb/go-driver v0.0.0-20210518064911-4985e8be3d90 h1:NMnMsS32jOF+e0v+MLXlgRJM7ejSAXxHg1UDv1q417I=
58+
github.com/arangodb/go-driver v0.0.0-20210518064911-4985e8be3d90/go.mod h1:3NUekcRLpgheFIGEwcOvxilEW73MV1queNKW58k7sdc=
5559
github.com/arangodb/go-upgrade-rules v0.0.0-20180809110947-031b4774ff21 h1:+W7D5ttxi/Ygh/39vialtypE23p9KI7P0J2qtoqUV4w=
5660
github.com/arangodb/go-upgrade-rules v0.0.0-20180809110947-031b4774ff21/go.mod h1:RkPIG6JJ2pcJUoymc18NxAJGraZd+iAEVnOTDjZey/w=
5761
github.com/arangodb/go-velocypack v0.0.0-20200318135517-5af53c29c67e h1:Xg+hGrY2LcQBbxd0ZFdbGSyRKTYMZCfBbw/pMJFOk1g=
@@ -226,6 +230,7 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq
226230
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
227231
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
228232
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
233+
github.com/google/addlicense v0.0.0-20200817051935-6f4cd4aacc89/go.mod h1:EMjYTRimagHs1FwlIqKyX3wAM0u3rA+McvlIIWmSamA=
229234
github.com/google/addlicense v0.0.0-20200906110928-a0294312aa76 h1:JypWNzPMSgH5yL0NvFoAIsDRlKFgL0AsS3GO5bg4Pto=
230235
github.com/google/addlicense v0.0.0-20200906110928-a0294312aa76/go.mod h1:EMjYTRimagHs1FwlIqKyX3wAM0u3rA+McvlIIWmSamA=
231236
github.com/google/addlicense v0.0.0-20210428195630-6d92264d7170 h1:jLUa4MO3autxlRJmC4KubeE5QGIb5JqW9oEaqYTb/fA=
@@ -415,6 +420,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
415420
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
416421
github.com/rs/zerolog v1.14.3 h1:4EGfSkR2hJDB0s3oFfrlPqjU1e4WLncergLil3nEKW0=
417422
github.com/rs/zerolog v1.14.3/go.mod h1:3WXPzbXEEliJ+a6UFE4vhIxV8qR1EML6ngzP9ug4eYg=
423+
github.com/rs/zerolog v1.19.0 h1:hYz4ZVdUgjXTBUmrkrw55j1nHx68LfOKIQk5IYtyScg=
424+
github.com/rs/zerolog v1.19.0/go.mod h1:IzD0RJ65iWH0w97OQQebJEvTZYvsCUm9WVLWBQrJRjo=
418425
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
419426
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
420427
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
@@ -463,6 +470,7 @@ github.com/voxelbrain/goptions v0.0.0-20180630082107-58cddc247ea2/go.mod h1:DGCI
463470
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
464471
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
465472
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
473+
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
466474
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
467475
github.com/yuin/goldmark v1.3.3/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
468476
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
@@ -544,6 +552,7 @@ golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLL
544552
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
545553
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
546554
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
555+
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
547556
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
548557
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
549558
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
@@ -563,6 +572,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEha
563572
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
564573
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
565574
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
575+
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
566576
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
567577
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
568578
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
@@ -642,6 +652,7 @@ golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgw
642652
golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
643653
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
644654
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
655+
golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
645656
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
646657
golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
647658
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
@@ -650,6 +661,7 @@ golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtn
650661
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
651662
golang.org/x/tools v0.0.0-20200616133436-c1934b75d054 h1:HHeAlu5H9b71C+Fx0K+1dGgVFN1DM1/wz4aoGOA5qS8=
652663
golang.org/x/tools v0.0.0-20200616133436-c1934b75d054/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
664+
golang.org/x/tools v0.0.0-20200818005847-188abfa75333/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
653665
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
654666
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
655667
golang.org/x/tools v0.1.1-0.20210504181558-0bb7e5c47b1a h1:xiJ7cj6CCsHjXZvlwLWEB1qwiw7jA7iWBzOLnkHM52c=

pkg/apis/deployment/v1/deployment_spec.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,46 @@ func validatePullPolicy(v core.PullPolicy) error {
5050
}
5151
}
5252

53+
// DeploymentCommunicationMethod define communication method used for inter-cluster communication
54+
type DeploymentCommunicationMethod string
55+
56+
// Get returns communication method from pointer. If pointer is nil default is returned.
57+
func (d *DeploymentCommunicationMethod) Get() DeploymentCommunicationMethod {
58+
if d == nil {
59+
return DefaultDeploymentCommunicationMethod
60+
}
61+
62+
switch v := *d; v {
63+
case DeploymentCommunicationMethodHeadlessService, DeploymentCommunicationMethodDNS, DeploymentCommunicationMethodIP, DeploymentCommunicationMethodShortDNS:
64+
return v
65+
default:
66+
return DefaultDeploymentCommunicationMethod
67+
}
68+
}
69+
70+
// String returns string representation of method.
71+
func (d DeploymentCommunicationMethod) String() string {
72+
return string(d)
73+
}
74+
75+
// New returns pointer.
76+
func (d DeploymentCommunicationMethod) New() *DeploymentCommunicationMethod {
77+
return &d
78+
}
79+
80+
const (
81+
// DefaultDeploymentCommunicationMethod define default communication method.
82+
DefaultDeploymentCommunicationMethod = DeploymentCommunicationMethodHeadlessService
83+
// DeploymentCommunicationMethodHeadlessService define old communication mechanism, based on headless service.
84+
DeploymentCommunicationMethodHeadlessService DeploymentCommunicationMethod = "headless"
85+
// DeploymentCommunicationMethodDNS define ClusterIP Service DNS based communication.
86+
DeploymentCommunicationMethodDNS DeploymentCommunicationMethod = "dns"
87+
// DeploymentCommunicationMethodDNS define ClusterIP Service DNS based communication. Use namespaced short DNS (used in migration)
88+
DeploymentCommunicationMethodShortDNS DeploymentCommunicationMethod = "short-dns"
89+
// DeploymentCommunicationMethodIP define ClusterIP Servce IP based communication.
90+
DeploymentCommunicationMethodIP DeploymentCommunicationMethod = "ip"
91+
)
92+
5393
// DeploymentSpec contains the spec part of a ArangoDeployment resource.
5494
type DeploymentSpec struct {
5595
Mode *DeploymentMode `json:"mode,omitempty"`
@@ -118,6 +158,9 @@ type DeploymentSpec struct {
118158
Timeouts *Timeouts `json:"timeouts,omitempty"`
119159

120160
ClusterDomain *string `json:"ClusterDomain,omitempty"`
161+
162+
// CommunicationMethod define communication method used in deployment
163+
CommunicationMethod *DeploymentCommunicationMethod `json:"communicationMethod,omitempty"`
121164
}
122165

123166
// GetRestoreFrom returns the restore from string or empty string if not set

pkg/apis/deployment/v1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/deployment/deployment_inspector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func (d *Deployment) inspectDeploymentWithError(ctx context.Context, lastInterva
235235
}
236236

237237
// Ensure we have image info
238-
if retrySoon, exists, err := d.ensureImages(ctx, d.apiObject); err != nil {
238+
if retrySoon, exists, err := d.ensureImages(ctx, d.apiObject, cachedStatus); err != nil {
239239
return minInspectionInterval, errors.Wrapf(err, "Image detection failed")
240240
} else if retrySoon || !exists {
241241
return minInspectionInterval, nil

pkg/deployment/images.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import (
3030
"strings"
3131
"time"
3232

33+
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
34+
3335
"github.com/arangodb/kube-arangodb/pkg/util/errors"
3436

3537
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/interfaces"
@@ -81,7 +83,7 @@ type imagesBuilder struct {
8183

8284
// ensureImages creates pods needed to detect ImageID for specified images.
8385
// Returns: retrySoon, error
84-
func (d *Deployment) ensureImages(ctx context.Context, apiObject *api.ArangoDeployment) (bool, bool, error) {
86+
func (d *Deployment) ensureImages(ctx context.Context, apiObject *api.ArangoDeployment, cachedStatus inspectorInterface.Inspector) (bool, bool, error) {
8587
status, lastVersion := d.GetStatus()
8688
ib := imagesBuilder{
8789
APIObject: apiObject,
@@ -96,8 +98,7 @@ func (d *Deployment) ensureImages(ctx context.Context, apiObject *api.ArangoDepl
9698
return nil
9799
},
98100
}
99-
100-
retrySoon, exists, err := ib.Run(ctx)
101+
retrySoon, exists, err := ib.Run(ctx, cachedStatus)
101102
if err != nil {
102103
return retrySoon, exists, errors.WithStack(err)
103104
}
@@ -107,11 +108,11 @@ func (d *Deployment) ensureImages(ctx context.Context, apiObject *api.ArangoDepl
107108
// Run creates pods needed to detect ImageID for specified images and puts the found
108109
// image ID's into the status.Images list.
109110
// Returns: retrySoon, error
110-
func (ib *imagesBuilder) Run(ctx context.Context) (bool, bool, error) {
111+
func (ib *imagesBuilder) Run(ctx context.Context, cachedStatus inspectorInterface.Inspector) (bool, bool, error) {
111112
// Check ArangoDB image
112113
if _, found := ib.Status.Images.GetByImage(ib.Spec.GetImage()); !found {
113114
// We need to find the image ID for the ArangoDB image
114-
retrySoon, err := ib.fetchArangoDBImageIDAndVersion(ctx, ib.Spec.GetImage())
115+
retrySoon, err := ib.fetchArangoDBImageIDAndVersion(ctx, cachedStatus, ib.Spec.GetImage())
115116
if err != nil {
116117
return retrySoon, false, errors.WithStack(err)
117118
}
@@ -124,7 +125,7 @@ func (ib *imagesBuilder) Run(ctx context.Context) (bool, bool, error) {
124125
// fetchArangoDBImageIDAndVersion checks a running pod for fetching the ID of the given image.
125126
// When no pod exists, it is created, otherwise the ID is fetched & version detected.
126127
// Returns: retrySoon, error
127-
func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, image string) (bool, error) {
128+
func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, cachedStatus inspectorInterface.Inspector, image string) (bool, error) {
128129
role := k8sutil.ImageIDAndVersionRole
129130
id := fmt.Sprintf("%0x", sha1.Sum([]byte(image)))[:6]
130131
podName := k8sutil.CreatePodName(ib.APIObject.GetName(), role, id, "")
@@ -225,7 +226,7 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, ima
225226
apiObject: ib.APIObject,
226227
}
227228

228-
pod, err = resources.RenderArangoPod(ib.APIObject, role, id, podName, args, &imagePod)
229+
pod, err = resources.RenderArangoPod(cachedStatus, ib.APIObject, role, id, podName, args, &imagePod)
229230
if err != nil {
230231
log.Debug().Err(err).Msg("Failed to render image ID pod")
231232
return true, errors.WithStack(err)
@@ -324,7 +325,7 @@ func (i *ImageUpdatePod) GetVolumes() ([]core.Volume, []core.VolumeMount) {
324325
func (i *ImageUpdatePod) GetSidecars(*core.Pod) {
325326
}
326327

327-
func (i *ImageUpdatePod) GetInitContainers() ([]core.Container, error) {
328+
func (i *ImageUpdatePod) GetInitContainers(cachedStatus interfaces.Inspector) ([]core.Container, error) {
328329
return nil, nil
329330
}
330331

pkg/deployment/images_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import (
2929
"testing"
3030
"time"
3131

32+
"github.com/arangodb/kube-arangodb/pkg/deployment/resources/inspector"
33+
3234
"github.com/arangodb/kube-arangodb/pkg/util/constants"
3335

3436
"github.com/arangodb/kube-arangodb/pkg/deployment/resources"
@@ -331,7 +333,7 @@ func TestEnsureImages(t *testing.T) {
331333
require.NoError(t, err)
332334

333335
// Act
334-
retrySoon, _, err := d.ensureImages(context.Background(), d.apiObject)
336+
retrySoon, _, err := d.ensureImages(context.Background(), d.apiObject, inspector.NewEmptyInspector())
335337

336338
// Assert
337339
assert.EqualValues(t, testCase.RetrySoon, retrySoon)

0 commit comments

Comments
 (0)