[Feature] Add conflictsWith to TraitDefitnition
Is your feature request related to a problem? Please describe.
For registering a given capability, we should support a field named conflictsWith
Describe the solution you'd like
$ kubectl get traits
NAME DEFINITION APPLIES TO CONFLICTS WITH
traffic virtualservices.networking.istio.io apps.k8s.io services.k8s.io
cronscaler cronscaler.core.oam.dev apps.k8s.io hpa.k8s.io
tls tls.core.oam.dev apps.k8s.io
So in case when operator apply cronscaler and hpa trait to the same component, oam runtime will report error.
Describe alternatives you've considered
Additional context
ref: https://github.com/oam-dev/spec/issues/352
ConflictWith could be presentation layer, and conflict labe in oam-dev/spec#352 could be real implementation.
@wonderflow appliesTo and conflictsWith should follow the same pattern, one example is:
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: virtualservices.networking.istio.io
annotations:
alias: traffic
spec:
appliesTo:
- apps.k8s.io
conflictsWith:
- services.k8s.io # API resource/crd name
- *.networking.k8s.io # API group
- labelSelector:foo=bar
definition: virtualservices.networking.istio.io
@zzxwill is working on it