Built-in trait types

The platform provides built-in support for the following trait definitions. You may use any of the trait definitions to modify aspects of the defined components. This enables customization of the components without altering their structure. For example, adding an ingress to a component can be done with traits instead of changing the component definition.

Exposing services

Trait type Description
napptive-ingress Expose a component to the outside with a K8s ingress.
gateway Expose a component to the outside with a K8s ingress.

Modifying generated resources

Trait type Description
annotations Add annotations to the generated K8s pods.
labels Add labels to the generated K8s pods.
env Add environments variables to the container
env-from Add environments variables from configmaps or secrets to the container
resource Add resource requests a limits to manage the quota.
container-image Set the container image to be used.
command Modify the command that will be launched by the container.
json-merge-patch Patch the generated component using JSON with a merge patch strategy.
json-patch Patch the generated component using JSON
lifecycle Add lifecycle hooks to every container in the component.
service-binding Bind secrets and configmaps to a component.
storage Add storage to a component
security-context Specify the security context for the containers that will be deployed on Kubernetes.

Adding containers

Trait type Description
init-container Add an init-container to the component using a shared volume.
sidecar Attach a sidecar to a component

Scaling components

Trait type Description
cpuscaler Automatically scale the component based on CPU usage
scaler Set a fixed number of replicas for a component.
stop Manually stop a component to reduce the quota utilization.

Playground traits

Trait type Description
kubeconfig-injector Inject the kubeconfig file that connects with the environment the application is deployed on. The kubeconfig file can be used with kubectl or the standard Kubernetes API.
playground-injector Inject the Playground CLI. This trait allows you to manage your Napptive account inside the component

What’s next