Logo

Documentation

Deliverable and Delivery Custom Resources

Deliverable

Deliverable allows the operator to pass information about the configuration to be applied to the environment to the delivery.

---
apiVersion: carto.run/v1alpha1
kind: Deliverable
metadata: {}
spec:

  # Additional parameters. See:
  # https://cartographer.sh/docs/latest/architecture/#parameter-hierarchy
  # +optional
  params:
    - # Name of the parameter. Should match a blueprint or
      # template parameter name.
      name: <string>

      # Value of the parameter.
      value: <any>

  # ServiceAccountName refers to the Service account with
  # permissions to create resources submitted by the supply chain.
  # If not set, Cartographer will use serviceAccountName from
  # delivery. 
  # If that is also not set, Cartographer will use the default
  # service account in the deliverable's namespace.
  # +optional
  serviceAccountName: <string>

  # The location of the source code for the workload. Specify one
  # of `spec.source` or `spec.image`
  # +optional
  source:

    # Source code location in a git repository.
    # +optional
    git:
      ref:
        branch: <string>
        commit: <string>
        tag: <string>
      url: <string>

    # OCI Image in a repository, containing the source code to be
    # used throughout the supply chain.
    # +optional
    image: <string>

    # Subpath inside the Git repository or Image to treat as the
    # root of the application. Defaults to the root if left empty.
    # +optional
    subPath: <string>

# Status conforms to the Kubernetes conventions:
# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
# +optional
status:

  # Conditions describing this resource's reconcile state. The top
  # level condition is of type `Ready`, and follows these
  # Kubernetes conventions:
  # https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
  # +optional
  conditions:
    - # Condition contains details for one aspect of the current
      # state of this API Resource. --- This struct is intended
      # for direct use as an array at the field path
      # .status.conditions.  For example, type FooStatus struct{
      # // Represents the observations of a foo's current state.
      # // Known .status.conditions.type are: "Available",
      # "Progressing", and "Degraded" // +patchMergeKey=type //
      # +patchStrategy=merge // +listType=map // +listMapKey=type
      # Conditions []metav1.Condition `json:"conditions,omitempty"
      # patchStrategy:"merge" patchMergeKey:"type"
      # protobuf:"bytes,1,rep,name=conditions"` 
      # // other fields }
      # +optional

  # DeliveryRef is the Delivery resource that was used when this
  # status was set.
  # +optional
  deliveryRef: {}

  # ObservedGeneration refers to the metadata.Generation of the
  # spec that resulted in the current `status`.
  # +optional
  observedGeneration: <integer>

  # Resources contain references to the objects created by the
  # Delivery and the templates used to create them. It also
  # contains Inputs and Outputs that were passed between the
  # templates as the Delivery was processed.
  # +optional
  resources:
    - # Conditions describing this resource's reconcile state. The
      # top level condition is of type `Ready`, and follows these
      # Kubernetes conventions:
      # https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
      # +optional
      conditions:
        - # Condition contains details for one aspect of the
          # current state of this API Resource. --- This struct is
          # intended for direct use as an array at the field path
          # .status.conditions.  For example, type FooStatus
          # struct{ // Represents the observations of a foo's
          # current state. // Known .status.conditions.type are:
          # "Available", "Progressing", and "Degraded" //
          # +patchMergeKey=type // +patchStrategy=merge //
          # +listType=map // +listMapKey=type Conditions
          # []metav1.Condition `json:"conditions,omitempty"
          # patchStrategy:"merge" patchMergeKey:"type"
          # protobuf:"bytes,1,rep,name=conditions"` 
          # // other fields }
          # +optional

      # Inputs are references to resources that were used to
      # template the object in StampedRef
      # +optional
      inputs:
        - # Name is the name of the resource in the blueprint
          # whose output the resource consumes as an input
          name: <string>

      # Name is the name of the resource in the blueprint
      name: <string>

      # Outputs are values from the object in StampedRef that can
      # be consumed by other resources
      # +optional
      outputs:
        - # Digest is a sha256 of the full value of the output
          digest: <string>

          # LastTransitionTime is a timestamp of the last time the
          # value changed
          lastTransitionTime: <string>

          # Name is the output type generated from the resource
          # [url, revision, image or config]
          name: <string>

          # Preview is a preview of the value of the output
          preview: <string>

      # StampedRef is a reference to the object that was created
      # by the resource
      # +optional
      stampedRef: {}

      # TemplateRef is a reference to the template used to create
      # the object in StampedRef
      # +optional
      templateRef: {}

