Resource definitions

This section describes the set of valid resource types that can be managed through calicoctl or kubectl.

While resources may be supplied in YAML or JSON format, this guide provides examples in YAML.

Overview of resource structure

The calicoctl commands for resource management (create, apply, delete, replace, get) all take resource manifests as input.

Each manifest may contain a single resource (e.g. a profile resource), or a list of multiple resources (e.g. a profile and two hostEndpoint resources).

The general structure of a single resource is as follows:

  1. apiVersion: projectcalico.org/v3
  2. kind: <type of resource>
  3. metadata:
  4. # Identifying information
  5. name: <name of resource>
  6. ...
  7. spec:
  8. # Specification of the resource
  9. ...

Schema

FieldDescriptionAccepted ValuesSchema
apiVersionIndicates the version of the API that the data corresponds to.projectcalico.org/v3string
kindSpecifies the type of resource described by the YAML document.kind
metadataContains information used to uniquely identify the particular instance of the resource.map
specContains the resource specification.map

Supported kinds

The following resources are supported:

Resource name requirements

Every resource must have the name field specified. Name must be unique within a namespace. Name required when creating resources, and cannot be updated. A valid resource name can have alphanumeric characters with optional ., _, or -. of up to 128 characters total.

Multiple resources in a single file

A file may contain multiple resource documents specified in a YAML list format. For example, the following is the contents of a file containing two HostEndpoint resources:

  1. - apiVersion: projectcalico.org/v3
  2. kind: HostEndpoint
  3. metadata:
  4. name: endpoint1
  5. labels:
  6. type: database
  7. spec:
  8. interface: eth0
  9. node: host1
  10. profiles:
  11. - prof1
  12. - prof2
  13. expectedIPs:
  14. - 1.2.3.4
  15. - '00:bb::aa'
  16. - apiVersion: projectcalico.org/v3
  17. kind: HostEndpoint
  18. metadata:
  19. name: endpoint2
  20. labels:
  21. type: frontend
  22. spec:
  23. interface: eth1
  24. node: host1
  25. profiles:
  26. - prof1
  27. - prof2
  28. expectedIPs:
  29. - 1.2.3.5