vshn / espejo

OpenShift and Kubernetes Object Syncer
BSD 3-Clause "New" or "Revised" License
11 stars 2 forks source link

Allow Regex in Name Matches #28

Closed srueg closed 4 years ago

srueg commented 4 years ago

Allow to use Regex expressions in the namespaceSelector.matchNames and namespaceSelector.ignoreNames (implemented in #27) fields.

This can be helpful to select multiple namespaces which don't have a common label, but a common naming scheme. For example: namespaceSelector.ignoreNames: ^openshift-.*$

ccremer commented 4 years ago

How would we differentiate between normal names and Regexes? Should we enclose regex in /, e.g. /^openshift-.*$/ so it's clear that this property should be treated as regex? Or should we assume it to be regex by default?

How do we go about migrating existing sync configs? Do we create alpha v2 or just change the implementation of alphav1? I think existing arrays of matchNames will match the namespaces anyway whether it's compared via Regex or as string equality.

srueg commented 4 years ago

Couldn't we just treat every string as regex? If there's no special control characters, it will just do a full match, as expected.