mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Bugfix] Allow to remove resources (CPU & Memory) on the managed pods (#1034)
This commit is contained in:
parent
54de5c6242
commit
0593626a1c
7 changed files with 23 additions and 18 deletions
|
@ -26,6 +26,7 @@
|
|||
- (Bugfix) Ensure Wait actions to be present after AddMember
|
||||
- (Documentation) Refactor metrics (Part 1)
|
||||
- (Bugfix) Extend Agency HealthCheck for replace
|
||||
- (Bugfix) Allow to remove resources (CPU & Memory) on the managed pods
|
||||
|
||||
## [1.2.13](https://github.com/arangodb/kube-arangodb/tree/1.2.13) (2022-06-07)
|
||||
- (Bugfix) Fix arangosync members state inspection
|
||||
|
|
|
@ -148,8 +148,8 @@ func (s *MetricsSpec) SetDefaultsFrom(source MetricsSpec) {
|
|||
if s.Authentication.JWTTokenSecretName == nil {
|
||||
s.Authentication.JWTTokenSecretName = util.NewStringOrNil(source.Authentication.JWTTokenSecretName)
|
||||
}
|
||||
setDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
}
|
||||
|
||||
// Validate the given spec
|
||||
|
|
|
@ -30,6 +30,6 @@ type LifecycleSpec struct {
|
|||
|
||||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *LifecycleSpec) SetDefaultsFrom(source LifecycleSpec) {
|
||||
setDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
}
|
||||
|
|
|
@ -620,14 +620,16 @@ func (s *ServerGroupSpec) SetDefaults(group ServerGroup, used bool, mode Deploym
|
|||
}
|
||||
}
|
||||
|
||||
// setDefaultsFromResourceList fills unspecified fields with a value from given source spec.
|
||||
func setDefaultsFromResourceList(s *core.ResourceList, source core.ResourceList) {
|
||||
// setStorageDefaultsFromResourceList fills unspecified storage-type fields with a value from given source spec.
|
||||
func setStorageDefaultsFromResourceList(s *core.ResourceList, source core.ResourceList) {
|
||||
for k, v := range source {
|
||||
if *s == nil {
|
||||
*s = make(core.ResourceList)
|
||||
}
|
||||
if _, found := (*s)[k]; !found {
|
||||
(*s)[k] = v
|
||||
if k != core.ResourceCPU && k != core.ResourceMemory {
|
||||
(*s)[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -658,8 +660,8 @@ func (s *ServerGroupSpec) SetDefaultsFrom(source ServerGroupSpec) {
|
|||
if s.NodeSelector == nil {
|
||||
s.NodeSelector = source.NodeSelector
|
||||
}
|
||||
setDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
if s.VolumeClaimTemplate == nil {
|
||||
s.VolumeClaimTemplate = source.VolumeClaimTemplate.DeepCopy()
|
||||
}
|
||||
|
|
|
@ -148,8 +148,8 @@ func (s *MetricsSpec) SetDefaultsFrom(source MetricsSpec) {
|
|||
if s.Authentication.JWTTokenSecretName == nil {
|
||||
s.Authentication.JWTTokenSecretName = util.NewStringOrNil(source.Authentication.JWTTokenSecretName)
|
||||
}
|
||||
setDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
}
|
||||
|
||||
// Validate the given spec
|
||||
|
|
|
@ -30,6 +30,6 @@ type LifecycleSpec struct {
|
|||
|
||||
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
|
||||
func (s *LifecycleSpec) SetDefaultsFrom(source LifecycleSpec) {
|
||||
setDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
}
|
||||
|
|
|
@ -620,14 +620,16 @@ func (s *ServerGroupSpec) SetDefaults(group ServerGroup, used bool, mode Deploym
|
|||
}
|
||||
}
|
||||
|
||||
// setDefaultsFromResourceList fills unspecified fields with a value from given source spec.
|
||||
func setDefaultsFromResourceList(s *core.ResourceList, source core.ResourceList) {
|
||||
// setStorageDefaultsFromResourceList fills unspecified storage-type fields with a value from given source spec.
|
||||
func setStorageDefaultsFromResourceList(s *core.ResourceList, source core.ResourceList) {
|
||||
for k, v := range source {
|
||||
if *s == nil {
|
||||
*s = make(core.ResourceList)
|
||||
}
|
||||
if _, found := (*s)[k]; !found {
|
||||
(*s)[k] = v
|
||||
if k != core.ResourceCPU && k != core.ResourceMemory {
|
||||
(*s)[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -658,8 +660,8 @@ func (s *ServerGroupSpec) SetDefaultsFrom(source ServerGroupSpec) {
|
|||
if s.NodeSelector == nil {
|
||||
s.NodeSelector = source.NodeSelector
|
||||
}
|
||||
setDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Limits, source.Resources.Limits)
|
||||
setStorageDefaultsFromResourceList(&s.Resources.Requests, source.Resources.Requests)
|
||||
if s.VolumeClaimTemplate == nil {
|
||||
s.VolumeClaimTemplate = source.VolumeClaimTemplate.DeepCopy()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue