Skip to content

Commit 3fab871

Browse files
authored
Merge pull request #285 from arangodb/feature/disable-ipv6
IPv6 revisited
2 parents 94d7ae8 + 41e15a4 commit 3fab871

File tree

6 files changed

+25
-19
lines changed

6 files changed

+25
-19
lines changed

docs/Manual/Deployment/Kubernetes/DeploymentResource.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ servers.
325325
When not specified, no monitoring token is used.
326326
The default value is empty.
327327

328-
### `spec.disableIPV6: bool`
328+
### `spec.disableIPv6: bool`
329329

330330
This setting prevents the use of IPv6 addresses by ArangoDB servers.
331331
The default is `false`.

pkg/apis/deployment/v1alpha/deployment_spec.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type DeploymentSpec struct {
5151
Image *string `json:"image,omitempty"`
5252
ImagePullPolicy *v1.PullPolicy `json:"imagePullPolicy,omitempty"`
5353
DowntimeAllowed *bool `json:"downtimeAllowed,omitempty"`
54-
DisableIPV6 *bool `json:"disableIPV6,omitempty"`
54+
DisableIPv6 *bool `json:"disableIPv6,omitempty"`
5555

5656
ExternalAccess ExternalAccessSpec `json:"externalAccess"`
5757
RocksDB RocksDBSpec `json:"rocksdb"`
@@ -99,14 +99,14 @@ func (s DeploymentSpec) IsDowntimeAllowed() bool {
9999
return util.BoolOrDefault(s.DowntimeAllowed)
100100
}
101101

102-
// IsDisableIPV6 returns the value of disableIPV6.
103-
func (s DeploymentSpec) IsDisableIPV6() bool {
104-
return util.BoolOrDefault(s.DisableIPV6)
102+
// IsDisableIPv6 returns the value of disableIPv6.
103+
func (s DeploymentSpec) IsDisableIPv6() bool {
104+
return util.BoolOrDefault(s.DisableIPv6)
105105
}
106106

107-
// GetListenAddr returns "[::]" or "0.0.0.0" depending on IsDisableIPV6
107+
// GetListenAddr returns "[::]" or "0.0.0.0" depending on IsDisableIPv6
108108
func (s DeploymentSpec) GetListenAddr() string {
109-
if s.IsDisableIPV6() {
109+
if s.IsDisableIPv6() {
110110
return "0.0.0.0"
111111
}
112112
return "[::]"
@@ -194,8 +194,8 @@ func (s *DeploymentSpec) SetDefaultsFrom(source DeploymentSpec) {
194194
if s.DowntimeAllowed == nil {
195195
s.DowntimeAllowed = util.NewBoolOrNil(source.DowntimeAllowed)
196196
}
197-
if s.DisableIPV6 == nil {
198-
s.DisableIPV6 = util.NewBoolOrNil(source.DisableIPV6)
197+
if s.DisableIPv6 == nil {
198+
s.DisableIPv6 = util.NewBoolOrNil(source.DisableIPv6)
199199
}
200200
s.ExternalAccess.SetDefaultsFrom(source.ExternalAccess)
201201
s.RocksDB.SetDefaultsFrom(source.RocksDB)
@@ -286,9 +286,9 @@ func (s DeploymentSpec) ResetImmutableFields(target *DeploymentSpec) []string {
286286
target.StorageEngine = NewStorageEngineOrNil(s.StorageEngine)
287287
resetFields = append(resetFields, "storageEngine")
288288
}
289-
if s.IsDisableIPV6() != target.IsDisableIPV6() {
290-
target.DisableIPV6 = util.NewBoolOrNil(s.DisableIPV6)
291-
resetFields = append(resetFields, "disableIPV6")
289+
if s.IsDisableIPv6() != target.IsDisableIPv6() {
290+
target.DisableIPv6 = util.NewBoolOrNil(s.DisableIPv6)
291+
resetFields = append(resetFields, "disableIPv6")
292292
}
293293
if l := s.ExternalAccess.ResetImmutableFields("externalAccess", &target.ExternalAccess); l != nil {
294294
resetFields = append(resetFields, l...)

pkg/apis/deployment/v1alpha/deployment_spec_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ func TestDeploymentSpecResetImmutableFields(t *testing.T) {
9797
[]string{"mode", "agents.count"},
9898
},
9999
{
100-
DeploymentSpec{DisableIPV6: util.NewBool(false)},
101-
DeploymentSpec{DisableIPV6: util.NewBool(true)},
102-
DeploymentSpec{DisableIPV6: util.NewBool(false)},
100+
DeploymentSpec{DisableIPv6: util.NewBool(false)},
101+
DeploymentSpec{DisableIPv6: util.NewBool(true)},
102+
DeploymentSpec{DisableIPv6: util.NewBool(false)},
103103
false,
104-
[]string{"disableIPV6"},
104+
[]string{"disableIPv6"},
105105
},
106106
}
107107

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

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

scripts/kube_run_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ kubectl --namespace ${DEPLOYMENTNAMESPACE} \
1818
--env="ARANGODIMAGE=${ARANGODIMAGE}" \
1919
--env="TEST_NAMESPACE=${DEPLOYMENTNAMESPACE}" \
2020
--env="CLEANDEPLOYMENTS=${CLEANDEPLOYMENTS}" \
21+
--env="TESTDISABLEIPV6=${TESTDISABLEIPV6}" \
2122
-- \
2223
-test.v -test.timeout $TESTTIMEOUT $TESTLENGTHOPTIONS $TESTOPTIONS

tests/test_util.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ import (
4949

5050
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1alpha"
5151
"github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
52+
"github.com/arangodb/kube-arangodb/pkg/util"
5253
"github.com/arangodb/kube-arangodb/pkg/util/arangod"
5354
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
5455
"github.com/arangodb/kube-arangodb/pkg/util/retry"
55-
"github.com/arangodb/kube-arangodb/pkg/util"
5656
)
5757

5858
const (
@@ -271,6 +271,11 @@ func newDeployment(name string) *api.ArangoDeployment {
271271
depl.Spec.Image = util.NewString(image)
272272
}
273273

274+
disableIPv6 := strings.TrimSpace(os.Getenv("TESTDISABLEIPV6"))
275+
if disableIPv6 != "" && disableIPv6 != "0" {
276+
depl.Spec.DisableIPv6 = util.NewBool(true)
277+
}
278+
274279
return depl
275280
}
276281

0 commit comments

Comments
 (0)