PageSourceSearch

https://archive-ce-3-20.netlify.app/assets/js/8f9192e0.c3b03836.js

js archive-ce-3-20.netlify.app collected 2026-10-03 10:27:57 UTC 48,955 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunktigera_docs=self.webpackChunktigera_docs||[]).push([["102"],{49596(e,s,n){n.d(s,{Ay:()=>c,RM:()=>i});var r=n(70689),t=n(3413);let i=[];function d(e){let s={code:"code",li:"li",p:"p",strong:"strong",ul:"ul",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.p,{children:["When a configured domain name has no wildcard (",(0,r.jsx)(s.code,{children:"*"}),"), it matches exactly that domain name. For example:"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:"microsoft.com"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:"tigera.io"})}),"\n"]}),"\n",(0,r.jsx)(s.p,{children:"With a single asterisk in any part of the domain name, it matches 1 or more path components at that position. For example:"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"*.google.com"})," matches ",(0,r.jsx)(s.code,{children:"www.google.com"})," and ",(0,r.jsx)(s.code,{children:"www.ipv6.google.com"}),", but not ",(0,r.jsx)(s.code,{children:"google.com"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"www.*.com"})," matches ",(0,r.jsx)(s.code,{children:"www.sun.com"})," and ",(0,r.jsx)(s.code,{children:"www.apple.com"}),", but not ",(0,r.jsx)(s.code,{children:"www.com"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"update.*.mycompany.com"})," matches ",(0,r.jsx)(s.code,{children:"update.tools.mycompany.com"}),", ",(0,r.jsx)(s.code,{children:"update.secure.suite.mycompany.com"}),", and so on"]}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.strong,{children:"Not"})," supported are:"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["Multiple wildcards in the same domain, for example: ",(0,r.jsx)(s.code,{children:"*.*.mycompany.com"})]}),"\n",(0,r.jsxs)(s.li,{children:["Asterisks that are not the entire component, for example: ",(0,r.jsx)(s.code,{children:"www.g*.com"})]}),"\n",(0,r.jsxs)(s.li,{children:["A wildcard as the last component, for example: ",(0,r.jsx)(s.code,{children:"www.mycompany.*"})]}),"\n",(0,r.jsx)(s.li,{children:"More general wildcards, such as regular expressions"}),"\n"]})]})}function c(e={}){let{wrapper:s}={...(0,t.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},2144(e,s,n){n.d(s,{Ay:()=>l,RM:()=>d});var r=n(70689),t=n(3413),i=n(49596);let d=[{value:"Selector performance in EntityRules",id:"selector-performance-in-entityrules",level:4},{value:"Exact and wildcard domain names",id:"exact-and-wildcard-domain-names",level:3},...i.RM];function c(e){let s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.p,{children:"Entity rules specify the attributes of the source or destination of a packet that must match for the rule as a whole\nto match. Packets can be matched on combinations of:"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["Identity of the source/destination, by using ",(0,r.jsx)(s.a,{href:"#selectors",children:"Selectors"})," or by specifying a particular\nKubernetes ",(0,r.jsx)(s.code,{children:"Service"}),". Selectors can match ",(0,r.jsx)(s.a,{href:"/calico-enterprise/3.20/reference/resources/workloadendpoint",children:"workload endpoints"}),",\n",(0,r.jsx)(s.a,{href:"/calico-enterprise/3.20/reference/resources/hostendpoint",children:"host endpoints"})," and (",(0,r.jsx)(s.a,{href:"/calico-enterprise/3.20/reference/resources/networkset",children:"namespaced"})," or\n",(0,r.jsx)(s.a,{href:"/calico-enterprise/3.20/reference/resources/globalnetworkset",children:"global"}),") network sets."]}),"\n",(0,r.jsx)(s.li,{children:"Source/destination IP address, protocol and port."}),"\n"]}),"\n",(0,r.jsx)(s.p,{children:"If the rule contains multiple match criteria (for example, an IP and a port) then all match criteria must match\nfor the rule as a whole to match a packet."}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Field"}),(0,r.jsx)(s.th,{children:"Description"}),(0,r.jsx)(s.th,{children:"Accepted Values"}),(0,r.jsx)(s.th,{children:"Schema"}),(0,r.jsx)(s.th,{children:"Default"})]})}),(0,r.jsxs)(s.tbody,{children:[(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"nets"}),(0,r.jsx)(s.td,{children:"Match packets with IP in any of the listed CIDRs."}),(0,r.jsx)(s.td,{children:"List of valid IPv4 CIDRs or list of valid IPv6 CIDRs (IPv4 and IPv6 CIDRs shouldn't be mixed in one rule)"}),(0,r.jsx)(s.td,{children:"list of cidrs"}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"notNets"}),(0,r.jsx)(s.td,{children:"Negative match on CIDRs. Match packets with IP not in any of the listed CIDRs."}),(0,r.jsx)(s.td,{children:"List of valid IPv4 CIDRs or list of valid IPv6 CIDRs (IPv4 and IPv6 CIDRs shouldn't be mixed in one rule)"}),(0,r.jsx)(s.td,{children:"list of cidrs"}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"selector"}),(0,r.jsxs)(s.td,{children:["Positive match on selected endpoints. If a ",(0,r.jsx)(s.code,{children:"namespaceSelector"})," is also defined, the set of endpoints this applies to is limited to the endpoints in the selected namespaces."]}),(0,r.jsx)(s.td,{children:"Valid selector"}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.a,{href:"#selector",children:"selector"})}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"notSelector"}),(0,r.jsxs)(s.td,{children:["Negative match on selected endpoints. If a ",(0,r.jsx)(s.code,{children:"namespaceSelector"})," is also defined, the set of endpoints this applies to is limited to the endpoints in the selected namespaces."]}),(0,r.jsx)(s.td,{children:"Valid selector"}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.a,{href:"#selector",children:"selector"})}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"namespaceSelector"}),(0,r.jsxs)(s.td,{children:["Positive match on selected namespaces. If specified, only workload endpoints in the selected Kubernetes namespaces are matched. Matches namespaces based on the labels that have been applied to the namespaces. Defines the scope that selectors will apply to, if not defined then selectors apply to the NetworkPolicy's namespace. Match a specific namespace by name using the ",(0,r.jsx)(s.code,{children:"projectcalico.org/name"})," label. Select the non-namespaced resources like GlobalNetworkSet(s), host endpoints to which this policy applies by using ",(0,r.jsx)(s.code,{children:"global()"})," selector."]}),(0,r.jsx)(s.td,{children:"Valid selector"}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.a,{href:"#selector",children:"selector"})}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"ports"}),(0,r.jsx)(s.td,{children:"Positive match on the specified ports"}),(0,r.jsx)(s.td,{}),(0,r.jsxs)(s.td,{children:["list of ",(0,r.jsx)(s.a,{href:"#ports",children:"ports"})]}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"domains"}),(0,r.jsxs)(s.td,{children:["Positive match on ",(0,r.jsx)(s.a,{href:"#exact-and-wildcard-domain-names",children:"domain names"}),"."]}),(0,r.jsxs)(s.td,{children:["List of ",(0,r.jsx)(s.a,{href:"#exact-and-wildcard-domain-names",children:"exact or wildcard domain names"})]}),(0,r.jsx)(s.td,{children:"list of strings"}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"notPorts"}),(0,r.jsx)(s.td,{children:"Negative match on the specified ports"}),(0,r.jsx)(s.td,{}),(0,r.jsxs)(s.td,{children:["list of ",(0,r.jsx)(s.a,{href:"#ports",children:"ports"})]}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"serviceAccounts"}),(0,r.jsxs)(s.td,{children:["Match endpoints running under service accounts. If a ",(0,r.jsx)(s.code,{children:"namespaceSelector"})," is also defined, the set of service accounts this applies to is limited to the service accounts in the selected namespaces."]}),(0,r.jsx)(s.td,{}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.a,{href:"#serviceaccountmatch",children:"ServiceAccountMatch"})}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"services"}),(0,r.jsx)(s.td,{children:"Match the specified service(s). If specified on egress rule destinations, no other selection criteria can be set. If specified on ingress rule sources, only positive or negative matches on ports can be specified."}),(0,r.jsx)(s.td,{}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.a,{href:"#servicematch",children:"ServiceMatch"})}),(0,r.jsx)(s.td,{})]})]})]}),"\n",(0,r.jsx)(s.admonition,{type:"note",children:(0,r.jsxs)(s.p,{children:["You cannot mix IPv4 and IPv6 CIDRs in a single rule using ",(0,r.jsx)(s.code,{children:"nets"})," or ",(0,r.jsx)(s.code,{children:"notNets"}),". If you need to match both, create 2 rules."]})}),"\n",(0,r.jsx)(s.h4,{id:"selector-performance-in-entityrules",children:"Selector performance in EntityRules"}),"\n",(0,r.jsx)(s.p,{children:"When rendering policy into the data plane, Calico Enterprise must identify the endpoints that match the selectors\nin all active rules.  This calculation is optimized for certain common selector types.\nUsing the optimized selector types reduces CPU usage (and policy rendering time) by orders of magnitude.\nThis becomes important at high scale (hundreds of active rules, hundreds of thousands of endpoints)."}),"\n",(0,r.jsx)(s.p,{children:"The optimized operators are as follows:"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:'label == "value"'})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:"label in { 'v1', 'v2' }"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:"has(label)"})}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"<expression 1> && <expression 2>"})," is optimized if ",(0,r.jsx)(s.strong,{children:"either"})," ",(0,r.jsx)(s.code,{children:"<expression 1>"})," or ",(0,r.jsx)(s.code,{children:"<expression 2>"})," is\noptimized."]}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["The following perform like ",(0,r.jsx)(s.code,{children:"has(label)"}),".  All endpoints with the label will be scanned to find matches:"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:"label contains 's'"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:"label starts with 's'"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:"label ends with 's'"})}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["The other operators, and in particular, ",(0,r.jsx)(s.code,{children:"all()"}),", ",(0,r.jsx)(s.code,{children:"!"}),", ",(0,r.jsx)(s.code,{children:"||"})," and ",(0,r.jsx)(s.code,{children:"!="})," are not optimized."]}),"\n",(0,r.jsx)(s.p,{children:"Examples:"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"a == 'b'"})," - optimized"]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"a == 'b' && has(c)"})," - optimized"]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"a == 'b' || has(c)"})," - ",(0,r.jsx)(s.strong,{children:"not"})," optimized due to use of ",(0,r.jsx)(s.code,{children:"||"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"c != 'd'"})," - ",(0,r.jsx)(s.strong,{children:"not"})," optimized due to use of ",(0,r.jsx)(s.code,{children:"!="})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"!has(a)"})," - ",(0,r.jsx)(s.strong,{children:"not"})," optimized due to use of ",(0,r.jsx)(s.code,{children:"!"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"a == 'b' && c != 'd'"})," - optimized, ",(0,r.jsx)(s.code,{children:"a =='b'"})," is optimized so ",(0,r.jsx)(s.code,{children:"a == 'b' && <anything>"})," is optimized."]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"c != 'd' && a == 'b'"})," - optimized, ",(0,r.jsx)(s.code,{children:"a =='b'"})," is optimized so ",(0,r.jsx)(s.code,{children:"<anything> && a == 'b'"})," is optimized."]}),"\n"]}),"\n",(0,r.jsx)(s.h3,{id:"exact-and-wildcard-domain-names",children:"Exact and wildcard domain names"}),"\n",(0,r.jsxs)(s.p,{children:["The ",(0,r.jsx)(s.code,{children:"domains"})," field is only valid for egress Allow rules. It restricts the\nrule to apply only to traffic to one of the specified domains. If this field is specified, the\nparent ",(0,r.jsx)(s.a,{href:"#rule",children:"Rule"}),"'s ",(0,r.jsx)(s.code,{children:"action"})," must be ",(0,r.jsx)(s.code,{children:"Allow"}),", and ",(0,r.jsx)(s.code,{children:"nets"})," and ",(0,r.jsx)(s.code,{children:"selector"})," must both be left empty."]}),"\n",(0,r.jsx)(i.Ay,{}),"\n",(0,r.jsx)(s.admonition,{type:"note",children:(0,r.jsx)(s.p,{children:"Calico Enterprise implements policy for domain names by learning the\ncorresponding IPs from DNS, then programming rules to allow those IPs. This means that\nif multiple domain names A, B and C all map to the same IP, and there is domain-based\npolicy to allow A, traffic to B and C will be allowed as well."})})]})}function l(e={}){let{wrapper:s}={...(0,t.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},87784(e,s,n){n.d(s,{Ay:()=>c,RM:()=>i});var r=n(70689),t=n(3413);let i=[];function d(e){let s={table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,t.R)(),...e.components};return(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Field"}),(0,r.jsx)(s.th,{children:"Description"}),(0,r.jsx)(s.th,{children:"Accepted Values"}),(0,r.jsx)(s.th,{children:"Schema"}),(0,r.jsx)(s.th,{children:"Default"})]})}),(0,r.jsxs)(s.tbody,{children:[(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"type"}),(0,r.jsx)(s.td,{children:"Match on ICMP type."}),(0,r.jsx)(s.td,{children:"Can be integer 0-254"}),(0,r.jsx)(s.td,{children:"integer"}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"code"}),(0,r.jsx)(s.td,{children:"Match on ICMP code."}),(0,r.jsx)(s.td,{children:"Can be integer 0-255"}),(0,r.jsx)(s.td,{children:"integer"}),(0,r.jsx)(s.td,{})]})]})]})}function c(e={}){let{wrapper:s}={...(0,t.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},77491(e,s,n){n.d(s,{Ay:()=>c,RM:()=>i});var r=n(70689),t=n(3413);let i=[{value:"Named ports",id:"named-ports",level:4}];function d(e){let s={admonition:"admonition",code:"code",h4:"h4",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.p,{children:"Calico Enterprise supports the following syntaxes for expressing ports."}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Syntax"}),(0,r.jsx)(s.th,{children:"Example"}),(0,r.jsx)(s.th,{children:"Description"})]})}),(0,r.jsxs)(s.tbody,{children:[(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"int"}),(0,r.jsx)(s.td,{children:"80"}),(0,r.jsx)(s.td,{children:"The exact (numeric) port specified"})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"start:end"}),(0,r.jsx)(s.td,{children:"6040:6050"}),(0,r.jsx)(s.td,{children:"All (numeric) ports within the range start \u2264 x \u2264 end"})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"string"}),(0,r.jsx)(s.td,{children:"named-port"}),(0,r.jsx)(s.td,{children:"A named port, as defined in the ports list of one or more endpoints"})]})]})]}),"\n",(0,r.jsx)(s.p,{children:"An individual numeric port may be specified as a YAML/JSON integer. A port range or\nnamed port must be represented as a string. For example, this would be a valid list of ports:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-yaml",children:"ports: [8080, '1234:5678', 'named-port']\n"})}),"\n",(0,r.jsx)(s.h4,{id:"named-ports",children:"Named ports"}),"\n",(0,r.jsxs)(s.p,{children:["Using a named port in an ",(0,r.jsx)(s.code,{children:"EntityRule"}),", instead of a numeric port, gives a layer of indirection,\nallowing for the named port to map to different numeric values for each endpoint."]}),"\n",(0,r.jsxs)(s.p,{children:["For exampl
1e, suppose you have multiple HTTP servers running as workloads; some exposing their HTTP\nport on port 80 and others on port 8080. In each workload, you could create a named port called\n",(0,r.jsx)(s.code,{children:"http-port"})," that maps to the correct local port. Then, in a rule, you could refer to the name\n",(0,r.jsx)(s.code,{children:"http-port"})," instead of writing a different rule for each type of server."]}),"\n",(0,r.jsx)(s.admonition,{type:"note",children:(0,r.jsx)(s.p,{children:"Since each named port may refer to many endpoints (and Calico Enterprise has to expand a named port into\na set of endpoint/port combinations), using a named port is considerably more expensive in terms\nof CPU than using a simple numeric port. We recommend that they are used sparingly, only where\nthe extra indirection is required."})})]})}function c(e={}){let{wrapper:s}={...(0,t.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},18161(e,s,n){n.d(s,{Ay:()=>c,RM:()=>i});var r=n(70689),t=n(3413);let i=[{value:"RuleMetadata",id:"rulemetadata",level:3}];function d(e){let s={a:"a",code:"code",h3:"h3",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.p,{children:"A single rule matches a set of packets and applies some action to them. When multiple rules are specified, they\nare executed in order."}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Field"}),(0,r.jsx)(s.th,{children:"Description"}),(0,r.jsx)(s.th,{children:"Accepted Values"}),(0,r.jsx)(s.th,{children:"Schema"}),(0,r.jsx)(s.th,{children:"Default"})]})}),(0,r.jsxs)(s.tbody,{children:[(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"metadata"}),(0,r.jsx)(s.td,{children:"Per-rule metadata."}),(0,r.jsx)(s.td,{}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.a,{href:"#rulemetadata",children:"RuleMetadata"})}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"action"}),(0,r.jsx)(s.td,{children:"Action to perform when matching this rule."}),(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.code,{children:"Allow"}),", ",(0,r.jsx)(s.code,{children:"Deny"}),", ",(0,r.jsx)(s.code,{children:"Log"}),", ",(0,r.jsx)(s.code,{children:"Pass"})]}),(0,r.jsx)(s.td,{children:"string"}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"protocol"}),(0,r.jsx)(s.td,{children:"Positive protocol match."}),(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.code,{children:"TCP"}),", ",(0,r.jsx)(s.code,{children:"UDP"}),", ",(0,r.jsx)(s.code,{children:"ICMP"}),", ",(0,r.jsx)(s.code,{children:"ICMPv6"}),", ",(0,r.jsx)(s.code,{children:"SCTP"}),", ",(0,r.jsx)(s.code,{children:"UDPLite"}),", ",(0,r.jsx)(s.code,{children:"1"}),"-",(0,r.jsx)(s.code,{children:"255"})]}),(0,r.jsx)(s.td,{children:"string | integer"}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"notProtocol"}),(0,r.jsx)(s.td,{children:"Negative protocol match."}),(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.code,{children:"TCP"}),", ",(0,r.jsx)(s.code,{children:"UDP"}),", ",(0,r.jsx)(s.code,{children:"ICMP"}),", ",(0,r.jsx)(s.code,{children:"ICMPv6"}),", ",(0,r.jsx)(s.code,{children:"SCTP"}),", ",(0,r.jsx)(s.code,{children:"UDPLite"}),", ",(0,r.jsx)(s.code,{children:"1"}),"-",(0,r.jsx)(s.code,{children:"255"})]}),(0,r.jsx)(s.td,{children:"string | integer"}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"icmp"}),(0,r.jsx)(s.td,{children:"ICMP match criteria."}),(0,r.jsx)(s.td,{}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.a,{href:"#icmp",children:"ICMP"})}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"notICMP"}),(0,r.jsx)(s.td,{children:"Negative match on ICMP."}),(0,r.jsx)(s.td,{}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.a,{href:"#icmp",children:"ICMP"})}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"ipVersion"}),(0,r.jsx)(s.td,{children:"Positive IP version match."}),(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.code,{children:"4"}),", ",(0,r.jsx)(s.code,{children:"6"})]}),(0,r.jsx)(s.td,{children:"integer"}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"source"}),(0,r.jsx)(s.td,{children:"Source match parameters."}),(0,r.jsx)(s.td,{}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.a,{href:"#entityrule",children:"EntityRule"})}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"destination"}),(0,r.jsx)(s.td,{children:"Destination match parameters."}),(0,r.jsx)(s.td,{}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.a,{href:"#entityrule",children:"EntityRule"})}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"http"}),(0,r.jsx)(s.td,{children:"Match HTTP request parameters. Application layer policy must be enabled to use this field."}),(0,r.jsx)(s.td,{}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.a,{href:"#httpmatch",children:"HTTPMatch"})}),(0,r.jsx)(s.td,{})]})]})]}),"\n",(0,r.jsxs)(s.p,{children:["After a ",(0,r.jsx)(s.code,{children:"Log"})," action, processing continues with the next rule; ",(0,r.jsx)(s.code,{children:"Allow"})," and ",(0,r.jsx)(s.code,{children:"Deny"}
1)," are immediate\nand final and no further rules are processed."]}),"\n",(0,r.jsxs)(s.p,{children:["An ",(0,r.jsx)(s.code,{children:"action"})," of ",(0,r.jsx)(s.code,{children:"Pass"})," in a ",(0,r.jsx)(s.code,{children:"NetworkPolicy"})," or ",(0,r.jsx)(s.code,{children:"GlobalNetworkPolicy"})," will skip over the remaining policies and jump to the\nfirst ",(0,r.jsx)(s.a,{href:"/calico-enterprise/3.20/reference/resources/profile",children:"profile"})," assigned to the endpoint, applying the policy configured in the\nprofile; if there are no Profiles configured for the endpoint the default applied action is ",(0,r.jsx)(s.code,{children:"Deny"}),"."]}),"\n",(0,r.jsx)(s.h3,{id:"rulemetadata",children:"RuleMetadata"}),"\n",(0,r.jsx)(s.p,{children:"Metadata associated with a specific rule (rather than the policy as a whole). The contents of the metadata does not affect how a rule is interpreted or enforced; it is\nsimply a way to store additional information for use by operators or applications that interact with Calico Enterprise."}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Field"}),(0,r.jsx)(s.th,{children:"Description"}),(0,r.jsx)(s.th,{children:"Schema"}),(0,r.jsx)(s.th,{children:"Default"})]})}),(0,r.jsx)(s.tbody,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"annotations"}),(0,r.jsx)(s.td,{children:"Arbitrary non-identifying metadata."}),(0,r.jsx)(s.td,{children:"map of string to string"}),(0,r.jsx)(s.td,{})]})})]}),"\n",(0,r.jsx)(s.p,{children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-yaml",children:"metadata:\n  annotations:\n    app: database\n    owner: devops\n"})}),"\n",(0,r.jsxs)(s.p,{children:["Annotations follow the\n",(0,r.jsx)(s.a,{href:"https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set",children:"same rules as Kubernetes for valid syntax and character set"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:["On Linux with the iptables data plane, rule annotations are rendered as comments in the form ",(0,r.jsx)(s.code,{children:'-m comment --comment "<key>=<value>"'})," on the iptables rule(s) that correspond\nto the Calico Enterprise rule."]})]})}function c(e={}){let{wrapper:s}={...(0,t.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},50917(e,s,n){n.d(s,{Ay:()=>c,RM:()=>i});var r=n(70689),t=n(3413);let i=[];function d(e){let s={code:"code",em:"em",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.p,{children:"A label selector is an expression which either matches or does not match a resource based on its labels."}),"\n",(0,r.jsx)(s.p,{children:"Calico Enterprise label selectors support a number of operators, which can be combined into larger expressions\nusing the boolean operators and parentheses."}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Expression"}),(0,r.jsx)(s.th,{children:"Meaning"})]})}),(0,r.jsxs)(s.tbody,{children:[(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.strong,{children:"Logical operators"})}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"( <expression> )"})}),(0,r.jsxs)(s.td,{children:["Matches if and only if ",(0,r.jsx)(s.code,{children:"<expression>"})," matches. (Parentheses are used for grouping expressions.)"]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"! <expression>"})}),(0,r.jsxs)(s.td,{children:["Matches if and only if ",(0,r.jsx)(s.code,{children:"<expression>"})," does not match. ",(0,r.jsx)(s.strong,{children:"Tip:"})," ",(0,r.jsx)(s.code,{children:"!"})," is a special character at the start of a YAML string, if you need to use ",(0,r.jsx)(s.code,{children:"!"})," at the start of a YAML string, enclose the string in quotes."]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"<expression 1> && <expression 2>"})}),(0,r.jsxs)(s.td,{children:['"And": matches if and only if both ',(0,r.jsx)(s.code,{children:"<expression 1>"}),", and, ",(0,r.jsx)(s.code,{children:"<expression 2>"})," matches"]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)("code",{children:"<expression 1> || <expression 2>"})}),(0,r.jsxs)(s.td,{children:['"Or": matches if and only if either ',(0,r.jsx)(s.code,{children:"<expression 1>"}),", or, ",(0,r.jsx)(s.code,{children:"<expression 2>"})," matches."]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.strong,{children:"Match operators"})}),(0,r.jsx)(s.td,{})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"all()"})}),(0,r.jsxs)(s.td,{children:["Match all in-scope resources. To match ",(0,r.jsx)(s.em,{children:"no"})," resources, combine this operator with ",(0,r.jsx)(s.code,{children:"!"})," to form ",(0,r.jsx)(s.code,{children:"!all()"}),"."]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"global()"})}),(0,r.jsxs)(s.td,{children:["Match all non-namespaced resources. Useful in a ",(0,r.jsx)(s.code,{children:"namespaceSelector"})," to select global resources such as global network sets."]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"k == 'v'"})}),(0,r.jsx)(s.td,{children:"Matches resources with the label 'k' and value 'v'."})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"k != 'v'"})}),(0,r.jsxs)(s.td,{children:["Matches resources without label 'k' or with label 'k' and value ",(0,r.jsx)(s.em,{children:"not"})," equal to ",(0,r.jsx)(s.code,{children:"v"})]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"has(k)"})}),(0,r.jsxs)(s.td,{children:["Matches resources with label 'k', independent of value. To match pods that do not have label ",(0,r.jsx)(s.code,{children:"k"}),", combine this operator with ",(0,r.jsx)(s.code,{children:"!"})," to form ",(0,r.jsx)(s.code,{children:"!has(k)"})]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"k in { 'v1', 'v2' }"})}),(0,r.jsx)(s.td,{children:"Matches resources with label 'k' and value in the given set"})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"k not in { 'v1', 'v2' }"})}),(0,r.jsxs)(s.td,{children:["Matches resources without label 'k' or with label 'k' and value ",(0,r.jsx)(s.em,{children:"not"})," in the given set"]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"k contains 's'"})}),(0,r.jsx)(s.td,{children:"Matches resources with label 'k' and value containing the substring 's'"})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"k starts with 's'"})}),(0,r.jsx)(s.td,{children:"Matches resources with label 'k' and value starting with the substring 's'"})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"k ends with 's'"})}),(0,r.jsx)(s.td,{children:"Matches resources with label 'k' and value ending with the substring 's'"})]})]})]}),"\n",(0,r.jsx)(s.p,{children:"Operators have the following precedence:"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.strong,{children:"Highe
1st"}),": all the match operators"]}),"\n",(0,r.jsxs)(s.li,{children:["Parentheses ",(0,r.jsx)(s.code,{children:"( ... )"})]}),"\n",(0,r.jsxs)(s.li,{children:["Negation with ",(0,r.jsx)(s.code,{children:"!"})]}),"\n",(0,r.jsxs)(s.li,{children:["Conjunction with ",(0,r.jsx)(s.code,{children:"&&"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.strong,{children:"Lowest"}),": Disjunction with ",(0,r.jsx)(s.code,{children:"||"})]}),"\n"]}),"\n",(0,r.jsx)(s.p,{children:"For example, the expression"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{children:"! has(my-label) || my-label starts with 'prod' && role in {'frontend','business'}\n"})}),"\n",(0,r.jsx)(s.p,{children:'Would be "bracketed" like this:'}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{children:"((!(has(my-label)) || ((my-label starts with 'prod') && (role in {'frontend','business'}))\n"})}),"\n",(0,r.jsx)(s.p,{children:"It would match:"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:'Any resource that did not have label "my-label".'}),"\n",(0,r.jsxs)(s.li,{children:["Any resource that both:","\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["Has a value for ",(0,r.jsx)(s.code,{children:"my-label"}),' that starts with "prod", and,']}),"\n",(0,r.jsx)(s.li,{children:'Has a role label with value either "frontend", or "business".'}),"\n"]}),"\n"]}),"\n"]})]})}function c(e={}){let{wrapper:s}={...(0,t.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},82234(e,s,n){n.d(s,{Ay:()=>c,RM:()=>i});var r=n(70689),t=n(3413);let i=[];function d(e){let s={a:"a",p:"p",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.p,{children:"A ServiceAccountMatch matches service accounts in an EntityRule."}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Field"}),(0,r.jsx)(s.th,{children:"Description"}),(0,r.jsx)(s.th,{children:"Schema"})]})}),(0,r.jsxs)(s.tbody,{children:[(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"names"}),(0,r.jsx)(s.td,{children:"Match service accounts by name"}),(0,r.jsx)(s.td,{children:"list of strings"})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"selector"}),(0,r.jsx)(s.td,{children:"Match service accounts by label"}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.a,{href:"#selector",children:"selector"})})]})]})]})]})}function c(e={}){let{wrapper:s}={...(0,t.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},1871(e,s,n){n.d(s,{Ay:()=>c,RM:()=>i});var r=n(70689),t=n(3413);let i=[];function d(e){let s={p:"p",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.p,{children:"A ServiceMatch matches a service in an EntityRule."}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Field"}),(0,r.jsx)(s.th,{children:"Description"}),(0,r.jsx)(s.th,{children:"Schema"})]})}),(0,r.jsxs)(s.tbody,{children:[(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"name"}),(0,r.jsx)(s.td,{children:"The service's name."}),(0,r.jsx)(s.td,{children:"string"})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:"namespace"}),(0,r.jsx)(s.td,{children:"The service's namespace."}),(0,r.jsx)(s.td,{children:"string"})]})]})]})]})}function c(e={}){let{wrapper:s}={...(0,t.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},40756(e,s,n){n.r(s),n.d(s,{metadata:()=>r,default:()=>y,frontMatter:()=>j,contentTitle:()=>p,toc:()=>m,assets:()=>u});var r=JSON.parse('{"id":"reference/resources/stagednetworkpolicy","title":"Staged network policy","description":"API for this Calico Enterprise resource.","source":"@site/calico-enterprise_versioned_docs/version-3.20-2/reference/resources/stagednetworkpolicy.mdx","sourceDirName":"reference/resources","slug":"/reference/resources/stagednetworkpolicy","permalink":"/calico-enterprise/3.20/reference/resources/stagednetworkpolicy","draft":false,"unlisted":false,"editUrl":"https://github.com/tigera/docs/edit/main/calico-enterprise_versioned_docs/version-3.20-2/reference/resources/stagednetworkpolicy.mdx","tags":[],"version":"3.20-2","frontMatter":{"description":"API for this Calico Enterprise resource."},"sidebar":"calicoEnterpriseSidebar","previous":{"title":"Staged Kubernetes network policy","permalink":"/calico-enterprise/3.20/reference/resources/stagedkubernetesnetworkpolicy"},"next":{"title":"Tier","permalink":"/calico-enterprise/3.20/reference/resources/tier"}}'),t=n(70689),i=n(3413),d=n(1871),c=n(82234),l=n(77491),o=n(50917),h=n(2144),a=n(87784),x=n(18161);let j={description:"API for this Calico Enterprise resource."},p="Staged network policy",u={},m=[{value:"Sample YAML",id:"sample-yaml",level:2},{value:"Definition",id:"definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Spec",id:"spec",level:3},{value:"Rule",id:"rule",level:3},...x.RM,{value:"ICMP",id:"icmp",level:3},...a.RM,{value:"EntityRule",id:"entityrule",level:3},...h.RM,{value:"Selector",id:"selector",level:3},...o.RM,{value:"Ports",id:"ports",level:3},...l.RM,{value:"ServiceAccountMatch",id:"serviceaccountmatch",level:3},...c.RM,{value:"ServiceMatch",id:"servicematch",level:3},...d.RM,{value:"Performance Hints",id:"performance-hints",level:3},{value:"Supported operations",id:"supported-operations",level:2},{value:"List filtering on tiers",id:"list-filtering-on-tiers",level:4},{value:"Field selector",id:"field-selector",level:5},{value:"Label selector",id:"label-selector",level:5}];function f(e){let s={a:"a",blockquote:"blockquote",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h
15:"h5",header:"header",li:"li",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.header,{children:(0,t.jsx)(s.h1,{id:"staged-network-policy",children:"Staged network policy"})}),"\n","\n","\n","\n","\n","\n","\n","\n",(0,t.jsxs)(s.p,{children:["A staged network policy resource (",(0,t.jsx)(s.code,{children:"StagedNetworkPolicy"}),") represents an ordered set of rules which are applied\nto a collection of endpoints that match a ",(0,t.jsx)(s.a,{href:"#selector",children:"label selector"}),". These rules are used to preview network behavior and do\nnot enforce network traffic. For enforcing network traffic, see ",(0,t.jsx)(s.a,{href:"/calico-enterprise/3.20/reference/resources/networkpolicy",children:"network policy resource"}),"."]}),"\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"StagedNetworkPolicy"})," is a namespaced resource. ",(0,t.jsx)(s.code,{children:"StagedNetworkPolicy"})," in a specific namespace\nonly applies to ",(0,t.jsx)(s.a,{href:"/calico-enterprise/3.20/reference/resources/workloadendpoint",children:"workload endpoint resources"}),"\nin that namespace. Two resources are in the same namespace if the ",(0,t.jsx)(s.code,{children:"namespace"}),"\nvalue is set the same on both.\nSee ",(0,t.jsx)(s.a,{href:"/calico-enterprise/3.20/reference/resources/stagedglobalnetworkpolicy",children:"staged global network policy resource"})," for staged non-namespaced network policy."]}),"\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"StagedNetworkPolicy"})," resources can be used to define network connectivity rules between groups of Calico Enterprise endpoints and host endpoints, and\ntake precedence over ",(0,t.jsx)(s.a,{href:"/calico-enterprise/3.20/reference/resources/profile",children:"profile resources"})," if any are defined."]}),"\n",(0,t.jsxs)(s.p,{children:["StagedNetworkPolicies are organized into ",(0,t.jsx)(s.a,{href:"/calico-enterprise/3.20/reference/resources/tier",children:"tiers"}),", which provide an additional layer of ordering\u2014in particular, note that the ",(0,t.jsx)(s.code,{children:"Pass"})," action skips to the\nnext ",(0,t.jsx)(s.a,{href:"/calico-enterprise/3.20/reference/resources/tier",children:"tier"}),", to enable hierarchical security policy."]}),"\n",(0,t.jsxs)(s.p,{children:["For ",(0,t.jsx)(s.code,{children:"kubectl"})," ",(0,t.jsx)(s.a,{href:"https://kubernetes.io/docs/reference/kubectl/overview/",children:"commands"}),", the following case-insensitive aliases\nmay be used to specify the resource type on the CLI:\n",(0,t.jsx)(s.code,{children:"stagednetworkpolicy.projectcalico.org"}),", ",(0,t.jsx)(s.code,{children:"stagednetworkpolicies.projectcalico.org"})," and abbreviations such as\n",(0,t.jsx)(s.code,{children:"stagednetworkpolicy.p"})," and ",(0,t.jsx)(s.code,{children:"stagednetworkpolicies.p"}),"."]}),"\n",(0,t.jsx)(s.h2,{id:"sample-yaml",children:"Sample YAML"}),"\n",(0,t.jsxs)(s.p,{children:["This sample policy allows TCP traffic from ",(0,t.jsx)(s.code,{children:"frontend"})," endpoints to port 6379 on\n",(0,t.jsx)(s.code,{children:"database"})," endpoints."]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-yaml",children:"apiVersion: projectcalico.org/v3\nkind: StagedNetworkPolicy\nmetadata:\n  name: internal-access.allow-tcp-6379\n  namespace: production\nspec:\n  tier: internal-access\n  selector: role == 'database'\n  types:\n    - Ingress\n    - Egress\n  ingress:\n    - action: Allow\n      protocol: TCP\n      source:\n        selector: role == 'frontend'\n      destination:\n        ports:\n          - 6379\n  egress:\n    - action: Allow\n"})}),"\n",(0,t.jsx)(s.h2,{id:"definition",children:"Definition"}),"\n",(0,t.jsx)(s.h3,{id:"metadata",children:"Metadata"}),"\n",(0,t.jsxs)(s.table,{children:[(0,t.jsx)(s.thead,{children:(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.th,{children:"Field"}),(0,t.jsx)(s.th,{children:"Description"}),(0,t.jsx)(s.th,{children:"Accepted Values"}),(0,t.jsx)(s.th,{children:"Schema"}),(0,t.jsx)(s.th,{children:"Default"})]})}),(0,t.jsxs)(s.tbody,{children:[(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"name"}),(0,t.jsx)(s.td,{children:"The name of the network policy. Required."}),(0,t.jsxs)(s.td,{children:["Alphanumeric string with optional ",(0,t.jsx)(s.code,{children:"."}),", ",(0,t.jsx)(s.code,{children:"_"}),", or ",(0,t.jsx)(s.code,{children:"-"}),"."]}),(0,t.jsx)(s.td,{children:"string"}),(0,t.jsx)(s.td,{})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"namespace"}),(0,t.jsx)(s.td,{children:"Namespace provides an additional qual
1ification to a resource name."}),(0,t.jsx)(s.td,{}),(0,t.jsx)(s.td,{children:"string"}),(0,t.jsx)(s.td,{children:'"default"'})]})]})]}),"\n",(0,t.jsx)(s.h3,{id:"spec",children:"Spec"}),"\n",(0,t.jsxs)(s.table,{children:[(0,t.jsx)(s.thead,{children:(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.th,{children:"Field"}),(0,t.jsx)(s.th,{children:"Description"}),(0,t.jsx)(s.th,{children:"Accepted Values"}),(0,t.jsx)(s.th,{children:"Schema"}),(0,t.jsx)(s.th,{children:"Default"})]})}),(0,t.jsxs)(s.tbody,{children:[(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"order"}),(0,t.jsx)(s.td,{children:"Controls the order of precedence. Calico Enterprise applies the policy with the lowest value first."}),(0,t.jsx)(s.td,{}),(0,t.jsx)(s.td,{children:"float"}),(0,t.jsx)(s.td,{})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"tier"}),(0,t.jsxs)(s.td,{children:["Name of the ",(0,t.jsx)(s.a,{href:"/calico-enterprise/3.20/reference/resources/tier",children:"tier"})," this policy belongs to."]}),(0,t.jsx)(s.td,{}),(0,t.jsx)(s.td,{children:"string"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"default"})})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"selector"}),(0,t.jsx)(s.td,{children:"Selects the endpoints to which this policy applies."}),(0,t.jsx)(s.td,{}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.a,{href:"#selector",children:"selector"})}),(0,t.jsx)(s.td,{children:"all()"})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"types"}),(0,t.jsxs)(s.td,{children:["Applies the policy based on the direction of the traffic. To apply the policy to inbound traffic, set to ",(0,t.jsx)(s.code,{children:"Ingress"}),". To apply the policy to outbound traffic, set to ",(0,t.jsx)(s.code,{children:"Egress"}),". To apply the policy to both, set to ",(0,t.jsx)(s.code,{children:"Ingress, Egress"}),"."]}),(0,t.jsxs)(s.td,{children:[(0,t.jsx)(s.code,{children:"Ingress"}),", ",(0,t.jsx)(s.code,{children:"Egress"})]}),(0,t.jsx)(s.td,{children:"List of strings"}),(0,t.jsx)(s.td,{children:"Depends on presence of ingress/egress rules*"})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ingress"}),(0,t.jsx)(s.td,{children:"Ordered list of ingress rules applied by policy."}),(0,t.jsx)(s.td,{}),(0,t.jsxs)(s.td,{children:["List of ",(0,t.jsx)(s.a,{href:"#rule",children:"Rule"})]}),(0,t.jsx)(s.td,{})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"egress"}),(0,t.jsx)(s.td,{children:"Ordered list of egress rules applied by this policy."}),(0,t.jsx)(s.td,{}),(0,t.jsxs)(s.td,{children:["List of ",(0,t.jsx)(s.a,{href:"#rule",children:"Rule"})]}),(0,t.jsx)(s.td,{})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"serviceAccountSelector"}),(0,t.jsxs)(s.td,{children:["Selects the service account(s) to which this policy applies. Select a specific service account by name using the ",(0,t.jsx)(s.code,{children:"projectcalico.org/name"})," label."]}),(0,t.jsx)(s.td,{}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.a,{href:"#selector",children:"selector"})}),(0,t.jsx)(s.td,{children:"all()"})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"performanceHints"}),(0,t.jsxs)(s.td,{children:["Contains a list of hints to Calico's policy engine to help process the policy more efficiently.  Hints never change the enforcement behaviour of the policy.  The available hints are described ",(0,t.jsx)(s.a,{href:"#performance-hints",children:"below"}),"."]}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"AssumeNeededOnEveryNode"})}),(0,t.jsx)(s.td,{children:"List of strings"}),(0,t.jsx)(s.td,{})]})]})]}),"\n",(0,t.jsxs)(s.p,{children:["* If ",(0,t.jsx)(s.code,{children:"types"})," has no value, Calico Enterprise defaults as follows."]}),"\n",(0,t.jsxs)(s.blockquote,{children:["\n",(0,t.jsxs)(s.table,{children:[(0,t.jsx)(s.thead,{children:(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.th,{children:"Ingress Rules Present"}),(0,t.jsx)(s.th,{children:"Egress Rules Present"}),(0,t.jsxs)(s.th,{children:[(0,t.jsx)(s.code,{children:"Types"})," value"]})]})}),(0,t.jsxs)(s.tbody,{children:[(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"No"}),(0,t.jsx)(s.td,{children:"No"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Ingress"})})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Yes"}),(0,t.jsx)(s.td,{children:"No"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Ingress"})})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"No"}),(0,t.jsx)(s.td,{children:"Yes"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Egress"})})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Yes"}),(0,t.jsx)(s.td,{children:"Yes"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Ingress, Egress"})})]})]})]}),"\n"]}),"\n",(0,t.jsx)(s.h3,{id:"rule",children:"Rule"}),"\n",(0,t.jsx)(x.Ay,{}),"\n",(0,t.jsx)(s.h3,{id:"icmp",children:"ICMP"}),"\n",(0,t.jsx)(a.Ay,{}),"\n",(0,t.jsx)(s.h3,{id:"entityrule",children:"EntityRule"}),"\n",(0,t.jsx)(h.Ay,{global:"false"}),"\n",(0,t.jsx)(s.h3,{id:"selector",children:"Selector"}),"\n",(0,t.jsx)(o.Ay,{}),"\n",(0,t.jsx)(s.h3,{id:"ports",children:"Ports"}),"\n",(0,t.jsx)(l.Ay,{}),"\n",(0,t.jsx)(s.h3,{id:"serviceaccountmatch",children:"ServiceAccountMatch"}),"\n",(0,t.jsx)(c.Ay,{}),"\n",(0,t.jsx)(s.h3,{id:"servicematch",children:"ServiceMatch"}),"\n",(0,t.jsx)(d.Ay,{}),"\n",(0,t.jsx)(s.h3,{id:"performance-hints",children:"Performance Hints"}),"\n",(0,t.jsx)(s.p,{children:"Performance hints provide a way to tell Calico Enterprise about the intended use of the policy so that it may\nprocess it more efficiently.  Currently only one hint is defined:"}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:[(0,t.jsx)(s.code,{children:"AssumeNeededOnEveryNode"}),": normally, Calico Enterprise only calculates a policy's rules and selectors on nodes where\nthe policy is actually in use (i.e. its selector matches a local endpoint).  This saves work in most cases.\nThe ",(0,t.jsx)(s.code,{children:"AssumeNeededOnEveryNode"}),' hint tells Calico Enterprise to treat the policy as "in use" on ',(0,t.jsx)(s.em,{children:"every"}),' node.  This is\nuseful for large policy sets that are known to apply to all (or nearly all) endpoints.  It effectively "preloads"\nthe policy on every node so that there is less work to do when the first endpoint matching the policy shows up.\nIt also prevents work from being done to tear down the policy when the last endpoint is drained.']}),"\n"]}),"\n",(0,t.jsx)(s.h2,{id:"supported-operations",children:"Supported operations"}),"\n",(0,t.jsxs)(s.table,{children:[(0,t.jsx)(s.thead,{children:(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.th,{children:"Datastore type"}),(0,t.jsx)(s.th,{children:"Create/Delete"}),(0,t.jsx)(s.th,{children:"Update"}),(0,t.jsx)(s.th,{children:"Get/List"}),(0,t.jsx)(s.th,{children:"Notes"})]})}),(0,t.jsx)(s.tbody,{children:(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Kubernetes API datastore"}),(0,t.jsx)(s.td,{children:"Yes"}),(0,t.jsx)(s.td,{children:"Yes"}),(0,t.jsx)(s.td,{children:"Yes"}),(0,t.jsx)(s.td,{})]})})]}),"\n",(0,t.jsx)(s.h4,{id:"list-filtering-on-tiers",children:"List filtering on tiers"}),"\n",(0,t.jsxs)(s.p,{children:["List and watch operations may specify label selectors or field selectors to filter ",(0,t.jsx)(s.code,{children:"StagedNetworkPolicy"})," resources on tiers returned by the API server.\nWhen no selector is specified, the API server returns all ",(0,t.jsx)(s.code,{children:"StagedNetworkPolicy"})," resources from all tiers that the user has access to."]}),"\n",(0,t.jsx)(s.h5,{id:"field-selector",children:"Field selector"}),"\n",(0,t.jsxs)(s.p,{children:["When using the field selector, supported operators are ",(0,t.jsx)(s.code,{children:"="})," and ",(0,t.jsx)(s.code,{children:"=="})]}),"\n",(0,t.jsxs)(s.p,{children:["The following example shows how to retrieve all ",(0,t.jsx)(s.code,{children:"StagedNetworkPolicy"})," resources in the default tier and in all namespaces:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-bash",children:"kubectl get stagednetworkpolicy.p --field-selector spec.tier=default --all-namespaces\n"})}),"\n",(0,t.jsx)(s.h5,{id:"label-selector",children:"Label selector"}),"\n",(0,t.jsxs)(s.p,{children:["When using the label selector, supported operators are ",(0,t.jsx)(s.code,{children:"="}),", ",(0,t.jsx)(s.code,{children:"=="})," and ",(0,t.jsx)(s.code,{children:"IN"}),"."]}),"\n",(0,t.jsxs)(s.p,{children:["The following example shows how to retrieve all ",(0,t.jsx)(s.code,{children:"StagedNetworkPolicy"})," resources in the ",(0,t.jsx)(s.code,{children:"default"})," and ",(0,t.jsx)(s.code,{children:"net-sec"})," tiers and in all namespaces:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-bash",children:"kubectl get stagednetworkpolicy.p -l 'projectcalico.org/tier in (default, net-sec)' --all-namespaces\n"})})]})}function y(e={}){let{wrapper:s}={...(0,i.R)(),...e.components};return s?(0,t.jsx)(s,{...e,children:(0,t.jsx)(f,{...e})}):f(e)}},3413(e,s,n){n.d(s,{R:()=>d,x:()=>c});var r=n(16645);let t={},i=r.createContext(t);function d(e){let s=r.useContext(i);return r.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function c(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:d(e.components),r.createElement(i.Provider,{value:s},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.