github.com/oam-dev/kubevela@v1.9.11/charts/vela-core/templates/defwithtemplate/lifecycle.yaml (about)

     1  # Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
     2  # Definition source cue file: vela-templates/definitions/internal/lifecycle.cue
     3  apiVersion: core.oam.dev/v1beta1
     4  kind: TraitDefinition
     5  metadata:
     6    annotations:
     7      definition.oam.dev/description: Add lifecycle hooks for every container of K8s pod for your workload which follows the pod spec in path 'spec.template'.
     8    name: lifecycle
     9    namespace: {{ include "systemDefinitionNamespace" . }}
    10  spec:
    11    appliesToWorkloads:
    12      - deployments.apps
    13      - statefulsets.apps
    14      - daemonsets.apps
    15      - jobs.batch
    16    podDisruptive: true
    17    schematic:
    18      cue:
    19        template: |
    20          patch: spec: template: spec: containers: [...{
    21          	lifecycle: {
    22          		if parameter.postStart != _|_ {
    23          			postStart: parameter.postStart
    24          		}
    25          		if parameter.preStop != _|_ {
    26          			preStop: parameter.preStop
    27          		}
    28          	}
    29          }]
    30          parameter: {
    31          	postStart?: #LifeCycleHandler
    32          	preStop?:   #LifeCycleHandler
    33          }
    34          #Port: int & >=1 & <=65535
    35          #LifeCycleHandler: {
    36          	exec?: command: [...string]
    37          	httpGet?: {
    38          		path?:  string
    39          		port:   #Port
    40          		host?:  string
    41          		scheme: *"HTTP" | "HTTPS"
    42          		httpHeaders?: [...{
    43          			name:  string
    44          			value: string
    45          		}]
    46          	}
    47          	tcpSocket?: {
    48          		port:  #Port
    49          		host?: string
    50          	}
    51          }
    52