Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter by OwnerReference's Kind #224

Merged
merged 3 commits into from
Sep 10, 2020
Merged

Filter by OwnerReference's Kind #224

merged 3 commits into from
Sep 10, 2020

Conversation

qlikcoe
Copy link

@qlikcoe qlikcoe commented Jun 5, 2020

This PR adds new flag --kinds.
It allows us to include/exclude specific Kinds of pods or, to be more specific, filter by OwnerReference's Kind.

So, for example, you can exclude any pods created by any DaemonSet by using the following flag:

--kinds="!DaemonSet"

@qlikcoe qlikcoe changed the title [WIP] Filter by OwnerReference's Kind Filter by OwnerReference's Kind Jun 6, 2020
@qlikcoe
Copy link
Author

qlikcoe commented Jun 8, 2020

Testing in my local cluster:

Configuration:

          args:
            - --interval=1m
            - --labels=
            - --annotations=
            - --namespaces=
            - --kinds=!DaemonSet
            - --no-dry-run
            - --excluded-weekdays=Sat,Sun
            - --excluded-times-of-day=
            - --excluded-days-of-year=
            - --timezone=America/Toronto
            - --minimum-age=5m
            - --grace-period=-1s
            - --metrics-address=

Logs:

chaoskube time="2020-06-08T18:11:40Z" level=info msg="setting pod filter" annotations= excludedPodNames="<nil>" includedPodNames="<nil>" kinds="!DaemonSet" labels= maxKill=1 minimumAge=5m0s  │
│ chaoskube time="2020-06-08T18:11:40Z" level=info msg="setting quiet times" daysOfYear="[]" timesOfDay="[]" weekdays="[Saturday Sunday]"                                                        │
│ chaoskube time="2020-06-08T18:11:40Z" level=info msg="setting timezone" location=America/Toronto name=EDT offset=-4                                                                            │
│ chaoskube time="2020-06-08T18:11:40Z" level=info msg="terminating pod" name=dns-controller-55f7fd9cf6-zrx46 namespace=kube-system                                                              │
│ chaoskube time="2020-06-08T18:12:40Z" level=info msg="terminating pod" name=etcd-server-ip-10-241-45-54.eu-west-1.compute.internal namespace=kube-system                                       │
│ chaoskube time="2020-06-08T18:13:40Z" level=info msg="terminating pod" name=coredns-autoscaler-c9cfff856-lvv7m namespace=kube-system                                                           │
│ chaoskube time="2020-06-08T18:14:40Z" level=info msg="terminating pod" name=kube-proxy-ip-10-241-45-182.eu-west-1.compute.internal namespace=kube-system                                       │
│ chaoskube time="2020-06-08T18:15:40Z" level=info msg="terminating pod" name=kube-scheduler-ip-10-241-75-181.eu-west-1.compute.internal namespace=kube-system                                   │
│ chaoskube time="2020-06-08T18:16:40Z" level=info msg="terminating pod" name=kube-controller-manager-ip-10-241-75-181.eu-west-1.compute.internal namespace=kube-system                          │
│ chaoskube time="2020-06-08T18:17:40Z" level=info msg="terminating pod" name=etcd-server-ip-10-241-75-181.eu-west-1.compute.internal namespace=kube-system                                      │
│ chaoskube time="2020-06-08T18:18:40Z" level=info msg="terminating pod" name=kube-proxy-ip-10-241-76-7.eu-west-1.compute.internal namespace=kube-system

@qlikcoe
Copy link
Author

qlikcoe commented Jun 8, 2020

Testing with --kinds=DaemonSet :

Screen Shot 2020-06-08 at 14 31 29

@qlikcoe
Copy link
Author

qlikcoe commented Jun 9, 2020

@linki 👀 🙏

@linki
Copy link
Owner

linki commented Jun 9, 2020

@qlikcoe That's awesome! 😀

I'll take a look in the following days.

@hairyhenderson
Copy link

@linki any updates? I think this would be a useful feature

@hairyhenderson
Copy link

ping @linki 😬

Filter by Kind. Set up tests.
@qlikcoe
Copy link
Author

qlikcoe commented Aug 31, 2020

Rebased

@qlikcoe
Copy link
Author

qlikcoe commented Sep 4, 2020

chaoskube/chaoskube_test.go Outdated Show resolved Hide resolved
@linki
Copy link
Owner

linki commented Sep 9, 2020

@qlikcoe Awesome stuff 👍 I removed a piece of code in the kinds filter that is obsolete, I think. Tests are still passing.

Let me know if you disagree. Otherwise I'll merge this.

A big thank you 🥳 and sorry for the delay!

@qlikcoe
Copy link
Author

qlikcoe commented Sep 9, 2020

@linki looks good!

@linki linki merged commit b1c3600 into linki:master Sep 10, 2020
@linki
Copy link
Owner

linki commented Sep 10, 2020

@qlikcoe Thanks again!

@qlikcoe qlikcoe deleted the filter-by-kind branch September 10, 2020 14:37
@linki
Copy link
Owner

linki commented Sep 28, 2020

This is part of v0.21.0.

@pims
Copy link
Contributor

pims commented Sep 28, 2020

That’s a great feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants