Open
Description
Eschewed features
- This issue is not requesting templating, unstuctured edits, build-time side-effects from args or env vars, or any other eschewed feature.
What would you like to have added?
I would like to add regex support in replacement selectors
Update 2025-03-01:
We should be able to select or reject multiple objects, in a single selector block.
Source selection should not be affected, no regex support.
The options' block behaviour is unchanged:
- if multiple targets are found with regex, same options should apply to all matching targets. As declared in the target block.
- regex does not apply for source object selection, thus options behaviour remains the same.
Why is this needed?
Supporting regex in replacement selectors would:
- reduce redundancy of replacement blocks, by targeting multiple objects with regex
- harmonize replacement selectors with the patch selectors that already support regex
- make it possible to migrate from patches to replacements
Can you accomplish the motivating task without this feature, and if so, how?
example: replace image tag using deploy1 into depoly2, st1 and st2:
apiVersion: v1
kind: Deployment
metadata:
name: deploy1
spec:
template:
spec:
containers:
- image: nginx:1.27.4
name: nginx-tagged
---
apiVersion: v1
kind: Deployment
metadata:
name: deploy2
spec:
template:
spec:
containers:
- image: nginx:1.5
name: nginx-tagged
---
apiVersion: v1
kind: Statefulset
metadata:
name: st1
spec:
template:
spec:
containers:
- image: nginx:1.5
name: nginx-tagged
---
apiVersion: v1
kind: Statefulset
metadata:
name: st2
spec:
template:
spec:
containers:
- image: nginx:1.5
name: nginx-tagged
current solution:
replacements:
- source:
kind: Deployment
name: deploy1
fieldPath: spec.template.spec.containers.0.image
targets:
- select:
kind: Deployment
name: deploy2
fieldPaths:
- spec.template.spec.containers.0.image
- select:
kind: StatefulSet
name: st1
fieldPaths:
- spec.template.spec.containers.0.image
- select:
kind: StatefulSet
name: st2
fieldPaths:
- spec.template.spec.containers.0.image
What other solutions have you considered?
proposed solution:
replacements:
- source:
kind: Deployment
name: deploy1
fieldPath: spec.template.spec.containers.0.image
targets:
- select:
kind: Deployment|StatefulSet
name: deploy2|st.*
fieldPaths:
- spec.template.spec.containers.0.image
Anything else we should know?
No response
Feature ownership
- I am interested in contributing this feature myself! 🎉