github.com/oam-dev/kubevela@v1.9.11/references/docgen/def-doc/policy/shared-resource.eg.md (about)

     1  It's used in [shared-resource](https://kubevela.io/docs/end-user/policies/shared-resource) scenario.
     2  It can be used to configure which resources can be shared between applications. The target resource will allow multiple application to read it but only the first one to be able to write it.
     3  
     4  ```yaml
     5  apiVersion: core.oam.dev/v1beta1
     6  kind: Application
     7  metadata:
     8    name: app1
     9  spec:
    10    components:
    11      - name: ns1
    12        type: k8s-objects
    13        properties:
    14          objects:
    15            - apiVersion: v1
    16              kind: Namespace
    17              metadata:
    18                name: example
    19      - name: cm1
    20        type: k8s-objects
    21        properties:
    22          objects:
    23            - apiVersion: v1
    24              kind: ConfigMap
    25              metadata:
    26                name: cm1
    27                namespace: example
    28              data:
    29                key: value1
    30    policies:
    31      - name: shared-resource
    32        type: shared-resource
    33        properties:
    34          rules:
    35            - selector:
    36                resourceTypes: ["Namespace"]
    37  ```
    38  
    39  ```yaml
    40  apiVersion: core.oam.dev/v1beta1
    41  kind: Application
    42  metadata:
    43    name: app2
    44  spec:
    45    components:
    46      - name: ns2
    47        type: k8s-objects
    48        properties:
    49          objects:
    50            - apiVersion: v1
    51              kind: Namespace
    52              metadata:
    53                name: example
    54      - name: cm2
    55        type: k8s-objects
    56        properties:
    57          objects:
    58            - apiVersion: v1
    59              kind: ConfigMap
    60              metadata:
    61                name: cm2
    62                namespace: example
    63              data:
    64                key: value2
    65    policies:
    66      - name: shared-resource
    67        type: shared-resource
    68        properties:
    69          rules:
    70            - selector:
    71                resourceTypes: ["Namespace"]
    72  ```