apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  annotations:
    addons.oam.dev/description: Kruise is a Kubernetes extended suite for application
      automations
  name: kruise
  namespace: vela-system
spec:
  components:
  - name: kruise
    properties:
      chart: ./charts/kruise/v0.9.0
      git:
        branch: master
      repoType: git
      url: https://github.com/openkruise/kruise
      values:
        featureGates: PreDownloadImageForInPlaceUpdate=true
    type: helm
  - name: cloneset
    properties:
      apiVersion: core.oam.dev/v1beta1
      kind: ComponentDefinition
      metadata:
        annotations:
          definition.oam.dev/description: Describes long-running, scalable, containerized
            services that have a stable network endpoint to receive external network
            traffic from customers. If workload type is skipped for any service defined
            in Appfile, it will be defaulted to `webservice` type.
        name: cloneset
        namespace: vela-system
      spec:
        schematic:
          cue:
            template: "output: {\n\tapiVersion: \"apps.kruise.io/v1alpha1\"\n\tkind:
              \      \"CloneSet\"\n\tmetadata: labels: {\n\t\t\"app.oam.dev/component\":
              context.name\n\t}\n\tspec: {\n\t\tselector: matchLabels: {\n\t\t\t\"app.oam.dev/component\":
              context.name\n\t\t}\n\n\t\ttemplate: {\n\t\t\tmetadata: labels: {\n\t\t\t\t\"app.oam.dev/component\":
              context.name\n\t\t\t}\n\n\t\t\tspec: {\n\t\t\t\tcontainers: [{\n\t\t\t\t\tname:
              \ context.name\n\t\t\t\t\timage: parameter.image\n\n\t\t\t\t\tif parameter.cmd
              != _|_ {\n\t\t\t\t\t\tcommand: parameter.cmd\n\t\t\t\t\t}\n\t\t\t\t\tif
              parameter.args != _|_ {\n\t\t\t\t\t\targs: parameter.args\n\t\t\t\t\t}\n\t\t\t\t\tif
              parameter.env != _|_ {\n\t\t\t\t\t\tenv: parameter.env\n\t\t\t\t\t}\n\n\t\t\t\t\tif
              context.config != _|_ {\n\t\t\t\t\t\tenv: context.config\n\t\t\t\t\t}\n\n\t\t\t\t\tif
              parameter[\"imagePullPolicy\"] != _|_ {\n\t\t\t\t\t\timagePullPolicy:
              parameter.imagePullPolicy\n\t\t\t\t\t}\n\n\t\t\t\t\tports: [{\n\t\t\t\t\t\tcontainerPort:
              parameter.port\n\t\t\t\t\t}]\n\n\t\t\t\t\tif parameter[\"cpu\"] != _|_
              {\n\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\tlimits: cpu:   parameter.cpu\n\t\t\t\t\t\t\trequests:
              cpu: parameter.cpu\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif parameter[\"memory\"]
              != _|_ {\n\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\tlimits: memory:   parameter.memory\n\t\t\t\t\t\t\trequests:
              memory: parameter.memory\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif
              parameter[\"livenessProbe\"] != _|_ {\n\t\t\t\t\t\tlivenessProbe: parameter.livenessProbe\n\t\t\t\t\t}\n\n\t\t\t\t\tif
              parameter[\"readinessProbe\"] != _|_ {\n\t\t\t\t\t\treadinessProbe:
              parameter.readinessProbe\n\t\t\t\t\t}\n\n\t\t\t\t\tlifecycle: {\n\t\t\t\t\t\tif
              parameter.postStart != _|_ {\n\t\t\t\t\t\t\tpostStart: exec: command:
              parameter.postStart\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif parameter.preStop
              != _|_ {\n\t\t\t\t\t\t\tpreStop: exec: command: parameter.preStop\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}]\n\t\t\t\tif
              parameter.hostAliases != _|_ {\n\t\t\t\t\thostAliases: parameter.hostAliases\n\t\t\t\t}\n\t\t\t\tif
              parameter[\"imagePullSecrets\"] != _|_ {\n\t\t\t\t\timagePullSecrets:
              [ for v in parameter.imagePullSecrets {name: v}]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif
              parameter.updateStrategyType != _|_ {\n\t\t\tupdateStrategy: {\n\t\t\t\ttype:
              parameter.updateStrategyType\n\t\t\t}\n\t\t}\n\t}\n}\nparameter: {\n\t//
              +usage=Which image would you like to use for your service\n\t// +short=i\n\timage:
              string\n\n\t// +usage=Specify image pull policy for your service\n\timagePullPolicy?:
              string\n\n\t// +usage=Specify image pull secrets for your service\n\timagePullSecrets?:
              [...string]\n\n\t// +usage=Number of CPU units for the service, like
              `0.5` (0.5 CPU core), `1` (1 CPU core)\n\tcpu?: string\n\n\t// +usage=Specify
              the amount of memory to limit\n\tmemory?: *\"2048Mi\" | =~\"^([1-9][0-9]{0,63})(E|P|T|G|M|K|Ei|Pi|Ti|Gi|Mi|Ki)$\"\n\n\t//
              +usage=Commands to run in the container\n\tcmd?: [...string]\n\n\t//
              +usage=Arguments to the command.\n\targs?: [...string]\n\n\t// +usage=postStart
              commands will be called immediately after a container is created.\n\tpostStart?:
              [...string]\n\n\t// +usage=PreStop is called immediately before a container
              is terminated due to an API request or management event such as liveness/startup
              probe failure, preemption, resource contention, etc. The handler is
              not called if the container crashes or exits. The reason for termination
              is passed to the handler. The Pod's termination grace period countdown
              begins before the PreStop hooked is executed. Regardless of the outcome
              of the handler, the container will eventually terminate within the Pod's
              termination grace period. Other management of the container blocks until
              the hook completes or until the termination grace period is reached.
              More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks\n\tpreStop?:
              [...string]\n\n\t// +usage=Which port do you want customer traffic sent
              to\n\t// +short=p\n\tport: *80 | int\n\n\t// +usage=Define arguments
              by using environment variables\n\tenv?: [...#ENV]\n\n\t// +usage=Cloneset
              updateStrategy, candidates are `ReCreate`/`InPlaceIfPossible`/`InPlaceOnly`\n\tupdateStrategyType?:
              string\n\n\t// +usage=HostAliases is a list of hosts and IPs that will
              be write into the pod's hosts file\n\thostAliases?: [...{\n\t\thostnames:
              [...string]\n\t\tip: string\n\t}]\n\n\t// +usage=Instructions for assessing
              whether the container is alive.\n\tlivenessProbe?: #HealthProbe\n\n\t//
              +usage=Instructions for assessing whether the container is in a suitable
              state to serve traffic.\n\treadinessProbe?: #HealthProbe\n}\n\n#ENV:
              {\n\t// +usage=Environment variable name\n\tname: string\n\t// +usage=The
              value of the environment variable\n\tvalue?: string\n\t// +usage=Specifies
              a source the value of this var should come from\n\tvalueFrom?: {\n\t\t//
              +usage=Selects a key of a secret in the pod's namespace\n\t\tsecretKeyRef:
              {\n\t\t\t// +usage=The name of the secret in the pod's namespace to
              select from\n\t\t\tname: string\n\t\t\t// +usage=The key of the secret
              to select from. Must be a valid secret key\n\t\t\tkey: string\n\t\t}\n\t}\n}\n\n#HealthProbe:
              {\n\n\t// +usage=Instructions for assessing container health by executing
              a command. Either this attribute or the httpGet attribute or the tcpSocket
              attribute MUST be specified. This attribute is mutually exclusive with
              both the httpGet attribute and the tcpSocket attribute.\n\texec?: {\n\t\t//
              +usage=A command to be executed inside the container to assess its health.
              Each space delimited token of the command is a separate array element.
              Commands exiting 0 are considered to be successful probes, whilst all
              other exit codes are considered failures.\n\t\tcommand: [...string]\n\t}\n\n\t//
              +usage=Instructions for assessing container health by executing an HTTP
              GET request. Either this attribute or the exec attribute or the tcpSocket
              attribute MUST be specified. This attribute is mutually exclusive with
              both the exec attribute and the tcpSocket attribute.\n\thttpGet?: {\n\t\t//
              +usage=The endpoint, relative to the port, to which the HTTP GET request
              should be directed.\n\t\tpath: string\n\t\t// +usage=The TCP socket
              within the container to which the HTTP GET request should be directed.\n\t\tport:
              int\n\t\thttpHeaders?: [...{\n\t\t\tname:  string\n\t\t\tvalue: string\n\t\t}]\n\t}\n\n\t//
              +usage=Instructions for assessing container health by probing a TCP
              socket. Either this attribute or the exec attribute or the httpGet attribute
              MUST be specified. This attribute is mutually exclusive with both the
              exec attribute and the httpGet attribute.\n\ttcpSocket?: {\n\t\t// +usage=The
              TCP socket within the container that should be probed to assess container
              health.\n\t\tport: int\n\t}\n\n\t// +usage=Number of seconds after the
              container is started before the first probe is initiated.\n\tinitialDelaySeconds:
              *0 | int\n\n\t// +usage=How often, in seconds, to execute the probe.\n\tperiodSeconds:
              *10 | int\n\n\t// +usage=Number of seconds after which the probe times
              out.\n\ttimeoutSeconds: *1 | int\n\n\t// +usage=Minimum consecutive
              successes for the probe to be considered successful after having failed.\n\tsuccessThreshold:
              *1 | int\n\n\t// +usage=Number of consecutive failures required to determine
              the container is not alive (liveness probe) or not ready (readiness
              probe).\n\tfailureThreshold: *3 | int\n} \n"
        workload:
          definition:
            apiVersion: apps.kruise.io/v1alpha1
            kind: CloneSet
    type: raw
  - name: predownloadimage
    properties:
      apiVersion: core.oam.dev/v1beta1
      kind: WorkflowStepDefinition
      metadata:
        name: predownloadimage
      spec:
        schematic:
          cue:
            template: "import (\"vela/op\")\nparameter: {\n  image: string\n  parallel:
              int\n  kvs: [string]: string\n  type: *\"Always\" | string\n  activeDeadlineSeconds:
              *1200 | int\n  ttlSecondsAfterFinished: *300 | int\n  backoffLimit?:
              int\n  timeoutSeconds?: int\n  arr: [...string]\n}\n\npullImageJob:
              op.#Apply & {\n  value:{\n    apiVersion: \"apps.kruise.io/v1alpha1\"\n
              \   kind:       \"ImagePullJob\"\n    metadata: {\n      name: \"pull-image-job\"\n
              \   }\n    spec: {\n      image: parameter.image\n      parallelism:
              parameter.parallel\n      selector: matchLabels: parameter.kvs\n      completionPolicy:
              {\n        type: parameter.type\n        activeDeadlineSeconds: parameter.activeDeadlineSeconds\n
              \       ttlSecondsAfterFinished: parameter.ttlSecondsAfterFinished\n
              \     }\n      pullPolicy: {\n        if parameter.backoffLimit != _|_
              {\n          backoffLimit: parameter.backoffLimit\n        }\n        if
              parameter.timeoutSeconds != _|_ {\n          timeoutSeconds: parameter.timeoutSeconds\n
              \       }\n      }\n      pullSecrets: parameter.arr\n    }            \n
              \ }          \n} \n"
    type: raw
  workflow:
    steps:
    - name: checking-depends-on
      properties:
        name: fluxcd
        namespace: vela-system
      type: depends-on-app
    - name: apply-resources
      type: apply-application
status:
  rollout:
    batchRollingState: ""
    currentBatch: 0
    lastTargetAppRevision: ""
    rollingState: ""
    upgradedReadyReplicas: 0
    upgradedReplicas: 0
