excluding all default namespaces
Closed this issue · 1 comments
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
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