ContainerApp API reference

This topic gives you ContainerApp API reference information for Tanzu Platform for Kubernetes.

The following ContainerApp resource fields are likely to be configured as part of the app configuration process:

apiVersion: apps.tanzu.vmware.com/v1
kind: ContainerApp
metadata:
  name: my-app
spec:
  # Short description for the application
  description: "WFD Java Microservice"

  # Contact information about the application owners
  contact:
    email: [email protected]
    slack: relevant-channel
    pagerduty: https://url...

  # Specifies build instructions for this app
  build:
    path: ..            # relative to the location of ContainerApp definition
    buildpacks: {}
    nonSecretEnv:       # non-secret vars for build time
    - name: BP_JAVA_VERSION
      value: "17"

  # List of named service bindings the app accepts
  acceptedServiceBindings:
  - name: db
    types:
    - mysql
    - postgresql

  # Environment-independent env variables
  nonSecretEnv:
  - name: spring_profiles_active
    value: mysql

  # Default number of application instances
  replicas: 1

  # Default resources for each application instance
  resources:
    cpu: 300m
    memory: 1Gi

  # The named network ports of the App
  ports:
  - name: main
    port: 8080

  # Used to determine the health of the application instances
  probes:
    liveness:
      httpGet:
        path: /livez
        port: 8080
        scheme: HTTP
    readiness:
      httpGet:
        path: /readyz
        port: 8080
        scheme: HTTP
    startup:
      failureThreshold: 120
      httpGet:
        path: /readyz
        port: 8080
        scheme: HTTP
      initialDelaySeconds: 1
      periodSeconds: 1

The following ContainerApp resource fields are likely to be augmented by a build process:

apiVersion: apps.tanzu.vmware.com/v1
kind: ContainerApp
metadata:
  name: my-app
  annotations:
    containerapp.apps.tanzu.vmware.com/class: kubernetes
spec:
  # Contains details about the app contents: source repository, revision, build dates, etc.
  content:
    buildTimestamp: "2024-05-08T18:16:01Z"
    gitCommit: d05e219000b79a30a96dfbcded4807a4729cd429
    gitURL: github.com/vmware-tanzu/application-accelerator-samples.git
    packageRefName: my-app.apps.local
    summary: "git:d05e219 @ 2024-05-08T18:16:01Z"
    version: 20240508.1816.1580

  # The image of the app
  image: ttl.sh/my-app:20240508.1816.1580@sha256:8cb600e62d84fb9169d313bb0ca9b342e7fb6cd4ae9acca4305f3a9fbb606504

  # References to associated resources so that modifications
  # to spec.replicas, spec.resources and spec.secretEnv
  # can be transferred appropriately to related live resources
  relatedRefs:
  - for: kubernetes.list-replicas
    kind: Pod
    labelSelector: containerapp.apps.tanzu.vmware.com/app-name=my-app
  - apiGroup: apps
    for: kubernetes.service-binding-target
    kind: Deployment
    name: my-app
  # ...

The following ContainerApp resource fields are likely to changed at runtime:

apiVersion: apps.tanzu.vmware.com/v1
kind: ContainerApp
metadata:
  name: my-app
spec:
  # Environment-dependent env variables (mutable)
  secretEnv:
  - name: TWILIO_SECRET
    secretKeyRef:
      # name of Secret resource deployed in the app's space
      name: my-secret
      # valid key within the Secret resource's data, holding the environment variable value
      key: TWILIO_SECRET

  # Wanted number of application instances
  replicas: 10

  # Wanted resources for each application instance
  resources:
    cpu: 300m
    memory: 1Gi
  
  # Want to restart the application. The unique string must be different than the currently applied string
  restartNonce: "UNIQUE-STRING"

  # Want to stop or start the previously stopped application. 
  # Setting the value to true would result in stopping the running application 
  # and you can start the previously stopped application by setting it to false
  stopped: true


status:
  # Represent the latest available observations of a ContainerApp's current state
  conditions:
  - type: DeploySucceeded
    status: "True"

  # List of live instances
  replicas:
  - name: my-app-75675f5897-7ci7o
    # Represents the server time when this application instance was created. It is in RFC3339 form and is in UTC
    creationTimestamp: "2020-12-31T00:00:00+08:00"
    contentSummary: "git:d05e219 @ 2024-05-08T18:16:01Z"
    availabilityTarget: dev-clusters-eu-east
    conditions:
    - type: Running
      status: "True"
check-circle-line exclamation-circle-line close-line
Scroll to top icon