Convention Resources

The convention controller is open to extension. These resources are typically consumed by platform developers and operators rather than by application developers.

Convention Service Resources

There are several resources involved in the application of conventions to workloads.

API Structure

The PodConventionContext API object in the webhooks.conventions.apps.tanzu.vmware.com API group is the structure used for both request and response from the convention server.

Template Status

The enriched PodTemplateSpec is reflected at .status.template. For more information about PodTemplateSpec, see the Kubernetes documentation.

Chaining Multiple Conventions

You can define multiple ClusterPodConventions and apply them to different types of workloads. You can also apply multiple conventions to a single workload.

The PodIntent reconciler lists all ClusterPodConvention resources and applies them serially. To ensure the consistency of enriched PodTemplateSpec, the list of ClusterPodConventionsis sorted alphabetically by name before applying conventions. You can use strategic naming to control the order in which the conventions are applied.

After the conventions are applied, the Ready status condition on the PodIntent resource is used to indicate whether it is applied successfully. A list of all applied conventions is stored under the annotation conventions.apps.tanzu.vmware.com/applied-conventions.

Collecting Logs from the Controller

The convention controller is a Kubernetes operator and can be deployed in a cluster with other components. If you have trouble, you can retrieve and examine the logs from the controller to help identify issues.

To retrieve Pod logs from the conventions-controller-manager running in the conventions-system namespace:

kubectl -n conventions-system logs -l control-plane=controller-manager

For example:

...
{"level":"info","ts":1637073467.3334172,"logger":"controllers.PodIntent.PodIntent.ApplyConventions","msg":"applied convention","diff":"  interface{}(\n- \ts\"&PodTemplateSpec{ObjectMeta:{      0 0001-01-01 00:00:00 +0000 UTC <nil> <nil> map[app.kubernetes.io/component:run app.kubernetes.io/part-of:spring-petclinic-app-db carto.run/workload-name:spring-petclinic-app-db] map[developer.conventions/target-container\"...,\n+ \tv1.PodTemplateSpec{\n+ \t\tObjectMeta: v1.ObjectMeta{\n+ \t\t\tLabels: map[string]string{\n+ \t\t\t\t\"app.kubernetes.io/component\": \"run\",\n+ \t\t\t\t\"app.kubernetes.io/part-of\":   \"spring-petclinic-app-db\",\n+ \t\t\t\t\"carto.run/workload-name\":     \"spring-petclinic-app-db\",\n+ \t\t\t\t\"tanzu.app.live.view\":         \"true\",\n+ \t\t\t\t...\n+ \t\t\t},\n+ \t\t\tAnnotations: map[string]string{\"developer.conventions/target-containers\": \"workload\"},\n+ \t\t},\n+ \t\tSpec: v1.PodSpec{Containers: []v1.Container{{...}}, ServiceAccountName: \"default\"},\n+ \t},\n  )\n","convention":"appliveview-sample"}
...

References

check-circle-line exclamation-circle-line close-line
Scroll to top icon