oam-kubernetes-runtime icon indicating copy to clipboard operation
oam-kubernetes-runtime copied to clipboard

[Feature] Add conflictsWith to TraitDefitnition

Open resouer opened this issue 5 years ago • 4 comments

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

resouer avatar Jul 26 '20 01:07 resouer

ref: https://github.com/oam-dev/spec/issues/352

hongchaodeng avatar Jul 26 '20 23:07 hongchaodeng

ConflictWith could be presentation layer, and conflict labe in oam-dev/spec#352 could be real implementation.

wonderflow avatar Jul 27 '20 02:07 wonderflow

@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

resouer avatar Jul 29 '20 18:07 resouer

@zzxwill is working on it

wonderflow avatar Nov 16 '20 07:11 wonderflow