github.com/oam-dev/kubevela@v1.9.11/pkg/controller/core.oam.dev/v1beta1/application/testdata/definitions/panic.yaml (about)

     1  apiVersion: core.oam.dev/v1beta1
     2  kind: TraitDefinition
     3  metadata:
     4    annotations: {}
     5    name: panic
     6    namespace: vela-system
     7  spec:
     8    schematic:
     9      cue:
    10        template: |
    11          pvcVolumesList: *[
    12                          for v in parameter.pvc if v.mountPath != _|_ {
    13                          {
    14                                  name: "pvc-" + v.name
    15                                  persistentVolumeClaim: claimName: v.name
    16                          }
    17                  },
    18          ] | []
    19          configMapVolumesList: *[
    20                                  for v in parameter.configMap if v.mountPath != _|_ {
    21                          {
    22                                  name: "configmap-" + v.name
    23                                  configMap: name: v.name
    24                          }
    25                  },
    26          ] | []
    27          volumesList: pvcVolumesList + configMapVolumesList
    28          deDupVolumesArray: [
    29                  for val in [
    30                          for i, vi in volumesList {
    31                                  for j, vj in volumesList if j < i && vi.name == vj.name {
    32                                          ignore: true
    33                                  }
    34                                  vi
    35                          },
    36                  ] if val.ignore == _|_ {
    37                          val
    38                  },
    39          ]
    40          patch: spec: template: spec: {
    41                  // +patchKey=name
    42                  volumes: deDupVolumesArray
    43          }
    44          parameter: {
    45                  // +usage=Declare pvc type storage
    46                  pvc?: [...{
    47                          name:       string
    48                          mountPath?: string
    49                  }]
    50  
    51                  // +usage=Declare config map type storage
    52                  configMap?: [...{
    53                          name:       string
    54                          mountPath?: string
    55                  }]
    56          }