Version: v1.0
Labels and Annotations
List Traits
The label and annotations traits allows you to append labels and annotations to the component.
# myapp.yamlapiVersion: core.oam.dev/v1beta1kind: Applicationmetadata:name: myappspec:components:- name: express-servertype: webserviceproperties:image: crccheck/hello-worldport: 8000traits:- type: labelsproperties:"release": "stable"- type: annotationsproperties:"description": "web application"
Deploy this application.
kubectl apply -f myapp.yaml
On runtime cluster, check the workload has been created successfully.
$ kubectl get deploymentsNAME READY UP-TO-DATE AVAILABLE AGEexpress-server 1/1 1 1 15s
Check the labels.
$ kubectl get deployments express-server -o jsonpath='{.spec.template.metadata.labels}'{"app.oam.dev/component":"express-server","release": "stable"}
Check the annotations.
$ kubectl get deployments express-server -o jsonpath='{.spec.template.metadata.annotations}'{"description":"web application"}