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

excluding all default namespaces #312

Closed
zfrhv opened this issue Jul 3, 2023 · 1 comment
Closed

excluding all default namespaces #312

zfrhv opened this issue Jul 3, 2023 · 1 comment

Comments

@zfrhv
Copy link
Contributor

zfrhv commented Jul 3, 2023

hello~
we have openshift cluster so i was configuring the HNC to exclude default openshift namespaces
but its like 70 namespaces (plus each redhat operator will create additional namesoace)

so we configured --included-namespace-regex=(\?\!openshift).*, but looking at how kubernetes is excluded im wondering, why to exclude each seperate namespace and not just do wildcard same as i did?:
instead if this:

        - "--excluded-namespace=kube-system"
        - "--excluded-namespace=kube-public"
        - "--excluded-namespace=hnc-system"
        - "--excluded-namespace=kube-node-lease"

do this:

        - "--included-namespace-regex=(\?\!kube-|openshift).*"
        - "--excluded-namespace=kube-system"

also without the backslashes it was crashing, not sure if its a feature or a bug

@zfrhv
Copy link
Contributor Author

zfrhv commented Jul 4, 2023

nevermind
apparently go regex doesnt accepts (?!...)
found it here:
https://stackoverflow.com/questions/52648425/regex-to-match-strings-that-do-not-start-with-www-in-golang

thats why it wasnt working without the backslash, so it was totally wrong

so ye, regex is very complicated now.
for anyone who is also using openshift this was my solution:

        - --included-namespace-regex=([^o].*|o(|[^p].*)|op(|[^e].*)|ope(|[^n].*)|open(|[^s].*)|opens(|[^h].*)|opensh(|[^i].*)|openshi(|[^f].*)|openshif(|[^t].*))
        - --excluded-namespace=default

sad solution but i guess it works, and i prefer 4 excludes this complicated regex.
so imma close this case

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

No branches or pull requests

1 participant