Component schema

The basic schema for a Dapr component

Dapr defines and registers components using a CustomResourceDefinition. All components are defined as a CRD and can be applied to any hosting environment where Dapr is running, not just Kubernetes.

Format

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: [COMPONENT-NAME]
  5. namespace: [COMPONENT-NAMESPACE]
  6. spec:
  7. type: [COMPONENT-TYPE]
  8. version: v1
  9. initTimeout: [TIMEOUT-DURATION]
  10. ignoreErrors: [BOOLEAN]
  11. metadata:
  12. - name: [METADATA-NAME]
  13. value: [METADATA-VALUE]

Fields

FieldRequiredDetailsExample
apiVersionYThe version of the Dapr (and Kubernetes if applicable) API you are callingdapr.io/v1alpha1
kindYThe type of CRD. For components is must always be ComponentComponent
metadata-Information about the component registration
metadata.nameYThe name of the componentprod-statestore
metadata.namespaceNThe namespace for the component for hosting environments with namespacesmyapp-namespace
spec-Detailed information on the component resource
spec.typeYThe type of the componentstate.redis
spec.versionYThe version of the componentv1
spec.initTimeoutNThe timeout duration for the initialization of the component. Default is 30s5m, 1h, 20s
spec.ignoreErrorsNTells the Dapr sidecar to continue initialization if the component fails to load. Default is falsefalse
spec.metadata-A key/value pair of component specific configuration. See your component definition for fields

Further reading

Last modified February 16, 2021: Merge pull request #1235 from dapr/update-v0.11 (b4e9fbb)