From 42a265f5e2ac46eeb8cf276e9b0638b71aba830e Mon Sep 17 00:00:00 2001 From: lamai93 Date: Wed, 31 Oct 2018 14:52:33 +0100 Subject: [PATCH 1/3] Set label to `disableIPv6` and added `TESTDISABLEIPV6` var to disable IPv6 for testing. --- .../Kubernetes/DeploymentResource.md | 2 +- pkg/apis/deployment/v1alpha/deployment_spec.go | 18 +++++++++--------- .../deployment/v1alpha/deployment_spec_test.go | 8 ++++---- .../v1alpha/zz_generated.deepcopy.go | 4 ++-- scripts/kube_run_tests.sh | 1 + tests/test_util.go | 7 ++++++- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/docs/Manual/Deployment/Kubernetes/DeploymentResource.md b/docs/Manual/Deployment/Kubernetes/DeploymentResource.md index 1e05de4aa..b6f3fb9bb 100644 --- a/docs/Manual/Deployment/Kubernetes/DeploymentResource.md +++ b/docs/Manual/Deployment/Kubernetes/DeploymentResource.md @@ -325,7 +325,7 @@ servers. When not specified, no monitoring token is used. The default value is empty. -### `spec.disableIPV6: bool` +### `spec.disableIPv6: bool` This setting prevents the use of IPv6 addresses by ArangoDB servers. The default is `false`. diff --git a/pkg/apis/deployment/v1alpha/deployment_spec.go b/pkg/apis/deployment/v1alpha/deployment_spec.go index 5c51a4728..e1e2a5654 100644 --- a/pkg/apis/deployment/v1alpha/deployment_spec.go +++ b/pkg/apis/deployment/v1alpha/deployment_spec.go @@ -51,7 +51,7 @@ type DeploymentSpec struct { Image *string `json:"image,omitempty"` ImagePullPolicy *v1.PullPolicy `json:"imagePullPolicy,omitempty"` DowntimeAllowed *bool `json:"downtimeAllowed,omitempty"` - DisableIPV6 *bool `json:"disableIPV6,omitempty"` + DisableIPv6 *bool `json:"disableIPv6,omitempty"` ExternalAccess ExternalAccessSpec `json:"externalAccess"` RocksDB RocksDBSpec `json:"rocksdb"` @@ -99,14 +99,14 @@ func (s DeploymentSpec) IsDowntimeAllowed() bool { return util.BoolOrDefault(s.DowntimeAllowed) } -// IsDisableIPV6 returns the value of disableIPV6. -func (s DeploymentSpec) IsDisableIPV6() bool { - return util.BoolOrDefault(s.DisableIPV6) +// IsDisableIPv6 returns the value of disableIPV6. +func (s DeploymentSpec) IsDisableIPv6() bool { + return util.BoolOrDefault(s.DisableIPv6) } // GetListenAddr returns "[::]" or "0.0.0.0" depending on IsDisableIPV6 func (s DeploymentSpec) GetListenAddr() string { - if s.IsDisableIPV6() { + if s.IsDisableIPv6() { return "0.0.0.0" } return "[::]" @@ -194,8 +194,8 @@ func (s *DeploymentSpec) SetDefaultsFrom(source DeploymentSpec) { if s.DowntimeAllowed == nil { s.DowntimeAllowed = util.NewBoolOrNil(source.DowntimeAllowed) } - if s.DisableIPV6 == nil { - s.DisableIPV6 = util.NewBoolOrNil(source.DisableIPV6) + if s.DisableIPv6 == nil { + s.DisableIPv6 = util.NewBoolOrNil(source.DisableIPv6) } s.ExternalAccess.SetDefaultsFrom(source.ExternalAccess) s.RocksDB.SetDefaultsFrom(source.RocksDB) @@ -286,8 +286,8 @@ func (s DeploymentSpec) ResetImmutableFields(target *DeploymentSpec) []string { target.StorageEngine = NewStorageEngineOrNil(s.StorageEngine) resetFields = append(resetFields, "storageEngine") } - if s.IsDisableIPV6() != target.IsDisableIPV6() { - target.DisableIPV6 = util.NewBoolOrNil(s.DisableIPV6) + if s.IsDisableIPv6() != target.IsDisableIPv6() { + target.DisableIPv6 = util.NewBoolOrNil(s.DisableIPv6) resetFields = append(resetFields, "disableIPV6") } if l := s.ExternalAccess.ResetImmutableFields("externalAccess", &target.ExternalAccess); l != nil { diff --git a/pkg/apis/deployment/v1alpha/deployment_spec_test.go b/pkg/apis/deployment/v1alpha/deployment_spec_test.go index 4bd447905..a30ee351f 100644 --- a/pkg/apis/deployment/v1alpha/deployment_spec_test.go +++ b/pkg/apis/deployment/v1alpha/deployment_spec_test.go @@ -97,11 +97,11 @@ func TestDeploymentSpecResetImmutableFields(t *testing.T) { []string{"mode", "agents.count"}, }, { - DeploymentSpec{DisableIPV6: util.NewBool(false)}, - DeploymentSpec{DisableIPV6: util.NewBool(true)}, - DeploymentSpec{DisableIPV6: util.NewBool(false)}, + DeploymentSpec{DisableIPv6: util.NewBool(false)}, + DeploymentSpec{DisableIPv6: util.NewBool(true)}, + DeploymentSpec{DisableIPv6: util.NewBool(false)}, false, - []string{"disableIPV6"}, + []string{"disableIPv6"}, }, } diff --git a/pkg/apis/deployment/v1alpha/zz_generated.deepcopy.go b/pkg/apis/deployment/v1alpha/zz_generated.deepcopy.go index 37e37b3a4..2886d19ff 100644 --- a/pkg/apis/deployment/v1alpha/zz_generated.deepcopy.go +++ b/pkg/apis/deployment/v1alpha/zz_generated.deepcopy.go @@ -239,8 +239,8 @@ func (in *DeploymentSpec) DeepCopyInto(out *DeploymentSpec) { *out = new(bool) **out = **in } - if in.DisableIPV6 != nil { - in, out := &in.DisableIPV6, &out.DisableIPV6 + if in.DisableIPv6 != nil { + in, out := &in.DisableIPv6, &out.DisableIPv6 *out = new(bool) **out = **in } diff --git a/scripts/kube_run_tests.sh b/scripts/kube_run_tests.sh index 9df7dec27..0d9597c40 100755 --- a/scripts/kube_run_tests.sh +++ b/scripts/kube_run_tests.sh @@ -18,5 +18,6 @@ kubectl --namespace ${DEPLOYMENTNAMESPACE} \ --env="ARANGODIMAGE=${ARANGODIMAGE}" \ --env="TEST_NAMESPACE=${DEPLOYMENTNAMESPACE}" \ --env="CLEANDEPLOYMENTS=${CLEANDEPLOYMENTS}" \ + --env="TESTDISABLEIPV6=${TESTDISABLEIPV6}" \ -- \ -test.v -test.timeout $TESTTIMEOUT $TESTLENGTHOPTIONS $TESTOPTIONS diff --git a/tests/test_util.go b/tests/test_util.go index 3cbe03789..bd70ecdf4 100644 --- a/tests/test_util.go +++ b/tests/test_util.go @@ -49,10 +49,10 @@ import ( api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1alpha" "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned" + "github.com/arangodb/kube-arangodb/pkg/util" "github.com/arangodb/kube-arangodb/pkg/util/arangod" "github.com/arangodb/kube-arangodb/pkg/util/k8sutil" "github.com/arangodb/kube-arangodb/pkg/util/retry" - "github.com/arangodb/kube-arangodb/pkg/util" ) const ( @@ -253,6 +253,11 @@ func newDeployment(name string) *api.ArangoDeployment { depl.Spec.Image = util.NewString(image) } + disableIPv6 := strings.TrimSpace(os.Getenv("TESTDISABLEIPV6")) + if disableIPv6 != "" && disableIPv6 != "0" { + depl.Spec.DisableIPv6 = util.NewBool(true) + } + return depl } From 86fbeb0eb073ba730714e63a7dfd286bb060d18a Mon Sep 17 00:00:00 2001 From: lamai93 Date: Wed, 31 Oct 2018 14:55:38 +0100 Subject: [PATCH 2/3] Fixed comment. --- pkg/apis/deployment/v1alpha/deployment_spec.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/apis/deployment/v1alpha/deployment_spec.go b/pkg/apis/deployment/v1alpha/deployment_spec.go index e1e2a5654..dea138e0f 100644 --- a/pkg/apis/deployment/v1alpha/deployment_spec.go +++ b/pkg/apis/deployment/v1alpha/deployment_spec.go @@ -99,7 +99,7 @@ func (s DeploymentSpec) IsDowntimeAllowed() bool { return util.BoolOrDefault(s.DowntimeAllowed) } -// IsDisableIPv6 returns the value of disableIPV6. +// IsDisableIPv6 returns the value of disableIPv6. func (s DeploymentSpec) IsDisableIPv6() bool { return util.BoolOrDefault(s.DisableIPv6) } From 41e15a4462174964b5813140636f7be7516bac3c Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Wed, 31 Oct 2018 15:36:55 +0100 Subject: [PATCH 3/3] Two more capital V. --- pkg/apis/deployment/v1alpha/deployment_spec.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/apis/deployment/v1alpha/deployment_spec.go b/pkg/apis/deployment/v1alpha/deployment_spec.go index dea138e0f..3a55163b4 100644 --- a/pkg/apis/deployment/v1alpha/deployment_spec.go +++ b/pkg/apis/deployment/v1alpha/deployment_spec.go @@ -104,7 +104,7 @@ func (s DeploymentSpec) IsDisableIPv6() bool { return util.BoolOrDefault(s.DisableIPv6) } -// GetListenAddr returns "[::]" or "0.0.0.0" depending on IsDisableIPV6 +// GetListenAddr returns "[::]" or "0.0.0.0" depending on IsDisableIPv6 func (s DeploymentSpec) GetListenAddr() string { if s.IsDisableIPv6() { return "0.0.0.0" @@ -288,7 +288,7 @@ func (s DeploymentSpec) ResetImmutableFields(target *DeploymentSpec) []string { } if s.IsDisableIPv6() != target.IsDisableIPv6() { target.DisableIPv6 = util.NewBoolOrNil(s.DisableIPv6) - resetFields = append(resetFields, "disableIPV6") + resetFields = append(resetFields, "disableIPv6") } if l := s.ExternalAccess.ResetImmutableFields("externalAccess", &target.ExternalAccess); l != nil { resetFields = append(resetFields, l...)