mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Feature] Generics for type handling (#1313)
This commit is contained in:
parent
fcc86c59c1
commit
0bbf335a47
113 changed files with 1009 additions and 1021 deletions
|
@ -7,6 +7,7 @@
|
|||
- (Bugfix) Discover Arango image during ID phase
|
||||
- (Feature) PV Unschedulable condition
|
||||
- (Feature) Features startup logging
|
||||
- (Maintenance) Generics for type handling
|
||||
|
||||
## [1.2.27](https://github.com/arangodb/kube-arangodb/tree/1.2.27) (2023-04-27)
|
||||
- (Feature) Add InSync Cache
|
||||
|
|
|
@ -83,11 +83,11 @@ func GenerateReadme(root string) error {
|
|||
for _, v := range p.Versions {
|
||||
if err := t.AddRow(map[md.Column]string{
|
||||
platform: p.Name,
|
||||
kVersion: util.StringOrDefault(v.KubernetesVersion, ""),
|
||||
aVersion: util.StringOrDefault(v.ArangoDBVersion, ""),
|
||||
state: util.StringOrDefault(v.State, ""),
|
||||
remarks: util.StringOrDefault(v.Remarks, ""),
|
||||
pRemarks: util.StringOrDefault(v.ProviderRemarks, ""),
|
||||
kVersion: util.TypeOrDefault[string](v.KubernetesVersion, ""),
|
||||
aVersion: util.TypeOrDefault[string](v.ArangoDBVersion, ""),
|
||||
state: util.TypeOrDefault[string](v.State, ""),
|
||||
remarks: util.TypeOrDefault[string](v.Remarks, ""),
|
||||
pRemarks: util.TypeOrDefault[string](v.ProviderRemarks, ""),
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -43,9 +43,9 @@ func TestArangoBackupSpecBackOff_Backoff(t *testing.T) {
|
|||
})
|
||||
t.Run("Custom", func(t *testing.T) {
|
||||
b := &ArangoBackupSpecBackOff{
|
||||
MinDelay: util.NewInt(20),
|
||||
MaxDelay: util.NewInt(120),
|
||||
Iterations: util.NewInt(10),
|
||||
MinDelay: util.NewType[int](20),
|
||||
MaxDelay: util.NewType[int](120),
|
||||
Iterations: util.NewType[int](10),
|
||||
}
|
||||
|
||||
assert.Equal(t, 20*time.Second, b.Backoff(0))
|
||||
|
@ -64,9 +64,9 @@ func TestArangoBackupSpecBackOff_Backoff(t *testing.T) {
|
|||
|
||||
t.Run("Invalid", func(t *testing.T) {
|
||||
b := &ArangoBackupSpecBackOff{
|
||||
MinDelay: util.NewInt(-1),
|
||||
MaxDelay: util.NewInt(-1),
|
||||
Iterations: util.NewInt(0),
|
||||
MinDelay: util.NewType[int](-1),
|
||||
MaxDelay: util.NewType[int](-1),
|
||||
Iterations: util.NewType[int](0),
|
||||
}
|
||||
|
||||
assert.Equal(t, 0, b.GetMinDelay())
|
||||
|
@ -78,8 +78,8 @@ func TestArangoBackupSpecBackOff_Backoff(t *testing.T) {
|
|||
|
||||
t.Run("Max < Min", func(t *testing.T) {
|
||||
b := &ArangoBackupSpecBackOff{
|
||||
MinDelay: util.NewInt(50),
|
||||
MaxDelay: util.NewInt(20),
|
||||
MinDelay: util.NewType[int](50),
|
||||
MaxDelay: util.NewType[int](20),
|
||||
}
|
||||
|
||||
assert.Equal(t, 20, b.GetMinDelay())
|
||||
|
|
|
@ -42,8 +42,8 @@ func TestArangoBackupStatusBackOff_Backoff(t *testing.T) {
|
|||
|
||||
t.Run("Test MaxIterations", func(t *testing.T) {
|
||||
var spec = &ArangoBackupSpecBackOff{
|
||||
Iterations: util.NewInt(2),
|
||||
MaxIterations: util.NewInt(3),
|
||||
Iterations: util.NewType[int](2),
|
||||
MaxIterations: util.NewType[int](3),
|
||||
}
|
||||
var status *ArangoBackupStatusBackOff
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -38,7 +38,7 @@ const (
|
|||
|
||||
// GetJWTSecretName returns the value of jwtSecretName.
|
||||
func (s AuthenticationSpec) GetJWTSecretName() string {
|
||||
return util.StringOrDefault(s.JWTSecretName)
|
||||
return util.TypeOrDefault[string](s.JWTSecretName)
|
||||
}
|
||||
|
||||
// IsAuthenticated returns true if authentication is enabled.
|
||||
|
@ -65,14 +65,14 @@ func (s *AuthenticationSpec) SetDefaults(defaultJWTSecretName string) {
|
|||
if s.GetJWTSecretName() == "" {
|
||||
// Note that we don't check for nil here, since even a specified, but empty
|
||||
// string should result in the default value.
|
||||
s.JWTSecretName = util.NewString(defaultJWTSecretName)
|
||||
s.JWTSecretName = util.NewType[string](defaultJWTSecretName)
|
||||
}
|
||||
}
|
||||
|
||||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *AuthenticationSpec) SetDefaultsFrom(source AuthenticationSpec) {
|
||||
if s.JWTSecretName == nil {
|
||||
s.JWTSecretName = util.NewStringOrNil(source.JWTSecretName)
|
||||
s.JWTSecretName = util.NewTypeOrNil[string](source.JWTSecretName)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ func (s AuthenticationSpec) ResetImmutableFields(fieldPrefix string, target *Aut
|
|||
var resetFields []string
|
||||
if s.IsAuthenticated() != target.IsAuthenticated() {
|
||||
// Note: You can change the name, but not from empty to non-empty (or reverse).
|
||||
target.JWTSecretName = util.NewStringOrNil(s.JWTSecretName)
|
||||
target.JWTSecretName = util.NewTypeOrNil[string](s.JWTSecretName)
|
||||
resetFields = append(resetFields, fieldPrefix+".jwtSecretName")
|
||||
}
|
||||
return resetFields
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -30,18 +30,18 @@ import (
|
|||
|
||||
func TestAuthenticationSpecValidate(t *testing.T) {
|
||||
// Valid
|
||||
assert.Nil(t, AuthenticationSpec{JWTSecretName: util.NewString("None")}.Validate(false))
|
||||
assert.Nil(t, AuthenticationSpec{JWTSecretName: util.NewString("foo")}.Validate(false))
|
||||
assert.Nil(t, AuthenticationSpec{JWTSecretName: util.NewString("foo")}.Validate(true))
|
||||
assert.Nil(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("None")}.Validate(false))
|
||||
assert.Nil(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")}.Validate(false))
|
||||
assert.Nil(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")}.Validate(true))
|
||||
|
||||
// Not valid
|
||||
assert.Error(t, AuthenticationSpec{JWTSecretName: util.NewString("Foo")}.Validate(false))
|
||||
assert.Error(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("Foo")}.Validate(false))
|
||||
}
|
||||
|
||||
func TestAuthenticationSpecIsAuthenticated(t *testing.T) {
|
||||
assert.False(t, AuthenticationSpec{JWTSecretName: util.NewString("None")}.IsAuthenticated())
|
||||
assert.True(t, AuthenticationSpec{JWTSecretName: util.NewString("foo")}.IsAuthenticated())
|
||||
assert.True(t, AuthenticationSpec{JWTSecretName: util.NewString("")}.IsAuthenticated())
|
||||
assert.False(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("None")}.IsAuthenticated())
|
||||
assert.True(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")}.IsAuthenticated())
|
||||
assert.True(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("")}.IsAuthenticated())
|
||||
}
|
||||
|
||||
func TestAuthenticationSpecSetDefaults(t *testing.T) {
|
||||
|
@ -51,7 +51,7 @@ func TestAuthenticationSpecSetDefaults(t *testing.T) {
|
|||
}
|
||||
|
||||
assert.Equal(t, "test-jwt", def(AuthenticationSpec{}).GetJWTSecretName())
|
||||
assert.Equal(t, "foo", def(AuthenticationSpec{JWTSecretName: util.NewString("foo")}).GetJWTSecretName())
|
||||
assert.Equal(t, "foo", def(AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")}).GetJWTSecretName())
|
||||
}
|
||||
|
||||
func TestAuthenticationSpecResetImmutableFields(t *testing.T) {
|
||||
|
@ -63,35 +63,35 @@ func TestAuthenticationSpecResetImmutableFields(t *testing.T) {
|
|||
}{
|
||||
// Valid "changes"
|
||||
{
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("None")},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo2")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo2")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo2")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo2")},
|
||||
nil,
|
||||
},
|
||||
|
||||
// Invalid changes
|
||||
{
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
[]string{"test.jwtSecretName"},
|
||||
},
|
||||
{
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("None")},
|
||||
[]string{"test.jwtSecretName"},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -39,12 +39,12 @@ type ChaosSpec struct {
|
|||
|
||||
// IsEnabled returns the value of enabled.
|
||||
func (s ChaosSpec) IsEnabled() bool {
|
||||
return util.BoolOrDefault(s.Enabled)
|
||||
return util.TypeOrDefault[bool](s.Enabled)
|
||||
}
|
||||
|
||||
// GetInterval returns the value of interval.
|
||||
func (s ChaosSpec) GetInterval() time.Duration {
|
||||
return util.DurationOrDefault(s.Interval)
|
||||
return util.TypeOrDefault[time.Duration](s.Interval)
|
||||
}
|
||||
|
||||
// GetKillPodProbability returns the value of kill-pod-probability.
|
||||
|
@ -68,7 +68,7 @@ func (s ChaosSpec) Validate() error {
|
|||
// SetDefaults fills in missing defaults
|
||||
func (s *ChaosSpec) SetDefaults() {
|
||||
if s.GetInterval() == 0 {
|
||||
s.Interval = util.NewDuration(time.Minute)
|
||||
s.Interval = util.NewType[time.Duration](time.Minute)
|
||||
}
|
||||
if s.GetKillPodProbability() == 0 {
|
||||
s.KillPodProbability = NewPercent(50)
|
||||
|
@ -78,10 +78,10 @@ func (s *ChaosSpec) SetDefaults() {
|
|||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *ChaosSpec) SetDefaultsFrom(source ChaosSpec) {
|
||||
if s.Enabled == nil {
|
||||
s.Enabled = util.NewBoolOrNil(source.Enabled)
|
||||
s.Enabled = util.NewTypeOrNil[bool](source.Enabled)
|
||||
}
|
||||
if s.Interval == nil {
|
||||
s.Interval = util.NewDurationOrNil(source.Interval)
|
||||
s.Interval = util.NewTypeOrNil[time.Duration](source.Interval)
|
||||
}
|
||||
if s.KillPodProbability == nil {
|
||||
s.KillPodProbability = NewPercentOrNil(source.KillPodProbability)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -106,7 +106,7 @@ func (s *MetricsSpec) GetPort() uint16 {
|
|||
|
||||
// IsEnabled returns whether metrics are enabled or not
|
||||
func (s *MetricsSpec) IsEnabled() bool {
|
||||
return util.BoolOrDefault(s.Enabled, false)
|
||||
return util.TypeOrDefault[bool](s.Enabled, false)
|
||||
}
|
||||
|
||||
// HasImage returns whether a image was specified or not
|
||||
|
@ -118,22 +118,22 @@ func (s *MetricsSpec) HasImage() bool {
|
|||
// GetImage returns the Image or empty string
|
||||
// Deprecated
|
||||
func (s *MetricsSpec) GetImage() string {
|
||||
return util.StringOrDefault(s.Image)
|
||||
return util.TypeOrDefault[string](s.Image)
|
||||
}
|
||||
|
||||
// SetDefaults sets default values
|
||||
func (s *MetricsSpec) SetDefaults(defaultTokenName string, isAuthenticated bool) {
|
||||
if s.Enabled == nil {
|
||||
s.Enabled = util.NewBool(false)
|
||||
s.Enabled = util.NewType[bool](false)
|
||||
}
|
||||
if s.GetJWTTokenSecretName() == "" {
|
||||
s.Authentication.JWTTokenSecretName = util.NewString(defaultTokenName)
|
||||
s.Authentication.JWTTokenSecretName = util.NewType[string](defaultTokenName)
|
||||
}
|
||||
}
|
||||
|
||||
// GetJWTTokenSecretName returns the token secret name or empty string
|
||||
func (s *MetricsSpec) GetJWTTokenSecretName() string {
|
||||
return util.StringOrDefault(s.Authentication.JWTTokenSecretName)
|
||||
return util.TypeOrDefault[string](s.Authentication.JWTTokenSecretName)
|
||||
}
|
||||
|
||||
// HasJWTTokenSecretName returns true if a secret name was specified
|
||||
|
@ -144,13 +144,13 @@ func (s *MetricsSpec) HasJWTTokenSecretName() bool {
|
|||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *MetricsSpec) SetDefaultsFrom(source MetricsSpec) {
|
||||
if s.Enabled == nil {
|
||||
s.Enabled = util.NewBoolOrNil(source.Enabled)
|
||||
s.Enabled = util.NewTypeOrNil[bool](source.Enabled)
|
||||
}
|
||||
if s.Image == nil {
|
||||
s.Image = util.NewStringOrNil(source.Image)
|
||||
s.Image = util.NewTypeOrNil[string](source.Image)
|
||||
}
|
||||
if s.Authentication.JWTTokenSecretName == nil {
|
||||
s.Authentication.JWTTokenSecretName = util.NewStringOrNil(source.Authentication.JWTTokenSecretName)
|
||||
s.Authentication.JWTTokenSecretName = util.NewTypeOrNil[string](source.Authentication.JWTTokenSecretName)
|
||||
}
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
|
|
|
@ -217,7 +217,7 @@ func (s *DeploymentSpec) GetAllowMemberRecreation(group ServerGroup) bool {
|
|||
|
||||
// GetRestoreFrom returns the restore from string or empty string if not set
|
||||
func (s *DeploymentSpec) GetRestoreFrom() string {
|
||||
return util.StringOrDefault(s.RestoreFrom)
|
||||
return util.TypeOrDefault[string](s.RestoreFrom)
|
||||
}
|
||||
|
||||
// HasRestoreFrom returns true if RestoreFrom is set
|
||||
|
@ -252,7 +252,7 @@ func (s DeploymentSpec) GetStorageEngine() StorageEngine {
|
|||
|
||||
// GetImage returns the value of image.
|
||||
func (s DeploymentSpec) GetImage() string {
|
||||
return util.StringOrDefault(s.Image)
|
||||
return util.TypeOrDefault[string](s.Image)
|
||||
}
|
||||
|
||||
// GetSyncImage returns, if set, Sync.Image or the default image.
|
||||
|
@ -265,22 +265,22 @@ func (s DeploymentSpec) GetSyncImage() string {
|
|||
|
||||
// GetImagePullPolicy returns the value of imagePullPolicy.
|
||||
func (s DeploymentSpec) GetImagePullPolicy() core.PullPolicy {
|
||||
return util.PullPolicyOrDefault(s.ImagePullPolicy)
|
||||
return util.TypeOrDefault[core.PullPolicy](s.ImagePullPolicy)
|
||||
}
|
||||
|
||||
// IsDowntimeAllowed returns the value of downtimeAllowed.
|
||||
func (s DeploymentSpec) IsDowntimeAllowed() bool {
|
||||
return util.BoolOrDefault(s.DowntimeAllowed)
|
||||
return util.TypeOrDefault[bool](s.DowntimeAllowed)
|
||||
}
|
||||
|
||||
// IsDisableIPv6 returns the value of disableIPv6.
|
||||
func (s DeploymentSpec) IsDisableIPv6() bool {
|
||||
return util.BoolOrDefault(s.DisableIPv6)
|
||||
return util.TypeOrDefault[bool](s.DisableIPv6)
|
||||
}
|
||||
|
||||
// IsNetworkAttachedVolumes returns the value of networkAttachedVolumes, default false
|
||||
func (s DeploymentSpec) IsNetworkAttachedVolumes() bool {
|
||||
return util.BoolOrDefault(s.NetworkAttachedVolumes, false)
|
||||
return util.TypeOrDefault[bool](s.NetworkAttachedVolumes, false)
|
||||
}
|
||||
|
||||
// GetListenAddr returns "[::]" or "0.0.0.0" depending on IsDisableIPv6
|
||||
|
@ -353,10 +353,10 @@ func (s *DeploymentSpec) SetDefaults(deploymentName string) {
|
|||
s.StorageEngine = NewStorageEngine(StorageEngineRocksDB)
|
||||
}
|
||||
if s.GetImage() == "" && s.IsDevelopment() {
|
||||
s.Image = util.NewString(DefaultImage)
|
||||
s.Image = util.NewType[string](DefaultImage)
|
||||
}
|
||||
if s.GetImagePullPolicy() == "" {
|
||||
s.ImagePullPolicy = util.NewPullPolicy(core.PullIfNotPresent)
|
||||
s.ImagePullPolicy = util.NewType[core.PullPolicy](core.PullIfNotPresent)
|
||||
}
|
||||
s.ExternalAccess.SetDefaults()
|
||||
s.RocksDB.SetDefaults()
|
||||
|
@ -386,20 +386,20 @@ func (s *DeploymentSpec) SetDefaultsFrom(source DeploymentSpec) {
|
|||
s.StorageEngine = NewStorageEngineOrNil(source.StorageEngine)
|
||||
}
|
||||
if s.Image == nil {
|
||||
s.Image = util.NewStringOrNil(source.Image)
|
||||
s.Image = util.NewTypeOrNil[string](source.Image)
|
||||
}
|
||||
if s.ImagePullPolicy == nil {
|
||||
s.ImagePullPolicy = util.NewPullPolicyOrNil(source.ImagePullPolicy)
|
||||
s.ImagePullPolicy = util.NewTypeOrNil[core.PullPolicy](source.ImagePullPolicy)
|
||||
}
|
||||
if s.DowntimeAllowed == nil {
|
||||
s.DowntimeAllowed = util.NewBoolOrNil(source.DowntimeAllowed)
|
||||
s.DowntimeAllowed = util.NewTypeOrNil[bool](source.DowntimeAllowed)
|
||||
}
|
||||
if s.DisableIPv6 == nil {
|
||||
s.DisableIPv6 = util.NewBoolOrNil(source.DisableIPv6)
|
||||
s.DisableIPv6 = util.NewTypeOrNil[bool](source.DisableIPv6)
|
||||
}
|
||||
|
||||
if s.AllowUnsafeUpgrade == nil {
|
||||
s.AllowUnsafeUpgrade = util.NewBoolOrNil(source.AllowUnsafeUpgrade)
|
||||
s.AllowUnsafeUpgrade = util.NewTypeOrNil[bool](source.AllowUnsafeUpgrade)
|
||||
}
|
||||
if s.Database == nil {
|
||||
s.Database = source.Database.DeepCopy()
|
||||
|
@ -516,7 +516,7 @@ func (s DeploymentSpec) ResetImmutableFields(target *DeploymentSpec) []string {
|
|||
resetFields = append(resetFields, "storageEngine")
|
||||
}
|
||||
if s.IsDisableIPv6() != target.IsDisableIPv6() {
|
||||
target.DisableIPv6 = util.NewBoolOrNil(s.DisableIPv6)
|
||||
target.DisableIPv6 = util.NewTypeOrNil[bool](s.DisableIPv6)
|
||||
resetFields = append(resetFields, "disableIPv6")
|
||||
}
|
||||
if l := s.ExternalAccess.ResetImmutableFields("externalAccess", &target.ExternalAccess); l != nil {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -53,30 +53,30 @@ func TestDeploymentSpecResetImmutableFields(t *testing.T) {
|
|||
}{
|
||||
// Valid "changes"
|
||||
{
|
||||
DeploymentSpec{Image: util.NewString("foo")},
|
||||
DeploymentSpec{Image: util.NewString("foo2")},
|
||||
DeploymentSpec{Image: util.NewString("foo2")},
|
||||
DeploymentSpec{Image: util.NewType[string]("foo")},
|
||||
DeploymentSpec{Image: util.NewType[string]("foo2")},
|
||||
DeploymentSpec{Image: util.NewType[string]("foo2")},
|
||||
false,
|
||||
nil,
|
||||
},
|
||||
{
|
||||
DeploymentSpec{Image: util.NewString("foo")},
|
||||
DeploymentSpec{Image: util.NewString("foo2")},
|
||||
DeploymentSpec{Image: util.NewString("foo2")},
|
||||
DeploymentSpec{Image: util.NewType[string]("foo")},
|
||||
DeploymentSpec{Image: util.NewType[string]("foo2")},
|
||||
DeploymentSpec{Image: util.NewType[string]("foo2")},
|
||||
true,
|
||||
nil,
|
||||
},
|
||||
{
|
||||
DeploymentSpec{ImagePullPolicy: util.NewPullPolicy(core.PullAlways)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewPullPolicy(core.PullNever)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewPullPolicy(core.PullNever)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewType[core.PullPolicy](core.PullAlways)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewType[core.PullPolicy](core.PullNever)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewType[core.PullPolicy](core.PullNever)},
|
||||
false,
|
||||
nil,
|
||||
},
|
||||
{
|
||||
DeploymentSpec{ImagePullPolicy: util.NewPullPolicy(core.PullAlways)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewPullPolicy(core.PullNever)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewPullPolicy(core.PullNever)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewType[core.PullPolicy](core.PullAlways)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewType[core.PullPolicy](core.PullNever)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewType[core.PullPolicy](core.PullNever)},
|
||||
true,
|
||||
nil,
|
||||
},
|
||||
|
@ -97,9 +97,9 @@ 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.NewType[bool](false)},
|
||||
DeploymentSpec{DisableIPv6: util.NewType[bool](true)},
|
||||
DeploymentSpec{DisableIPv6: util.NewType[bool](false)},
|
||||
false,
|
||||
[]string{"disableIPv6"},
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -139,7 +139,7 @@ func (ds *DeploymentStatus) Equal(other DeploymentStatus) bool {
|
|||
|
||||
// IsForceReload returns true if ForceStatusReload is set to true
|
||||
func (ds *DeploymentStatus) IsForceReload() bool {
|
||||
return util.BoolOrDefault(ds.ForceStatusReload, false)
|
||||
return util.TypeOrDefault[bool](ds.ForceStatusReload, false)
|
||||
}
|
||||
|
||||
func (ds *DeploymentStatus) IsPlanEmpty() bool {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -55,17 +55,17 @@ func (s ExternalAccessSpec) GetType() ExternalAccessType {
|
|||
|
||||
// GetNodePort returns the value of nodePort.
|
||||
func (s ExternalAccessSpec) GetNodePort() int {
|
||||
return util.IntOrDefault(s.NodePort)
|
||||
return util.TypeOrDefault[int](s.NodePort)
|
||||
}
|
||||
|
||||
// GetLoadBalancerIP returns the value of loadBalancerIP.
|
||||
func (s ExternalAccessSpec) GetLoadBalancerIP() string {
|
||||
return util.StringOrDefault(s.LoadBalancerIP)
|
||||
return util.TypeOrDefault[string](s.LoadBalancerIP)
|
||||
}
|
||||
|
||||
// GetAdvertisedEndpoint returns the advertised endpoint or empty string if none was specified
|
||||
func (s ExternalAccessSpec) GetAdvertisedEndpoint() string {
|
||||
return util.StringOrDefault(s.AdvertisedEndpoint)
|
||||
return util.TypeOrDefault[string](s.AdvertisedEndpoint)
|
||||
}
|
||||
|
||||
// GetManagedServiceNames returns a list of managed service names.
|
||||
|
@ -107,10 +107,10 @@ func (s *ExternalAccessSpec) SetDefaultsFrom(source ExternalAccessSpec) {
|
|||
s.Type = NewExternalAccessTypeOrNil(source.Type)
|
||||
}
|
||||
if s.NodePort == nil {
|
||||
s.NodePort = util.NewIntOrNil(source.NodePort)
|
||||
s.NodePort = util.NewTypeOrNil[int](source.NodePort)
|
||||
}
|
||||
if s.LoadBalancerIP == nil {
|
||||
s.LoadBalancerIP = util.NewStringOrNil(source.LoadBalancerIP)
|
||||
s.LoadBalancerIP = util.NewTypeOrNil[string](source.LoadBalancerIP)
|
||||
}
|
||||
if s.LoadBalancerSourceRanges == nil && len(source.LoadBalancerSourceRanges) > 0 {
|
||||
s.LoadBalancerSourceRanges = append([]string{}, source.LoadBalancerSourceRanges...)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -37,7 +37,7 @@ func (s LicenseSpec) HasSecretName() bool {
|
|||
|
||||
// GetSecretName returns the license key if set. Empty string otherwise.
|
||||
func (s LicenseSpec) GetSecretName() string {
|
||||
return util.StringOrDefault(s.SecretName)
|
||||
return util.TypeOrDefault[string](s.SecretName)
|
||||
}
|
||||
|
||||
// Validate validates the LicenseSpec
|
||||
|
@ -54,6 +54,6 @@ func (s LicenseSpec) Validate() error {
|
|||
// SetDefaultsFrom fills all values not set in s with values from other
|
||||
func (s *LicenseSpec) SetDefaultsFrom(other LicenseSpec) {
|
||||
if !s.HasSecretName() {
|
||||
s.SecretName = util.NewStringOrNil(other.SecretName)
|
||||
s.SecretName = util.NewTypeOrNil[string](other.SecretName)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -30,7 +30,7 @@ import (
|
|||
|
||||
func TestLicenseSpecValidation(t *testing.T) {
|
||||
assert.Nil(t, LicenseSpec{SecretName: nil}.Validate())
|
||||
assert.Nil(t, LicenseSpec{SecretName: util.NewString("some-name")}.Validate())
|
||||
assert.Nil(t, LicenseSpec{SecretName: util.NewType[string]("some-name")}.Validate())
|
||||
|
||||
assert.Error(t, LicenseSpec{SecretName: util.NewString("@@")}.Validate())
|
||||
assert.Error(t, LicenseSpec{SecretName: util.NewType[string]("@@")}.Validate())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -35,5 +35,5 @@ func (a *ArangoDeploymentRecoverySpec) Get() ArangoDeploymentRecoverySpec {
|
|||
}
|
||||
|
||||
func (a ArangoDeploymentRecoverySpec) GetAutoRecover() bool {
|
||||
return util.BoolOrDefault(a.AutoRecover, false)
|
||||
return util.TypeOrDefault[bool](a.AutoRecover, false)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -33,7 +33,7 @@ type RocksDBEncryptionSpec struct {
|
|||
|
||||
// GetKeySecretName returns the value of keySecretName.
|
||||
func (s RocksDBEncryptionSpec) GetKeySecretName() string {
|
||||
return util.StringOrDefault(s.KeySecretName)
|
||||
return util.TypeOrDefault[string](s.KeySecretName)
|
||||
}
|
||||
|
||||
// IsEncrypted returns true when an encryption key secret name is provided,
|
||||
|
@ -69,7 +69,7 @@ func (s *RocksDBSpec) SetDefaults() {
|
|||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *RocksDBSpec) SetDefaultsFrom(source RocksDBSpec) {
|
||||
if s.Encryption.KeySecretName == nil {
|
||||
s.Encryption.KeySecretName = util.NewStringOrNil(source.Encryption.KeySecretName)
|
||||
s.Encryption.KeySecretName = util.NewTypeOrNil[string](source.Encryption.KeySecretName)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ func (s RocksDBSpec) ResetImmutableFields(fieldPrefix string, target *RocksDBSpe
|
|||
var resetFields []string
|
||||
if s.IsEncrypted() != target.IsEncrypted() {
|
||||
// Note: You can change the name, but not from empty to non-empty (or reverse).
|
||||
target.Encryption.KeySecretName = util.NewStringOrNil(s.Encryption.KeySecretName)
|
||||
target.Encryption.KeySecretName = util.NewTypeOrNil[string](s.Encryption.KeySecretName)
|
||||
resetFields = append(resetFields, fieldPrefix+".encryption.keySecretName")
|
||||
}
|
||||
return resetFields
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -31,16 +31,16 @@ import (
|
|||
func TestRocksDBSpecValidate(t *testing.T) {
|
||||
// Valid
|
||||
assert.Nil(t, RocksDBSpec{}.Validate())
|
||||
assert.Nil(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}}.Validate())
|
||||
assert.Nil(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}}.Validate())
|
||||
|
||||
// Not valid
|
||||
assert.Error(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("Foo")}}.Validate())
|
||||
assert.Error(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("Foo")}}.Validate())
|
||||
}
|
||||
|
||||
func TestRocksDBSpecIsEncrypted(t *testing.T) {
|
||||
assert.False(t, RocksDBSpec{}.IsEncrypted())
|
||||
assert.False(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("")}}.IsEncrypted())
|
||||
assert.True(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}}.IsEncrypted())
|
||||
assert.False(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("")}}.IsEncrypted())
|
||||
assert.True(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}}.IsEncrypted())
|
||||
}
|
||||
|
||||
func TestRocksDBSpecSetDefaults(t *testing.T) {
|
||||
|
@ -67,23 +67,23 @@ func TestRocksDBSpecResetImmutableFields(t *testing.T) {
|
|||
nil,
|
||||
},
|
||||
{
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo2")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo2")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo2")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo2")}},
|
||||
nil,
|
||||
},
|
||||
|
||||
// Invalid changes
|
||||
{
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}},
|
||||
[]string{"test.encryption.keySecretName"},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -284,17 +284,17 @@ func (s ServerGroupSpec) GetVolumeClaimTemplate() *core.PersistentVolumeClaim {
|
|||
|
||||
// GetCount returns the value of count.
|
||||
func (s ServerGroupSpec) GetCount() int {
|
||||
return util.IntOrDefault(s.Count)
|
||||
return util.TypeOrDefault[int](s.Count)
|
||||
}
|
||||
|
||||
// GetMinCount returns MinCount or 1 if not set
|
||||
func (s ServerGroupSpec) GetMinCount() int {
|
||||
return util.IntOrDefault(s.MinCount, 1)
|
||||
return util.TypeOrDefault[int](s.MinCount, 1)
|
||||
}
|
||||
|
||||
// GetMaxCount returns MaxCount or
|
||||
func (s ServerGroupSpec) GetMaxCount() int {
|
||||
return util.IntOrDefault(s.MaxCount, math.MaxInt32)
|
||||
return util.TypeOrDefault[int](s.MaxCount, math.MaxInt32)
|
||||
}
|
||||
|
||||
// GetNodeSelector returns the selectors for nodes of this group
|
||||
|
@ -315,9 +315,9 @@ func (s ServerGroupSpec) GetArgs() []string {
|
|||
// GetStorageClassName returns the value of storageClassName.
|
||||
func (s ServerGroupSpec) GetStorageClassName() string {
|
||||
if pvc := s.GetVolumeClaimTemplate(); pvc != nil {
|
||||
return util.StringOrDefault(pvc.Spec.StorageClassName)
|
||||
return util.TypeOrDefault[string](pvc.Spec.StorageClassName)
|
||||
}
|
||||
return util.StringOrDefault(s.StorageClassName)
|
||||
return util.TypeOrDefault[string](s.StorageClassName)
|
||||
}
|
||||
|
||||
// GetTolerations returns the value of tolerations.
|
||||
|
@ -327,7 +327,7 @@ func (s ServerGroupSpec) GetTolerations() []core.Toleration {
|
|||
|
||||
// GetServiceAccountName returns the value of serviceAccountName.
|
||||
func (s ServerGroupSpec) GetServiceAccountName() string {
|
||||
return util.StringOrDefault(s.ServiceAccountName)
|
||||
return util.TypeOrDefault[string](s.ServiceAccountName)
|
||||
}
|
||||
|
||||
// HasProbesSpec returns true if Probes is non nil
|
||||
|
@ -522,12 +522,12 @@ func (s *ServerGroupSpec) SetDefaults(group ServerGroup, used bool, mode Deploym
|
|||
switch group {
|
||||
case ServerGroupSingle:
|
||||
if mode == DeploymentModeSingle {
|
||||
s.Count = util.NewInt(1) // Single server
|
||||
s.Count = util.NewType[int](1) // Single server
|
||||
} else {
|
||||
s.Count = util.NewInt(2) // ActiveFailover
|
||||
s.Count = util.NewType[int](2) // ActiveFailover
|
||||
}
|
||||
default:
|
||||
s.Count = util.NewInt(3)
|
||||
s.Count = util.NewType[int](3)
|
||||
}
|
||||
} else if s.GetCount() > 0 && !used {
|
||||
s.Count = nil
|
||||
|
@ -574,25 +574,25 @@ func setStorageDefaultsFromResourceList(s *core.ResourceList, source core.Resour
|
|||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *ServerGroupSpec) SetDefaultsFrom(source ServerGroupSpec) {
|
||||
if s.Count == nil {
|
||||
s.Count = util.NewIntOrNil(source.Count)
|
||||
s.Count = util.NewTypeOrNil[int](source.Count)
|
||||
}
|
||||
if s.MinCount == nil {
|
||||
s.MinCount = util.NewIntOrNil(source.MinCount)
|
||||
s.MinCount = util.NewTypeOrNil[int](source.MinCount)
|
||||
}
|
||||
if s.MaxCount == nil {
|
||||
s.MaxCount = util.NewIntOrNil(source.MaxCount)
|
||||
s.MaxCount = util.NewTypeOrNil[int](source.MaxCount)
|
||||
}
|
||||
if s.Args == nil {
|
||||
s.Args = source.Args
|
||||
}
|
||||
if s.StorageClassName == nil {
|
||||
s.StorageClassName = util.NewStringOrNil(source.StorageClassName)
|
||||
s.StorageClassName = util.NewTypeOrNil[string](source.StorageClassName)
|
||||
}
|
||||
if s.Tolerations == nil {
|
||||
s.Tolerations = source.Tolerations
|
||||
}
|
||||
if s.ServiceAccountName == nil {
|
||||
s.ServiceAccountName = util.NewStringOrNil(source.ServiceAccountName)
|
||||
s.ServiceAccountName = util.NewTypeOrNil[string](source.ServiceAccountName)
|
||||
}
|
||||
if s.NodeSelector == nil {
|
||||
s.NodeSelector = source.NodeSelector
|
||||
|
@ -610,7 +610,7 @@ func (s ServerGroupSpec) ResetImmutableFields(group ServerGroup, fieldPrefix str
|
|||
var resetFields []string
|
||||
if group == ServerGroupAgents {
|
||||
if s.GetCount() != target.GetCount() {
|
||||
target.Count = util.NewIntOrNil(s.Count)
|
||||
target.Count = util.NewTypeOrNil[int](s.Count)
|
||||
resetFields = append(resetFields, fieldPrefix+".count")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -58,7 +58,7 @@ func (s *ServerGroupSpecPodMode) Apply(p *core.PodSpec) {
|
|||
// Default, no change
|
||||
case ServerGroupPIDModePod:
|
||||
// Enable Pod shared namespaces
|
||||
p.ShareProcessNamespace = util.NewBool(true)
|
||||
p.ShareProcessNamespace = util.NewType[bool](true)
|
||||
case ServerGroupPIDModeHost:
|
||||
// Enable Host shared namespaces
|
||||
p.HostPID = true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -30,55 +30,55 @@ import (
|
|||
|
||||
func TestServerGroupSpecValidateCount(t *testing.T) {
|
||||
// Valid
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, false, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(6)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, false, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](6)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2), MinCount: util.NewInt(2), MaxCount: util.NewInt(5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1), MaxCount: util.NewInt(5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(6), MinCount: util.NewInt(2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(5), MinCount: util.NewInt(5), MaxCount: util.NewInt(5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2), MinCount: util.NewType[int](2), MaxCount: util.NewType[int](5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1), MaxCount: util.NewType[int](5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](6), MinCount: util.NewType[int](2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](5), MinCount: util.NewType[int](5), MaxCount: util.NewType[int](5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
|
||||
// Invalid
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, false, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, true, DeploymentModeActiveFailover, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(-1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(-1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(-1)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(-1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(-1)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(-1)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, false, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, true, DeploymentModeActiveFailover, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](-1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](-1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](-1)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](-1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](-1)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](-1)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(2), MinCount: util.NewInt(5), MaxCount: util.NewInt(1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(6), MaxCount: util.NewInt(5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1), MinCount: util.NewInt(2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](2), MinCount: util.NewType[int](5), MaxCount: util.NewType[int](1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](6), MaxCount: util.NewType[int](5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1), MinCount: util.NewType[int](2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
|
||||
}
|
||||
|
||||
|
@ -120,13 +120,13 @@ func TestServerGroupSpecDefault(t *testing.T) {
|
|||
|
||||
func TestServerGroupSpecValidateArgs(t *testing.T) {
|
||||
// Valid
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{"--master.endpoint"}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{"--server.authentication=true"}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{"--master.endpoint"}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{"--server.authentication=true"}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
// Invalid
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{"--server.authentication=true"}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{"--server.authentication", "true"}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{"--master.endpoint=http://something"}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{"--mq.type=strange"}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{"--server.authentication=true"}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{"--server.authentication", "true"}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{"--master.endpoint=http://something"}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{"--mq.type=strange"}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -34,12 +34,12 @@ type SyncAuthenticationSpec struct {
|
|||
|
||||
// GetJWTSecretName returns the value of jwtSecretName.
|
||||
func (s SyncAuthenticationSpec) GetJWTSecretName() string {
|
||||
return util.StringOrDefault(s.JWTSecretName)
|
||||
return util.TypeOrDefault[string](s.JWTSecretName)
|
||||
}
|
||||
|
||||
// GetClientCASecretName returns the value of clientCASecretName.
|
||||
func (s SyncAuthenticationSpec) GetClientCASecretName() string {
|
||||
return util.StringOrDefault(s.ClientCASecretName)
|
||||
return util.TypeOrDefault[string](s.ClientCASecretName)
|
||||
}
|
||||
|
||||
// Validate the given spec
|
||||
|
@ -58,22 +58,22 @@ func (s *SyncAuthenticationSpec) SetDefaults(defaultJWTSecretName, defaultClient
|
|||
if s.GetJWTSecretName() == "" {
|
||||
// Note that we don't check for nil here, since even a specified, but empty
|
||||
// string should result in the default value.
|
||||
s.JWTSecretName = util.NewString(defaultJWTSecretName)
|
||||
s.JWTSecretName = util.NewType[string](defaultJWTSecretName)
|
||||
}
|
||||
if s.GetClientCASecretName() == "" {
|
||||
// Note that we don't check for nil here, since even a specified, but empty
|
||||
// string should result in the default value.
|
||||
s.ClientCASecretName = util.NewString(defaultClientCASecretName)
|
||||
s.ClientCASecretName = util.NewType[string](defaultClientCASecretName)
|
||||
}
|
||||
}
|
||||
|
||||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *SyncAuthenticationSpec) SetDefaultsFrom(source SyncAuthenticationSpec) {
|
||||
if s.JWTSecretName == nil {
|
||||
s.JWTSecretName = util.NewStringOrNil(source.JWTSecretName)
|
||||
s.JWTSecretName = util.NewTypeOrNil[string](source.JWTSecretName)
|
||||
}
|
||||
if s.ClientCASecretName == nil {
|
||||
s.ClientCASecretName = util.NewStringOrNil(source.ClientCASecretName)
|
||||
s.ClientCASecretName = util.NewTypeOrNil[string](source.ClientCASecretName)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -33,7 +33,7 @@ type MonitoringSpec struct {
|
|||
|
||||
// GetTokenSecretName returns the value of tokenSecretName.
|
||||
func (s MonitoringSpec) GetTokenSecretName() string {
|
||||
return util.StringOrDefault(s.TokenSecretName)
|
||||
return util.TypeOrDefault[string](s.TokenSecretName)
|
||||
}
|
||||
|
||||
// Validate the given spec
|
||||
|
@ -49,13 +49,13 @@ func (s *MonitoringSpec) SetDefaults(defaultTokenSecretName string) {
|
|||
if s.GetTokenSecretName() == "" {
|
||||
// Note that we don't check for nil here, since even a specified, but empty
|
||||
// string should result in the default value.
|
||||
s.TokenSecretName = util.NewString(defaultTokenSecretName)
|
||||
s.TokenSecretName = util.NewType[string](defaultTokenSecretName)
|
||||
}
|
||||
}
|
||||
|
||||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *MonitoringSpec) SetDefaultsFrom(source MonitoringSpec) {
|
||||
if s.TokenSecretName == nil {
|
||||
s.TokenSecretName = util.NewStringOrNil(source.TokenSecretName)
|
||||
s.TokenSecretName = util.NewTypeOrNil[string](source.TokenSecretName)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -31,12 +31,12 @@ import (
|
|||
func TestMonitoringSpecValidate(t *testing.T) {
|
||||
// Valid
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: nil}.Validate())
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: util.NewString("")}.Validate())
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: util.NewString("foo")}.Validate())
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: util.NewString("foo")}.Validate())
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: util.NewType[string]("")}.Validate())
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: util.NewType[string]("foo")}.Validate())
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: util.NewType[string]("foo")}.Validate())
|
||||
|
||||
// Not valid
|
||||
assert.Error(t, MonitoringSpec{TokenSecretName: util.NewString("Foo")}.Validate())
|
||||
assert.Error(t, MonitoringSpec{TokenSecretName: util.NewType[string]("Foo")}.Validate())
|
||||
}
|
||||
|
||||
func TestMonitoringSpecSetDefaults(t *testing.T) {
|
||||
|
@ -51,5 +51,5 @@ func TestMonitoringSpecSetDefaults(t *testing.T) {
|
|||
|
||||
assert.Equal(t, "", def(MonitoringSpec{}).GetTokenSecretName())
|
||||
assert.Equal(t, "def2", def2(MonitoringSpec{}).GetTokenSecretName())
|
||||
assert.Equal(t, "foo", def(MonitoringSpec{TokenSecretName: util.NewString("foo")}).GetTokenSecretName())
|
||||
assert.Equal(t, "foo", def(MonitoringSpec{TokenSecretName: util.NewType[string]("foo")}).GetTokenSecretName())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -38,12 +38,12 @@ type SyncSpec struct {
|
|||
|
||||
// IsEnabled returns the value of enabled.
|
||||
func (s SyncSpec) IsEnabled() bool {
|
||||
return util.BoolOrDefault(s.Enabled)
|
||||
return util.TypeOrDefault[bool](s.Enabled)
|
||||
}
|
||||
|
||||
// GetSyncImage returns the syncer image or empty string
|
||||
func (s SyncSpec) GetSyncImage() string {
|
||||
return util.StringOrDefault(s.Image)
|
||||
return util.TypeOrDefault[string](s.Image)
|
||||
}
|
||||
|
||||
// HasSyncImage returns whether a special sync image is set
|
||||
|
@ -84,10 +84,10 @@ func (s *SyncSpec) SetDefaults(defaultJWTSecretName, defaultClientAuthCASecretNa
|
|||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *SyncSpec) SetDefaultsFrom(source SyncSpec) {
|
||||
if s.Enabled == nil {
|
||||
s.Enabled = util.NewBoolOrNil(source.Enabled)
|
||||
s.Enabled = util.NewTypeOrNil[bool](source.Enabled)
|
||||
}
|
||||
if s.Image == nil {
|
||||
s.Image = util.NewStringOrNil(source.Image)
|
||||
s.Image = util.NewTypeOrNil[string](source.Image)
|
||||
}
|
||||
s.ExternalAccess.SetDefaultsFrom(source.ExternalAccess)
|
||||
s.Authentication.SetDefaultsFrom(source.Authentication)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -30,16 +30,16 @@ import (
|
|||
|
||||
func TestSyncSpecValidate(t *testing.T) {
|
||||
// Valid
|
||||
auth := SyncAuthenticationSpec{JWTSecretName: util.NewString("foo"), ClientCASecretName: util.NewString("foo-client")}
|
||||
tls := TLSSpec{CASecretName: util.NewString("None")}
|
||||
auth := SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo"), ClientCASecretName: util.NewType[string]("foo-client")}
|
||||
tls := TLSSpec{CASecretName: util.NewType[string]("None")}
|
||||
assert.Nil(t, SyncSpec{Authentication: auth}.Validate(DeploymentModeSingle))
|
||||
assert.Nil(t, SyncSpec{Authentication: auth}.Validate(DeploymentModeActiveFailover))
|
||||
assert.Nil(t, SyncSpec{Authentication: auth}.Validate(DeploymentModeCluster))
|
||||
assert.Nil(t, SyncSpec{Authentication: auth, TLS: tls, Enabled: util.NewBool(true)}.Validate(DeploymentModeCluster))
|
||||
assert.Nil(t, SyncSpec{Authentication: auth, TLS: tls, Enabled: util.NewType[bool](true)}.Validate(DeploymentModeCluster))
|
||||
|
||||
// Not valid
|
||||
assert.Error(t, SyncSpec{Authentication: auth, TLS: tls, Enabled: util.NewBool(true)}.Validate(DeploymentModeSingle))
|
||||
assert.Error(t, SyncSpec{Authentication: auth, TLS: tls, Enabled: util.NewBool(true)}.Validate(DeploymentModeActiveFailover))
|
||||
assert.Error(t, SyncSpec{Authentication: auth, TLS: tls, Enabled: util.NewType[bool](true)}.Validate(DeploymentModeSingle))
|
||||
assert.Error(t, SyncSpec{Authentication: auth, TLS: tls, Enabled: util.NewType[bool](true)}.Validate(DeploymentModeActiveFailover))
|
||||
}
|
||||
|
||||
func TestSyncSpecSetDefaults(t *testing.T) {
|
||||
|
@ -49,11 +49,11 @@ func TestSyncSpecSetDefaults(t *testing.T) {
|
|||
}
|
||||
|
||||
assert.False(t, def(SyncSpec{}).IsEnabled())
|
||||
assert.False(t, def(SyncSpec{Enabled: util.NewBool(false)}).IsEnabled())
|
||||
assert.True(t, def(SyncSpec{Enabled: util.NewBool(true)}).IsEnabled())
|
||||
assert.False(t, def(SyncSpec{Enabled: util.NewType[bool](false)}).IsEnabled())
|
||||
assert.True(t, def(SyncSpec{Enabled: util.NewType[bool](true)}).IsEnabled())
|
||||
assert.Equal(t, "test-jwt", def(SyncSpec{}).Authentication.GetJWTSecretName())
|
||||
assert.Equal(t, "test-mon", def(SyncSpec{}).Monitoring.GetTokenSecretName())
|
||||
assert.Equal(t, "foo", def(SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo")}}).Authentication.GetJWTSecretName())
|
||||
assert.Equal(t, "foo", def(SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo")}}).Authentication.GetJWTSecretName())
|
||||
}
|
||||
|
||||
func TestSyncSpecResetImmutableFields(t *testing.T) {
|
||||
|
@ -65,33 +65,33 @@ func TestSyncSpecResetImmutableFields(t *testing.T) {
|
|||
}{
|
||||
// Valid "changes"
|
||||
{
|
||||
SyncSpec{Enabled: util.NewBool(false)},
|
||||
SyncSpec{Enabled: util.NewBool(true)},
|
||||
SyncSpec{Enabled: util.NewBool(true)},
|
||||
SyncSpec{Enabled: util.NewType[bool](false)},
|
||||
SyncSpec{Enabled: util.NewType[bool](true)},
|
||||
SyncSpec{Enabled: util.NewType[bool](true)},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
SyncSpec{Enabled: util.NewBool(true)},
|
||||
SyncSpec{Enabled: util.NewBool(false)},
|
||||
SyncSpec{Enabled: util.NewBool(false)},
|
||||
SyncSpec{Enabled: util.NewType[bool](true)},
|
||||
SyncSpec{Enabled: util.NewType[bool](false)},
|
||||
SyncSpec{Enabled: util.NewType[bool](false)},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("None"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("None"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("None"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("None"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("None"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("None"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo2"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo2"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo2"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo2"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
nil,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -68,7 +68,7 @@ const (
|
|||
|
||||
// GetCASecretName returns the value of caSecretName.
|
||||
func (s TLSSpec) GetCASecretName() string {
|
||||
return util.StringOrDefault(s.CASecretName)
|
||||
return util.TypeOrDefault[string](s.CASecretName)
|
||||
}
|
||||
|
||||
// GetAltNames returns the value of altNames.
|
||||
|
@ -132,7 +132,7 @@ func (s *TLSSpec) SetDefaults(defaultCASecretName string) {
|
|||
if s.GetCASecretName() == "" {
|
||||
// Note that we don't check for nil here, since even a specified, but empty
|
||||
// string should result in the default value.
|
||||
s.CASecretName = util.NewString(defaultCASecretName)
|
||||
s.CASecretName = util.NewType[string](defaultCASecretName)
|
||||
}
|
||||
if s.GetTTL() == "" {
|
||||
// Note that we don't check for nil here, since even a specified, but zero
|
||||
|
@ -144,7 +144,7 @@ func (s *TLSSpec) SetDefaults(defaultCASecretName string) {
|
|||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *TLSSpec) SetDefaultsFrom(source TLSSpec) {
|
||||
if s.CASecretName == nil {
|
||||
s.CASecretName = util.NewStringOrNil(source.CASecretName)
|
||||
s.CASecretName = util.NewTypeOrNil[string](source.CASecretName)
|
||||
}
|
||||
if s.AltNames == nil {
|
||||
s.AltNames = source.AltNames
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -31,23 +31,23 @@ import (
|
|||
|
||||
func TestTLSSpecValidate(t *testing.T) {
|
||||
// Valid
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewString("foo")}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewString("None")}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewString("None"), AltNames: []string{}}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewString("None"), AltNames: []string{"foo"}}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewString("None"), AltNames: []string{"email@example.com", "127.0.0.1"}}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewType[string]("foo")}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewType[string]("None")}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewType[string]("None"), AltNames: []string{}}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewType[string]("None"), AltNames: []string{"foo"}}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewType[string]("None"), AltNames: []string{"email@example.com", "127.0.0.1"}}.Validate())
|
||||
|
||||
// Not valid
|
||||
assert.Error(t, TLSSpec{CASecretName: nil}.Validate())
|
||||
assert.Error(t, TLSSpec{CASecretName: util.NewString("")}.Validate())
|
||||
assert.Error(t, TLSSpec{CASecretName: util.NewString("Foo")}.Validate())
|
||||
assert.Error(t, TLSSpec{CASecretName: util.NewString("foo"), AltNames: []string{"@@"}}.Validate())
|
||||
assert.Error(t, TLSSpec{CASecretName: util.NewType[string]("")}.Validate())
|
||||
assert.Error(t, TLSSpec{CASecretName: util.NewType[string]("Foo")}.Validate())
|
||||
assert.Error(t, TLSSpec{CASecretName: util.NewType[string]("foo"), AltNames: []string{"@@"}}.Validate())
|
||||
}
|
||||
|
||||
func TestTLSSpecIsSecure(t *testing.T) {
|
||||
assert.True(t, TLSSpec{CASecretName: util.NewString("")}.IsSecure())
|
||||
assert.True(t, TLSSpec{CASecretName: util.NewString("foo")}.IsSecure())
|
||||
assert.False(t, TLSSpec{CASecretName: util.NewString("None")}.IsSecure())
|
||||
assert.True(t, TLSSpec{CASecretName: util.NewType[string]("")}.IsSecure())
|
||||
assert.True(t, TLSSpec{CASecretName: util.NewType[string]("foo")}.IsSecure())
|
||||
assert.False(t, TLSSpec{CASecretName: util.NewType[string]("None")}.IsSecure())
|
||||
}
|
||||
|
||||
func TestTLSSpecSetDefaults(t *testing.T) {
|
||||
|
@ -57,7 +57,7 @@ func TestTLSSpecSetDefaults(t *testing.T) {
|
|||
}
|
||||
|
||||
assert.Equal(t, "", def(TLSSpec{}).GetCASecretName())
|
||||
assert.Equal(t, "foo", def(TLSSpec{CASecretName: util.NewString("foo")}).GetCASecretName())
|
||||
assert.Equal(t, "foo", def(TLSSpec{CASecretName: util.NewType[string]("foo")}).GetCASecretName())
|
||||
assert.Len(t, def(TLSSpec{}).GetAltNames(), 0)
|
||||
assert.Len(t, def(TLSSpec{AltNames: []string{"foo.local"}}).GetAltNames(), 1)
|
||||
assert.Equal(t, defaultTLSTTL, def(TLSSpec{}).GetTTL())
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -38,7 +38,7 @@ const (
|
|||
|
||||
// GetJWTSecretName returns the value of jwtSecretName.
|
||||
func (s AuthenticationSpec) GetJWTSecretName() string {
|
||||
return util.StringOrDefault(s.JWTSecretName)
|
||||
return util.TypeOrDefault[string](s.JWTSecretName)
|
||||
}
|
||||
|
||||
// IsAuthenticated returns true if authentication is enabled.
|
||||
|
@ -65,14 +65,14 @@ func (s *AuthenticationSpec) SetDefaults(defaultJWTSecretName string) {
|
|||
if s.GetJWTSecretName() == "" {
|
||||
// Note that we don't check for nil here, since even a specified, but empty
|
||||
// string should result in the default value.
|
||||
s.JWTSecretName = util.NewString(defaultJWTSecretName)
|
||||
s.JWTSecretName = util.NewType[string](defaultJWTSecretName)
|
||||
}
|
||||
}
|
||||
|
||||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *AuthenticationSpec) SetDefaultsFrom(source AuthenticationSpec) {
|
||||
if s.JWTSecretName == nil {
|
||||
s.JWTSecretName = util.NewStringOrNil(source.JWTSecretName)
|
||||
s.JWTSecretName = util.NewTypeOrNil[string](source.JWTSecretName)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ func (s AuthenticationSpec) ResetImmutableFields(fieldPrefix string, target *Aut
|
|||
var resetFields []string
|
||||
if s.IsAuthenticated() != target.IsAuthenticated() {
|
||||
// Note: You can change the name, but not from empty to non-empty (or reverse).
|
||||
target.JWTSecretName = util.NewStringOrNil(s.JWTSecretName)
|
||||
target.JWTSecretName = util.NewTypeOrNil[string](s.JWTSecretName)
|
||||
resetFields = append(resetFields, fieldPrefix+".jwtSecretName")
|
||||
}
|
||||
return resetFields
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -30,18 +30,18 @@ import (
|
|||
|
||||
func TestAuthenticationSpecValidate(t *testing.T) {
|
||||
// Valid
|
||||
assert.Nil(t, AuthenticationSpec{JWTSecretName: util.NewString("None")}.Validate(false))
|
||||
assert.Nil(t, AuthenticationSpec{JWTSecretName: util.NewString("foo")}.Validate(false))
|
||||
assert.Nil(t, AuthenticationSpec{JWTSecretName: util.NewString("foo")}.Validate(true))
|
||||
assert.Nil(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("None")}.Validate(false))
|
||||
assert.Nil(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")}.Validate(false))
|
||||
assert.Nil(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")}.Validate(true))
|
||||
|
||||
// Not valid
|
||||
assert.Error(t, AuthenticationSpec{JWTSecretName: util.NewString("Foo")}.Validate(false))
|
||||
assert.Error(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("Foo")}.Validate(false))
|
||||
}
|
||||
|
||||
func TestAuthenticationSpecIsAuthenticated(t *testing.T) {
|
||||
assert.False(t, AuthenticationSpec{JWTSecretName: util.NewString("None")}.IsAuthenticated())
|
||||
assert.True(t, AuthenticationSpec{JWTSecretName: util.NewString("foo")}.IsAuthenticated())
|
||||
assert.True(t, AuthenticationSpec{JWTSecretName: util.NewString("")}.IsAuthenticated())
|
||||
assert.False(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("None")}.IsAuthenticated())
|
||||
assert.True(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")}.IsAuthenticated())
|
||||
assert.True(t, AuthenticationSpec{JWTSecretName: util.NewType[string]("")}.IsAuthenticated())
|
||||
}
|
||||
|
||||
func TestAuthenticationSpecSetDefaults(t *testing.T) {
|
||||
|
@ -51,7 +51,7 @@ func TestAuthenticationSpecSetDefaults(t *testing.T) {
|
|||
}
|
||||
|
||||
assert.Equal(t, "test-jwt", def(AuthenticationSpec{}).GetJWTSecretName())
|
||||
assert.Equal(t, "foo", def(AuthenticationSpec{JWTSecretName: util.NewString("foo")}).GetJWTSecretName())
|
||||
assert.Equal(t, "foo", def(AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")}).GetJWTSecretName())
|
||||
}
|
||||
|
||||
func TestAuthenticationSpecResetImmutableFields(t *testing.T) {
|
||||
|
@ -63,35 +63,35 @@ func TestAuthenticationSpecResetImmutableFields(t *testing.T) {
|
|||
}{
|
||||
// Valid "changes"
|
||||
{
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("None")},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo2")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo2")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo2")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo2")},
|
||||
nil,
|
||||
},
|
||||
|
||||
// Invalid changes
|
||||
{
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
[]string{"test.jwtSecretName"},
|
||||
},
|
||||
{
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewString("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("None")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("foo")},
|
||||
AuthenticationSpec{JWTSecretName: util.NewType[string]("None")},
|
||||
[]string{"test.jwtSecretName"},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -39,12 +39,12 @@ type ChaosSpec struct {
|
|||
|
||||
// IsEnabled returns the value of enabled.
|
||||
func (s ChaosSpec) IsEnabled() bool {
|
||||
return util.BoolOrDefault(s.Enabled)
|
||||
return util.TypeOrDefault[bool](s.Enabled)
|
||||
}
|
||||
|
||||
// GetInterval returns the value of interval.
|
||||
func (s ChaosSpec) GetInterval() time.Duration {
|
||||
return util.DurationOrDefault(s.Interval)
|
||||
return util.TypeOrDefault[time.Duration](s.Interval)
|
||||
}
|
||||
|
||||
// GetKillPodProbability returns the value of kill-pod-probability.
|
||||
|
@ -68,7 +68,7 @@ func (s ChaosSpec) Validate() error {
|
|||
// SetDefaults fills in missing defaults
|
||||
func (s *ChaosSpec) SetDefaults() {
|
||||
if s.GetInterval() == 0 {
|
||||
s.Interval = util.NewDuration(time.Minute)
|
||||
s.Interval = util.NewType[time.Duration](time.Minute)
|
||||
}
|
||||
if s.GetKillPodProbability() == 0 {
|
||||
s.KillPodProbability = NewPercent(50)
|
||||
|
@ -78,10 +78,10 @@ func (s *ChaosSpec) SetDefaults() {
|
|||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *ChaosSpec) SetDefaultsFrom(source ChaosSpec) {
|
||||
if s.Enabled == nil {
|
||||
s.Enabled = util.NewBoolOrNil(source.Enabled)
|
||||
s.Enabled = util.NewTypeOrNil[bool](source.Enabled)
|
||||
}
|
||||
if s.Interval == nil {
|
||||
s.Interval = util.NewDurationOrNil(source.Interval)
|
||||
s.Interval = util.NewTypeOrNil[time.Duration](source.Interval)
|
||||
}
|
||||
if s.KillPodProbability == nil {
|
||||
s.KillPodProbability = NewPercentOrNil(source.KillPodProbability)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -106,7 +106,7 @@ func (s *MetricsSpec) GetPort() uint16 {
|
|||
|
||||
// IsEnabled returns whether metrics are enabled or not
|
||||
func (s *MetricsSpec) IsEnabled() bool {
|
||||
return util.BoolOrDefault(s.Enabled, false)
|
||||
return util.TypeOrDefault[bool](s.Enabled, false)
|
||||
}
|
||||
|
||||
// HasImage returns whether a image was specified or not
|
||||
|
@ -118,22 +118,22 @@ func (s *MetricsSpec) HasImage() bool {
|
|||
// GetImage returns the Image or empty string
|
||||
// Deprecated
|
||||
func (s *MetricsSpec) GetImage() string {
|
||||
return util.StringOrDefault(s.Image)
|
||||
return util.TypeOrDefault[string](s.Image)
|
||||
}
|
||||
|
||||
// SetDefaults sets default values
|
||||
func (s *MetricsSpec) SetDefaults(defaultTokenName string, isAuthenticated bool) {
|
||||
if s.Enabled == nil {
|
||||
s.Enabled = util.NewBool(false)
|
||||
s.Enabled = util.NewType[bool](false)
|
||||
}
|
||||
if s.GetJWTTokenSecretName() == "" {
|
||||
s.Authentication.JWTTokenSecretName = util.NewString(defaultTokenName)
|
||||
s.Authentication.JWTTokenSecretName = util.NewType[string](defaultTokenName)
|
||||
}
|
||||
}
|
||||
|
||||
// GetJWTTokenSecretName returns the token secret name or empty string
|
||||
func (s *MetricsSpec) GetJWTTokenSecretName() string {
|
||||
return util.StringOrDefault(s.Authentication.JWTTokenSecretName)
|
||||
return util.TypeOrDefault[string](s.Authentication.JWTTokenSecretName)
|
||||
}
|
||||
|
||||
// HasJWTTokenSecretName returns true if a secret name was specified
|
||||
|
@ -144,13 +144,13 @@ func (s *MetricsSpec) HasJWTTokenSecretName() bool {
|
|||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *MetricsSpec) SetDefaultsFrom(source MetricsSpec) {
|
||||
if s.Enabled == nil {
|
||||
s.Enabled = util.NewBoolOrNil(source.Enabled)
|
||||
s.Enabled = util.NewTypeOrNil[bool](source.Enabled)
|
||||
}
|
||||
if s.Image == nil {
|
||||
s.Image = util.NewStringOrNil(source.Image)
|
||||
s.Image = util.NewTypeOrNil[string](source.Image)
|
||||
}
|
||||
if s.Authentication.JWTTokenSecretName == nil {
|
||||
s.Authentication.JWTTokenSecretName = util.NewStringOrNil(source.Authentication.JWTTokenSecretName)
|
||||
s.Authentication.JWTTokenSecretName = util.NewTypeOrNil[string](source.Authentication.JWTTokenSecretName)
|
||||
}
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
|
|
|
@ -217,7 +217,7 @@ func (s *DeploymentSpec) GetAllowMemberRecreation(group ServerGroup) bool {
|
|||
|
||||
// GetRestoreFrom returns the restore from string or empty string if not set
|
||||
func (s *DeploymentSpec) GetRestoreFrom() string {
|
||||
return util.StringOrDefault(s.RestoreFrom)
|
||||
return util.TypeOrDefault[string](s.RestoreFrom)
|
||||
}
|
||||
|
||||
// HasRestoreFrom returns true if RestoreFrom is set
|
||||
|
@ -252,7 +252,7 @@ func (s DeploymentSpec) GetStorageEngine() StorageEngine {
|
|||
|
||||
// GetImage returns the value of image.
|
||||
func (s DeploymentSpec) GetImage() string {
|
||||
return util.StringOrDefault(s.Image)
|
||||
return util.TypeOrDefault[string](s.Image)
|
||||
}
|
||||
|
||||
// GetSyncImage returns, if set, Sync.Image or the default image.
|
||||
|
@ -265,22 +265,22 @@ func (s DeploymentSpec) GetSyncImage() string {
|
|||
|
||||
// GetImagePullPolicy returns the value of imagePullPolicy.
|
||||
func (s DeploymentSpec) GetImagePullPolicy() core.PullPolicy {
|
||||
return util.PullPolicyOrDefault(s.ImagePullPolicy)
|
||||
return util.TypeOrDefault[core.PullPolicy](s.ImagePullPolicy)
|
||||
}
|
||||
|
||||
// IsDowntimeAllowed returns the value of downtimeAllowed.
|
||||
func (s DeploymentSpec) IsDowntimeAllowed() bool {
|
||||
return util.BoolOrDefault(s.DowntimeAllowed)
|
||||
return util.TypeOrDefault[bool](s.DowntimeAllowed)
|
||||
}
|
||||
|
||||
// IsDisableIPv6 returns the value of disableIPv6.
|
||||
func (s DeploymentSpec) IsDisableIPv6() bool {
|
||||
return util.BoolOrDefault(s.DisableIPv6)
|
||||
return util.TypeOrDefault[bool](s.DisableIPv6)
|
||||
}
|
||||
|
||||
// IsNetworkAttachedVolumes returns the value of networkAttachedVolumes, default false
|
||||
func (s DeploymentSpec) IsNetworkAttachedVolumes() bool {
|
||||
return util.BoolOrDefault(s.NetworkAttachedVolumes, false)
|
||||
return util.TypeOrDefault[bool](s.NetworkAttachedVolumes, false)
|
||||
}
|
||||
|
||||
// GetListenAddr returns "[::]" or "0.0.0.0" depending on IsDisableIPv6
|
||||
|
@ -353,10 +353,10 @@ func (s *DeploymentSpec) SetDefaults(deploymentName string) {
|
|||
s.StorageEngine = NewStorageEngine(StorageEngineRocksDB)
|
||||
}
|
||||
if s.GetImage() == "" && s.IsDevelopment() {
|
||||
s.Image = util.NewString(DefaultImage)
|
||||
s.Image = util.NewType[string](DefaultImage)
|
||||
}
|
||||
if s.GetImagePullPolicy() == "" {
|
||||
s.ImagePullPolicy = util.NewPullPolicy(core.PullIfNotPresent)
|
||||
s.ImagePullPolicy = util.NewType[core.PullPolicy](core.PullIfNotPresent)
|
||||
}
|
||||
s.ExternalAccess.SetDefaults()
|
||||
s.RocksDB.SetDefaults()
|
||||
|
@ -386,20 +386,20 @@ func (s *DeploymentSpec) SetDefaultsFrom(source DeploymentSpec) {
|
|||
s.StorageEngine = NewStorageEngineOrNil(source.StorageEngine)
|
||||
}
|
||||
if s.Image == nil {
|
||||
s.Image = util.NewStringOrNil(source.Image)
|
||||
s.Image = util.NewTypeOrNil[string](source.Image)
|
||||
}
|
||||
if s.ImagePullPolicy == nil {
|
||||
s.ImagePullPolicy = util.NewPullPolicyOrNil(source.ImagePullPolicy)
|
||||
s.ImagePullPolicy = util.NewTypeOrNil[core.PullPolicy](source.ImagePullPolicy)
|
||||
}
|
||||
if s.DowntimeAllowed == nil {
|
||||
s.DowntimeAllowed = util.NewBoolOrNil(source.DowntimeAllowed)
|
||||
s.DowntimeAllowed = util.NewTypeOrNil[bool](source.DowntimeAllowed)
|
||||
}
|
||||
if s.DisableIPv6 == nil {
|
||||
s.DisableIPv6 = util.NewBoolOrNil(source.DisableIPv6)
|
||||
s.DisableIPv6 = util.NewTypeOrNil[bool](source.DisableIPv6)
|
||||
}
|
||||
|
||||
if s.AllowUnsafeUpgrade == nil {
|
||||
s.AllowUnsafeUpgrade = util.NewBoolOrNil(source.AllowUnsafeUpgrade)
|
||||
s.AllowUnsafeUpgrade = util.NewTypeOrNil[bool](source.AllowUnsafeUpgrade)
|
||||
}
|
||||
if s.Database == nil {
|
||||
s.Database = source.Database.DeepCopy()
|
||||
|
@ -516,7 +516,7 @@ func (s DeploymentSpec) ResetImmutableFields(target *DeploymentSpec) []string {
|
|||
resetFields = append(resetFields, "storageEngine")
|
||||
}
|
||||
if s.IsDisableIPv6() != target.IsDisableIPv6() {
|
||||
target.DisableIPv6 = util.NewBoolOrNil(s.DisableIPv6)
|
||||
target.DisableIPv6 = util.NewTypeOrNil[bool](s.DisableIPv6)
|
||||
resetFields = append(resetFields, "disableIPv6")
|
||||
}
|
||||
if l := s.ExternalAccess.ResetImmutableFields("externalAccess", &target.ExternalAccess); l != nil {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -53,30 +53,30 @@ func TestDeploymentSpecResetImmutableFields(t *testing.T) {
|
|||
}{
|
||||
// Valid "changes"
|
||||
{
|
||||
DeploymentSpec{Image: util.NewString("foo")},
|
||||
DeploymentSpec{Image: util.NewString("foo2")},
|
||||
DeploymentSpec{Image: util.NewString("foo2")},
|
||||
DeploymentSpec{Image: util.NewType[string]("foo")},
|
||||
DeploymentSpec{Image: util.NewType[string]("foo2")},
|
||||
DeploymentSpec{Image: util.NewType[string]("foo2")},
|
||||
false,
|
||||
nil,
|
||||
},
|
||||
{
|
||||
DeploymentSpec{Image: util.NewString("foo")},
|
||||
DeploymentSpec{Image: util.NewString("foo2")},
|
||||
DeploymentSpec{Image: util.NewString("foo2")},
|
||||
DeploymentSpec{Image: util.NewType[string]("foo")},
|
||||
DeploymentSpec{Image: util.NewType[string]("foo2")},
|
||||
DeploymentSpec{Image: util.NewType[string]("foo2")},
|
||||
true,
|
||||
nil,
|
||||
},
|
||||
{
|
||||
DeploymentSpec{ImagePullPolicy: util.NewPullPolicy(core.PullAlways)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewPullPolicy(core.PullNever)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewPullPolicy(core.PullNever)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewType[core.PullPolicy](core.PullAlways)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewType[core.PullPolicy](core.PullNever)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewType[core.PullPolicy](core.PullNever)},
|
||||
false,
|
||||
nil,
|
||||
},
|
||||
{
|
||||
DeploymentSpec{ImagePullPolicy: util.NewPullPolicy(core.PullAlways)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewPullPolicy(core.PullNever)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewPullPolicy(core.PullNever)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewType[core.PullPolicy](core.PullAlways)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewType[core.PullPolicy](core.PullNever)},
|
||||
DeploymentSpec{ImagePullPolicy: util.NewType[core.PullPolicy](core.PullNever)},
|
||||
true,
|
||||
nil,
|
||||
},
|
||||
|
@ -97,9 +97,9 @@ 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.NewType[bool](false)},
|
||||
DeploymentSpec{DisableIPv6: util.NewType[bool](true)},
|
||||
DeploymentSpec{DisableIPv6: util.NewType[bool](false)},
|
||||
false,
|
||||
[]string{"disableIPv6"},
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -139,7 +139,7 @@ func (ds *DeploymentStatus) Equal(other DeploymentStatus) bool {
|
|||
|
||||
// IsForceReload returns true if ForceStatusReload is set to true
|
||||
func (ds *DeploymentStatus) IsForceReload() bool {
|
||||
return util.BoolOrDefault(ds.ForceStatusReload, false)
|
||||
return util.TypeOrDefault[bool](ds.ForceStatusReload, false)
|
||||
}
|
||||
|
||||
func (ds *DeploymentStatus) IsPlanEmpty() bool {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -55,17 +55,17 @@ func (s ExternalAccessSpec) GetType() ExternalAccessType {
|
|||
|
||||
// GetNodePort returns the value of nodePort.
|
||||
func (s ExternalAccessSpec) GetNodePort() int {
|
||||
return util.IntOrDefault(s.NodePort)
|
||||
return util.TypeOrDefault[int](s.NodePort)
|
||||
}
|
||||
|
||||
// GetLoadBalancerIP returns the value of loadBalancerIP.
|
||||
func (s ExternalAccessSpec) GetLoadBalancerIP() string {
|
||||
return util.StringOrDefault(s.LoadBalancerIP)
|
||||
return util.TypeOrDefault[string](s.LoadBalancerIP)
|
||||
}
|
||||
|
||||
// GetAdvertisedEndpoint returns the advertised endpoint or empty string if none was specified
|
||||
func (s ExternalAccessSpec) GetAdvertisedEndpoint() string {
|
||||
return util.StringOrDefault(s.AdvertisedEndpoint)
|
||||
return util.TypeOrDefault[string](s.AdvertisedEndpoint)
|
||||
}
|
||||
|
||||
// GetManagedServiceNames returns a list of managed service names.
|
||||
|
@ -107,10 +107,10 @@ func (s *ExternalAccessSpec) SetDefaultsFrom(source ExternalAccessSpec) {
|
|||
s.Type = NewExternalAccessTypeOrNil(source.Type)
|
||||
}
|
||||
if s.NodePort == nil {
|
||||
s.NodePort = util.NewIntOrNil(source.NodePort)
|
||||
s.NodePort = util.NewTypeOrNil[int](source.NodePort)
|
||||
}
|
||||
if s.LoadBalancerIP == nil {
|
||||
s.LoadBalancerIP = util.NewStringOrNil(source.LoadBalancerIP)
|
||||
s.LoadBalancerIP = util.NewTypeOrNil[string](source.LoadBalancerIP)
|
||||
}
|
||||
if s.LoadBalancerSourceRanges == nil && len(source.LoadBalancerSourceRanges) > 0 {
|
||||
s.LoadBalancerSourceRanges = append([]string{}, source.LoadBalancerSourceRanges...)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -37,7 +37,7 @@ func (s LicenseSpec) HasSecretName() bool {
|
|||
|
||||
// GetSecretName returns the license key if set. Empty string otherwise.
|
||||
func (s LicenseSpec) GetSecretName() string {
|
||||
return util.StringOrDefault(s.SecretName)
|
||||
return util.TypeOrDefault[string](s.SecretName)
|
||||
}
|
||||
|
||||
// Validate validates the LicenseSpec
|
||||
|
@ -54,6 +54,6 @@ func (s LicenseSpec) Validate() error {
|
|||
// SetDefaultsFrom fills all values not set in s with values from other
|
||||
func (s *LicenseSpec) SetDefaultsFrom(other LicenseSpec) {
|
||||
if !s.HasSecretName() {
|
||||
s.SecretName = util.NewStringOrNil(other.SecretName)
|
||||
s.SecretName = util.NewTypeOrNil[string](other.SecretName)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -30,7 +30,7 @@ import (
|
|||
|
||||
func TestLicenseSpecValidation(t *testing.T) {
|
||||
assert.Nil(t, LicenseSpec{SecretName: nil}.Validate())
|
||||
assert.Nil(t, LicenseSpec{SecretName: util.NewString("some-name")}.Validate())
|
||||
assert.Nil(t, LicenseSpec{SecretName: util.NewType[string]("some-name")}.Validate())
|
||||
|
||||
assert.Error(t, LicenseSpec{SecretName: util.NewString("@@")}.Validate())
|
||||
assert.Error(t, LicenseSpec{SecretName: util.NewType[string]("@@")}.Validate())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -35,5 +35,5 @@ func (a *ArangoDeploymentRecoverySpec) Get() ArangoDeploymentRecoverySpec {
|
|||
}
|
||||
|
||||
func (a ArangoDeploymentRecoverySpec) GetAutoRecover() bool {
|
||||
return util.BoolOrDefault(a.AutoRecover, false)
|
||||
return util.TypeOrDefault[bool](a.AutoRecover, false)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -33,7 +33,7 @@ type RocksDBEncryptionSpec struct {
|
|||
|
||||
// GetKeySecretName returns the value of keySecretName.
|
||||
func (s RocksDBEncryptionSpec) GetKeySecretName() string {
|
||||
return util.StringOrDefault(s.KeySecretName)
|
||||
return util.TypeOrDefault[string](s.KeySecretName)
|
||||
}
|
||||
|
||||
// IsEncrypted returns true when an encryption key secret name is provided,
|
||||
|
@ -69,7 +69,7 @@ func (s *RocksDBSpec) SetDefaults() {
|
|||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *RocksDBSpec) SetDefaultsFrom(source RocksDBSpec) {
|
||||
if s.Encryption.KeySecretName == nil {
|
||||
s.Encryption.KeySecretName = util.NewStringOrNil(source.Encryption.KeySecretName)
|
||||
s.Encryption.KeySecretName = util.NewTypeOrNil[string](source.Encryption.KeySecretName)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ func (s RocksDBSpec) ResetImmutableFields(fieldPrefix string, target *RocksDBSpe
|
|||
var resetFields []string
|
||||
if s.IsEncrypted() != target.IsEncrypted() {
|
||||
// Note: You can change the name, but not from empty to non-empty (or reverse).
|
||||
target.Encryption.KeySecretName = util.NewStringOrNil(s.Encryption.KeySecretName)
|
||||
target.Encryption.KeySecretName = util.NewTypeOrNil[string](s.Encryption.KeySecretName)
|
||||
resetFields = append(resetFields, fieldPrefix+".encryption.keySecretName")
|
||||
}
|
||||
return resetFields
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -31,16 +31,16 @@ import (
|
|||
func TestRocksDBSpecValidate(t *testing.T) {
|
||||
// Valid
|
||||
assert.Nil(t, RocksDBSpec{}.Validate())
|
||||
assert.Nil(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}}.Validate())
|
||||
assert.Nil(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}}.Validate())
|
||||
|
||||
// Not valid
|
||||
assert.Error(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("Foo")}}.Validate())
|
||||
assert.Error(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("Foo")}}.Validate())
|
||||
}
|
||||
|
||||
func TestRocksDBSpecIsEncrypted(t *testing.T) {
|
||||
assert.False(t, RocksDBSpec{}.IsEncrypted())
|
||||
assert.False(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("")}}.IsEncrypted())
|
||||
assert.True(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}}.IsEncrypted())
|
||||
assert.False(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("")}}.IsEncrypted())
|
||||
assert.True(t, RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}}.IsEncrypted())
|
||||
}
|
||||
|
||||
func TestRocksDBSpecSetDefaults(t *testing.T) {
|
||||
|
@ -67,23 +67,23 @@ func TestRocksDBSpecResetImmutableFields(t *testing.T) {
|
|||
nil,
|
||||
},
|
||||
{
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo2")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo2")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo2")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo2")}},
|
||||
nil,
|
||||
},
|
||||
|
||||
// Invalid changes
|
||||
{
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewString("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("")}},
|
||||
RocksDBSpec{Encryption: RocksDBEncryptionSpec{KeySecretName: util.NewType[string]("foo")}},
|
||||
[]string{"test.encryption.keySecretName"},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -284,17 +284,17 @@ func (s ServerGroupSpec) GetVolumeClaimTemplate() *core.PersistentVolumeClaim {
|
|||
|
||||
// GetCount returns the value of count.
|
||||
func (s ServerGroupSpec) GetCount() int {
|
||||
return util.IntOrDefault(s.Count)
|
||||
return util.TypeOrDefault[int](s.Count)
|
||||
}
|
||||
|
||||
// GetMinCount returns MinCount or 1 if not set
|
||||
func (s ServerGroupSpec) GetMinCount() int {
|
||||
return util.IntOrDefault(s.MinCount, 1)
|
||||
return util.TypeOrDefault[int](s.MinCount, 1)
|
||||
}
|
||||
|
||||
// GetMaxCount returns MaxCount or
|
||||
func (s ServerGroupSpec) GetMaxCount() int {
|
||||
return util.IntOrDefault(s.MaxCount, math.MaxInt32)
|
||||
return util.TypeOrDefault[int](s.MaxCount, math.MaxInt32)
|
||||
}
|
||||
|
||||
// GetNodeSelector returns the selectors for nodes of this group
|
||||
|
@ -315,9 +315,9 @@ func (s ServerGroupSpec) GetArgs() []string {
|
|||
// GetStorageClassName returns the value of storageClassName.
|
||||
func (s ServerGroupSpec) GetStorageClassName() string {
|
||||
if pvc := s.GetVolumeClaimTemplate(); pvc != nil {
|
||||
return util.StringOrDefault(pvc.Spec.StorageClassName)
|
||||
return util.TypeOrDefault[string](pvc.Spec.StorageClassName)
|
||||
}
|
||||
return util.StringOrDefault(s.StorageClassName)
|
||||
return util.TypeOrDefault[string](s.StorageClassName)
|
||||
}
|
||||
|
||||
// GetTolerations returns the value of tolerations.
|
||||
|
@ -327,7 +327,7 @@ func (s ServerGroupSpec) GetTolerations() []core.Toleration {
|
|||
|
||||
// GetServiceAccountName returns the value of serviceAccountName.
|
||||
func (s ServerGroupSpec) GetServiceAccountName() string {
|
||||
return util.StringOrDefault(s.ServiceAccountName)
|
||||
return util.TypeOrDefault[string](s.ServiceAccountName)
|
||||
}
|
||||
|
||||
// HasProbesSpec returns true if Probes is non nil
|
||||
|
@ -522,12 +522,12 @@ func (s *ServerGroupSpec) SetDefaults(group ServerGroup, used bool, mode Deploym
|
|||
switch group {
|
||||
case ServerGroupSingle:
|
||||
if mode == DeploymentModeSingle {
|
||||
s.Count = util.NewInt(1) // Single server
|
||||
s.Count = util.NewType[int](1) // Single server
|
||||
} else {
|
||||
s.Count = util.NewInt(2) // ActiveFailover
|
||||
s.Count = util.NewType[int](2) // ActiveFailover
|
||||
}
|
||||
default:
|
||||
s.Count = util.NewInt(3)
|
||||
s.Count = util.NewType[int](3)
|
||||
}
|
||||
} else if s.GetCount() > 0 && !used {
|
||||
s.Count = nil
|
||||
|
@ -574,25 +574,25 @@ func setStorageDefaultsFromResourceList(s *core.ResourceList, source core.Resour
|
|||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *ServerGroupSpec) SetDefaultsFrom(source ServerGroupSpec) {
|
||||
if s.Count == nil {
|
||||
s.Count = util.NewIntOrNil(source.Count)
|
||||
s.Count = util.NewTypeOrNil[int](source.Count)
|
||||
}
|
||||
if s.MinCount == nil {
|
||||
s.MinCount = util.NewIntOrNil(source.MinCount)
|
||||
s.MinCount = util.NewTypeOrNil[int](source.MinCount)
|
||||
}
|
||||
if s.MaxCount == nil {
|
||||
s.MaxCount = util.NewIntOrNil(source.MaxCount)
|
||||
s.MaxCount = util.NewTypeOrNil[int](source.MaxCount)
|
||||
}
|
||||
if s.Args == nil {
|
||||
s.Args = source.Args
|
||||
}
|
||||
if s.StorageClassName == nil {
|
||||
s.StorageClassName = util.NewStringOrNil(source.StorageClassName)
|
||||
s.StorageClassName = util.NewTypeOrNil[string](source.StorageClassName)
|
||||
}
|
||||
if s.Tolerations == nil {
|
||||
s.Tolerations = source.Tolerations
|
||||
}
|
||||
if s.ServiceAccountName == nil {
|
||||
s.ServiceAccountName = util.NewStringOrNil(source.ServiceAccountName)
|
||||
s.ServiceAccountName = util.NewTypeOrNil[string](source.ServiceAccountName)
|
||||
}
|
||||
if s.NodeSelector == nil {
|
||||
s.NodeSelector = source.NodeSelector
|
||||
|
@ -610,7 +610,7 @@ func (s ServerGroupSpec) ResetImmutableFields(group ServerGroup, fieldPrefix str
|
|||
var resetFields []string
|
||||
if group == ServerGroupAgents {
|
||||
if s.GetCount() != target.GetCount() {
|
||||
target.Count = util.NewIntOrNil(s.Count)
|
||||
target.Count = util.NewTypeOrNil[int](s.Count)
|
||||
resetFields = append(resetFields, fieldPrefix+".count")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -58,7 +58,7 @@ func (s *ServerGroupSpecPodMode) Apply(p *core.PodSpec) {
|
|||
// Default, no change
|
||||
case ServerGroupPIDModePod:
|
||||
// Enable Pod shared namespaces
|
||||
p.ShareProcessNamespace = util.NewBool(true)
|
||||
p.ShareProcessNamespace = util.NewType[bool](true)
|
||||
case ServerGroupPIDModeHost:
|
||||
// Enable Host shared namespaces
|
||||
p.HostPID = true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -30,55 +30,55 @@ import (
|
|||
|
||||
func TestServerGroupSpecValidateCount(t *testing.T) {
|
||||
// Valid
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, false, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(6)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, false, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](6)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](3)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2), MinCount: util.NewInt(2), MaxCount: util.NewInt(5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1), MaxCount: util.NewInt(5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(6), MinCount: util.NewInt(2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(5), MinCount: util.NewInt(5), MaxCount: util.NewInt(5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2), MinCount: util.NewType[int](2), MaxCount: util.NewType[int](5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1), MaxCount: util.NewType[int](5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](6), MinCount: util.NewType[int](2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](5), MinCount: util.NewType[int](5), MaxCount: util.NewType[int](5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
|
||||
// Invalid
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, false, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, true, DeploymentModeActiveFailover, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(0)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(-1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(-1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(-1)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(-1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(-1)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(-1)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(2)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, false, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupSingle).Validate(ServerGroupSingle, true, DeploymentModeActiveFailover, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](0)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](-1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](-1)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](-1)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](-1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](-1)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](-1)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](2)}.WithGroup(ServerGroupAgents).Validate(ServerGroupAgents, true, DeploymentModeActiveFailover, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupDBServers).Validate(ServerGroupDBServers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupSyncMasters).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1)}.WithGroup(ServerGroupSyncWorkers).Validate(ServerGroupSyncWorkers, true, DeploymentModeCluster, EnvironmentProduction))
|
||||
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(2), MinCount: util.NewInt(5), MaxCount: util.NewInt(1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(6), MaxCount: util.NewInt(5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1), MinCount: util.NewInt(2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](2), MinCount: util.NewType[int](5), MaxCount: util.NewType[int](1)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](6), MaxCount: util.NewType[int](5)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1), MinCount: util.NewType[int](2)}.WithGroup(ServerGroupCoordinators).Validate(ServerGroupCoordinators, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
|
||||
}
|
||||
|
||||
|
@ -120,13 +120,13 @@ func TestServerGroupSpecDefault(t *testing.T) {
|
|||
|
||||
func TestServerGroupSpecValidateArgs(t *testing.T) {
|
||||
// Valid
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{"--master.endpoint"}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{"--server.authentication=true"}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{"--master.endpoint"}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Nil(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{"--server.authentication=true"}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
// Invalid
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{"--server.authentication=true"}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{"--server.authentication", "true"}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{"--master.endpoint=http://something"}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewInt(1), Args: []string{"--mq.type=strange"}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{"--server.authentication=true"}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{"--server.authentication", "true"}}.WithDefaults(ServerGroupSingle, true, DeploymentModeSingle).Validate(ServerGroupSingle, true, DeploymentModeSingle, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{"--master.endpoint=http://something"}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
assert.Error(t, ServerGroupSpec{Count: util.NewType[int](1), Args: []string{"--mq.type=strange"}}.WithDefaults(ServerGroupSyncMasters, true, DeploymentModeCluster).Validate(ServerGroupSyncMasters, true, DeploymentModeCluster, EnvironmentDevelopment))
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -34,12 +34,12 @@ type SyncAuthenticationSpec struct {
|
|||
|
||||
// GetJWTSecretName returns the value of jwtSecretName.
|
||||
func (s SyncAuthenticationSpec) GetJWTSecretName() string {
|
||||
return util.StringOrDefault(s.JWTSecretName)
|
||||
return util.TypeOrDefault[string](s.JWTSecretName)
|
||||
}
|
||||
|
||||
// GetClientCASecretName returns the value of clientCASecretName.
|
||||
func (s SyncAuthenticationSpec) GetClientCASecretName() string {
|
||||
return util.StringOrDefault(s.ClientCASecretName)
|
||||
return util.TypeOrDefault[string](s.ClientCASecretName)
|
||||
}
|
||||
|
||||
// Validate the given spec
|
||||
|
@ -58,22 +58,22 @@ func (s *SyncAuthenticationSpec) SetDefaults(defaultJWTSecretName, defaultClient
|
|||
if s.GetJWTSecretName() == "" {
|
||||
// Note that we don't check for nil here, since even a specified, but empty
|
||||
// string should result in the default value.
|
||||
s.JWTSecretName = util.NewString(defaultJWTSecretName)
|
||||
s.JWTSecretName = util.NewType[string](defaultJWTSecretName)
|
||||
}
|
||||
if s.GetClientCASecretName() == "" {
|
||||
// Note that we don't check for nil here, since even a specified, but empty
|
||||
// string should result in the default value.
|
||||
s.ClientCASecretName = util.NewString(defaultClientCASecretName)
|
||||
s.ClientCASecretName = util.NewType[string](defaultClientCASecretName)
|
||||
}
|
||||
}
|
||||
|
||||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *SyncAuthenticationSpec) SetDefaultsFrom(source SyncAuthenticationSpec) {
|
||||
if s.JWTSecretName == nil {
|
||||
s.JWTSecretName = util.NewStringOrNil(source.JWTSecretName)
|
||||
s.JWTSecretName = util.NewTypeOrNil[string](source.JWTSecretName)
|
||||
}
|
||||
if s.ClientCASecretName == nil {
|
||||
s.ClientCASecretName = util.NewStringOrNil(source.ClientCASecretName)
|
||||
s.ClientCASecretName = util.NewTypeOrNil[string](source.ClientCASecretName)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -33,7 +33,7 @@ type MonitoringSpec struct {
|
|||
|
||||
// GetTokenSecretName returns the value of tokenSecretName.
|
||||
func (s MonitoringSpec) GetTokenSecretName() string {
|
||||
return util.StringOrDefault(s.TokenSecretName)
|
||||
return util.TypeOrDefault[string](s.TokenSecretName)
|
||||
}
|
||||
|
||||
// Validate the given spec
|
||||
|
@ -49,13 +49,13 @@ func (s *MonitoringSpec) SetDefaults(defaultTokenSecretName string) {
|
|||
if s.GetTokenSecretName() == "" {
|
||||
// Note that we don't check for nil here, since even a specified, but empty
|
||||
// string should result in the default value.
|
||||
s.TokenSecretName = util.NewString(defaultTokenSecretName)
|
||||
s.TokenSecretName = util.NewType[string](defaultTokenSecretName)
|
||||
}
|
||||
}
|
||||
|
||||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *MonitoringSpec) SetDefaultsFrom(source MonitoringSpec) {
|
||||
if s.TokenSecretName == nil {
|
||||
s.TokenSecretName = util.NewStringOrNil(source.TokenSecretName)
|
||||
s.TokenSecretName = util.NewTypeOrNil[string](source.TokenSecretName)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -31,12 +31,12 @@ import (
|
|||
func TestMonitoringSpecValidate(t *testing.T) {
|
||||
// Valid
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: nil}.Validate())
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: util.NewString("")}.Validate())
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: util.NewString("foo")}.Validate())
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: util.NewString("foo")}.Validate())
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: util.NewType[string]("")}.Validate())
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: util.NewType[string]("foo")}.Validate())
|
||||
assert.Nil(t, MonitoringSpec{TokenSecretName: util.NewType[string]("foo")}.Validate())
|
||||
|
||||
// Not valid
|
||||
assert.Error(t, MonitoringSpec{TokenSecretName: util.NewString("Foo")}.Validate())
|
||||
assert.Error(t, MonitoringSpec{TokenSecretName: util.NewType[string]("Foo")}.Validate())
|
||||
}
|
||||
|
||||
func TestMonitoringSpecSetDefaults(t *testing.T) {
|
||||
|
@ -51,5 +51,5 @@ func TestMonitoringSpecSetDefaults(t *testing.T) {
|
|||
|
||||
assert.Equal(t, "", def(MonitoringSpec{}).GetTokenSecretName())
|
||||
assert.Equal(t, "def2", def2(MonitoringSpec{}).GetTokenSecretName())
|
||||
assert.Equal(t, "foo", def(MonitoringSpec{TokenSecretName: util.NewString("foo")}).GetTokenSecretName())
|
||||
assert.Equal(t, "foo", def(MonitoringSpec{TokenSecretName: util.NewType[string]("foo")}).GetTokenSecretName())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -38,12 +38,12 @@ type SyncSpec struct {
|
|||
|
||||
// IsEnabled returns the value of enabled.
|
||||
func (s SyncSpec) IsEnabled() bool {
|
||||
return util.BoolOrDefault(s.Enabled)
|
||||
return util.TypeOrDefault[bool](s.Enabled)
|
||||
}
|
||||
|
||||
// GetSyncImage returns the syncer image or empty string
|
||||
func (s SyncSpec) GetSyncImage() string {
|
||||
return util.StringOrDefault(s.Image)
|
||||
return util.TypeOrDefault[string](s.Image)
|
||||
}
|
||||
|
||||
// HasSyncImage returns whether a special sync image is set
|
||||
|
@ -84,10 +84,10 @@ func (s *SyncSpec) SetDefaults(defaultJWTSecretName, defaultClientAuthCASecretNa
|
|||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *SyncSpec) SetDefaultsFrom(source SyncSpec) {
|
||||
if s.Enabled == nil {
|
||||
s.Enabled = util.NewBoolOrNil(source.Enabled)
|
||||
s.Enabled = util.NewTypeOrNil[bool](source.Enabled)
|
||||
}
|
||||
if s.Image == nil {
|
||||
s.Image = util.NewStringOrNil(source.Image)
|
||||
s.Image = util.NewTypeOrNil[string](source.Image)
|
||||
}
|
||||
s.ExternalAccess.SetDefaultsFrom(source.ExternalAccess)
|
||||
s.Authentication.SetDefaultsFrom(source.Authentication)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -30,16 +30,16 @@ import (
|
|||
|
||||
func TestSyncSpecValidate(t *testing.T) {
|
||||
// Valid
|
||||
auth := SyncAuthenticationSpec{JWTSecretName: util.NewString("foo"), ClientCASecretName: util.NewString("foo-client")}
|
||||
tls := TLSSpec{CASecretName: util.NewString("None")}
|
||||
auth := SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo"), ClientCASecretName: util.NewType[string]("foo-client")}
|
||||
tls := TLSSpec{CASecretName: util.NewType[string]("None")}
|
||||
assert.Nil(t, SyncSpec{Authentication: auth}.Validate(DeploymentModeSingle))
|
||||
assert.Nil(t, SyncSpec{Authentication: auth}.Validate(DeploymentModeActiveFailover))
|
||||
assert.Nil(t, SyncSpec{Authentication: auth}.Validate(DeploymentModeCluster))
|
||||
assert.Nil(t, SyncSpec{Authentication: auth, TLS: tls, Enabled: util.NewBool(true)}.Validate(DeploymentModeCluster))
|
||||
assert.Nil(t, SyncSpec{Authentication: auth, TLS: tls, Enabled: util.NewType[bool](true)}.Validate(DeploymentModeCluster))
|
||||
|
||||
// Not valid
|
||||
assert.Error(t, SyncSpec{Authentication: auth, TLS: tls, Enabled: util.NewBool(true)}.Validate(DeploymentModeSingle))
|
||||
assert.Error(t, SyncSpec{Authentication: auth, TLS: tls, Enabled: util.NewBool(true)}.Validate(DeploymentModeActiveFailover))
|
||||
assert.Error(t, SyncSpec{Authentication: auth, TLS: tls, Enabled: util.NewType[bool](true)}.Validate(DeploymentModeSingle))
|
||||
assert.Error(t, SyncSpec{Authentication: auth, TLS: tls, Enabled: util.NewType[bool](true)}.Validate(DeploymentModeActiveFailover))
|
||||
}
|
||||
|
||||
func TestSyncSpecSetDefaults(t *testing.T) {
|
||||
|
@ -49,11 +49,11 @@ func TestSyncSpecSetDefaults(t *testing.T) {
|
|||
}
|
||||
|
||||
assert.False(t, def(SyncSpec{}).IsEnabled())
|
||||
assert.False(t, def(SyncSpec{Enabled: util.NewBool(false)}).IsEnabled())
|
||||
assert.True(t, def(SyncSpec{Enabled: util.NewBool(true)}).IsEnabled())
|
||||
assert.False(t, def(SyncSpec{Enabled: util.NewType[bool](false)}).IsEnabled())
|
||||
assert.True(t, def(SyncSpec{Enabled: util.NewType[bool](true)}).IsEnabled())
|
||||
assert.Equal(t, "test-jwt", def(SyncSpec{}).Authentication.GetJWTSecretName())
|
||||
assert.Equal(t, "test-mon", def(SyncSpec{}).Monitoring.GetTokenSecretName())
|
||||
assert.Equal(t, "foo", def(SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo")}}).Authentication.GetJWTSecretName())
|
||||
assert.Equal(t, "foo", def(SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo")}}).Authentication.GetJWTSecretName())
|
||||
}
|
||||
|
||||
func TestSyncSpecResetImmutableFields(t *testing.T) {
|
||||
|
@ -65,33 +65,33 @@ func TestSyncSpecResetImmutableFields(t *testing.T) {
|
|||
}{
|
||||
// Valid "changes"
|
||||
{
|
||||
SyncSpec{Enabled: util.NewBool(false)},
|
||||
SyncSpec{Enabled: util.NewBool(true)},
|
||||
SyncSpec{Enabled: util.NewBool(true)},
|
||||
SyncSpec{Enabled: util.NewType[bool](false)},
|
||||
SyncSpec{Enabled: util.NewType[bool](true)},
|
||||
SyncSpec{Enabled: util.NewType[bool](true)},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
SyncSpec{Enabled: util.NewBool(true)},
|
||||
SyncSpec{Enabled: util.NewBool(false)},
|
||||
SyncSpec{Enabled: util.NewBool(false)},
|
||||
SyncSpec{Enabled: util.NewType[bool](true)},
|
||||
SyncSpec{Enabled: util.NewType[bool](false)},
|
||||
SyncSpec{Enabled: util.NewType[bool](false)},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("None"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("None"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("None"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("None"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("None"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("None"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo2"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewString("foo2"), ClientCASecretName: util.NewString("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo2"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
SyncSpec{Authentication: SyncAuthenticationSpec{JWTSecretName: util.NewType[string]("foo2"), ClientCASecretName: util.NewType[string]("some")}},
|
||||
nil,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -68,7 +68,7 @@ const (
|
|||
|
||||
// GetCASecretName returns the value of caSecretName.
|
||||
func (s TLSSpec) GetCASecretName() string {
|
||||
return util.StringOrDefault(s.CASecretName)
|
||||
return util.TypeOrDefault[string](s.CASecretName)
|
||||
}
|
||||
|
||||
// GetAltNames returns the value of altNames.
|
||||
|
@ -132,7 +132,7 @@ func (s *TLSSpec) SetDefaults(defaultCASecretName string) {
|
|||
if s.GetCASecretName() == "" {
|
||||
// Note that we don't check for nil here, since even a specified, but empty
|
||||
// string should result in the default value.
|
||||
s.CASecretName = util.NewString(defaultCASecretName)
|
||||
s.CASecretName = util.NewType[string](defaultCASecretName)
|
||||
}
|
||||
if s.GetTTL() == "" {
|
||||
// Note that we don't check for nil here, since even a specified, but zero
|
||||
|
@ -144,7 +144,7 @@ func (s *TLSSpec) SetDefaults(defaultCASecretName string) {
|
|||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *TLSSpec) SetDefaultsFrom(source TLSSpec) {
|
||||
if s.CASecretName == nil {
|
||||
s.CASecretName = util.NewStringOrNil(source.CASecretName)
|
||||
s.CASecretName = util.NewTypeOrNil[string](source.CASecretName)
|
||||
}
|
||||
if s.AltNames == nil {
|
||||
s.AltNames = source.AltNames
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -31,23 +31,23 @@ import (
|
|||
|
||||
func TestTLSSpecValidate(t *testing.T) {
|
||||
// Valid
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewString("foo")}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewString("None")}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewString("None"), AltNames: []string{}}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewString("None"), AltNames: []string{"foo"}}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewString("None"), AltNames: []string{"email@example.com", "127.0.0.1"}}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewType[string]("foo")}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewType[string]("None")}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewType[string]("None"), AltNames: []string{}}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewType[string]("None"), AltNames: []string{"foo"}}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: util.NewType[string]("None"), AltNames: []string{"email@example.com", "127.0.0.1"}}.Validate())
|
||||
|
||||
// Not valid
|
||||
assert.Error(t, TLSSpec{CASecretName: nil}.Validate())
|
||||
assert.Error(t, TLSSpec{CASecretName: util.NewString("")}.Validate())
|
||||
assert.Error(t, TLSSpec{CASecretName: util.NewString("Foo")}.Validate())
|
||||
assert.Error(t, TLSSpec{CASecretName: util.NewString("foo"), AltNames: []string{"@@"}}.Validate())
|
||||
assert.Error(t, TLSSpec{CASecretName: util.NewType[string]("")}.Validate())
|
||||
assert.Error(t, TLSSpec{CASecretName: util.NewType[string]("Foo")}.Validate())
|
||||
assert.Error(t, TLSSpec{CASecretName: util.NewType[string]("foo"), AltNames: []string{"@@"}}.Validate())
|
||||
}
|
||||
|
||||
func TestTLSSpecIsSecure(t *testing.T) {
|
||||
assert.True(t, TLSSpec{CASecretName: util.NewString("")}.IsSecure())
|
||||
assert.True(t, TLSSpec{CASecretName: util.NewString("foo")}.IsSecure())
|
||||
assert.False(t, TLSSpec{CASecretName: util.NewString("None")}.IsSecure())
|
||||
assert.True(t, TLSSpec{CASecretName: util.NewType[string]("")}.IsSecure())
|
||||
assert.True(t, TLSSpec{CASecretName: util.NewType[string]("foo")}.IsSecure())
|
||||
assert.False(t, TLSSpec{CASecretName: util.NewType[string]("None")}.IsSecure())
|
||||
}
|
||||
|
||||
func TestTLSSpecSetDefaults(t *testing.T) {
|
||||
|
@ -57,7 +57,7 @@ func TestTLSSpecSetDefaults(t *testing.T) {
|
|||
}
|
||||
|
||||
assert.Equal(t, "", def(TLSSpec{}).GetCASecretName())
|
||||
assert.Equal(t, "foo", def(TLSSpec{CASecretName: util.NewString("foo")}).GetCASecretName())
|
||||
assert.Equal(t, "foo", def(TLSSpec{CASecretName: util.NewType[string]("foo")}).GetCASecretName())
|
||||
assert.Len(t, def(TLSSpec{}).GetAltNames(), 0)
|
||||
assert.Len(t, def(TLSSpec{AltNames: []string{"foo.local"}}).GetAltNames(), 1)
|
||||
assert.Equal(t, defaultTLSTTL, def(TLSSpec{}).GetTTL())
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -41,12 +41,12 @@ type EndpointAuthenticationSpec struct {
|
|||
|
||||
// GetKeyfileSecretName returns the value of keyfileSecretName.
|
||||
func (s EndpointAuthenticationSpec) GetKeyfileSecretName() string {
|
||||
return util.StringOrDefault(s.KeyfileSecretName)
|
||||
return util.TypeOrDefault[string](s.KeyfileSecretName)
|
||||
}
|
||||
|
||||
// GetUserSecretName returns the value of userSecretName.
|
||||
func (s EndpointAuthenticationSpec) GetUserSecretName() string {
|
||||
return util.StringOrDefault(s.UserSecretName)
|
||||
return util.TypeOrDefault[string](s.UserSecretName)
|
||||
}
|
||||
|
||||
// Validate the given spec, returning an error on validation
|
||||
|
@ -71,10 +71,10 @@ func (s *EndpointAuthenticationSpec) SetDefaults() {
|
|||
// SetDefaultsFrom fills empty field with default values from the given source.
|
||||
func (s *EndpointAuthenticationSpec) SetDefaultsFrom(source EndpointAuthenticationSpec) {
|
||||
if s.KeyfileSecretName == nil {
|
||||
s.KeyfileSecretName = util.NewStringOrNil(source.KeyfileSecretName)
|
||||
s.KeyfileSecretName = util.NewTypeOrNil[string](source.KeyfileSecretName)
|
||||
}
|
||||
if s.UserSecretName == nil {
|
||||
s.UserSecretName = util.NewStringOrNil(source.UserSecretName)
|
||||
s.UserSecretName = util.NewTypeOrNil[string](source.UserSecretName)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -44,7 +44,7 @@ type EndpointSpec struct {
|
|||
|
||||
// GetDeploymentName returns the value of deploymentName.
|
||||
func (s EndpointSpec) GetDeploymentName() string {
|
||||
return util.StringOrDefault(s.DeploymentName)
|
||||
return util.TypeOrDefault[string](s.DeploymentName)
|
||||
}
|
||||
|
||||
// HasDeploymentName returns the true when a non-empty deployment name it set.
|
||||
|
@ -85,7 +85,7 @@ func (s *EndpointSpec) SetDefaults() {
|
|||
// SetDefaultsFrom fills empty field with default values from the given source.
|
||||
func (s *EndpointSpec) SetDefaultsFrom(source EndpointSpec) {
|
||||
if s.DeploymentName == nil {
|
||||
s.DeploymentName = util.NewStringOrNil(source.DeploymentName)
|
||||
s.DeploymentName = util.NewTypeOrNil[string](source.DeploymentName)
|
||||
}
|
||||
s.Authentication.SetDefaultsFrom(source.Authentication)
|
||||
s.TLS.SetDefaultsFrom(source.TLS)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -35,7 +35,7 @@ type EndpointTLSSpec struct {
|
|||
|
||||
// GetCASecretName returns the value of caSecretName.
|
||||
func (s EndpointTLSSpec) GetCASecretName() string {
|
||||
return util.StringOrDefault(s.CASecretName)
|
||||
return util.TypeOrDefault[string](s.CASecretName)
|
||||
}
|
||||
|
||||
// Validate the given spec, returning an error on validation
|
||||
|
@ -57,7 +57,7 @@ func (s *EndpointTLSSpec) SetDefaults() {
|
|||
// SetDefaultsFrom fills empty field with default values from the given source.
|
||||
func (s *EndpointTLSSpec) SetDefaultsFrom(source EndpointTLSSpec) {
|
||||
if s.CASecretName == nil {
|
||||
s.CASecretName = util.NewStringOrNil(source.CASecretName)
|
||||
s.CASecretName = util.NewTypeOrNil[string](source.CASecretName)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -41,12 +41,12 @@ type EndpointAuthenticationSpec struct {
|
|||
|
||||
// GetKeyfileSecretName returns the value of keyfileSecretName.
|
||||
func (s EndpointAuthenticationSpec) GetKeyfileSecretName() string {
|
||||
return util.StringOrDefault(s.KeyfileSecretName)
|
||||
return util.TypeOrDefault[string](s.KeyfileSecretName)
|
||||
}
|
||||
|
||||
// GetUserSecretName returns the value of userSecretName.
|
||||
func (s EndpointAuthenticationSpec) GetUserSecretName() string {
|
||||
return util.StringOrDefault(s.UserSecretName)
|
||||
return util.TypeOrDefault[string](s.UserSecretName)
|
||||
}
|
||||
|
||||
// Validate the given spec, returning an error on validation
|
||||
|
@ -71,10 +71,10 @@ func (s *EndpointAuthenticationSpec) SetDefaults() {
|
|||
// SetDefaultsFrom fills empty field with default values from the given source.
|
||||
func (s *EndpointAuthenticationSpec) SetDefaultsFrom(source EndpointAuthenticationSpec) {
|
||||
if s.KeyfileSecretName == nil {
|
||||
s.KeyfileSecretName = util.NewStringOrNil(source.KeyfileSecretName)
|
||||
s.KeyfileSecretName = util.NewTypeOrNil[string](source.KeyfileSecretName)
|
||||
}
|
||||
if s.UserSecretName == nil {
|
||||
s.UserSecretName = util.NewStringOrNil(source.UserSecretName)
|
||||
s.UserSecretName = util.NewTypeOrNil[string](source.UserSecretName)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -44,7 +44,7 @@ type EndpointSpec struct {
|
|||
|
||||
// GetDeploymentName returns the value of deploymentName.
|
||||
func (s EndpointSpec) GetDeploymentName() string {
|
||||
return util.StringOrDefault(s.DeploymentName)
|
||||
return util.TypeOrDefault[string](s.DeploymentName)
|
||||
}
|
||||
|
||||
// HasDeploymentName returns the true when a non-empty deployment name it set.
|
||||
|
@ -85,7 +85,7 @@ func (s *EndpointSpec) SetDefaults() {
|
|||
// SetDefaultsFrom fills empty field with default values from the given source.
|
||||
func (s *EndpointSpec) SetDefaultsFrom(source EndpointSpec) {
|
||||
if s.DeploymentName == nil {
|
||||
s.DeploymentName = util.NewStringOrNil(source.DeploymentName)
|
||||
s.DeploymentName = util.NewTypeOrNil[string](source.DeploymentName)
|
||||
}
|
||||
s.Authentication.SetDefaultsFrom(source.Authentication)
|
||||
s.TLS.SetDefaultsFrom(source.TLS)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -35,7 +35,7 @@ type EndpointTLSSpec struct {
|
|||
|
||||
// GetCASecretName returns the value of caSecretName.
|
||||
func (s EndpointTLSSpec) GetCASecretName() string {
|
||||
return util.StringOrDefault(s.CASecretName)
|
||||
return util.TypeOrDefault[string](s.CASecretName)
|
||||
}
|
||||
|
||||
// Validate the given spec, returning an error on validation
|
||||
|
@ -57,7 +57,7 @@ func (s *EndpointTLSSpec) SetDefaults() {
|
|||
// SetDefaultsFrom fills empty field with default values from the given source.
|
||||
func (s *EndpointTLSSpec) SetDefaultsFrom(source EndpointTLSSpec) {
|
||||
if s.CASecretName == nil {
|
||||
s.CASecretName = util.NewStringOrNil(source.CASecretName)
|
||||
s.CASecretName = util.NewTypeOrNil[string](source.CASecretName)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -95,7 +95,7 @@ func (d databaseGenerator) Add() StateGenerator {
|
|||
}
|
||||
|
||||
planCol := StatePlanCollection{
|
||||
Name: util.NewString(col),
|
||||
Name: util.NewType[string](col),
|
||||
Shards: planShards,
|
||||
WriteConcern: colDet.wc,
|
||||
ReplicationFactor: colDet.rf,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -55,7 +55,7 @@ func (d *Deployment) removePodFinalizers(ctx context.Context, cachedStatus inspe
|
|||
defer cancel()
|
||||
|
||||
if err := d.PodsModInterface().Delete(ctxChild, pod.GetName(), meta.DeleteOptions{
|
||||
GracePeriodSeconds: util.NewInt64(0),
|
||||
GracePeriodSeconds: util.NewType[int64](0),
|
||||
}); err != nil {
|
||||
if !kerrors.IsNotFound(err) {
|
||||
log.Err(err).Warn("Failed to remove pod")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -56,7 +56,7 @@ func TestEnsurePod_ArangoDB_AntiAffinity(t *testing.T) {
|
|||
Name: "DBserver POD with antiAffinity required",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -118,7 +118,7 @@ func TestEnsurePod_ArangoDB_AntiAffinity(t *testing.T) {
|
|||
Name: "DBserver POD with antiAffinity prefered",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -180,7 +180,7 @@ func TestEnsurePod_ArangoDB_AntiAffinity(t *testing.T) {
|
|||
Name: "DBserver POD with antiAffinity both",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -246,7 +246,7 @@ func TestEnsurePod_ArangoDB_AntiAffinity(t *testing.T) {
|
|||
Name: "DBserver POD with antiAffinity mixed",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -332,7 +332,7 @@ func TestEnsurePod_ArangoDB_Affinity(t *testing.T) {
|
|||
Name: "DBserver POD with affinity required",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -397,7 +397,7 @@ func TestEnsurePod_ArangoDB_Affinity(t *testing.T) {
|
|||
Name: "DBserver POD with affinity prefered",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -462,7 +462,7 @@ func TestEnsurePod_ArangoDB_Affinity(t *testing.T) {
|
|||
Name: "DBserver POD with affinity both",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -531,7 +531,7 @@ func TestEnsurePod_ArangoDB_Affinity(t *testing.T) {
|
|||
Name: "DBserver POD with affinity mixed",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -611,7 +611,7 @@ func TestEnsurePod_ArangoDB_NodeAffinity(t *testing.T) {
|
|||
Name: "DBserver POD with nodeAffinity required",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -41,10 +41,10 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Agent Pod with image pull policy",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
ImagePullPolicy: util.NewPullPolicy(core.PullAlways),
|
||||
ImagePullPolicy: util.NewType[core.PullPolicy](core.PullAlways),
|
||||
},
|
||||
},
|
||||
Helper: func(t *testing.T, deployment *Deployment, testCase *testCaseStruct) {
|
||||
|
@ -92,10 +92,10 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Agent Pod with image pull policy",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
ImagePullPolicy: util.NewPullPolicy(core.PullAlways),
|
||||
ImagePullPolicy: util.NewType[core.PullPolicy](core.PullAlways),
|
||||
},
|
||||
},
|
||||
Helper: func(t *testing.T, deployment *Deployment, testCase *testCaseStruct) {
|
||||
|
@ -143,7 +143,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Agent Pod with sidecar",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
Agents: api.ServerGroupSpec{
|
||||
|
@ -209,7 +209,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Agent Pod with image pull secrets",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
ImagePullSecrets: []string{"docker-registry", "other-registry"},
|
||||
|
@ -268,7 +268,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Agent Pod with alpine init container",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -325,7 +325,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "DBserver POD with resource requirements",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -382,7 +382,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "DBserver POD with resource requirements and memory override",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -439,7 +439,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "DBserver POD with resource requirements and persistent volume claim",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -499,7 +499,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Initialized DBserver POD with alpine init container",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -558,7 +558,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Agent Pod without TLS, authentication, persistent volume claim, metrics, rocksDB encryption, license",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -609,7 +609,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Agent Pod with persistent volume claim",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -666,7 +666,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Agent Pod with TLS",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: tlsSpec,
|
||||
},
|
||||
|
@ -719,7 +719,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Agent Pod with authentication and unsecured liveness",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
TLS: noTLS,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
|
@ -777,10 +777,10 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Agent Pod with TLS and authentication and secured liveness probe",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
TLS: api.TLSSpec{
|
||||
CASecretName: util.NewString(testCASecretName),
|
||||
CASecretName: util.NewType[string](testCASecretName),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -838,7 +838,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Agent Pod with encrypted rocksdb",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
RocksDB: rocksDBSpec,
|
||||
|
@ -895,7 +895,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "DBserver Pod with internal metrics exporter",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
TLS: noTLS,
|
||||
Metrics: metricsSpec,
|
||||
|
@ -956,14 +956,14 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "DBserver Pod with metrics exporter which contains resource requirements",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
TLS: noTLS,
|
||||
Metrics: api.MetricsSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Image: util.NewString(testImage),
|
||||
Enabled: util.NewType[bool](true),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: api.MetricsAuthenticationSpec{
|
||||
JWTTokenSecretName: util.NewString(testExporterToken),
|
||||
JWTTokenSecretName: util.NewType[string](testExporterToken),
|
||||
},
|
||||
Resources: resourcesUnfiltered,
|
||||
},
|
||||
|
@ -1024,7 +1024,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "DBserver Pod with lifecycle init container which contains resource requirements",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
TLS: noTLS,
|
||||
Metrics: metricsSpec,
|
||||
|
@ -1097,7 +1097,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "DBserver Pod with metrics exporter and lifecycle init container and alpine init container",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
TLS: noTLS,
|
||||
Metrics: metricsSpec,
|
||||
|
@ -1167,11 +1167,11 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Coordinator Pod with TLS and authentication and readiness and liveness",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
TLS: api.TLSSpec{
|
||||
CASecretName: util.NewString(testCASecretName),
|
||||
CASecretName: util.NewType[string](testCASecretName),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1229,10 +1229,10 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Single Pod with TLS and authentication and readiness and readiness",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
TLS: api.TLSSpec{
|
||||
CASecretName: util.NewString(testCASecretName),
|
||||
CASecretName: util.NewType[string](testCASecretName),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1294,13 +1294,13 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
Name: "Single Pod with TLS and authentication and readiness and port override",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
TLS: api.TLSSpec{
|
||||
CASecretName: util.NewString(testCASecretName),
|
||||
CASecretName: util.NewType[string](testCASecretName),
|
||||
},
|
||||
Single: api.ServerGroupSpec{
|
||||
Port: util.NewUInt16(18529),
|
||||
Port: util.NewType[uint16](18529),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1365,14 +1365,14 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
|
|||
},
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
TLS: api.TLSSpec{
|
||||
CASecretName: util.NewString(testCASecretName),
|
||||
CASecretName: util.NewType[string](testCASecretName),
|
||||
},
|
||||
Coordinators: api.ServerGroupSpec{
|
||||
Port: util.NewUInt16(18529),
|
||||
Port: util.NewType[uint16](18529),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -81,31 +81,31 @@ var (
|
|||
}
|
||||
|
||||
noAuthentication = api.AuthenticationSpec{
|
||||
JWTSecretName: util.NewString(api.JWTSecretNameDisabled),
|
||||
JWTSecretName: util.NewType[string](api.JWTSecretNameDisabled),
|
||||
}
|
||||
|
||||
noTLS = api.TLSSpec{
|
||||
CASecretName: util.NewString(api.CASecretNameDisabled),
|
||||
CASecretName: util.NewType[string](api.CASecretNameDisabled),
|
||||
}
|
||||
|
||||
authenticationSpec = api.AuthenticationSpec{
|
||||
JWTSecretName: util.NewString(testJWTSecretName),
|
||||
JWTSecretName: util.NewType[string](testJWTSecretName),
|
||||
}
|
||||
tlsSpec = api.TLSSpec{
|
||||
CASecretName: util.NewString(testCASecretName),
|
||||
CASecretName: util.NewType[string](testCASecretName),
|
||||
}
|
||||
|
||||
rocksDBSpec = api.RocksDBSpec{
|
||||
Encryption: api.RocksDBEncryptionSpec{
|
||||
KeySecretName: util.NewString(testRocksDBEncryptionKey),
|
||||
KeySecretName: util.NewType[string](testRocksDBEncryptionKey),
|
||||
},
|
||||
}
|
||||
|
||||
metricsSpec = api.MetricsSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Image: util.NewString(testImage),
|
||||
Enabled: util.NewType[bool](true),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: api.MetricsAuthenticationSpec{
|
||||
JWTTokenSecretName: util.NewString(testExporterToken),
|
||||
JWTTokenSecretName: util.NewType[string](testExporterToken),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -39,7 +39,7 @@ func TestEnsurePod_ArangoDB_Encryption(t *testing.T) {
|
|||
Name: "Agent CE 3.7.0 Pod with encrypted rocksdb",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
RocksDB: rocksDBSpec,
|
||||
|
@ -99,14 +99,14 @@ func TestEnsurePod_ArangoDB_Encryption(t *testing.T) {
|
|||
Name: "DBserver CE 3.7.0 Pod with metrics exporter, lifecycle, tls, authentication, license, rocksDB encryption, secured liveness",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
TLS: tlsSpec,
|
||||
Metrics: metricsSpec,
|
||||
RocksDB: rocksDBSpec,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -186,7 +186,7 @@ func TestEnsurePod_ArangoDB_Encryption(t *testing.T) {
|
|||
Name: "Agent EE 3.7.0 Pod with encrypted rocksdb, disabled feature",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
RocksDB: rocksDBSpec,
|
||||
|
@ -246,7 +246,7 @@ func TestEnsurePod_ArangoDB_Encryption(t *testing.T) {
|
|||
Name: "Agent EE 3.7.0 Pod with encrypted rocksdb, enabled feature",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
RocksDB: rocksDBSpec,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -37,7 +37,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
Name: "DBserver POD with disabled foxx services",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -96,7 +96,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
Name: "DBserver POD with enabled foxx services",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -113,7 +113,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
deployment.currentObjectStatus.Members.DBServers[0].IsInitialized = true
|
||||
|
||||
deployment.currentObject.Spec.Features = &api.DeploymentFeatures{
|
||||
FoxxQueues: util.NewBool(false),
|
||||
FoxxQueues: util.NewType[bool](false),
|
||||
}
|
||||
|
||||
testCase.createTestPodData(deployment, api.ServerGroupDBServers, firstDBServerStatus)
|
||||
|
@ -159,7 +159,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
Name: "Coordinator POD with undefined foxx services",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -218,7 +218,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
Name: "Coordinator POD with disabled foxx services",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -235,7 +235,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
deployment.currentObjectStatus.Members.Coordinators[0].IsInitialized = true
|
||||
|
||||
deployment.currentObject.Spec.Features = &api.DeploymentFeatures{
|
||||
FoxxQueues: util.NewBool(false),
|
||||
FoxxQueues: util.NewType[bool](false),
|
||||
}
|
||||
|
||||
testCase.createTestPodData(deployment, api.ServerGroupCoordinators, firstCoordinatorStatus)
|
||||
|
@ -281,7 +281,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
Name: "Coordinator POD with enabled foxx services",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -298,7 +298,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
deployment.currentObjectStatus.Members.Coordinators[0].IsInitialized = true
|
||||
|
||||
deployment.currentObject.Spec.Features = &api.DeploymentFeatures{
|
||||
FoxxQueues: util.NewBool(true),
|
||||
FoxxQueues: util.NewType[bool](true),
|
||||
}
|
||||
|
||||
testCase.createTestPodData(deployment, api.ServerGroupCoordinators, firstCoordinatorStatus)
|
||||
|
@ -344,7 +344,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
Name: "Single POD with undefined foxx services",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -405,7 +405,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
Name: "Single POD with disabled foxx services",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -422,7 +422,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
deployment.currentObjectStatus.Members.Single[0].IsInitialized = true
|
||||
|
||||
deployment.currentObject.Spec.Features = &api.DeploymentFeatures{
|
||||
FoxxQueues: util.NewBool(false),
|
||||
FoxxQueues: util.NewType[bool](false),
|
||||
}
|
||||
|
||||
testCase.createTestPodData(deployment, api.ServerGroupSingle, singleStatus)
|
||||
|
@ -470,7 +470,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
Name: "Single POD with enabled foxx services",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -487,7 +487,7 @@ func TestEnsurePod_ArangoDB_Features(t *testing.T) {
|
|||
deployment.currentObjectStatus.Members.Single[0].IsInitialized = true
|
||||
|
||||
deployment.currentObject.Spec.Features = &api.DeploymentFeatures{
|
||||
FoxxQueues: util.NewBool(true),
|
||||
FoxxQueues: util.NewType[bool](true),
|
||||
}
|
||||
|
||||
testCase.createTestPodData(deployment, api.ServerGroupSingle, singleStatus)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -56,10 +56,10 @@ func TestEnsurePod_ArangoDB_ImagePropagation(t *testing.T) {
|
|||
Name: "Agent Pod with defined image",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(image),
|
||||
Image: util.NewType[string](image),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
ImagePullPolicy: util.NewPullPolicy(core.PullAlways),
|
||||
ImagePullPolicy: util.NewType[core.PullPolicy](core.PullAlways),
|
||||
},
|
||||
},
|
||||
Helper: func(t *testing.T, deployment *Deployment, testCase *testCaseStruct) {
|
||||
|
@ -107,11 +107,11 @@ func TestEnsurePod_ArangoDB_ImagePropagation(t *testing.T) {
|
|||
Name: "Agent Pod with defined image and defined kubelet mode",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(image),
|
||||
Image: util.NewType[string](image),
|
||||
ImageDiscoveryMode: api.NewDeploymentImageDiscoveryModeSpec(api.DeploymentImageDiscoveryKubeletMode),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
ImagePullPolicy: util.NewPullPolicy(core.PullAlways),
|
||||
ImagePullPolicy: util.NewType[core.PullPolicy](core.PullAlways),
|
||||
},
|
||||
},
|
||||
Helper: func(t *testing.T, deployment *Deployment, testCase *testCaseStruct) {
|
||||
|
@ -159,11 +159,11 @@ func TestEnsurePod_ArangoDB_ImagePropagation(t *testing.T) {
|
|||
Name: "Agent Pod with defined image and defined direct mode",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(image),
|
||||
Image: util.NewType[string](image),
|
||||
ImageDiscoveryMode: api.NewDeploymentImageDiscoveryModeSpec(api.DeploymentImageDiscoveryDirectMode),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
ImagePullPolicy: util.NewPullPolicy(core.PullAlways),
|
||||
ImagePullPolicy: util.NewType[core.PullPolicy](core.PullAlways),
|
||||
},
|
||||
},
|
||||
Helper: func(t *testing.T, deployment *Deployment, testCase *testCaseStruct) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -37,13 +37,13 @@ func TestEnsurePod_Metrics(t *testing.T) {
|
|||
Name: "DBserver Pod with metrics exporter and port override",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
Metrics: func() api.MetricsSpec {
|
||||
m := metricsSpec.DeepCopy()
|
||||
|
||||
m.Port = util.NewUInt16(9999)
|
||||
m.Port = util.NewType[uint16](9999)
|
||||
|
||||
return *m
|
||||
}(),
|
||||
|
@ -97,7 +97,7 @@ func TestEnsurePod_Metrics(t *testing.T) {
|
|||
Name: "DBserver Pod with metrics exporter with mode",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
Metrics: func() api.MetricsSpec {
|
||||
|
@ -157,7 +157,7 @@ func TestEnsurePod_Metrics(t *testing.T) {
|
|||
Name: "DBserver Pod with metrics exporter with internal mode",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
Metrics: func() api.MetricsSpec {
|
||||
|
@ -225,7 +225,7 @@ func TestEnsurePod_Metrics(t *testing.T) {
|
|||
Name: "Agent Pod with metrics exporter with internal mode",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
Metrics: func() api.MetricsSpec {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -45,7 +45,7 @@ func TestEnsurePod_ArangoDB_Probe(t *testing.T) {
|
|||
Name: "Agent Pod default probes",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -95,13 +95,13 @@ func TestEnsurePod_ArangoDB_Probe(t *testing.T) {
|
|||
Name: "Agent Pod customized probes",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
Agents: api.ServerGroupSpec{
|
||||
Probes: &api.ServerGroupProbesSpec{
|
||||
LivenessProbeSpec: &api.ServerGroupProbeSpec{
|
||||
TimeoutSeconds: util.NewInt32(50),
|
||||
TimeoutSeconds: util.NewType[int32](50),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -154,13 +154,13 @@ func TestEnsurePod_ArangoDB_Probe(t *testing.T) {
|
|||
Name: "Agent Pod enabled probes",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
Agents: api.ServerGroupSpec{
|
||||
Probes: &api.ServerGroupProbesSpec{
|
||||
LivenessProbeDisabled: util.NewBool(false),
|
||||
ReadinessProbeDisabled: util.NewBool(false),
|
||||
LivenessProbeDisabled: util.NewType[bool](false),
|
||||
ReadinessProbeDisabled: util.NewType[bool](false),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -211,7 +211,7 @@ func TestEnsurePod_ArangoDB_Probe(t *testing.T) {
|
|||
Name: "DBServer Pod default probes",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -261,13 +261,13 @@ func TestEnsurePod_ArangoDB_Probe(t *testing.T) {
|
|||
Name: "DBServer Pod enabled probes",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
Probes: &api.ServerGroupProbesSpec{
|
||||
LivenessProbeDisabled: util.NewBool(false),
|
||||
ReadinessProbeDisabled: util.NewBool(false),
|
||||
LivenessProbeDisabled: util.NewType[bool](false),
|
||||
ReadinessProbeDisabled: util.NewType[bool](false),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -318,7 +318,7 @@ func TestEnsurePod_ArangoDB_Probe(t *testing.T) {
|
|||
Name: "Coordinator Pod default probes",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -368,13 +368,13 @@ func TestEnsurePod_ArangoDB_Probe(t *testing.T) {
|
|||
Name: "Coordinator Pod enabled probes",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
Coordinators: api.ServerGroupSpec{
|
||||
Probes: &api.ServerGroupProbesSpec{
|
||||
LivenessProbeDisabled: util.NewBool(false),
|
||||
ReadinessProbeDisabled: util.NewBool(false),
|
||||
LivenessProbeDisabled: util.NewType[bool](false),
|
||||
ReadinessProbeDisabled: util.NewType[bool](false),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -425,7 +425,7 @@ func TestEnsurePod_ArangoDB_Probe(t *testing.T) {
|
|||
Name: "DBServer with early connections",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(createTestImageForVersion("3.10.0")),
|
||||
Image: util.NewType[string](createTestImageForVersion("3.10.0")),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -482,7 +482,7 @@ func TestEnsurePod_ArangoDB_Probe(t *testing.T) {
|
|||
Name: "DBServer without early connections because version is lower than 3.10.0",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(createTestImageForVersion("3.9.2")),
|
||||
Image: util.NewType[string](createTestImageForVersion("3.9.2")),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -536,7 +536,7 @@ func TestEnsurePod_ArangoDB_Probe(t *testing.T) {
|
|||
Name: "DBServer without early connections because 3.10 feature is disabled",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(createTestImageForVersion("3.10.0")),
|
||||
Image: util.NewType[string](createTestImageForVersion("3.10.0")),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -590,7 +590,7 @@ func TestEnsurePod_ArangoDB_Probe(t *testing.T) {
|
|||
Name: "Coordinator should be without early connections",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(createTestImageForVersion("3.10.0")),
|
||||
Image: util.NewType[string](createTestImageForVersion("3.10.0")),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
@ -644,7 +644,7 @@ func TestEnsurePod_ArangoDB_Probe(t *testing.T) {
|
|||
Name: "Agent should be without early connections",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(createTestImageForVersion("3.10.0")),
|
||||
Image: util.NewType[string](createTestImageForVersion("3.10.0")),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -98,7 +98,7 @@ func TestEnsurePod_ArangoDB_Resources(t *testing.T) {
|
|||
Name: "DBserver POD with resource requirements",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -155,12 +155,12 @@ func TestEnsurePod_ArangoDB_Resources(t *testing.T) {
|
|||
Name: "DBserver POD with resource requirements, with override flag",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
Resources: resourcesUnfiltered,
|
||||
OverrideDetectedTotalMemory: util.NewBool(false),
|
||||
OverrideDetectedTotalMemory: util.NewType[bool](false),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -213,11 +213,11 @@ func TestEnsurePod_ArangoDB_Resources(t *testing.T) {
|
|||
Name: "DBserver POD without resource requirements, with override flag",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
OverrideDetectedTotalMemory: util.NewBool(true),
|
||||
OverrideDetectedTotalMemory: util.NewType[bool](true),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -42,7 +42,7 @@ func TestEnsurePod_Sync_Error(t *testing.T) {
|
|||
Name: "Sync Pod does not work for enterprise image",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
},
|
||||
},
|
||||
Helper: func(t *testing.T, deployment *Deployment, testCase *testCaseStruct) {
|
||||
|
@ -61,7 +61,7 @@ func TestEnsurePod_Sync_Error(t *testing.T) {
|
|||
Name: "Sync Pod cannot get master JWT secret",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
},
|
||||
},
|
||||
Helper: func(t *testing.T, deployment *Deployment, testCase *testCaseStruct) {
|
||||
|
@ -81,9 +81,9 @@ func TestEnsurePod_Sync_Error(t *testing.T) {
|
|||
Name: "Sync Pod cannot get monitoring token secret",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -115,9 +115,9 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
Name: "Sync Master Pod cannot create TLS keyfile secret",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -142,10 +142,10 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
Name: "Sync Master Pod cannot get cluster JWT secret",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -170,10 +170,10 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
Name: "Sync Master Pod cannot get authentication CA certificate",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -200,13 +200,13 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
"liveness probe, priority class name, resource requirements",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: authenticationSpec,
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
},
|
||||
SyncMasters: api.ServerGroupSpec{
|
||||
ServiceAccountName: util.NewString(testServiceAccountName),
|
||||
ServiceAccountName: util.NewType[string](testServiceAccountName),
|
||||
NodeSelector: nodeSelectorTest,
|
||||
PriorityClassName: testPriorityClassName,
|
||||
Resources: resourcesUnfiltered,
|
||||
|
@ -292,14 +292,14 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
},
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -380,11 +380,11 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
ExternalAccess: api.SyncExternalAccessSpec{
|
||||
MasterEndpoint: []string{
|
||||
"https://arangodb.xyz:8629",
|
||||
|
@ -392,7 +392,7 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
},
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -492,11 +492,11 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
ExternalAccess: api.SyncExternalAccessSpec{
|
||||
MasterEndpoint: []string{
|
||||
"https://arangodb.xyz:8629",
|
||||
|
@ -504,7 +504,7 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
},
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -585,11 +585,11 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
ExternalAccess: api.SyncExternalAccessSpec{
|
||||
MasterEndpoint: []string{
|
||||
"https://arangodb.xyz:8629",
|
||||
|
@ -597,7 +597,7 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
},
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -686,11 +686,11 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
ExternalAccess: api.SyncExternalAccessSpec{
|
||||
MasterEndpoint: []string{
|
||||
"https://127.0.0.1:8629",
|
||||
|
@ -698,7 +698,7 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
},
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -790,14 +790,14 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
},
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -889,11 +889,11 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
ExternalAccess: api.SyncExternalAccessSpec{
|
||||
MasterEndpoint: []string{
|
||||
"https://arangodb.xyz:8629",
|
||||
|
@ -903,7 +903,7 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
},
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1005,11 +1005,11 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
ExternalAccess: api.SyncExternalAccessSpec{
|
||||
MasterEndpoint: []string{
|
||||
"https://arangodb.xyz:8629",
|
||||
|
@ -1019,7 +1019,7 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
},
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1119,11 +1119,11 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
Environment: api.NewEnvironment(api.EnvironmentProduction),
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
ExternalAccess: api.SyncExternalAccessSpec{
|
||||
MasterEndpoint: []string{
|
||||
"https://arangodb2.xyz:8629",
|
||||
|
@ -1133,7 +1133,7 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
|
|||
},
|
||||
},
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1242,19 +1242,19 @@ func TestEnsurePod_Sync_Worker(t *testing.T) {
|
|||
},
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
Sync: api.SyncSpec{
|
||||
Enabled: util.NewBool(true),
|
||||
Enabled: util.NewType[bool](true),
|
||||
},
|
||||
SyncWorkers: api.ServerGroupSpec{
|
||||
ServiceAccountName: util.NewString(testServiceAccountName),
|
||||
ServiceAccountName: util.NewType[string](testServiceAccountName),
|
||||
NodeSelector: nodeSelectorTest,
|
||||
PriorityClassName: testPriorityClassName,
|
||||
Resources: resourcesUnfiltered,
|
||||
},
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -58,7 +58,7 @@ func TestEnsurePod_ArangoDB_TLS_SNI(t *testing.T) {
|
|||
Name: "Pod SNI Mounts",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: func() api.TLSSpec {
|
||||
s := tlsSpec.DeepCopy()
|
||||
|
@ -134,7 +134,7 @@ func TestEnsurePod_ArangoDB_TLS_SNI(t *testing.T) {
|
|||
Name: "Pod SNI Mounts - Enterprise - 3.6.0",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(createTestImageForVersion("3.6.0")),
|
||||
Image: util.NewType[string](createTestImageForVersion("3.6.0")),
|
||||
Authentication: noAuthentication,
|
||||
TLS: func() api.TLSSpec {
|
||||
s := tlsSpec.DeepCopy()
|
||||
|
@ -209,7 +209,7 @@ func TestEnsurePod_ArangoDB_TLS_SNI(t *testing.T) {
|
|||
Name: "Pod SNI Mounts - 3.7.0",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: func() api.TLSSpec {
|
||||
s := tlsSpec.DeepCopy()
|
||||
|
@ -284,7 +284,7 @@ func TestEnsurePod_ArangoDB_TLS_SNI(t *testing.T) {
|
|||
Name: "Pod SNI Mounts - Enterprise- 3.7.0",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: func() api.TLSSpec {
|
||||
s := tlsSpec.DeepCopy()
|
||||
|
@ -392,7 +392,7 @@ func TestEnsurePod_ArangoDB_TLS_SNI(t *testing.T) {
|
|||
Name: "Pod SNI Mounts - Enterprise - 3.7.0 - DBServer",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: func() api.TLSSpec {
|
||||
s := tlsSpec.DeepCopy()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -56,7 +56,7 @@ func TestEnsurePod_ArangoDB_Volumes(t *testing.T) {
|
|||
Name: "DBserver POD with Volume",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -115,7 +115,7 @@ func TestEnsurePod_ArangoDB_Volumes(t *testing.T) {
|
|||
Name: "DBserver POD with Volumes",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
@ -176,7 +176,7 @@ func TestEnsurePod_ArangoDB_Volumes(t *testing.T) {
|
|||
Name: "DBserver POD with Volume Mount",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
Authentication: noAuthentication,
|
||||
TLS: noTLS,
|
||||
DBServers: api.ServerGroupSpec{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -223,7 +223,7 @@ func runTestCase(t *testing.T, testCase testCaseStruct) {
|
|||
pods, err := d.deps.Client.Kubernetes().CoreV1().Pods(testNamespace).List(context.Background(), meta.ListOptions{})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, pods.Items, 1)
|
||||
if util.BoolOrDefault(testCase.CompareChecksum, true) {
|
||||
if util.TypeOrDefault[bool](testCase.CompareChecksum, true) {
|
||||
compareSpec(t, testCase.ExpectedPod.Spec, pods.Items[0].Spec)
|
||||
}
|
||||
require.Equal(t, testCase.ExpectedPod.Spec, pods.Items[0].Spec)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -923,7 +923,7 @@ func (testCase *testCaseStruct) createTestEnvVariables(deployment *Deployment, g
|
|||
LocalObjectReference: core.LocalObjectReference{
|
||||
Name: features.ConfigMapName(),
|
||||
},
|
||||
Optional: util.NewBool(true),
|
||||
Optional: util.NewType[bool](true),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -35,7 +35,7 @@ var metricsExporter = &feature{
|
|||
enterpriseRequired: false,
|
||||
enabledByDefault: true,
|
||||
deprecated: "It is always set to True",
|
||||
constValue: util.NewBool(true),
|
||||
constValue: util.NewType[bool](true),
|
||||
hidden: true,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -223,7 +223,7 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, cac
|
|||
if s := ib.Spec.License; s.HasSecretName() {
|
||||
if secret, ok := cachedStatus.Secret().V1().GetSimple(s.GetSecretName()); ok {
|
||||
if _, ok := secret.Data[constants.SecretKeyToken]; ok {
|
||||
license = util.NewString(s.GetSecretName())
|
||||
license = util.NewType[string](s.GetSecretName())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -68,7 +68,7 @@ func TestEnsureImages(t *testing.T) {
|
|||
Name: "Image has not been changed",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testImage),
|
||||
Image: util.NewType[string](testImage),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -76,7 +76,7 @@ func TestEnsureImages(t *testing.T) {
|
|||
Name: "Image has been changed",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testNewImage),
|
||||
Image: util.NewType[string](testNewImage),
|
||||
},
|
||||
},
|
||||
RetrySoon: true,
|
||||
|
@ -132,9 +132,9 @@ func TestEnsureImages(t *testing.T) {
|
|||
Name: "Image not been changed with license (proper one)",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testNewImage),
|
||||
Image: util.NewType[string](testNewImage),
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -179,9 +179,9 @@ func TestEnsureImages(t *testing.T) {
|
|||
Name: "Image not been changed with license (missing one)",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testNewImage),
|
||||
Image: util.NewType[string](testNewImage),
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -235,9 +235,9 @@ func TestEnsureImages(t *testing.T) {
|
|||
Name: "Image not been changed with license (missing key)",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testNewImage),
|
||||
Image: util.NewType[string](testNewImage),
|
||||
License: api.LicenseSpec{
|
||||
SecretName: util.NewString(testLicense),
|
||||
SecretName: util.NewType[string](testLicense),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -278,7 +278,7 @@ func TestEnsureImages(t *testing.T) {
|
|||
Name: "Image is being updated in failed phase",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testNewImage),
|
||||
Image: util.NewType[string](testNewImage),
|
||||
},
|
||||
},
|
||||
Before: func(t *testing.T, deployment *Deployment) {
|
||||
|
@ -305,7 +305,7 @@ func TestEnsureImages(t *testing.T) {
|
|||
Name: "Image is being updated too long in failed phase",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testNewImage),
|
||||
Image: util.NewType[string](testNewImage),
|
||||
},
|
||||
},
|
||||
Before: func(t *testing.T, deployment *Deployment) {
|
||||
|
@ -329,7 +329,7 @@ func TestEnsureImages(t *testing.T) {
|
|||
Name: "Image is being updated in not ready phase",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testNewImage),
|
||||
Image: util.NewType[string](testNewImage),
|
||||
},
|
||||
},
|
||||
RetrySoon: true,
|
||||
|
@ -358,7 +358,7 @@ func TestEnsureImages(t *testing.T) {
|
|||
Name: "Image is being updated in ready phase with empty statuses list",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testNewImage),
|
||||
Image: util.NewType[string](testNewImage),
|
||||
},
|
||||
},
|
||||
RetrySoon: true,
|
||||
|
@ -388,7 +388,7 @@ func TestEnsureImages(t *testing.T) {
|
|||
Name: "Can not get API version of arnagod",
|
||||
ArangoDeployment: &api.ArangoDeployment{
|
||||
Spec: api.DeploymentSpec{
|
||||
Image: util.NewString(testNewImage),
|
||||
Image: util.NewType[string](testNewImage),
|
||||
},
|
||||
},
|
||||
RetrySoon: true,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -81,7 +81,7 @@ func (a *actionArangoMemberUpdatePodSpec) Start(ctx context.Context) (bool, erro
|
|||
|
||||
if m.Endpoint == nil || *m.Endpoint != endpoint {
|
||||
// Update endpoint
|
||||
m.Endpoint = util.NewString(endpoint)
|
||||
m.Endpoint = util.NewType[string](endpoint)
|
||||
if err := status.Members.Update(m, a.action.Group); err != nil {
|
||||
a.log.Err(err).Error("Unable to update endpoint")
|
||||
return false, err
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -31,7 +31,7 @@ import (
|
|||
func newDisableClusterScalingAction(action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionDisableClusterScaling{}
|
||||
|
||||
a.actionImpl = newActionImpl(action, actionCtx, util.NewString(""))
|
||||
a.actionImpl = newActionImpl(action, actionCtx, util.NewType[string](""))
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -31,7 +31,7 @@ import (
|
|||
func newEnableClusterScalingAction(action api.Action, actionCtx ActionContext) Action {
|
||||
a := &actionEnableClusterScaling{}
|
||||
|
||||
a.actionImpl = newActionImpl(action, actionCtx, util.NewString(""))
|
||||
a.actionImpl = newActionImpl(action, actionCtx, util.NewType[string](""))
|
||||
|
||||
return a
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -65,7 +65,7 @@ func (a *actionTLSKeyStatusUpdate) Start(ctx context.Context) (bool, error) {
|
|||
r := false
|
||||
if len(keyHashes) == 1 {
|
||||
if s.Hashes.TLS.CA == nil || *s.Hashes.TLS.CA != keyHashes[0] {
|
||||
s.Hashes.TLS.CA = util.NewString(keyHashes[0])
|
||||
s.Hashes.TLS.CA = util.NewType[string](keyHashes[0])
|
||||
r = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -74,7 +74,7 @@ func (a *actionWaitForMemberInSync) check() (bool, error) {
|
|||
|
||||
groupSpec := spec.GetServerGroupSpec(a.action.Group)
|
||||
|
||||
if !util.BoolOrDefault(groupSpec.ExtendedRotationCheck, false) {
|
||||
if !util.TypeOrDefault[bool](groupSpec.ExtendedRotationCheck, false) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ func (r *Reconciler) isStorageClassChanged(_ context.Context, apiObject k8sutil.
|
|||
r.log.Str("role", group.AsRole()).Str("id", member.ID).Warn("Failed to get PVC")
|
||||
return false, "", fmt.Errorf("failed to get PVC %s", member.PersistentVolumeClaim.GetName())
|
||||
} else {
|
||||
pvcClassName := util.StringOrDefault(pvc.Spec.StorageClassName)
|
||||
pvcClassName := util.TypeOrDefault[string](pvc.Spec.StorageClassName)
|
||||
if pvcClassName == storageClassName {
|
||||
// A storage class has not been changed.
|
||||
return false, "", nil
|
||||
|
|
|
@ -317,7 +317,7 @@ func (s shutdownNow) CheckProgress(ctx context.Context) (bool, bool, error) {
|
|||
// Terminate pod.
|
||||
options := meta.DeleteOptions{
|
||||
// Leave one second to clean a PVC.
|
||||
GracePeriodSeconds: util.NewInt64(1),
|
||||
GracePeriodSeconds: util.NewType[int64](1),
|
||||
}
|
||||
if err := cache.Client().Kubernetes().CoreV1().Pods(cache.Namespace()).Delete(ctx, podName, options); err != nil {
|
||||
if !kerrors.IsNotFound(err) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -84,7 +84,7 @@ func (r *Reconciler) createRotateOrUpgradeDecisionMember(spec api.DeploymentSpec
|
|||
}
|
||||
|
||||
d.updateAllowed, d.updateMessage = groupReadyForRestart(context, status, element.Member, element.Group)
|
||||
d.unsafeUpdateAllowed = util.BoolOrDefault(spec.AllowUnsafeUpgrade, false)
|
||||
d.unsafeUpdateAllowed = util.TypeOrDefault[bool](spec.AllowUnsafeUpgrade, false)
|
||||
|
||||
if rotation.CheckPossible(element.Member) {
|
||||
if element.Member.Conditions.IsTrue(api.ConditionTypeRestart) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -55,7 +55,7 @@ func Test_RotateUpgrade_Condition(t *testing.T) {
|
|||
|
||||
newSpec := func(image string, mode api.DeploymentImageDiscoveryModeSpec) api.DeploymentSpec {
|
||||
return api.DeploymentSpec{
|
||||
Image: util.NewString(image),
|
||||
Image: util.NewType[string](image),
|
||||
ImageDiscoveryMode: api.NewDeploymentImageDiscoveryModeSpec(mode),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -457,12 +457,12 @@ func TestCreatePlanSingleScale(t *testing.T) {
|
|||
assert.True(t, changed)
|
||||
assert.Len(t, newPlan, 0) // Single mode does not scale
|
||||
|
||||
spec.Single.Count = util.NewInt(2)
|
||||
spec.Single.Count = util.NewType[int](2)
|
||||
newPlan, _, changed = r.createNormalPlan(ctx, depl, nil, spec, status, c)
|
||||
assert.True(t, changed)
|
||||
assert.Len(t, newPlan, 0) // Single mode does not scale
|
||||
|
||||
spec.Single.Count = util.NewInt(1)
|
||||
spec.Single.Count = util.NewType[int](1)
|
||||
// Test with 2 single members (which should not happen) and try to scale down
|
||||
status.Members.Single = api.MemberStatusList{
|
||||
api.MemberStatus{
|
||||
|
@ -494,7 +494,7 @@ func TestCreatePlanActiveFailoverScale(t *testing.T) {
|
|||
Mode: api.NewMode(api.DeploymentModeActiveFailover),
|
||||
}
|
||||
spec.SetDefaults("test")
|
||||
spec.Single.Count = util.NewInt(2)
|
||||
spec.Single.Count = util.NewType[int](2)
|
||||
depl := &api.ArangoDeployment{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "test_depl",
|
||||
|
@ -673,8 +673,8 @@ func TestCreatePlanClusterScale(t *testing.T) {
|
|||
},
|
||||
},
|
||||
}
|
||||
spec.DBServers.Count = util.NewInt(1)
|
||||
spec.Coordinators.Count = util.NewInt(1)
|
||||
spec.DBServers.Count = util.NewType[int](1)
|
||||
spec.Coordinators.Count = util.NewType[int](1)
|
||||
newPlan, _, changed = r.createNormalPlan(ctx, depl, nil, spec, status, c)
|
||||
assert.True(t, changed)
|
||||
require.Len(t, newPlan, 7) // Note: Downscaling is done 1 at a time
|
||||
|
@ -774,7 +774,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
Spec: api.DeploymentSpec{
|
||||
Mode: api.NewMode(api.DeploymentModeCluster),
|
||||
TLS: api.TLSSpec{
|
||||
CASecretName: util.NewString(api.CASecretNameDisabled),
|
||||
CASecretName: util.NewType[string](api.CASecretNameDisabled),
|
||||
},
|
||||
},
|
||||
Status: api.DeploymentStatus{
|
||||
|
@ -825,7 +825,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
PVCS: map[string]*core.PersistentVolumeClaim{
|
||||
pvcName: {
|
||||
Spec: core.PersistentVolumeClaimSpec{
|
||||
StorageClassName: util.NewString("oldStorage"),
|
||||
StorageClassName: util.NewType[string]("oldStorage"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -838,10 +838,10 @@ func TestCreatePlan(t *testing.T) {
|
|||
},
|
||||
Helper: func(ad *api.ArangoDeployment) {
|
||||
ad.Spec.DBServers = api.ServerGroupSpec{
|
||||
Count: util.NewInt(3),
|
||||
Count: util.NewType[int](3),
|
||||
VolumeClaimTemplate: &core.PersistentVolumeClaim{
|
||||
Spec: core.PersistentVolumeClaimSpec{
|
||||
StorageClassName: util.NewString("newStorage"),
|
||||
StorageClassName: util.NewType[string]("newStorage"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -878,7 +878,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
PVCS: map[string]*core.PersistentVolumeClaim{
|
||||
pvcName: {
|
||||
Spec: core.PersistentVolumeClaimSpec{
|
||||
StorageClassName: util.NewString("oldStorage"),
|
||||
StorageClassName: util.NewType[string]("oldStorage"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -888,10 +888,10 @@ func TestCreatePlan(t *testing.T) {
|
|||
},
|
||||
Helper: func(ad *api.ArangoDeployment) {
|
||||
ad.Spec.DBServers = api.ServerGroupSpec{
|
||||
Count: util.NewInt(3),
|
||||
Count: util.NewType[int](3),
|
||||
VolumeClaimTemplate: &core.PersistentVolumeClaim{
|
||||
Spec: core.PersistentVolumeClaimSpec{
|
||||
StorageClassName: util.NewString("newStorage"),
|
||||
StorageClassName: util.NewType[string]("newStorage"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -912,7 +912,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
PVCS: map[string]*core.PersistentVolumeClaim{
|
||||
pvcName: {
|
||||
Spec: core.PersistentVolumeClaimSpec{
|
||||
StorageClassName: util.NewString(""),
|
||||
StorageClassName: util.NewType[string](""),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -922,8 +922,8 @@ func TestCreatePlan(t *testing.T) {
|
|||
},
|
||||
Helper: func(ad *api.ArangoDeployment) {
|
||||
ad.Spec.Agents = api.ServerGroupSpec{
|
||||
Count: util.NewInt(2),
|
||||
StorageClassName: util.NewString("newStorage"),
|
||||
Count: util.NewType[int](2),
|
||||
StorageClassName: util.NewType[string]("newStorage"),
|
||||
}
|
||||
ad.Status.Members.Agents[0].Phase = api.MemberPhaseCreated
|
||||
ad.Status.Members.Agents[0].PersistentVolumeClaim = &api.MemberPersistentVolumeClaimStatus{
|
||||
|
@ -951,7 +951,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
PVCS: map[string]*core.PersistentVolumeClaim{
|
||||
pvcName: {
|
||||
Spec: core.PersistentVolumeClaimSpec{
|
||||
StorageClassName: util.NewString("oldStorage"),
|
||||
StorageClassName: util.NewType[string]("oldStorage"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -961,10 +961,10 @@ func TestCreatePlan(t *testing.T) {
|
|||
},
|
||||
Helper: func(ad *api.ArangoDeployment) {
|
||||
ad.Spec.Coordinators = api.ServerGroupSpec{
|
||||
Count: util.NewInt(3),
|
||||
Count: util.NewType[int](3),
|
||||
VolumeClaimTemplate: &core.PersistentVolumeClaim{
|
||||
Spec: core.PersistentVolumeClaimSpec{
|
||||
StorageClassName: util.NewString("newStorage"),
|
||||
StorageClassName: util.NewType[string]("newStorage"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -994,7 +994,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
PVCS: map[string]*core.PersistentVolumeClaim{
|
||||
"pvc_test": {
|
||||
Spec: core.PersistentVolumeClaimSpec{
|
||||
StorageClassName: util.NewString("oldStorage"),
|
||||
StorageClassName: util.NewType[string]("oldStorage"),
|
||||
},
|
||||
Status: core.PersistentVolumeClaimStatus{
|
||||
Conditions: []core.PersistentVolumeClaimCondition{
|
||||
|
@ -1055,10 +1055,10 @@ func TestCreatePlan(t *testing.T) {
|
|||
},
|
||||
Helper: func(ad *api.ArangoDeployment) {
|
||||
ad.Spec.Agents = api.ServerGroupSpec{
|
||||
Count: util.NewInt(2),
|
||||
Count: util.NewType[int](2),
|
||||
VolumeClaimTemplate: &core.PersistentVolumeClaim{
|
||||
Spec: core.PersistentVolumeClaimSpec{
|
||||
StorageClassName: util.NewString("oldStorage"),
|
||||
StorageClassName: util.NewType[string]("oldStorage"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
},
|
||||
Helper: func(ad *api.ArangoDeployment) {
|
||||
ad.Spec.Agents = api.ServerGroupSpec{
|
||||
Count: util.NewInt(2),
|
||||
Count: util.NewType[int](2),
|
||||
}
|
||||
ad.Status.Members.Agents[0].Phase = api.MemberPhaseFailed
|
||||
ad.Status.Members.Agents[0].ID = "id"
|
||||
|
@ -1102,7 +1102,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
},
|
||||
Helper: func(ad *api.ArangoDeployment) {
|
||||
ad.Spec.Coordinators = api.ServerGroupSpec{
|
||||
Count: util.NewInt(2),
|
||||
Count: util.NewType[int](2),
|
||||
}
|
||||
ad.Status.Members.Coordinators[0].Phase = api.MemberPhaseFailed
|
||||
ad.Status.Members.Coordinators[0].ID = "id"
|
||||
|
@ -1122,7 +1122,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
},
|
||||
Helper: func(ad *api.ArangoDeployment) {
|
||||
ad.Spec.DBServers = api.ServerGroupSpec{
|
||||
Count: util.NewInt(3),
|
||||
Count: util.NewType[int](3),
|
||||
}
|
||||
ad.Status.Members.DBServers[0].Phase = api.MemberPhaseFailed
|
||||
ad.Status.Members.DBServers[0].ID = "id"
|
||||
|
@ -1142,7 +1142,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
},
|
||||
Helper: func(ad *api.ArangoDeployment) {
|
||||
ad.Spec.DBServers = api.ServerGroupSpec{
|
||||
Count: util.NewInt(2),
|
||||
Count: util.NewType[int](2),
|
||||
}
|
||||
ad.Status.Members.DBServers[2].Phase = api.MemberPhaseFailed
|
||||
ad.Status.Members.DBServers[2].ID = "id3"
|
||||
|
@ -1162,7 +1162,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
},
|
||||
Helper: func(ad *api.ArangoDeployment) {
|
||||
ad.Spec.DBServers = api.ServerGroupSpec{
|
||||
Count: util.NewInt(3),
|
||||
Count: util.NewType[int](3),
|
||||
}
|
||||
ad.Status.Members.DBServers[0].Phase = api.MemberPhaseCreated
|
||||
ad.Status.Members.DBServers[0].Conditions = api.ConditionList{
|
||||
|
@ -1187,7 +1187,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
},
|
||||
Helper: func(ad *api.ArangoDeployment) {
|
||||
ad.Spec.DBServers = api.ServerGroupSpec{
|
||||
Count: util.NewInt(2),
|
||||
Count: util.NewType[int](2),
|
||||
}
|
||||
ad.Status.Members.DBServers[2].ID = "id3"
|
||||
ad.Status.Members.DBServers[2].Phase = api.MemberPhaseCreated
|
||||
|
@ -1213,7 +1213,7 @@ func TestCreatePlan(t *testing.T) {
|
|||
},
|
||||
Helper: func(ad *api.ArangoDeployment) {
|
||||
ad.Spec.DBServers = api.ServerGroupSpec{
|
||||
Count: util.NewInt(2),
|
||||
Count: util.NewType[int](2),
|
||||
}
|
||||
ad.Status.Members.DBServers[0].Phase = api.MemberPhaseCreated
|
||||
},
|
||||
|
|
|
@ -175,7 +175,7 @@ func testModClientMetrics[S meta.Object](t *testing.T, definition definitions.Co
|
|||
|
||||
t.Run("ForceDelete", func(t *testing.T) {
|
||||
err := in.Delete(context.Background(), obj.GetName(), meta.DeleteOptions{
|
||||
GracePeriodSeconds: util.NewInt64(0),
|
||||
GracePeriodSeconds: util.NewType[int64](0),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -186,7 +186,7 @@ func testModClientMetrics[S meta.Object](t *testing.T, definition definitions.Co
|
|||
|
||||
t.Run("ForceDelete - missing", func(t *testing.T) {
|
||||
err := in.Delete(context.Background(), obj.GetName(), meta.DeleteOptions{
|
||||
GracePeriodSeconds: util.NewInt64(0),
|
||||
GracePeriodSeconds: util.NewType[int64](0),
|
||||
})
|
||||
require.Error(t, err)
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ func createArangodArgs(cachedStatus interfaces.Inspector, input pod.Input, addit
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
endpoint = util.StringOrDefault(input.Member.Endpoint, endpoint)
|
||||
endpoint = util.TypeOrDefault[string](input.Member.Endpoint, endpoint)
|
||||
|
||||
myTCPURL := scheme + "://" + net.JoinHostPort(endpoint, strconv.Itoa(shared.ArangoPort))
|
||||
addAgentEndpoints := false
|
||||
|
@ -128,7 +128,7 @@ func createArangodArgs(cachedStatus interfaces.Inspector, input pod.Input, addit
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
options.Addf("--agency.endpoint", "%s://%s", scheme, net.JoinHostPort(util.StringOrDefault(p.Endpoint, dnsName), strconv.Itoa(shared.ArangoPort)))
|
||||
options.Addf("--agency.endpoint", "%s://%s", scheme, net.JoinHostPort(util.TypeOrDefault[string](p.Endpoint, dnsName), strconv.Itoa(shared.ArangoPort)))
|
||||
}
|
||||
}
|
||||
case api.ServerGroupDBServers:
|
||||
|
@ -172,7 +172,7 @@ func createArangodArgs(cachedStatus interfaces.Inspector, input pod.Input, addit
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
options.Addf("--cluster.agency-endpoint", "%s://%s", scheme, net.JoinHostPort(util.StringOrDefault(p.Endpoint, dnsName), strconv.Itoa(shared.ArangoPort)))
|
||||
options.Addf("--cluster.agency-endpoint", "%s://%s", scheme, net.JoinHostPort(util.TypeOrDefault[string](p.Endpoint, dnsName), strconv.Itoa(shared.ArangoPort)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -202,7 +202,7 @@ func TestCreateArangodArgsAgent(t *testing.T) {
|
|||
Spec: api.DeploymentSpec{
|
||||
Mode: api.NewMode(api.DeploymentModeCluster),
|
||||
TLS: api.TLSSpec{
|
||||
CASecretName: util.NewString("None"),
|
||||
CASecretName: util.NewType[string]("None"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ func TestCreateArangodArgsAgent(t *testing.T) {
|
|||
},
|
||||
}
|
||||
apiObject.Spec.SetDefaults("test")
|
||||
apiObject.Spec.Authentication.JWTSecretName = util.NewString("None")
|
||||
apiObject.Spec.Authentication.JWTSecretName = util.NewType[string]("None")
|
||||
apiObject.Spec.StorageEngine = api.NewStorageEngine(api.StorageEngineMMFiles)
|
||||
agents := api.MemberStatusList{
|
||||
api.MemberStatus{ID: "a1"},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -173,7 +173,7 @@ func (a *ArangoDContainer) GetImage() string {
|
|||
switch a.spec.ImageDiscoveryMode.Get() {
|
||||
case api.DeploymentImageDiscoveryDirectMode:
|
||||
// In case of direct mode ignore discovery
|
||||
return util.StringOrDefault(a.spec.Image, a.imageInfo.ImageID)
|
||||
return util.TypeOrDefault[string](a.spec.Image, a.imageInfo.ImageID)
|
||||
default:
|
||||
return a.imageInfo.ImageID
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ func (a *ArangoDContainer) GetEnvs() ([]core.EnvVar, []core.EnvFromSource) {
|
|||
Name: features.ConfigMapName(),
|
||||
},
|
||||
// Optional in case if operator could not create it when process started.
|
||||
Optional: util.NewBool(true),
|
||||
Optional: util.NewType[bool](true),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -229,7 +229,7 @@ func TestCreateArangodArgsCoordinator(t *testing.T) {
|
|||
Spec: api.DeploymentSpec{
|
||||
Mode: api.NewMode(api.DeploymentModeCluster),
|
||||
TLS: api.TLSSpec{
|
||||
CASecretName: util.NewString("None"),
|
||||
CASecretName: util.NewType[string]("None"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ func TestCreateArangodArgsCoordinator(t *testing.T) {
|
|||
},
|
||||
}
|
||||
apiObject.Spec.SetDefaults("test")
|
||||
apiObject.Spec.Authentication.JWTSecretName = util.NewString("None")
|
||||
apiObject.Spec.Authentication.JWTSecretName = util.NewType[string]("None")
|
||||
agents := api.MemberStatusList{
|
||||
api.MemberStatus{ID: "a1"},
|
||||
api.MemberStatus{ID: "a2"},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -168,7 +168,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
|
|||
},
|
||||
Spec: api.DeploymentSpec{
|
||||
Mode: api.NewMode(api.DeploymentModeCluster),
|
||||
ClusterDomain: util.NewString("cluster.local"),
|
||||
ClusterDomain: util.NewType[string]("cluster.local"),
|
||||
},
|
||||
}
|
||||
apiObject.Spec.SetDefaults("test")
|
||||
|
@ -230,7 +230,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
|
|||
Spec: api.DeploymentSpec{
|
||||
Mode: api.NewMode(api.DeploymentModeCluster),
|
||||
TLS: api.TLSSpec{
|
||||
CASecretName: util.NewString("None"),
|
||||
CASecretName: util.NewType[string]("None"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
|
|||
},
|
||||
}
|
||||
apiObject.Spec.SetDefaults("test")
|
||||
apiObject.Spec.Authentication.JWTSecretName = util.NewString("None")
|
||||
apiObject.Spec.Authentication.JWTSecretName = util.NewType[string]("None")
|
||||
agents := api.MemberStatusList{
|
||||
api.MemberStatus{ID: "a1"},
|
||||
api.MemberStatus{ID: "a2"},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -350,8 +350,8 @@ func (r *Resources) probeBuilderReadinessSimpleCoreOperator(spec api.DeploymentS
|
|||
}
|
||||
|
||||
p.SetSpec(&api.ServerGroupProbeSpec{
|
||||
InitialDelaySeconds: util.NewInt32(15),
|
||||
PeriodSeconds: util.NewInt32(10),
|
||||
InitialDelaySeconds: util.NewType[int32](15),
|
||||
PeriodSeconds: util.NewType[int32](10),
|
||||
})
|
||||
|
||||
return p, nil
|
||||
|
@ -369,8 +369,8 @@ func (r *Resources) probeBuilderReadinessSimpleCore(spec api.DeploymentSpec, gro
|
|||
}
|
||||
|
||||
p.SetSpec(&api.ServerGroupProbeSpec{
|
||||
InitialDelaySeconds: util.NewInt32(15),
|
||||
PeriodSeconds: util.NewInt32(10),
|
||||
InitialDelaySeconds: util.NewType[int32](15),
|
||||
PeriodSeconds: util.NewType[int32](10),
|
||||
})
|
||||
|
||||
return p, nil
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -133,7 +133,7 @@ func TestCreateArangodArgsSingle(t *testing.T) {
|
|||
Spec: api.DeploymentSpec{
|
||||
Mode: api.NewMode(api.DeploymentModeSingle),
|
||||
TLS: api.TLSSpec{
|
||||
CASecretName: util.NewString("None"),
|
||||
CASecretName: util.NewType[string]("None"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ func TestCreateArangodArgsSingle(t *testing.T) {
|
|||
Mode: api.NewMode(api.DeploymentModeSingle),
|
||||
},
|
||||
}
|
||||
apiObject.Spec.Authentication.JWTSecretName = util.NewString("None")
|
||||
apiObject.Spec.Authentication.JWTSecretName = util.NewType[string]("None")
|
||||
apiObject.Spec.SetDefaults("test")
|
||||
input := pod.Input{
|
||||
ApiObject: apiObject,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -102,7 +102,7 @@ func (r *Resources) runPodFinalizers(ctx context.Context, p *core.Pod, memberSta
|
|||
groupSpec := r.context.GetSpec().GetServerGroupSpec(group)
|
||||
if t := p.ObjectMeta.DeletionTimestamp; t != nil {
|
||||
d := time.Duration(groupSpec.GetShutdownDelay(group)) * time.Second
|
||||
gr := time.Duration(util.Int64OrDefault(p.ObjectMeta.GetDeletionGracePeriodSeconds(), 0)) * time.Second
|
||||
gr := time.Duration(util.TypeOrDefault[int64](p.ObjectMeta.GetDeletionGracePeriodSeconds(), 0)) * time.Second
|
||||
e := t.Time.Add(-1 * gr).Sub(time.Now().Add(-1 * d))
|
||||
log.Str("finalizer", f).Str("left", e.String()).Error("Delay finalizer status")
|
||||
if e < 0 || d == 0 {
|
||||
|
|
|
@ -437,7 +437,7 @@ func (r *Resources) InspectPods(ctx context.Context, cachedStatus inspectorInter
|
|||
defer c()
|
||||
|
||||
if err := cachedStatus.PodsModInterface().V1().Delete(nctx, pod.GetName(), meta.DeleteOptions{
|
||||
GracePeriodSeconds: util.NewInt64(gps),
|
||||
GracePeriodSeconds: util.NewType[int64](gps),
|
||||
Preconditions: meta.NewUIDPreconditions(string(pod.GetUID())),
|
||||
}); err != nil {
|
||||
if kerrors.IsNotFound(err) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -83,7 +83,7 @@ func Test_ArangoD_TerminationGracePeriodSeconds(t *testing.T) {
|
|||
pod.Spec.TerminationGracePeriodSeconds = nil
|
||||
}),
|
||||
status: buildPodSpec(func(pod *core.PodTemplateSpec) {
|
||||
pod.Spec.TerminationGracePeriodSeconds = util.NewInt64(30)
|
||||
pod.Spec.TerminationGracePeriodSeconds = util.NewType[int64](30)
|
||||
}),
|
||||
|
||||
TestCaseOverride: TestCaseOverride{
|
||||
|
@ -93,7 +93,7 @@ func Test_ArangoD_TerminationGracePeriodSeconds(t *testing.T) {
|
|||
{
|
||||
name: "Remove",
|
||||
spec: buildPodSpec(func(pod *core.PodTemplateSpec) {
|
||||
pod.Spec.TerminationGracePeriodSeconds = util.NewInt64(30)
|
||||
pod.Spec.TerminationGracePeriodSeconds = util.NewType[int64](30)
|
||||
}),
|
||||
status: buildPodSpec(func(pod *core.PodTemplateSpec) {
|
||||
pod.Spec.TerminationGracePeriodSeconds = nil
|
||||
|
@ -106,10 +106,10 @@ func Test_ArangoD_TerminationGracePeriodSeconds(t *testing.T) {
|
|||
{
|
||||
name: "Update",
|
||||
spec: buildPodSpec(func(pod *core.PodTemplateSpec) {
|
||||
pod.Spec.TerminationGracePeriodSeconds = util.NewInt64(33)
|
||||
pod.Spec.TerminationGracePeriodSeconds = util.NewType[int64](33)
|
||||
}),
|
||||
status: buildPodSpec(func(pod *core.PodTemplateSpec) {
|
||||
pod.Spec.TerminationGracePeriodSeconds = util.NewInt64(30)
|
||||
pod.Spec.TerminationGracePeriodSeconds = util.NewType[int64](30)
|
||||
}),
|
||||
|
||||
TestCaseOverride: TestCaseOverride{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -180,7 +180,7 @@ func (h *handler) refreshDeploymentBackup(deployment *database.ArangoDeployment,
|
|||
status := updateStatus(backup,
|
||||
updateStatusState(backupApi.ArangoBackupStateReady, ""),
|
||||
updateStatusBackup(backupMeta),
|
||||
updateStatusBackupImported(util.NewBool(true)))
|
||||
updateStatusBackupImported(util.NewType[bool](true)))
|
||||
|
||||
backup.Status = *status
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ func Test_State_Create_SuccessForced(t *testing.T) {
|
|||
|
||||
obj, deployment := newObjectSet(backupApi.ArangoBackupStateCreate)
|
||||
obj.Spec.Options = &backupApi.ArangoBackupSpecOptions{
|
||||
AllowInconsistent: util.NewBool(true),
|
||||
AllowInconsistent: util.NewType[bool](true),
|
||||
}
|
||||
|
||||
// Act
|
||||
|
@ -194,8 +194,8 @@ func Test_State_CreateError_Transfer_To_Failed(t *testing.T) {
|
|||
}
|
||||
|
||||
obj.Spec.Backoff = &backupApi.ArangoBackupSpecBackOff{
|
||||
Iterations: util.NewInt(1),
|
||||
MaxIterations: util.NewInt(2),
|
||||
Iterations: util.NewType[int](1),
|
||||
MaxIterations: util.NewType[int](2),
|
||||
}
|
||||
|
||||
obj.Status.Time.Time = time.Now().Add(-2 * downloadDelay)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -91,7 +91,7 @@ func stateDownloadingHandler(h *handler, backup *backupApi.ArangoBackup) (*backu
|
|||
updateStatusState(backupApi.ArangoBackupStateReady, ""),
|
||||
updateStatusAvailable(true),
|
||||
updateStatusBackup(backupMeta),
|
||||
updateStatusBackupDownload(util.NewBool(true)),
|
||||
updateStatusBackupDownload(util.NewType[bool](true)),
|
||||
cleanStatusJob(),
|
||||
)
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue