github.com/oam-dev/kubevela@v1.9.11/e2e/plugin/testdata/cloneset.yaml (about)

     1  # Code generated by KubeVela templates. DO NOT EDIT.
     2  apiVersion: core.oam.dev/v1beta1
     3  kind: ComponentDefinition
     4  metadata:
     5    name: cloneset
     6    namespace: vela-system
     7    annotations:
     8      definition.oam.dev/description: "Describes long-running, scalable, containerized services that have a stable network endpoint to receive external network traffic from customers. It was implemented by OpenKruise Cloneset."
     9  spec:
    10    workload:
    11      definition:
    12        apiVersion: apps.kruise.io/v1alpha1
    13        kind: CloneSet
    14    schematic:
    15      cue:
    16        template: |
    17          output: {
    18              apiVersion: "apps.kruise.io/v1alpha1"
    19              kind:       "CloneSet"
    20              metadata: labels: {
    21                "app.oam.dev/component": context.name
    22              }
    23              spec: {
    24                  replicas: parameter.replicas
    25                  selector: matchLabels: {
    26                      "app.oam.dev/component": context.name
    27                  }
    28  
    29                  template: {
    30                      metadata: labels: {
    31                        "app.oam.dev/component": context.name
    32                      }
    33  
    34                      spec: {
    35                          containers: [{
    36                            name:  context.name
    37                            image: parameter.image
    38  
    39                            if parameter["cmd"] != _|_ {
    40                                command: parameter.cmd
    41                            }
    42  
    43                            if parameter["env"] != _|_ {
    44                                env: parameter.env
    45                            }
    46  
    47                            if context["config"] != _|_ {
    48                                env: context.config
    49                            }
    50  
    51                            ports: [{
    52                                containerPort: parameter.port
    53                            }]
    54  
    55                            if parameter["cpu"] != _|_ {
    56                                resources: {
    57                                    limits:
    58                                        cpu: parameter.cpu
    59                                    requests:
    60                                        cpu: parameter.cpu
    61                                }
    62                            }
    63                        }]
    64                      }
    65                  }
    66                  if parameter["updateStrategyType"] != _|_ {
    67                      updateStrategy: {
    68                        type: parameter.updateStrategyType
    69                      }
    70                  }
    71              }
    72          }
    73          parameter: {
    74              // +usage=Which image would you like to use for your service
    75              // +short=i
    76              image: string
    77  
    78              // +usage=Commands to run in the container
    79              cmd?: [...string]
    80  
    81              // +usage=Which port do you want customer traffic sent to
    82              // +short=p
    83              port: *80 | int
    84              // +usage=Define arguments by using environment variables
    85              env?: [...{
    86                  // +usage=Environment variable name
    87                  name: string
    88                  // +usage=The value of the environment variable
    89                  value?: string
    90                  // +usage=Specifies a source the value of this var should come from
    91                  valueFrom?: {
    92                      // +usage=Selects a key of a secret in the pod's namespace
    93                      secretKeyRef: {
    94                          // +usage=The name of the secret in the pod's namespace to select from
    95                          name: string
    96                          // +usage=The key of the secret to select from. Must be a valid secret key
    97                          key: string
    98                      }
    99                  }
   100              }]
   101              // +usage=Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core)
   102              cpu?: string
   103              // +usage=Cloneset updateStrategy, candidates are `ReCreate`/`InPlaceIfPossible`/`InPlaceOnly`
   104              updateStrategyType?: string
   105              // +usage=Number of pods in the cloneset
   106              replicas: *5 | int
   107          }