Notes:

  1. labels serve as a way of indirectly selecting ClusterDelivery

ref: pkg/apis/v1alpha1/deliverable.go

ClusterDelivery

A ClusterDelivery is a cluster-scoped resources that enables application operators to define a continuous delivery workflow. Delivery is analogous to SupplyChain, in that it specifies a list of resources that are created when requested by the developer. Early resources in the delivery are expected to configure the k8s environment (for example by deploying an application). Later resources validate the environment is healthy.

The SupplyChain resources ClusterSourceTemplates and ClusterTemplates are valid for delivery. Delivery additionally has the resource ClusterDeploymentTemplates. Delivery can cast the values from a ClusterSourceTemplate so that they may be consumed by a ClusterDeploymentTemplate.

ClusterDeliveries specify the type of configuration they accept through the spec.selector field. Deliverables with matching spec.selector then create a logical delivery. This makes the values in the Deliverable available to all of the resources in the ClusterDeliverys spec.resources.

---
apiVersion: carto.run/v1alpha1
kind: ClusterDelivery
metadata: {}
spec:

  # Additional parameters. See:
  # https://cartographer.sh/docs/latest/architecture/#parameter-hierarchy
  # +optional
  params:
    - # DefaultValue of the parameter. Causes the parameter to be
      # optional; If the Owner does not specify this parameter,
      # this value is used.
      # +optional
      default: <any>

      # Name of the parameter. Should match a template parameter
      # name.
      name: <string>

      # Value of the parameter. If specified, owner properties are
      # ignored.
      # +optional
      value: <any>

  # Resources that are responsible for deploying and validating
  # the deliverable
  resources:
    - # Configs is a list of references to other 'config'
      # resources in this list. A config resource has the kind
      # ClusterConfigTemplate 
      # In a template, configs can be consumed as:
      # $(configs.<name>.config)$ 
      # If there is only one image, it can be consumed as:
      # $(config)$
      # +optional
      configs:
        - name: <string>
          resource: <string>

      # Deployment is a reference to a 'deployment' resource. A
      # deployment resource has the kind ClusterDeploymentTemplate
      # In a template, the deployment can be consumed as:
      # $(deployment.url)$ and $(deployment.revision)$
      # +optional
      deployment:
        resource: <string>

      # Name of the resource. Used as a reference for inputs, as
      # well as being the name presented in deliverable statuses
      # to identify this resource.
      name: <string>

      # Params are a list of parameters to provide to the template
      # in TemplateRef Template params do not have to be specified
      # here, unless you want to force a particular value, or add
      # a default value. 
      # Parameters are consumed in a template with the syntax:
      # $(params.<name>)$
      # +optional
      params:
        - # DefaultValue of the parameter. Causes the parameter to
          # be optional; If the Owner does not specify this
          # parameter, this value is used.
          # +optional
          default: <any>

          # Name of the parameter. Should match a template
          # parameter name.
          name: <string>

          # Value of the parameter. If specified, owner properties
          # are ignored.
          # +optional
          value: <any>

      # Sources is a list of references to other 'source'
      # resources in this list. A source resource has the kind
      # ClusterSourceTemplate or ClusterDeploymentTemplate 
      # In a template, sources can be consumed as:
      # $(sources.<name>.url)$ and $(sources.<name>.revision)$ 
      # If there is only one source, it can be consumed as:
      # $(source.url)$ and $(source.revision)$
      # +optional
      sources:
        - name: <string>
          resource: <string>

      # TemplateRef identifies the template used to produce this
      # resource
      templateRef:

        # Kind of the template to apply
        kind: <[ClusterSourceTemplate|ClusterDeploymentTemplate|ClusterTemplate|ClusterConfigTemplate]>

        # Name of the template to apply
        # +optional
        name: <string>

        # Options is a list of template names and Selector. The
        # templates must all be of type Kind. A template will be
        # selected if the deliverable matches the specified
        # selector. Only one template can be selected. Only one of
        # Name and Options can be specified.
        # +optional
        options:
          - # Name of the template to apply
            name: <string>

            # Selector is a criteria to match against  a workload
            # or deliverable resource.
            selector:

              # matchExpressions is a list of label selector
              # requirements. The requirements are ANDed.
              # +optional
              matchExpressions:
                - # A label selector requirement is a selector
                  # that contains values, a key, and an operator
                  # that relates the key and values.
                  # +optional

                  # key is the label key that the selector applies
                  # to.
                  key: <string>

                  # operator represents a key's relationship to a
                  # set of values. Valid operators are In, NotIn,
                  # Exists and DoesNotExist.
                  operator: <string>

                  # values is an array of string values. If the
                  # operator is In or NotIn, the values array must
                  # be non-empty. If the operator is Exists or
                  # DoesNotExist, the values array must be empty.
                  # This array is replaced during a strategic
                  # merge patch.
                  # +optional
                  values: [ <string> ]

              # MatchFields is a list of field selector
              # requirements. The requirements are ANDed.
              # +optional
              matchFields:
                - # Key is the JSON path in the workload to match
                  # against. e.g. for workload:
                  # "workload.spec.source.git.url", e.g. for
                  # deliverable: "deliverable.spec.source.git.url"
                  key: <string>

                  # Operator represents a key's relationship to a
                  # set of values. Valid operators are In, NotIn,
                  # Exists and DoesNotExist.
                  operator: <[In|NotIn|Exists|DoesNotExist]>

                  # Values is an array of string values. If the
                  # operator is In or NotIn, the values array must
                  # be non-empty. If the operator is Exists or
                  # DoesNotExist, the values array must be empty.
                  # +optional
                  values: [ <string> ]

              # matchLabels is a map of {key,value} pairs. A
              # single {key,value} in the matchLabels map is
              # equivalent to an element of matchExpressions,
              # whose key field is "key", the operator is "In",
              # and the values array contains only "value". The
              # requirements are ANDed.
              # +optional
              matchLabels: {}

  # Specifies the label key-value pairs used to select owners See:
  # https://cartographer.sh/docs/v0.1.0/architecture/#selectors
  # +optional
  selector: {}

  # Specifies the requirements used to select owners based on
  # their labels See:
  # https://cartographer.sh/docs/v0.1.0/architecture/#selectors
  # +optional
  selectorMatchExpressions:
    - # A label selector requirement is a selector that contains
      # values, a key, and an operator that relates the key and
      # values.
      # +optional

      # key is the label key that the selector applies to.
      key: <string>

      # operator represents a key's relationship to a set of
      # values. Valid operators are In, NotIn, Exists and
      # DoesNotExist.
      operator: <string>

      # values is an array of string values. If the operator is In
      # or NotIn, the values array must be non-empty. If the
      # operator is Exists or DoesNotExist, the values array must
      # be empty. This array is replaced during a strategic merge
      # patch.
      # +optional
      values: [ <string> ]

  # Specifies the requirements used to select owners based on
  # their fields See:
  # https://cartographer.sh/docs/v0.1.0/architecture/#selectors
  # +optional
  selectorMatchFields:
    - # Key is the JSON path in the workload to match against.
      # e.g. for workload: "workload.spec.source.git.url", e.g.
      # for deliverable: "deliverable.spec.source.git.url"
      key: <string>

      # Operator represents a key's relationship to a set of
      # values. Valid operators are In, NotIn, Exists and
      # DoesNotExist.
      operator: <[In|NotIn|Exists|DoesNotExist]>

      # Values is an array of string values. If the operator is In
      # or NotIn, the values array must be non-empty. If the
      # operator is Exists or DoesNotExist, the values array must
      # be empty.
      # +optional
      values: [ <string> ]

  # ServiceAccountName refers to the Service account with
  # permissions to create resources submitted by the supply chain.
  # If not set, Cartographer will use serviceAccountName from
  # supply chain. 
  # If that is also not set, Cartographer will use the default
  # service account in the workload's namespace.
  # +optional
  serviceAccountRef:

    # Name of the service account being referred to
    name: <string>

    # Namespace of the service account being referred to if
    # omitted, the Owner's namespace is used.
    # +optional
    namespace: <string>

ref: pkg/apis/v1alpha1/cluster_delivery.go