1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

[Feature] Optional Flag propagation (#837)

This commit is contained in:
Adam Janikowski 2021-11-17 00:13:38 +01:00 committed by GitHub
parent f346963496
commit 0d814a796e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 41 additions and 9 deletions

View file

@ -34,6 +34,10 @@ func (m *MetricsServiceMonitorSpec) IsEnabled() bool {
}
func (m *MetricsServiceMonitorSpec) GetLabels(def map[string]string) map[string]string {
if m == nil {
return def
}
if len(m.Labels) == 0 {
return def
}

View file

@ -251,9 +251,9 @@ func (s DeploymentSpec) IsDisableIPv6() bool {
return util.BoolOrDefault(s.DisableIPv6)
}
// IsNetworkAttachedVolumes returns the value of networkAttachedVolumes, default false
// IsNetworkAttachedVolumes returns the value of networkAttachedVolumes, default true
func (s DeploymentSpec) IsNetworkAttachedVolumes() bool {
return util.BoolOrDefault(s.NetworkAttachedVolumes, false)
return util.BoolOrDefault(s.NetworkAttachedVolumes, true)
}
// GetListenAddr returns "[::]" or "0.0.0.0" depending on IsDisableIPv6

View file

@ -1571,6 +1571,16 @@ func (in *ServerGroupProbesSpec) DeepCopyInto(out *ServerGroupProbesSpec) {
*out = new(ServerGroupProbeSpec)
(*in).DeepCopyInto(*out)
}
if in.StartupProbeDisabled != nil {
in, out := &in.StartupProbeDisabled, &out.StartupProbeDisabled
*out = new(bool)
**out = **in
}
if in.StartupProbeSpec != nil {
in, out := &in.StartupProbeSpec, &out.StartupProbeSpec
*out = new(ServerGroupProbeSpec)
(*in).DeepCopyInto(*out)
}
return
}

View file

@ -34,6 +34,10 @@ func (m *MetricsServiceMonitorSpec) IsEnabled() bool {
}
func (m *MetricsServiceMonitorSpec) GetLabels(def map[string]string) map[string]string {
if m == nil {
return def
}
if len(m.Labels) == 0 {
return def
}

View file

@ -251,9 +251,9 @@ func (s DeploymentSpec) IsDisableIPv6() bool {
return util.BoolOrDefault(s.DisableIPv6)
}
// IsNetworkAttachedVolumes returns the value of networkAttachedVolumes, default false
// IsNetworkAttachedVolumes returns the value of networkAttachedVolumes, default true
func (s DeploymentSpec) IsNetworkAttachedVolumes() bool {
return util.BoolOrDefault(s.NetworkAttachedVolumes, false)
return util.BoolOrDefault(s.NetworkAttachedVolumes, true)
}
// GetListenAddr returns "[::]" or "0.0.0.0" depending on IsDisableIPv6

View file

@ -261,6 +261,11 @@ type ServerGroupProbesSpec struct {
ReadinessProbeDisabled *bool `json:"readinessProbeDisabled,omitempty"`
// ReadinessProbeSpec override readiness probe configuration
ReadinessProbeSpec *ServerGroupProbeSpec `json:"readinessProbeSpec,omitempty"`
// StartupProbeDisabled if true startupProbes are disabled
StartupProbeDisabled *bool `json:"startupProbeDisabled,omitempty"`
// StartupProbeSpec override startup probe configuration
StartupProbeSpec *ServerGroupProbeSpec `json:"startupProbeSpec,omitempty"`
}
// GetReadinessProbeDisabled returns in proper manner readiness probe flag with backward compatibility.

View file

@ -1571,6 +1571,16 @@ func (in *ServerGroupProbesSpec) DeepCopyInto(out *ServerGroupProbesSpec) {
*out = new(ServerGroupProbeSpec)
(*in).DeepCopyInto(*out)
}
if in.StartupProbeDisabled != nil {
in, out := &in.StartupProbeDisabled, &out.StartupProbeDisabled
*out = new(bool)
**out = **in
}
if in.StartupProbeSpec != nil {
in, out := &in.StartupProbeSpec, &out.StartupProbeSpec
*out = new(ServerGroupProbeSpec)
(*in).DeepCopyInto(*out)
}
return
}

View file

@ -62,9 +62,8 @@ func containersCompare(_ api.DeploymentSpec, _ api.ServerGroup, spec, status *co
if !equality.Semantic.DeepEqual(ac.Env, bc.Env) {
if areEnvsEqual(ac.Env, bc.Env, func(a, b map[string]core.EnvVar) (map[string]core.EnvVar, map[string]core.EnvVar) {
if _, ok := a[topology.ArangoDBZone]; !ok {
delete(b, topology.ArangoDBZone)
}
delete(a, topology.ArangoDBZone)
delete(b, topology.ArangoDBZone)
return a, b
}) {

View file

@ -270,7 +270,7 @@ func Test_ArangoD_Envs_Zone(t *testing.T) {
c.Env = []core.EnvVar{}
})),
expectedMode: GracefulRotation,
expectedMode: SilentRotation,
},
{
name: "Update Zone env",
@ -293,7 +293,7 @@ func Test_ArangoD_Envs_Zone(t *testing.T) {
}
})),
expectedMode: GracefulRotation,
expectedMode: SilentRotation,
},
{
name: "Update other env",