tanzu apps workload apply is a command used to create and update workloads that are deployed in a
cluster through a supply chain.
In the output of the workload apply command, the specification for the workload is shown as if they
were in a YAML file.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-1.5.0 --type web
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | source:
11 + | git:
12 + | ref:
13 + | tag: tap-1.5.0
14 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
15 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:
π Created workload "tanzu-java-web-app"
To see logs: "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-java-web-app"
In the first section, the definition of workload is displayed. It's followed by a dialog box asking
whether the workload should be created or updated. In the last section, if workload is created or
updated, a couple of hints are displayed about the next set of commands that are used for a follow up.
Each flag used in this example is explained in detail in the following section.
Sets the annotations to be applied to the workload. To specify more than one annotation set the flag multiple times. These annotations are passed as parameters to be processed in the supply chain.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-1.5.0 --type web --annotation tag=tap-1.5.0 --annotation name="Tanzu Java Web"
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | params:
11 + | - name: annotations
12 + | value:
13 + | name: Tanzu Java Web
14 + | tag: tap-1.5.0
15 + | source:
16 + | git:
17 + | ref:
18 + | tag: tap-1.5.0
19 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
20 + | subPath: tanzu-java-web-appTo delete an annotation, use - after it's name.
Example
tanzu apps workload apply tanzu-java-web-app --annotation tag-
π Update workload:
...
10, 10 | params:
11, 11 | - name: annotations
12, 12 | value:
13, 13 | name: Tanzu Java Web
14 - | tag: tap-1.5.0
15, 14 | source:
16, 15 | git:
17, 16 | ref:
18, 17 | tag: tap-1.5.0
...
β Really update the workload "tanzu-java-web-app"? [yN]:The app of which the workload is part of. This is part of the workload metadata section.
Example
tanzu apps workload apply tanzu-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-1.5.0 --type web --app tanzu-java-web-app
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | app.kubernetes.io/part-of: tanzu-java-web-app
7 + | apps.tanzu.vmware.com/workload-type: web
8 + | name: tanzu-app
9 + | namespace: default
10 + |spec:
11 + | source:
12 + | git:
13 + | ref:
14 + | tag: tap-1.5.0
15 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
16 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:
π Created workload "tanzu-app"
To see logs: "tanzu apps workload tail tanzu-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-app"
Sets environment variables to be used in the build phase by the build resources in the supply chain where some build specific behavior is set or changed.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-1.5.0 --type web --build-env JAVA_VERSION=1.8
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | build:
11 + | env:
12 + | - name: JAVA_VERSION
13 + | value: "1.8"
14 + | source:
15 + | git:
16 + | ref:
17 + | tag: tap-1.5.0
18 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
19 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:To delete a build environment variable, use - after its name.
Example
tanzu apps workload apply tanzu-java-web-app --build-env JAVA_VERSION-
π Update workload:
...
6, 6 | apps.tanzu.vmware.com/workload-type: web
7, 7 | name: tanzu-java-web-app
8, 8 | namespace: default
9, 9 |spec:
10 - | build:
11 - | env:
12 - | - name: JAVA_VERSION
13 - | value: "1.8"
14, 10 | source:
15, 11 | git:
16, 12 | ref:
17, 13 | tag: tap-1.5.0
...
β Really update the workload "tanzu-java-web-app"? [yN]:Sets the parameter variable debug to true in the workload.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --debug
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | params:
11 + | - name: debug
12 + | value: "true"
13 + | source:
14 + | git:
15 + | ref:
16 + | branch: main
17 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
18 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:Prepares all the steps to submit the workload to the cluster and stops before sending it, showing an output of the final structure of the workload.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-1.5.0 --type web --build-env JAVA_VERSION=1.8 --param-yaml server=$'port: 8080\nmanagement-port: 8181' --dry-run
---
apiVersion: carto.run/v1alpha1
kind: Workload
metadata:
creationTimestamp: null
labels:
apps.tanzu.vmware.com/workload-type: web
name: tanzu-java-web-app
namespace: default
spec:
build:
env:
- name: JAVA_VERSION
value: "1.8"
params:
- name: server
value:
management-port: 8181
port: 8080
source:
git:
ref:
tag: tap-1.5.0
url: https://github.com/vmware-tanzu/application-accelerator-samples
subPath: tanzu-java-web-app
status:
supplyChainRef: {}Sets the environment variables to the workload so the supply chain resources can used it to deploy the workload application.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-1.5.0 --type web --env NAME="Tanzu Java App"
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | env:
11 + | - name: NAME
12 + | value: Tanzu Java App
13 + | source:
14 + | git:
15 + | ref:
16 + | tag: tap-1.5.0
17 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
18 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:To unset an environment variable, use - after its name.
tanzu apps workload apply tanzu-java-web-app --env NAME-
π Update workload:
...
6, 6 | apps.tanzu.vmware.com/workload-type: web
7, 7 | name: tanzu-java-web-app
8, 8 | namespace: default
9, 9 |spec:
10 - | env:
11 - | - name: NAME
12 - | value: Tanzu Java App
13, 10 | source:
14, 11 | git:
15, 12 | ref:
16, 13 | tag: tap-1.5.0
...
β Really update the workload "tanzu-java-web-app"? [yN]:Sets the workload specification file to create the workload. This comes from any other workload
specification passed by flags to the command set or overrides what is in the file. Another way to
use this flag is by using - in the command to receive workload definition through stdin.
See Working with YAML Files section for
an example.
Example
tanzu apps workload apply tanzu-java-web-app -f java-app-workload.yaml --param-yaml server=$'port: 9090\nmanagement-port: 9190'
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | build:
11 + | env:
12 + | - name: JAVA_VERSION
13 + | value: "1.8"
14 + | params:
15 + | - name: server
16 + | value:
17 + | management-port: 9190
18 + | port: 9090
19 + | source:
20 + | git:
21 + | ref:
22 + | tag: tap-1.5.0
23 + | url: url: https://github.com/vmware-tanzu/application-accelerator-samples
24 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:The Git repository from which the workload is created. With this, either --git-tag, --git-commit,
--git-branch or the three of them can be specified. When setting this flag to empty string, the whole
spec.source.git section is removed from workload definition.
For Git source, if all the flags are specified (--git-tag, --git-commit,
--git-branch) the revision to which the workload will checkout will entirely depend on the source controller.
The branch in a Git repository from where the workload is created. Commit and tag can also be specified alongside this flag.
It can be unset by defining it as empty string when applying a workload (--git-branch "").
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | source:
11 + | git:
12 + | ref:
13 + | branch: main
14 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
15 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:The tag in a Git repository from which the workload is created. Can be unset by defining it as empty string when applying a workload (--git-tag "").
Commit in Git repository from where the workload is resolved. Either --git-branch or --git-tag can be specified with it too.
It can be unset by defining it as empty string when applying a workload (--git-commit "").
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-commit 1c4cf82e499f7e46da182922d4097908d4817320 --type web
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | source:
11 + | git:
12 + | ref:
13 + | commit: 1c4cf82e499f7e46da182922d4097908d4817320
14 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
15 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:Sets the OSI image to be used as the workload application source instead of a Git repository
Example
tanzu apps workload apply tanzu-java-web-app --image private.repo.domain.com/tanzu-java-web-app --type web
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | build:
11 + | env:
12 + | - name: JAVA_VERSION
13 + | value: "1.8"
14 + | params:
15 + | - name: server
16 + | value:
17 + | management-port: 9190
18 + | port: 9090
19 + | source:
20 + | git:
21 + | ref:
22 + | tag: tap-1.5.0
23 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
24 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:Sets the label to be applied to the workload, to specify more than one label set the flag multiple times.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --label stage=production
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | stage: production
8 + | name: tanzu-java-web-app
9 + | namespace: default
10 + |spec:
11 + | source:
12 + | git:
13 + | ref:
14 + | branch: main
15 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
16 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:To unset labels, use - after their name.
Example
tanzu apps workload apply tanzu-java-web-app --label stage-
π Update workload:
...
3, 3 |kind: Workload
4, 4 |metadata:
5, 5 | labels:
6, 6 | apps.tanzu.vmware.com/workload-type: web
7 - | stage: production
8, 7 | name: tanzu-java-web-app
9, 8 | namespace: default
10, 9 |spec:
11, 10 | source:
...
β Really update the workload "tanzu-java-web-app"? [yN]:The maximum CPU the workload pods are allowed to use.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --limit-cpu .2
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | resources:
11 + | limits:
12 + | cpu: 200m
13 + | source:
14 + | git:
15 + | ref:
16 + | branch: main
17 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
18 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:The maximum memory the workload pods are allowed to use.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --limit-memory 200Mi
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | resources:
11 + | limits:
12 + | memory: 200Mi
13 + | source:
14 + | git:
15 + | ref:
16 + | branch: main
17 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
18 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:Enable this to deploy the workload once, save changes to the code, and see those changes reflected within seconds in the workload running on the cluster.
Example
An example with a Spring Boot application:
-
Clone the repository by running:
git clone https://github.com/vmware-tanzu/application-accelerator-samples -
Change into the
tanzu-java-web-appdirectory. -
In
Tiltfile, first change theSOURCE_IMAGEvariable to use your registry and project. -
At the very end of the file add:
allow_k8s_contexts('your-cluster-name') -
Inside the directory, run:
tanzu apps workload apply tanzu-java-web-app --live-update --local-path . -s gcr.io/my-project/tanzu-java-web-app-live-update -yExpected output:
The files and directories listed in the .tanzuignore file are being excluded from the uploaded source code. Publishing source in "." to "gcr.io/my-project/tanzu-java-web-app-live-update"... π₯ Published source π Create workload: 1 + |--- 2 + |apiVersion: carto.run/v1alpha1 3 + |kind: Workload 4 + |metadata: 5 + | name: tanzu-java-web-app 6 + | namespace: default 7 + |spec: 8 + | params: 9 + | - name: live-update 10 + | value: "true" 11 + | source: 12 + | image: gcr.io/my-project/tanzu-java-web-app-live-update:latest@sha256:3c9fd738492a23ac532a709301fcf0c9aa2a8761b2b9347bdbab52ce9404264b π Created workload "tanzu-java-web-app" To see logs: "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h" To get status: "tanzu apps workload get tanzu-java-web-app"
-
Run Tilt to deploy the workload.
tilt up Tilt started on http://localhost:10350/ v0.23.6, built 2022-01-14 (space) to open the browser (s) to stream logs (--stream=true) (t) to open legacy terminal mode (--legacy=true) (ctrl-c) to exit Tilt started on http://localhost:10350/ v0.23.6, built 2022-01-14 Initial Build β’ (Tiltfile) Loading Tiltfile at: /path/to/repo/tanzu-java-web-app/Tiltfile Successfully loaded Tiltfile (1.500809ms) tanzu-java-wβ¦ β tanzu-java-wβ¦ β Initial Build β’ tanzu-java-web-app tanzu-java-wβ¦ β WARNING: Live Update failed with unexpected error: tanzu-java-wβ¦ β Cannot extract live updates on this build graph structure tanzu-java-wβ¦ β Falling back to a full image build + deploy tanzu-java-wβ¦ β STEP 1/1 β Deploying tanzu-java-wβ¦ β Objects applied to cluster: tanzu-java-wβ¦ β β tanzu-java-web-app:workload tanzu-java-wβ¦ β tanzu-java-wβ¦ β Step 1 - 8.87s (Deploying) tanzu-java-wβ¦ β DONE IN: 8.87s tanzu-java-wβ¦ β tanzu-java-wβ¦ β tanzu-java-wβ¦ β Tracking new pod rollout (tanzu-java-web-app-build-1-build-pod): tanzu-java-wβ¦ β β Scheduled - (β¦) Pending tanzu-java-wβ¦ β β Initialized - (β¦) Pending tanzu-java-wβ¦ β β Ready - (β¦) Pending ...
Sets the path to a source in the local machine from where the workload creates an image to use as an
application source. The local path may be a directory, a JAR, a ZIP, or a WAR file. Java/Spring Boot
compiled binaries are also supported. This flag must be used with --source-image flag.
**Note:**If Java/Spring compiled binary is passed instead of source code, the command will take less time to apply the workload since the build pack will skip the compiling steps and start uploading the image.
When working with local source code, you can exclude files from the source code to be uploaded within
the image by creating a file .tanzuignore at the root of the source code.
The .tanzuignore file contains a list of file paths to exclude from the image including the file itself.
The directories must not end with the system path separator (/ or \). If the file contains directories
that are not in the source code, they are ignored. Lines starting with a # hashtag are also ignored.
This artifact is an output of a Maven project build. This flag must be used with --maven-version
and --maven-group.
Example
tanzu apps workload apply petc-mvn --maven-artifact petc --maven-version 2.6.1 --maven-group demo.com
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | name: petc-mvn
6 + | namespace: default
7 + |spec:
8 + | params:
9 + | - name: maven
10 + | value:
11 + | artifactId: petc
12 + | groupId: demo.com
13 + | version: 2.6.1
β Do you want to create this workload? [yN]:This group identifies the project across all other Maven projects.
This specifies the type of artifact that the Maven project produces. This flag is optional,
and is set by default as jar by the supply chain.
Definition of the the current version of the Maven project.
Registry path where the local source code is uploaded as an image.
Example
tanzu apps workload apply spring-pet-clinic --local-path /home/user/workspace/spring-pet-clinic --source-image gcr.io/spring-community/spring-pet-clinic --type web
β Publish source in "/home/user/workspace/spring-pet-clinic" to "gcr.io/spring-community/spring-pet-clinic"? It may be visible to others who can pull images from that repository Yes
The files and/or directories listed in the .tanzuignore file are being excluded from the uploaded source code.
Publishing source in "/home/user/workspace/spring-pet-clinic" to "gcr.io/spring-community/spring-pet-clinic"...
π₯ Published source
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: spring-pet-clinic
8 + | namespace: default
9 + |spec:
10 + | source:
11 + | image:gcr.io/spring-community/spring-pet-clinic:latest@sha256:5feb0d9daf3f639755d8683ca7b647027cfddc7012e80c61dcdac27f0d7856a7
β Do you want to create this workload? [yN]:Specifies the namespace in which the workload is created or updated in.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --namespace my-namespace
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: my-namespace
9 + |spec:
10 + | source:
11 + | git:
12 + | ref:
13 + | branch: main
14 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
15 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:This flag can be used to retrieve a workload right after it's applied in the specified format (yaml, yml, json).
If used with --yes flag, all prompts are skipped and it only returns the workload definition.
It can also be used with --wait or --tail flags in order to return the workload with its status.
Example
tanzu apps workload apply rmq-sample-app --git-repo https://github.com/jhvhs/rabbitmq-sample --git-branch main --service-ref "rmq=rabbitmq.com/v1beta1:RabbitmqCluster:example-rabbitmq-cluster-1" --type web --output yaml
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: rmq-sample-app
8 + | namespace: default
9 + |spec:
10 + | serviceClaims:
11 + | - name: rmq
12 + | ref:
13 + | apiVersion: rabbitmq.com/v1beta1
14 + | kind: RabbitmqCluster
15 + | name: example-rabbitmq-cluster-1
16 + | source:
17 + | git:
18 + | ref:
19 + | branch: main
20 + | url: https://github.com/jhvhs/rabbitmq-sample
β Do you want to create this workload? [yN]: y
π Created workload "rmq-sample-app"
To see logs: "tanzu apps workload tail rmq-sample-app --timestamp --since 1h"
To get status: "tanzu apps workload get rmq-sample-app"
---
apiVersion: carto.run/v1alpha1
kind: Workload
metadata:
creationTimestamp: "2023-04-04T15:18:13Z"
generation: 1
labels:
apps.tanzu.vmware.com/workload-type: web
name: rmq-sample-app
namespace: default
resourceVersion: "184169566"
uid: 6588d398-b803-47e3-b31a-23d9a1a633a9
spec:
serviceClaims:
- name: rmq
ref:
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
name: example-rabbitmq-cluster-1
source:
git:
ref:
branch: main
url: https://github.com/jhvhs/rabbitmq-sample
status:
supplyChainRef: {}Additional parameters to be sent to the supply chain, the value is sent as a string. For complex YAML
and JSON objects use --param-yaml.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --param port=9090 --param management-port=9190
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | params:
11 + | - name: port
12 + | value: "9090"
13 + | - name: management-port
14 + | value: "9190"
15 + | source:
16 + | git:
17 + | ref:
18 + | branch: main
19 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
20 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:To unset parameters, use - after their name.
Example
tanzu apps workload apply tanzu-java-web-app --param port-
π Update workload:
...
7, 7 | name: tanzu-java-web-app
8, 8 | namespace: default
9, 9 |spec:
10, 10 | params:
11 - | - name: port
12 - | value: "9090"
13, 11 | - name: management-port
14, 12 | value: "9190"
15, 13 | source:
16, 14 | git:
...
β Really update the workload "tanzu-java-web-app"? [yN]:Additional parameters to be sent to the supply chain, the value is sent as a complex object.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --param-yaml server=$'port: 9090\nmanagement-port: 9190'
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | params:
11 + | - name: server
12 + | value:
13 + | management-port: 9190
14 + | port: 9090
15 + | source:
16 + | git:
17 + | ref:
18 + | branch: main
19 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
20 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:To unset parameters, use - after their name.
Example
tanzu apps workload apply tanzu-java-web-app --param-yaml server-
π Update workload:
...
6, 6 | apps.tanzu.vmware.com/workload-type: web
7, 7 | name: tanzu-java-web-app
8, 8 | namespace: default
9, 9 |spec:
10 - | params:
11 - | - name: server
12 - | value:
13 - | management-port: 9190
14 - | port: 9090
15, 10 | source:
16, 11 | git:
17, 12 | ref:
18, 13 | branch: main
...
β Really update the workload "tanzu-java-web-app"? [yN]:Refers to the path of the self-signed certificate needed for the custom/private registry.
This is also populated with a default value through environment variables. If the environment
variable TANZU_APPS_REGISTRY_CA_CERT is set, it's not necessary to use it in the command.
See Environment variables with default values to know the currently supported environment variables.
Example
tanzu apps workload apply my-workload --local-path . -s registry.url.nip.io/my-package/my-image --type web --registry-ca-cert path/to/cacert/mycert.nip.io.crt --registry-username my-username --registry-password my-password
β Publish source in "." to "registry.url.nip.io/my-package/my-image"? It may be visible to others who can pull images from that repository Yes
Publishing source in "." to "registry.url.nip.io/my-package/my-image"...
π₯ Published source
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: my-workload
8 + | namespace: default
9 + |spec:
10 + | source:
11 + | image: registry.url.nip.io/my-package/my-image:latest@sha256:caeb7e3a0e3ae0659f74d01095b6fdfe0d3c4a12856a15ac67ad6cd3b9e43648
β Do you want to create this workload? [yN]:If credentials are needed, the user name and password values are set through the --registry-password
flag. The value of this flag can also be specified through TANZU_APPS_REGISTRY_PASSWORD.
Used for token authentication in the private registry. This flag is set as
TANZU_APPS_REGISTRY_TOKEN envvar.
Often used with --registry-password to set private registry credentials. Can be provided using
TANZU_APPS_REGISTRY_USERNAME envvar to avoid setting it every time in the command.
Refers to the minimum CPU the workload pods are requesting to use.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --request-cpu .3
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | resources:
11 + | requests:
12 + | cpu: 300m
13 + | source:
14 + | git:
15 + | ref:
16 + | branch: main
17 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
18 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:Refers to the minimum memory the workload pods are requesting to use.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --request-memory 300Mi
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | resources:
11 + | requests:
12 + | memory: 300Mi
13 + | source:
14 + | git:
15 + | ref:
16 + | branch: main
17 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
18 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:Refers to the service account to be associated with the workload. A service account provides an identity for a workload object.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --service-account petc-serviceaccount
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | serviceAccountName: petc-serviceaccount
11 + | source:
12 + | git:
13 + | ref:
14 + | branch: main
15 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
16 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]:To unset a service account, pass empty string.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --service-account ""
π Update workload:
...
6, 6 | apps.tanzu.vmware.com/workload-type: web
7, 7 | name: tanzu-java-web-app
8, 8 | namespace: default
9, 9 |spec:
10 - | serviceAccountName: petc-serviceaccount
11, 10 | source:
12, 11 | git:
13, 12 | ref:
14, 13 | branch: main
...
β Really update the workload "tanzu-java-web-app"? [yN]:Binds a service to a workload to provide the information from a service resource to an application.
|>Note:| For more information see Tanzu Application Platform documentation.
Example
tanzu apps workload apply rmq-sample-app --git-repo https://github.com/jhvhs/rabbitmq-sample --git-branch main --service-ref "rmq=rabbitmq.com/v1beta1:RabbitmqCluster:example-rabbitmq-cluster-1"
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | name: rmq-sample-app
6 + | namespace: default
7 + |spec:
8 + | serviceClaims:
9 + | - name: rmq
10 + | ref:
11 + | apiVersion: rabbitmq.com/v1beta1
12 + | kind: RabbitmqCluster
13 + | name: example-rabbitmq-cluster-1
14 + | source:
15 + | git:
16 + | ref:
17 + | branch: main
18 + | url: https://github.com/jhvhs/rabbitmq-sample
β Do you want to create this workload? [yN]:To delete service binding, use the service name followed by -.
Example
tanzu apps workload apply rmq-sample-app --service-ref rmq-
π Update workload:
...
4, 4 |metadata:
5, 5 | name: rmq-sample-app
6, 6 | namespace: default
7, 7 |spec:
8 - | serviceClaims:
9 - | - name: rmq
10 - | ref:
11 - | apiVersion: rabbitmq.com/v1beta1
12 - | kind: RabbitmqCluster
13 - | name: example-rabbitmq-cluster-1
14, 8 | source:
15, 9 | git:
16, 10 | ref:
17, 11 | branch: main
...
β Really update the workload "rmq-sample-app"? [yN]:Defines which path is used as the root path to create and update the workload.
Example
-
Git repository
tanzu apps workload apply subpathtester --git-repo https://github.com/path-to-repo/my-repo --git-branch main --type web --sub-path my-subpath π Create workload: 1 + |--- 2 + |apiVersion: carto.run/v1alpha1 3 + |kind: Workload 4 + |metadata: 5 + | labels: 6 + | apps.tanzu.vmware.com/workload-type: web 7 + | name: subpathtester 8 + | namespace: default 9 + |spec: 10 + | source: 11 + | git: 12 + | ref: 13 + | branch: main 14 + | url: https://github.com/path-to-repo/my-repo 15 + | subPath: my-subpath β Do you want to create this workload? [yN]: -
Local path
-
In the directory of the project you want to create the workload from
tanzu apps workload apply my-workload --local-path . -s gcr.io/my-registry/my-workload-image --sub-path subpath_folder β Publish source in "." to "gcr.io/my-registry/my-workload-image"? It may be visible to others who can pull images from that repository Yes Publishing source in "." to "gcr.io/my-registry/my-workload-image"... π₯ Published source π Create workload: 1 + |--- 2 + |apiVersion: carto.run/v1alpha1 3 + |kind: Workload 4 + |metadata: 5 + | name: myworkload 6 + | namespace: default 7 + |spec: 8 + | source: 9 + | image: gcr.io/my-registry/my-workload-image:latest@sha256:f28c5fedd0e902800e6df9605ce5e20a8e835df9e87b1a0aa256666ea179fc3f 10 + | subPath: subpath_folder β Do you want to create this workload? [yN]:
-
Prints the logs of the workload creation in every step.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --tail
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | source:
11 + | git:
12 + | ref:
13 + | branch: main
14 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
15 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]: y
π Created workload "tanzu-java-web-app"
To see logs: "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-java-web-app"
Waiting for workload "tanzu-java-web-app" to become ready...
+ tanzu-java-web-app-build-1-build-pod βΊ prepare
tanzu-java-web-app-build-1-build-pod[prepare] Build reason(s): CONFIG
tanzu-java-web-app-build-1-build-pod[prepare] CONFIG:
tanzu-java-web-app-build-1-build-pod[prepare] + env:
tanzu-java-web-app-build-1-build-pod[prepare] + - name: BP_OCI_SOURCE
tanzu-java-web-app-build-1-build-pod[prepare] + value: main/d381fb658cb435a04e2271ca85bd3e8627a5e7e4
tanzu-java-web-app-build-1-build-pod[prepare] resources: {}
tanzu-java-web-app-build-1-build-pod[prepare] - source: {}
tanzu-java-web-app-build-1-build-pod[prepare] + source:
tanzu-java-web-app-build-1-build-pod[prepare] + blob:
tanzu-java-web-app-build-1-build-pod[prepare] + url: http://source-controller.flux-system.svc.cluster.local./gitrepository/default/tanzu-java-web-app/1c4cf82e499f7e46da182922d4097908d4817320.tar.gz
...
...
...Prints the logs of the workload creation in every step adding the time in which the log is occurring.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --tail-timestamp
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | source:
11 + | git:
12 + | ref:
13 + | branch: main
14 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
15 + | subPath: tanzu-java-web-app
β Do you want to create this workload? [yN]: y
π Created workload "tanzu-java-web-app"
To see logs: "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-java-web-app"
Waiting for workload "tanzu-java-web-app" to become ready...
+ tanzu-java-web-app-build-1-build-pod βΊ prepare
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.348418803-05:00 Build reason(s): CONFIG
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.364719405-05:00 CONFIG:
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.364761781-05:00 + env:
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.364771861-05:00 + - name: BP_OCI_SOURCE
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.364781718-05:00 + value: main/d381fb658cb435a04e2271ca85bd3e8627a5e7e4
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.364788374-05:00 resources: {}
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.364795451-05:00 - source: {}
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.365344965-05:00 + source:
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.365364101-05:00 + blob:
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.365372427-05:00 + url: http://source-controller.flux-system.svc.cluster.local./gitrepository/default/tanzu-java-web-app/1c4cf82e499f7e46da182922d4097908d4817320.tar.gz
...
...
...Sets the type of the workload by adding the label apps.tanzu.vmware.com/workload-type, which is used
as a matcher by supply chains. Use TANZU_APPS_TYPE envvar to have a default value for this flag.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: tanzu-java-web-app
8 + | namespace: default
9 + |spec:
10 + | source:
11 + | git:
12 + | ref:
13 + | branch: main
14 + | url: https://github.com/vmware-tanzu/application-accelerator-samples
15 + | subPath: tanzu-java-web-appSpecifies if the update from file should be done by replacing the current workload or merging it. Defaults to merge.
Example
Assuming there is a workload created from a file, which has in its spec the following:
...
spec:
resources:
requests:
memory: 1Gi
limits: # delete this line
memory: 1Gi # delete this line
cpu: 500m # delete this line
...If the workload file is changed as specified in the comments, there are two ways to update the workload running in the cluster.
One, with merge update strategy.
tanzu apps workload apply -f ./spring-petclinic.yaml # defaulting to merge
β WARNING: Configuration file update strategy is changing. By default, provided configuration files will replace rather than merge existing configuration. The change will take place in the January 2024 TAP release (use "--update-strategy" to control strategy explicitly).
Workload is unchanged, skipping updateThe other, with replace update strategy, which will completely overwrite the workload in the cluster according to the new specifications in the file.
tanzu apps workload apply -f ./spring-petclinic.yaml --update-strategy replace
β WARNING: Configuration file update strategy is changing. By default, provided configuration files will replace rather than merge existing configuration. The change will take place in the January 2024 TAP release (use "--update-strategy" to control strategy explicitly).
π Update workload:
...
8, 8 | name: spring-petclinic
9, 9 | namespace: default
10, 10 |spec:
11, 11 | resources:
12 - | limits:
13 - | cpu: 500m
14 - | memory: 1Gi
15, 12 | requests:
16, 13 | memory: 1Gi
17, 14 | source:
18, 15 | git:
...
β Really update the workload "spring-petclinic"? [yN]:Holds the command until the workload is ready.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-1.5.0 --type web --wait
π Update workload:
...
10, 10 | source:
11, 11 | git:
12, 12 | ref:
13, 13 | branch: main
14 + | tag: tap-1.5.0
14, 15 | url: https://github.com/vmware-tanzu/application-accelerator-samples
15, 16 | subPath: tanzu-java-web-app
β Really update the workload "tanzu-java-web-app"? Yes
π Updated workload "tanzu-java-web-app"
To see logs: "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-java-web-app"
Waiting for workload "tanzu-java-web-app" to become ready...
Workload "tanzu-java-web-app" is readySets a timeout to wait for the workload to become ready.
Example
tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-1.5.0-take1 --type web --wait --wait-timeout 1m
π Update workload:
...
10, 10 | source:
11, 11 | git:
12, 12 | ref:
13, 13 | branch: main
14 - | tag: tap-1.5.0
14 + | tag: tap-1.5.0-take1
15, 15 | url: https://github.com/vmware-tanzu/application-accelerator-samples
16, 16 | subPath: tanzu-java-web-app
β Really update the workload "tanzu-java-web-app"? Yes
π Updated workload "tanzu-java-web-app"
To see logs: "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-java-web-app"
Waiting for workload "tanzu-java-web-app" to become ready...
Workload "tanzu-java-web-app" is readyAssumes yes on all the survey prompts.
Example
tanzu apps workload apply spring-pet-clinic --local-path/home/user/workspace/spring-pet-clinic --source-image gcr.io/spring-community/spring-pet-clinic --type web -y
The files and/or directories listed in the .tanzuignore file are being excluded from the uploaded source code.
Publishing source in "/Users/dalfonso/Documents/src/java/tanzu-java-web-app" to "gcr.io/spring-community/spring-pet-clinic"...
π₯ Published source
π Create workload:
1 + |---
2 + |apiVersion: carto.run/v1alpha1
3 + |kind: Workload
4 + |metadata:
5 + | labels:
6 + | apps.tanzu.vmware.com/workload-type: web
7 + | name: spring-pet-clinic
8 + | namespace: default
9 + |spec:
10 + | source:
11 + | image: gcr.io/spring-community/spring-pet-clinic:latest@sha256:5feb0d9daf3f639755d8683ca7b647027cfddc7012e80c61dcdac27f0d7856a7
π Created workload "spring-pet-clinic"
To see logs: "tanzu apps workload tail spring-pet-clinic --timestamp --since 1h"
To get status: "tanzu apps workload get spring-pet-clinic"