1"use strict";(self.webpackChunktigera_docs=self.webpackChunktigera_docs||[]).push([["2070"],{88887:function(e,r,n){n.r(r),n.d(r,{frontMatter:()=>o,toc:()=>a,default:()=>h,metadata:()=>i,assets:()=>l,contentTitle:()=>t});var i=JSON.parse('{"id":"reference/resources/overview","title":"Resource definitions","description":"Calico resources (APIs) that you can manage using calicoctl.","source":"@site/calico_versioned_docs/version-3.28/reference/resources/overview.mdx","sourceDirName":"reference/resources","slug":"/reference/resources/overview","permalink":"/calico/3.28/reference/resources/overview","draft":false,"unlisted":false,"editUrl":"https://github.com/tigera/docs/edit/main/calico_versioned_docs/version-3.28/reference/resources/overview.mdx","tags":[],"version":"3.28","frontMatter":{"description":"Calico resources (APIs) that you can manage using calicoctl."},"sidebar":"calicoSidebar","previous":{"title":"Resource definitions","permalink":"/calico/3.28/reference/resources/"},"next":{"title":"BGP configuration","permalink":"/calico/3.28/reference/resources/bgpconfig"}}'),s=n(37937),c=n(17869);let o={description:"Calico resources (APIs) that you can manage using calicoctl."},t="Resource definitions",l={},a=[{value:"Overview of resource structure",id:"overview-of-resource-structure",level:2},{value:"Schema",id:"schema",level:3},{value:"Supported kinds",id:"supported-kinds",level:3},{value:"Resource name requirements",id:"resource-name-requirements",level:3},{value:"Multiple resources in a single file",id:"multiple-resources-in-a-single-file",level:3}];function d(e){let r={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,c.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.header,{children:(0,s.jsx)(r.h1,{id:"resource-definitions",children:"Resource definitions"})}),"\n",(0,s.jsxs)(r.p,{children:["This section describes the set of valid resource types that can be managed\nthrough ",(0,s.jsx)(r.code,{children:"calicoctl"})," or ",(0,s.jsx)(r.code,{children:"kubectl"}),"."]}),"\n",(0,s.jsx)(r.p,{children:"While resources may be supplied in YAML or JSON format, this guide provides examples in YAML."}),"\n",(0,s.jsx)(r.h2,{id:"overview-of-resource-structure",children:"Overview of resource structure"}),"\n",(0,s.jsx)(r.p,{children:"The calicoctl commands for resource management (create, apply, delete, replace, get)\nall take resource manifests as input."}),"\n",(0,s.jsx)(r.p,{children:"Each manifest may contain a single resource\n(e.g. a profile resource), or a list of multiple resources (e.g. a profile and two\nhostEndpoint resources)."}),"\n",(0,s.jsx)(r.p,{children:"The general structure of a single resource is as follows:"}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-yaml",metastring:"noValidation",children:"apiVersion: projectcalico.org/v3\nkind: <type of resource>\nmetadata:\n # Identifying information\n name: <name of resource>\n ...\nspec:\n # Specification of the resource\n ...\n"})}),"\n",(0,s.jsx)(r.h3,{id:"schema",children:"Schema"}),"\n",(0,s.jsxs)(r.table,{children:[(0,s.jsx)(r.thead,{children:(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.th,{children:"Field"}),(0,s.jsx)(r.th,{children:"Description"}),(0,s.jsx)(r.th,{children:"Accepted Values"}),(0,s.jsx)(r.th,{children:"Schema"})]})}),(0,s.jsxs)(r.tbody,{children:[(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.td,{children:"apiVersion"}),(0,s.jsx)(r.td,{children:"Indicates the version of the API that the data corresponds to."}),(0,s.jsx)(r.td,{children:"projectcalico.org/v3"}),(0,s.jsx)(r.td,{children:"string"})]}),(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.td,{children:"kind"}),(0,s.jsx)(r.td,{children:"Specifies the type of resource described by the YAML document."}),(0,s.jsx)(r.td,{}),(0,s.jsx)(r.td,{children:(0,s.jsx)(r.a,{href:"#supported-kinds",children:"kind"})})]}),(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.td,{children:"metadata"}),(0,s.jsx)(r.td,{children:"Contains information used to uniquely identify the particular instance of the resource."}),(0,s.jsx)(r.td,{}),(0,s.jsx)(r.td,{children:"map"})]}),(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.td,{children:"spec"}),(0,s.jsx)(r.td,{children:"Contains the resource specification."}),(0,s.jsx)(r.td,{}),(0,s.jsx)(r.td,{children:"map"})]})]})]}),"\n",(0,s.jsx)(r.h3,{id:"supported-kinds",children:"Supported kinds"}),"\n",(0,s.jsx)(r.p,{children:"The following resources are supported:"}),"\n",(0,s.jsxs)(r.ul,{children:["\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"/calico/3.28/reference/resources/bgpconfig",children:"BGPConfiguration"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"/calico/3.28/reference/resources/bgppeer",children:"BGPPeer"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"/calico/3.28/reference/resources/felixconfig",children:"FelixConfiguration"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"/calico/3.28/reference/resources/globalnetworkpolicy",children:"GlobalNetworkPolicy"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"/calico/3.28/reference/resources/globalnetworkset",children:"GlobalNetworkSet"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"/calico/3.28/reference/resources/hostendpoint",children:"HostEndpoint"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"/calico/3.28/reference/resources/ippool",children:"IPPool"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"/calico/3.28/reference/resources/networkpolicy",children:"NetworkPolicy"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"/calico/3.28/reference/resources/networkset",children:"NetworkSet"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"/calico/3.28/reference/resources/node",children:"Node"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"/calico/3.28/reference/resources/profile",children:"Profile"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"/calico/3.28/reference/resources/workloadendpoint",children:"WorkloadEndpoint"})}),"\n"]}),"\n",(0,s.jsx)(r.h3,{id:"resource-name-requirements",children:"Resource name requirements"}),"\n",(0,s.jsxs)(r.p,{children:["Every resource must have the ",(0,s.jsx)(r.code,{children:"name"})," field specified. Name must be unique within a namespace.\nName required when creating resources, and cannot be updated.\nA valid resource name can have alphanumeric characters with optional ",(0,s.jsx)(r.code,{children:"."}),", ",(0,s.jsx)(r.code,{children:"_"}),", or ",(0,s.jsx)(r.code,{children:"-"}),". of up to 128 characters total."]}),"\n",(0,s.jsx)(r.h3,{id:"multiple-resources-in-a-single-file",children:"Multiple resources in a single file"}),"\n",(0,s.jsxs)(r.p,{children:["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 ",(0,s.jsx)(r.code,{children:"HostEndpoint"})," resources:"]}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-yaml",children:"- apiVersion: projectcalico.org/v3\n kind: HostEndpoint\n metadata:\n name: endpoint1\n labels:\n type: database\n spec:\n interface: eth0\n node: host1\n profiles:\n - prof1\n - prof2\n expectedIPs:\n - 1.2.3.4\n - '00:bb::aa'\n- apiVersion: projectcalico.org/v3\n kind: HostEndpoint\n metadata:\n name: endpoint2\n labels:\n type: frontend\n spec:\n interface: eth1\n node: host1\n profiles:\n - prof1\n - prof2\n expectedIPs:\n - 1.2.3.5\n"})})]})}function h(e={}){let{wrapper:r}={...(0,c.R)(),...e.components};return r?(0,s.jsx)(r,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},17869:function(e,r,n){n.d(r,{R:()=>o,x:()=>t});var i=n(82645);let s={},c=i.createContext(s);function o(e){let r=i.useContext(c);return i.useMemo(function(){return"function"==typeof e?e(r):{...r,...e}},[r,e])}function t(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),i.createElement(c.Provider,{value:r},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.