Skip to content

Commit 1321cee

Browse files
authored
[Feature] [1.0] Fix chaos monkey (#643)
1 parent 6318b7e commit 1321cee

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Change Log
22

33
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
4+
- Fix Panics in Deployments without authentication
5+
- Fix ChaosMonkey mode
46

57
## [1.0.8](https://github.com/arangodb/kube-arangodb/tree/1.0.8) (2020-09-10)
68
- Fix Volume rotation on AKS

pkg/deployment/context_impl.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,3 +570,22 @@ func (d *Deployment) SecretsInterface() k8sutil.SecretInterface {
570570
func (d *Deployment) GetName() string {
571571
return d.apiObject.GetName()
572572
}
573+
574+
func (d *Deployment) GetOwnedPods() ([]v1.Pod, error) {
575+
pods, err := d.GetKubeCli().CoreV1().Pods(d.apiObject.GetNamespace()).List(meta.ListOptions{})
576+
if err != nil {
577+
return nil, err
578+
}
579+
580+
podList := make([]v1.Pod, 0, len(pods.Items))
581+
582+
for _, p := range pods.Items {
583+
if !d.isOwnerOf(&p) {
584+
continue
585+
}
586+
c := p.DeepCopy()
587+
podList = append(podList, *c)
588+
}
589+
590+
return podList, nil
591+
}

pkg/deployment/deployment.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ func New(config Config, deps Dependencies, apiObject *api.ArangoDeployment) (*De
164164
go d.resources.RunDeploymentHealthLoop(d.stopCh)
165165
go d.resources.RunDeploymentShardSyncLoop(d.stopCh)
166166
}
167-
//if config.AllowChaos {
168-
// d.chaosMonkey = chaos.NewMonkey(deps.Log, d)
169-
// go d.chaosMonkey.Run(d.stopCh)
170-
//}
167+
if config.AllowChaos {
168+
d.chaosMonkey = chaos.NewMonkey(deps.Log, d)
169+
go d.chaosMonkey.Run(d.stopCh)
170+
}
171171

172172
return d, nil
173173
}

0 commit comments

Comments
 (0)