<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Kubernetes Contributors – Code Organization</title><link>https://deploy-preview-776--kubernetes-contributor.netlify.app/docs/code/</link><description>Recent content in Code Organization on Kubernetes Contributors</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://deploy-preview-776--kubernetes-contributor.netlify.app/docs/code/index.xml" rel="self" type="application/rss+xml"/><item><title>Docs: Declarative API validation</title><link>https://deploy-preview-776--kubernetes-contributor.netlify.app/docs/code/declarative-validation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-776--kubernetes-contributor.netlify.app/docs/code/declarative-validation/</guid><description>
&lt;p>Declarative validation lets Kubernetes API authors put common validation rules next to the versioned API types they apply to. Instead of hand-writing every basic check in &lt;code>validation.go&lt;/code>, API authors add &lt;code>+k8s:&lt;/code> tags to &lt;code>types.go&lt;/code>, and &lt;code>validation-gen&lt;/code> turns those tags into Go validation code.&lt;/p>
&lt;p>This does not completely replace handwritten validation as there are complex/bespoke validation rules that cannot easily be expressed as tags for which the best practice is to still use handwritten validation code. The goal is to move the simple, repeated, field-local rules into a form that is easier to review and harder to accidentally drift.&lt;/p>
&lt;h2 id="tldr-of-declarative-validation-usage">TLDR of declarative validation usage&lt;/h2>
&lt;ul>
&lt;li>Put validation tags on versioned API types.&lt;/li>
&lt;li>Run &lt;code>hack/update-codegen.sh&lt;/code> after adding or changing tags.&lt;/li>
&lt;/ul>
&lt;h2 id="rollout-and-feature-gates">Rollout and feature gates&lt;/h2>
&lt;p>Declarative validation has two separate concerns:&lt;/p>
&lt;ul>
&lt;li>whether generated validation code runs at all&lt;/li>
&lt;li>whether a particular generated error is returned to the user or only compared against handwritten validation.&lt;/li>
&lt;/ul>
&lt;p>The current rollout uses these feature gates:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Feature gate&lt;/th>
&lt;th>Stage&lt;/th>
&lt;th>Default&lt;/th>
&lt;th>What it does&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>DeclarativeValidation&lt;/code>&lt;/td>
&lt;td>GA in v1.36&lt;/td>
&lt;td>&lt;code>true&lt;/code>, locked to default&lt;/td>
&lt;td>Runs declarative validation logic where it has been wired in. &lt;code>DeclarativeValidationBeta&lt;/code> toggles whether hand-written or declarative validation is authoritative. This only &amp;ldquo;turns DV&amp;rdquo; on for migration cases, it is always on for cases w/ no hand-written fallback logic like in new APIs&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>DeclarativeValidationBeta&lt;/code>&lt;/td>
&lt;td>Beta&lt;/td>
&lt;td>&lt;code>true&lt;/code>&lt;/td>
&lt;td>Controls &lt;code>+k8s:beta&lt;/code> validation rules. When enabled, Beta rules reject invalid requests. When disabled, Beta rules fall back to shadow mode.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>DeclarativeValidationTakeover&lt;/code>&lt;/td>
&lt;td>Deprecated in v1.36&lt;/td>
&lt;td>n/a&lt;/td>
&lt;td>Previously controlled whether declarative validation was authoritative. It is no longer honored, but may still be accepted to avoid unknown-gate errors.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Migrated validation rules (vs net new declarative validation rules) are staged with lifecycle wrappers:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Rule shape&lt;/th>
&lt;th>Enforcement behavior&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>+k8s:alpha(since: &amp;quot;1.N&amp;quot;)=&amp;lt;validator&amp;gt;&lt;/code>&lt;/td>
&lt;td>Always shadowed. Handwritten validation wins. Mismatches are reported through metrics.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>+k8s:beta(since: &amp;quot;1.N&amp;quot;)=&amp;lt;validator&amp;gt;&lt;/code>&lt;/td>
&lt;td>DV authoritative when &lt;code>DeclarativeValidationBeta=true&lt;/code>, shadowed when the gate is disabled. Mismateches are reported through metrics.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>&amp;lt;validator&amp;gt;&lt;/code>&lt;/td>
&lt;td>Stable/unwrapped. DV always authoritative.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h2 id="opt-out">Disabling &lt;code>DeclarativeValidationBeta&lt;/code>&lt;/h2>
&lt;p>Cluster administrators can set &lt;code>DeclarativeValidationBeta=false&lt;/code> to move &lt;code>+k8s:beta&lt;/code> rules back to shadow mode. This is mostly a rollback valve.&lt;/p>
&lt;p>Reasons to consider disabling it:&lt;/p>
&lt;ul>
&lt;li>Beta declarative validation rejects requests that should still be valid.&lt;/li>
&lt;li>Beta declarative validation allows objects that handwritten validation would have rejected.&lt;/li>
&lt;/ul>
&lt;p>For feature gate mechanics, see the Kubernetes &lt;a href="https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/"
target="_blank" rel="noopener">feature gates&lt;/a>
documentation.&lt;/p>
&lt;h2 id="catalog">Tag catalog&lt;/h2>
&lt;p>Descriptions and stability levels in this table come from &lt;code>validation-gen&lt;/code> &lt;code>TagDoc&lt;/code> values when the tag is a validator. A few generator wiring tags do not have validator &lt;code>TagDoc&lt;/code> values, those are marked as metadata.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Tag&lt;/th>
&lt;th>Description&lt;/th>
&lt;th>Stability&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;a href="#tag-alpha"
>&lt;code>+k8s:alpha&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Marks the given payload validation as a Alpha validation of the handwritten validation code. An optional Kubernetes version can be specified.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-beta"
>&lt;code>+k8s:beta&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Marks the given payload validation as a Beta validation of the handwritten validation code. An optional Kubernetes version can be specified.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-customUnique"
>&lt;code>+k8s:customUnique&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that uniqueness validation for this list is implemented via custom, handwritten validation. This disables generation of uniqueness validation for this list.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-eachKey"
>&lt;code>+k8s:eachKey&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Declares a validation for each value in a map or list.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-eachVal"
>&lt;code>+k8s:eachVal&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Declares a validation for each value in a map or list.&lt;/td>
&lt;td>Alpha&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-enum"
>&lt;code>+k8s:enum&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a string type is an enum. All constant values of this type are considered values in the enum unless excluded using +k8s:enumExclude.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-enumExclude"
>&lt;code>+k8s:enumExclude&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that an constant value is not part of an enum, even if the constant&amp;rsquo;s type is tagged with k8s:enum. May be conditionally excluded via +k8s:ifEnabled(Option)=+k8s:enumExclude or +k8s:ifDisabled(Option)=+k8s:enumExclude. If multiple +k8s:ifEnabled/+k8s:ifDisabled tags are used, the value is excluded if any of the exclude conditions are met.&lt;/td>
&lt;td>Alpha&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-forbidden"
>&lt;code>+k8s:forbidden&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a field may not be specified.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-format"
>&lt;code>+k8s:format&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a string field has a particular format.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-ifDisabled"
>&lt;code>+k8s:ifDisabled&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Declares a validation that only applies when an option is disabled.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-ifEnabled"
>&lt;code>+k8s:ifEnabled&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Declares a validation that only applies when an option is enabled.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-ifMode"
>&lt;code>+k8s:ifMode&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that this field&amp;rsquo;s validation depends on a mode discriminator.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-immutable"
>&lt;code>+k8s:immutable&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a field may not be updated.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-isSubresource"
>&lt;code>+k8s:isSubresource&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Mark a type as validation for a specific subresource.&lt;/td>
&lt;td>Metadata&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-item"
>&lt;code>+k8s:item&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Declares a validation for an item of a slice declared as a +k8s:listType=map. The item to match is declared by providing field-value pair arguments. All key fields must be specified.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-listMapKey"
>&lt;code>+k8s:listMapKey&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Declares a named sub-field of a list&amp;rsquo;s value-type to be part of the list-map key.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-listType"
>&lt;code>+k8s:listType&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Declares a list field&amp;rsquo;s semantic type and ownership behavior. atomic: single ownership, set: shared ownership with uniqueness, map: shared ownership with key-based uniqueness.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-maxBytes"
>&lt;code>+k8s:maxBytes&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a string field has a limit on its length in bytes. This could only allow as few as N/4 multi-byte characters. If you want to limit length of characters specifically, use maxLength.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-maxItems"
>&lt;code>+k8s:maxItems&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a list has a limit on its size.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-maxLength"
>&lt;code>+k8s:maxLength&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a string field has a limit on its length in characters. This could allow up to 4*N bytes if multi-byte characters are used. If you want to limit length of bytes specifically, use maxBytes.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-maxProperties"
>&lt;code>+k8s:maxProperties&lt;/code>&lt;/a>
&lt;/td>
&lt;td>maxProperties provides a limit on properties of an object as defined by JSON schema. In Kubernetes it may only be used to constrain the number of elements on a field defined as a golang map.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-maximum"
>&lt;code>+k8s:maximum&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a numeric field has a maximum value.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-minItems"
>&lt;code>+k8s:minItems&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a list has a minimum size.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-minLength"
>&lt;code>+k8s:minLength&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a string field has a minimum length for its value in characters. This means that the minimum size in bytes is a range from X to 4X if multi-byte characters are allowed.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-minProperties"
>&lt;code>+k8s:minProperties&lt;/code>&lt;/a>
&lt;/td>
&lt;td>minProperties provides a limit on properties of an object as defined by JSON schema. In Kubernetes it may only be used to constrain the number of elements on a field defined as a golang map.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-minimum"
>&lt;code>+k8s:minimum&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a numeric field has a minimum value.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-modeDiscriminator"
>&lt;code>+k8s:modeDiscriminator&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that this field is a discriminator for state-based validation.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-neq"
>&lt;code>+k8s:neq&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Verifies the field&amp;rsquo;s value is not equal to a specific disallowed value. Supports string, integer, and boolean types.&lt;/td>
&lt;td>Alpha&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-opaqueType"
>&lt;code>+k8s:opaqueType&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that any validations declared on the referenced type will be ignored. If a referenced type&amp;rsquo;s package is not included in the generator&amp;rsquo;s current flags, this tag must be set, or code generation will fail (preventing silent mistakes). If the validations should not be ignored, add the type&amp;rsquo;s package to the generator using the &amp;ndash;readonly-pkg flag.&lt;/td>
&lt;td>Alpha&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-optional"
>&lt;code>+k8s:optional&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a field is optional to clients.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-required"
>&lt;code>+k8s:required&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that a field must be specified by clients.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-subfield"
>&lt;code>+k8s:subfield&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Declares a validation for a subfield of a struct.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-supportsSubresource"
>&lt;code>+k8s:supportsSubresource&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Declare supported validation subresources for a type.&lt;/td>
&lt;td>Metadata&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-unionDiscriminator"
>&lt;code>+k8s:unionDiscriminator&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that this field is the discriminator for a union.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-unionMember"
>&lt;code>+k8s:unionMember&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that this field is a member of a union.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-unique"
>&lt;code>+k8s:unique&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Declares that a list field&amp;rsquo;s elements are unique. This tag can be used with listType=atomic to add uniqueness constraints, or independently to specify uniqueness semantics.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-update"
>&lt;code>+k8s:update&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Provides constraints on the allowed update operations of a field. Constraints: NoSet (prevents unset-&amp;gt;set transitions), NoUnset (prevents set-&amp;gt;unset transitions), NoModify (prevents value changes but allows set/unset transitions), NoAddItem (prevents adding items to a slice or map), NoRemoveItem (prevents removing items from a slice or map). Multiple constraints can be specified using multiple tags. For non-pointer structs, NoSet and NoUnset have no effect as these fields cannot be unset. For slice and map fields, &amp;lsquo;unset&amp;rsquo; means len == 0. Slice item identity for NoAddItem/NoRemoveItem comes from +k8s:listType/+k8s:listMapKey/+k8s:unique, for maps the key is the item identity. NoModify is not supported on slices or maps, use +k8s:eachVal=+k8s:update=NoModify for per-item immutability. On lists, +k8s:eachVal=+k8s:update=NoModify requires listType=map or unique=map, otherwise content changes are not detectable. Examples: +k8s:update=NoModify +k8s:update=NoUnset for set-once fields, +k8s:update=NoSet for fields that must be set at creation or never, +k8s:update=NoAddItem +k8s:update=NoRemoveItem on a listType=map field to freeze the structural shape of the list.&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#testing-only-tags"
>&lt;code>+k8s:validateError&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Always fails code generation (useful for testing).&lt;/td>
&lt;td>Alpha&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#testing-only-tags"
>&lt;code>+k8s:validateFalse&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Always fails validation (useful for testing).&lt;/td>
&lt;td>Alpha&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#testing-only-tags"
>&lt;code>+k8s:validateTrue&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Always passes validation (useful for testing).&lt;/td>
&lt;td>Alpha&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#testing-only-tags"
>&lt;code>+k8s:validateTrueAlpha&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Always passes validation (useful for testing).&lt;/td>
&lt;td>Alpha&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#testing-only-tags"
>&lt;code>+k8s:validateTrueBeta&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Always passes validation (useful for testing).&lt;/td>
&lt;td>Beta&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="#tag-zeroOrOneOfMember"
>&lt;code>+k8s:zeroOrOneOfMember&lt;/code>&lt;/a>
&lt;/td>
&lt;td>Indicates that this field is a member of a zero-or-one-of union.&lt;/td>
&lt;td>Stable&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h2 id="tag-reference">Tag reference&lt;/h2>
&lt;h3 id="tag-alpha">&lt;code>+k8s:alpha&lt;/code>&lt;/h3>
&lt;p>Marks the given payload validation as a Alpha validation of the handwritten validation code. An optional Kubernetes version can be specified.&lt;/p>
&lt;ul>
&lt;li>Argument &lt;code>since&lt;/code>: The Kubernetes version (e.g. &lt;code>1.34&lt;/code>) at which this validation was added.&lt;/li>
&lt;li>Payload &lt;code>&amp;lt;validation-tag&amp;gt;&lt;/code>: The validation tag to evaluate as a Alpha validation.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:alpha(since: &amp;#34;1.36&amp;#34;)=+k8s:minimum=1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyField &lt;span style="color:#0b0;font-weight:bold">int&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myField&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Do not use this to try to disable handwritten validation. It only controls the lifecycle stage of the generated rule.&lt;/p>
&lt;h3 id="tag-beta">&lt;code>+k8s:beta&lt;/code>&lt;/h3>
&lt;p>Marks the given payload validation as a Beta validation of the handwritten validation code. An optional Kubernetes version can be specified.&lt;/p>
&lt;ul>
&lt;li>Argument &lt;code>since&lt;/code>: The Kubernetes version (e.g. &lt;code>1.34&lt;/code>) at which this validation was added.&lt;/li>
&lt;li>Payload &lt;code>&amp;lt;validation-tag&amp;gt;&lt;/code>: The validation tag to evaluate as a Beta validation.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:beta(since: &amp;#34;1.37&amp;#34;)=+k8s:minimum=1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyField &lt;span style="color:#0b0;font-weight:bold">int&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myField&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-customUnique">&lt;code>+k8s:customUnique&lt;/code>&lt;/h3>
&lt;p>Indicates that uniqueness validation for this list is implemented via custom, handwritten validation. This disables generation of uniqueness validation for this list.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:listType=set&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:customUnique&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Names []&lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;names&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-eachKey">&lt;code>+k8s:eachKey&lt;/code>&lt;/h3>
&lt;p>Declares a validation for each value in a map or list.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;validation-tag&amp;gt;&lt;/code>: The tag to evaluate for each key.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:eachKey=+k8s:minimum=1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyMap &lt;span style="color:#a2f;font-weight:bold">map&lt;/span>[&lt;span style="color:#0b0;font-weight:bold">int&lt;/span>]&lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myMap&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>In this case every key in &lt;code>MyMap&lt;/code> must be at least &lt;code>1&lt;/code>.&lt;/p>
&lt;h3 id="tag-eachVal">&lt;code>+k8s:eachVal&lt;/code>&lt;/h3>
&lt;p>Declares a validation for each value in a map or list.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;validation-tag&amp;gt;&lt;/code>: The tag to evaluate for each value.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:eachVal=+k8s:minimum=1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyMap &lt;span style="color:#a2f;font-weight:bold">map&lt;/span>[&lt;span style="color:#0b0;font-weight:bold">string&lt;/span>]&lt;span style="color:#0b0;font-weight:bold">int&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myMap&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>In this case every value in &lt;code>MyMap&lt;/code> must be at least &lt;code>1&lt;/code>.&lt;/p>
&lt;h3 id="tag-enum">&lt;code>+k8s:enum&lt;/code>&lt;/h3>
&lt;p>Indicates that a string type is an enum. All constant values of this type are considered values in the enum unless excluded using +k8s:enumExclude.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#080;font-style:italic">// +k8s:enum&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyEnum &lt;span style="color:#0b0;font-weight:bold">string&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">const&lt;/span> (
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyEnumA MyEnum = &lt;span style="color:#b44">&amp;#34;A&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyEnumB MyEnum = &lt;span style="color:#b44">&amp;#34;B&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyField MyEnum &lt;span style="color:#b44">`json:&amp;#34;myField&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Generated validation rejects values outside the declared constants.&lt;/p>
&lt;h3 id="tag-enumExclude">&lt;code>+k8s:enumExclude&lt;/code>&lt;/h3>
&lt;p>Indicates that an constant value is not part of an enum, even if the constant&amp;rsquo;s type is tagged with k8s:enum.
May be conditionally excluded via +k8s:ifEnabled(Option)=+k8s:enumExclude or +k8s:ifDisabled(Option)=+k8s:enumExclude.
If multiple +k8s:ifEnabled/+k8s:ifDisabled tags are used, the value is excluded if any of the exclude conditions are met.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#080;font-style:italic">// +k8s:enum&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyEnum &lt;span style="color:#0b0;font-weight:bold">string&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">const&lt;/span> (
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyEnumA MyEnum = &lt;span style="color:#b44">&amp;#34;A&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyEnumB MyEnum = &lt;span style="color:#b44">&amp;#34;B&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:enumExclude&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyEnumInternal MyEnum = &lt;span style="color:#b44">&amp;#34;Internal&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-forbidden">&lt;code>+k8s:forbidden&lt;/code>&lt;/h3>
&lt;p>Indicates that a field may not be specified.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:forbidden&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyField &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myField&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-format">&lt;code>+k8s:format&lt;/code>&lt;/h3>
&lt;p>Indicates that a string field has a particular format.&lt;/p>
&lt;p>Supported payloads:&lt;/p>
&lt;ul>
&lt;li>&lt;code>k8s-extended-resource-name&lt;/code>: This field holds a Kubernetes extended resource name. This is a domain-prefixed name that must not have a &lt;code>kubernetes.io&lt;/code> or &lt;code>requests.&lt;/code> prefix. When &lt;code>requests.&lt;/code> is prepended, the result must be a valid label key, as used by quota.&lt;/li>
&lt;li>&lt;code>k8s-label-key&lt;/code>: This field holds a Kubernetes label key.&lt;/li>
&lt;li>&lt;code>k8s-label-value&lt;/code>: This field holds a Kubernetes label value.&lt;/li>
&lt;li>&lt;code>k8s-long-name&lt;/code>: This field holds a Kubernetes &amp;ldquo;long name&amp;rdquo;, aka a &amp;ldquo;DNS subdomain&amp;rdquo; value.&lt;/li>
&lt;li>&lt;code>k8s-long-name-caseless&lt;/code>: Deprecated: This field holds a case-insensitive Kubernetes &amp;ldquo;long name&amp;rdquo;, aka a &amp;ldquo;DNS subdomain&amp;rdquo; value.&lt;/li>
&lt;li>&lt;code>k8s-path-segment-name&lt;/code>: This field holds a Kubernetes &amp;ldquo;path segment name&amp;rdquo; value.&lt;/li>
&lt;li>&lt;code>k8s-resource-fully-qualified-name&lt;/code>: This field holds a Kubernetes resource &amp;ldquo;fully qualified name&amp;rdquo; value. A fully qualified name must not be empty and must be composed of a prefix and a name, separated by a slash (e.g., &amp;ldquo;prefix/name&amp;rdquo;). The prefix must be a DNS subdomain, and the name part must be a C identifier with no more than 32 characters.&lt;/li>
&lt;li>&lt;code>k8s-resource-pool-name&lt;/code>: This field holds value with one or more Kubernetes &amp;ldquo;long name&amp;rdquo; parts separated by &lt;code>/&lt;/code> and no longer than 253 characters.&lt;/li>
&lt;li>&lt;code>k8s-short-name&lt;/code>: This field holds a Kubernetes &amp;ldquo;short name&amp;rdquo;, aka a &amp;ldquo;DNS label&amp;rdquo; value.&lt;/li>
&lt;li>&lt;code>k8s-uuid&lt;/code>: This field holds a Kubernetes UUID, which conforms to RFC 4122.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:format=k8s-label-key&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> LabelKey &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;labelKey&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:format=k8s-uuid&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> UID &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;uid&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-ifDisabled">&lt;code>+k8s:ifDisabled&lt;/code>&lt;/h3>
&lt;p>Declares a validation that only applies when an option is disabled.&lt;/p>
&lt;ul>
&lt;li>Argument: &lt;code>&amp;lt;option&amp;gt;&lt;/code>.&lt;/li>
&lt;li>Payload &lt;code>&amp;lt;validation-tag&amp;gt;&lt;/code>: This validation tag will be evaluated only if the validation option is disabled.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:ifDisabled(MyFeature)=+k8s:required&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyField &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myField&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-ifEnabled">&lt;code>+k8s:ifEnabled&lt;/code>&lt;/h3>
&lt;p>Declares a validation that only applies when an option is enabled.&lt;/p>
&lt;ul>
&lt;li>Argument: &lt;code>&amp;lt;option&amp;gt;&lt;/code>.&lt;/li>
&lt;li>Payload &lt;code>&amp;lt;validation-tag&amp;gt;&lt;/code>: This validation tag will be evaluated only if the validation option is enabled.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:ifEnabled(MyFeature)=+k8s:required&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyField &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myField&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-ifMode">&lt;code>+k8s:ifMode&lt;/code>&lt;/h3>
&lt;p>Indicates that this field&amp;rsquo;s validation depends on a mode discriminator.&lt;/p>
&lt;ul>
&lt;li>Positional argument &lt;code>&amp;lt;string&amp;gt;&lt;/code>: the value of the mode discriminator for which this validation applies.&lt;/li>
&lt;li>Argument &lt;code>modality&lt;/code> (&lt;code>&amp;lt;string&amp;gt;&lt;/code>): the name of the discriminator group.&lt;/li>
&lt;li>Argument &lt;code>mode&lt;/code> (&lt;code>&amp;lt;string&amp;gt;&lt;/code>): the mode value for which this validation applies.&lt;/li>
&lt;li>Payload: &lt;code>&amp;lt;validation-tag&amp;gt;&lt;/code>.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:modeDiscriminator&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Mode &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;mode&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:ifMode(&amp;#34;External&amp;#34;)=+k8s:required&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> External &lt;span style="color:#666">*&lt;/span>ExternalConfig &lt;span style="color:#b44">`json:&amp;#34;external,omitempty&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-immutable">&lt;code>+k8s:immutable&lt;/code>&lt;/h3>
&lt;p>Indicates that a field may not be updated.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:immutable&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Name &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;name&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-isSubresource">&lt;code>+k8s:isSubresource&lt;/code>&lt;/h3>
&lt;p>Marks a type as the validation shape for a specific subresource.&lt;/p>
&lt;p>It depends on &lt;code>+k8s:supportsSubresource&lt;/code> on the root resource type. Without that matching support declaration, generated subresource validation code may exist but not be reachable through the dispatcher.&lt;/p>
&lt;ul>
&lt;li>Payload: subresource path, such as &lt;code>&amp;quot;/status&amp;quot;&lt;/code> or &lt;code>&amp;quot;/scale&amp;quot;&lt;/code>.&lt;/li>
&lt;/ul>
&lt;p>Root resource type:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#080;font-style:italic">// +k8s:supportsSubresource=&amp;#34;/scale&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyResource &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Spec MySpec &lt;span style="color:#b44">`json:&amp;#34;spec,omitempty&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Status MyStatus &lt;span style="color:#b44">`json:&amp;#34;status,omitempty&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Subresource type:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#080;font-style:italic">// +k8s:isSubresource=&amp;#34;/scale&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyResourceScale &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Spec ScaleSpec &lt;span style="color:#b44">`json:&amp;#34;spec,omitempty&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Status ScaleStatus &lt;span style="color:#b44">`json:&amp;#34;status,omitempty&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Use this when subresource validation needs to live separately from root-object validation.&lt;/p>
&lt;h3 id="tag-item">&lt;code>+k8s:item&lt;/code>&lt;/h3>
&lt;p>Declares a validation for an item of a slice declared as a +k8s:listType=map. The item to match is declared by providing field-value pair arguments. All key fields must be specified.&lt;/p>
&lt;p>Arguments must be named with the JSON names of the list-map key fields. Values can be strings, integers, or booleans. For example: +k8s:item(name: &amp;ldquo;myname&amp;rdquo;, priority: 10, enabled: true)=&lt;chained-validation-tag>&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;validation-tag&amp;gt;&lt;/code>: The tag to evaluate for the matching list item.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:listType=map&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:listMapKey=type&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:item(type: &amp;#34;Approved&amp;#34;)=+k8s:zeroOrOneOfMember&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:item(type: &amp;#34;Denied&amp;#34;)=+k8s:zeroOrOneOfMember&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyConditions []MyCondition &lt;span style="color:#b44">`json:&amp;#34;conditions&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyCondition &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Type &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;type&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Status &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;status&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Here only the items with &lt;code>type: &amp;quot;Approved&amp;quot;&lt;/code> or &lt;code>type: &amp;quot;Denied&amp;quot;&lt;/code> get the nested validation.&lt;/p>
&lt;h3 id="tag-listMapKey">&lt;code>+k8s:listMapKey&lt;/code>&lt;/h3>
&lt;p>Declares a named sub-field of a list&amp;rsquo;s value-type to be part of the list-map key.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;field-json-name&amp;gt;&lt;/code>: The name of the field.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#080;font-style:italic">// +k8s:listType=map&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#080;font-style:italic">// +k8s:listMapKey=keyFieldOne&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#080;font-style:italic">// +k8s:listMapKey=keyFieldTwo&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyList []MyStruct
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> KeyFieldOne &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;keyFieldOne&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> KeyFieldTwo &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;keyFieldTwo&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ValueField &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;valueField&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-listType">&lt;code>+k8s:listType&lt;/code>&lt;/h3>
&lt;p>Declares a list field&amp;rsquo;s semantic type and ownership behavior. atomic: single ownership, set: shared ownership with uniqueness, map: shared ownership with key-based uniqueness.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;type&amp;gt;&lt;/code>: atomic | map | set.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#080;font-style:italic">// +k8s:listType=map&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#080;font-style:italic">// +k8s:listMapKey=keyField&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyList []MyStruct
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> KeyField &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;keyField&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ValueField &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;valueField&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-maxBytes">&lt;code>+k8s:maxBytes&lt;/code>&lt;/h3>
&lt;p>Indicates that a string field has a limit on its length in bytes.
This could only allow as few as N/4 multi-byte characters.
If you want to limit length of characters specifically, use maxLength.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;non-negative integer&amp;gt;&lt;/code>: This field must be no more than X bytes long.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:maxBytes=64&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Token &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;token&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-maxItems">&lt;code>+k8s:maxItems&lt;/code>&lt;/h3>
&lt;p>Indicates that a list has a limit on its size.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;non-negative integer&amp;gt;&lt;/code>: This list must be no more than X items long.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:maxItems=5&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyList []&lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myList&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-maxLength">&lt;code>+k8s:maxLength&lt;/code>&lt;/h3>
&lt;p>Indicates that a string field has a limit on its length in characters.
This could allow up to 4*N bytes if multi-byte characters are used.
If you want to limit length of bytes specifically, use maxBytes.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;non-negative integer&amp;gt;&lt;/code>: This field must be no more than X characters long.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:maxLength=10&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyString &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myString&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-maxProperties">&lt;code>+k8s:maxProperties&lt;/code>&lt;/h3>
&lt;p>maxProperties provides a limit on properties of an object as defined by JSON schema. In Kubernetes it may only be used to constrain the number of elements on a field defined as a golang map.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;non-negative integer&amp;gt;&lt;/code>: This map must have no more than X properties (where X &amp;lt;= 100000).&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:maxProperties=8&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Labels &lt;span style="color:#a2f;font-weight:bold">map&lt;/span>[&lt;span style="color:#0b0;font-weight:bold">string&lt;/span>]&lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;labels&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-maximum">&lt;code>+k8s:maximum&lt;/code>&lt;/h3>
&lt;p>Indicates that a numeric field has a maximum value.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;integer&amp;gt;&lt;/code>: This field must be less than or equal to X.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:maximum=10&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Replicas &lt;span style="color:#0b0;font-weight:bold">int&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;replicas&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-minItems">&lt;code>+k8s:minItems&lt;/code>&lt;/h3>
&lt;p>Indicates that a list has a minimum size.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;non-negative integer&amp;gt;&lt;/code>: This list must be at least X items long.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:minItems=1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Names []&lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;names&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-minLength">&lt;code>+k8s:minLength&lt;/code>&lt;/h3>
&lt;p>Indicates that a string field has a minimum length for its value in characters.
This means that the minimum size in bytes is a range from X to 4X if multi-byte characters are allowed.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;integer&amp;gt;&lt;/code>: This field must be at least X characters long.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:minLength=1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Name &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;name&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-minProperties">&lt;code>+k8s:minProperties&lt;/code>&lt;/h3>
&lt;p>minProperties provides a limit on properties of an object as defined by JSON schema. In Kubernetes it may only be used to constrain the number of elements on a field defined as a golang map.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;non-negative integer&amp;gt;&lt;/code>: This map must have at least X properties (where X &amp;lt;= 100000).&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:minProperties=1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Selectors &lt;span style="color:#a2f;font-weight:bold">map&lt;/span>[&lt;span style="color:#0b0;font-weight:bold">string&lt;/span>]&lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;selectors&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-minimum">&lt;code>+k8s:minimum&lt;/code>&lt;/h3>
&lt;p>Indicates that a numeric field has a minimum value.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;integer&amp;gt;&lt;/code>: This field must be greater than or equal to X.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:minimum=0&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyInt &lt;span style="color:#0b0;font-weight:bold">int&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myInt&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-modeDiscriminator">&lt;code>+k8s:modeDiscriminator&lt;/code>&lt;/h3>
&lt;p>Indicates that this field is a discriminator for state-based validation.&lt;/p>
&lt;ul>
&lt;li>Argument &lt;code>modality&lt;/code> (&lt;code>&amp;lt;string&amp;gt;&lt;/code>): the name of the discriminator group, if more than one exists.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:modeDiscriminator&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Mode &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;mode&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:ifMode(&amp;#34;File&amp;#34;)=+k8s:required&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> File &lt;span style="color:#666">*&lt;/span>FileSource &lt;span style="color:#b44">`json:&amp;#34;file,omitempty&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:ifMode(&amp;#34;URL&amp;#34;)=+k8s:required&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> URL &lt;span style="color:#666">*&lt;/span>URLSource &lt;span style="color:#b44">`json:&amp;#34;url,omitempty&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-neq">&lt;code>+k8s:neq&lt;/code>&lt;/h3>
&lt;p>Verifies the field&amp;rsquo;s value is not equal to a specific disallowed value. Supports string, integer, and boolean types.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;value&amp;gt;&lt;/code>: The disallowed value. The parser will infer the type (string, int, bool).&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:neq=&amp;#34;disallowed&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyString &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myString&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:neq=0&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyInt &lt;span style="color:#0b0;font-weight:bold">int&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myInt&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:neq=true&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyBool &lt;span style="color:#0b0;font-weight:bold">bool&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myBool&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-opaqueType">&lt;code>+k8s:opaqueType&lt;/code>&lt;/h3>
&lt;p>Indicates that any validations declared on the referenced type will be ignored. If a referenced type&amp;rsquo;s package is not included in the generator&amp;rsquo;s current flags, this tag must be set, or code generation will fail (preventing silent mistakes). If the validations should not be ignored, add the type&amp;rsquo;s package to the generator using the &amp;ndash;readonly-pkg flag.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">import&lt;/span> &lt;span style="color:#b44">&amp;#34;some/external/package&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:opaqueType&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ExternalField &lt;span style="color:#a2f;font-weight:bold">package&lt;/span>.ExternalType &lt;span style="color:#b44">`json:&amp;#34;externalField&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-optional">&lt;code>+k8s:optional&lt;/code>&lt;/h3>
&lt;p>Indicates that a field is optional to clients.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:optional&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyField &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myField&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-required">&lt;code>+k8s:required&lt;/code>&lt;/h3>
&lt;p>Indicates that a field must be specified by clients.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:required&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MyField &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;myField&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-subfield">&lt;code>+k8s:subfield&lt;/code>&lt;/h3>
&lt;p>Declares a validation for a subfield of a struct.&lt;/p>
&lt;p>The named subfield must be a direct field of the struct, or of an embedded struct.&lt;/p>
&lt;ul>
&lt;li>Argument &lt;code>&amp;lt;field-json-name&amp;gt;&lt;/code>.&lt;/li>
&lt;li>Payload &lt;code>&amp;lt;validation-tag&amp;gt;&lt;/code>: The tag to evaluate for the subfield.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> Wrapper &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:subfield(name)=+k8s:required&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Metadata ObjectMeta &lt;span style="color:#b44">`json:&amp;#34;metadata&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> ObjectMeta &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Name &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;name&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-supportsSubresource">&lt;code>+k8s:supportsSubresource&lt;/code>&lt;/h3>
&lt;p>Declares which subresources the validation dispatcher should recognize for a root resource type.&lt;/p>
&lt;ul>
&lt;li>Payload: subresource path, such as &lt;code>&amp;quot;/status&amp;quot;&lt;/code> or &lt;code>&amp;quot;/scale&amp;quot;&lt;/code>.&lt;/li>
&lt;li>May be repeated for multiple subresources.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#080;font-style:italic">// +k8s:supportsSubresource=&amp;#34;/status&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#080;font-style:italic">// +k8s:supportsSubresource=&amp;#34;/scale&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyResource &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Spec MySpec &lt;span style="color:#b44">`json:&amp;#34;spec,omitempty&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Status MyStatus &lt;span style="color:#b44">`json:&amp;#34;status,omitempty&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If a type has no &lt;code>+k8s:supportsSubresource&lt;/code> tags, generated validation is only wired for the root resource.&lt;/p>
&lt;h3 id="tag-unionDiscriminator">&lt;code>+k8s:unionDiscriminator&lt;/code>&lt;/h3>
&lt;p>Indicates that this field is the discriminator for a union.&lt;/p>
&lt;ul>
&lt;li>Argument &lt;code>union&lt;/code> (&lt;code>&amp;lt;string&amp;gt;&lt;/code>): the name of the union, if more than one exists.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:unionDiscriminator&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Type MyType &lt;span style="color:#b44">`json:&amp;#34;type&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:unionMember&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:optional&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> OptionA &lt;span style="color:#666">*&lt;/span>OptionA &lt;span style="color:#b44">`json:&amp;#34;optionA&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:unionMember&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:optional&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> OptionB &lt;span style="color:#666">*&lt;/span>OptionB &lt;span style="color:#b44">`json:&amp;#34;optionB&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-unionMember">&lt;code>+k8s:unionMember&lt;/code>&lt;/h3>
&lt;p>Indicates that this field is a member of a union.&lt;/p>
&lt;ul>
&lt;li>Argument &lt;code>union&lt;/code> (&lt;code>&amp;lt;string&amp;gt;&lt;/code>): the name of the union, if more than one exists.&lt;/li>
&lt;li>Argument &lt;code>memberName&lt;/code> (&lt;code>&amp;lt;string&amp;gt;&lt;/code>): the discriminator value for this member.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:unionMember(union: &amp;#34;backend&amp;#34;, memberName: &amp;#34;service&amp;#34;)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:optional&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Service &lt;span style="color:#666">*&lt;/span>ServiceBackend &lt;span style="color:#b44">`json:&amp;#34;service&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:unionMember(union: &amp;#34;backend&amp;#34;, memberName: &amp;#34;resource&amp;#34;)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:optional&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Resource &lt;span style="color:#666">*&lt;/span>ResourceBackend &lt;span style="color:#b44">`json:&amp;#34;resource&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-unique">&lt;code>+k8s:unique&lt;/code>&lt;/h3>
&lt;p>Declares that a list field&amp;rsquo;s elements are unique. This tag can be used with listType=atomic to add uniqueness constraints, or independently to specify uniqueness semantics.&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;type&amp;gt;&lt;/code>: map | set.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:listType=atomic&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:unique=map&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:listMapKey=name&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Ports []Port &lt;span style="color:#b44">`json:&amp;#34;ports&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> Port &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Name &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;name&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Port &lt;span style="color:#0b0;font-weight:bold">int32&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;port&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-update">&lt;code>+k8s:update&lt;/code>&lt;/h3>
&lt;p>Provides constraints on the allowed update operations of a field. Constraints: NoSet (prevents unset-&amp;gt;set transitions), NoUnset (prevents set-&amp;gt;unset transitions), NoModify (prevents value changes but allows set/unset transitions), NoAddItem (prevents adding items to a slice or map), NoRemoveItem (prevents removing items from a slice or map). Multiple constraints can be specified using multiple tags. For non-pointer structs, NoSet and NoUnset have no effect as these fields cannot be unset. For slice and map fields, &amp;lsquo;unset&amp;rsquo; means len == 0. Slice item identity for NoAddItem/NoRemoveItem comes from +k8s:listType/+k8s:listMapKey/+k8s:unique, for maps the key is the item identity. NoModify is not supported on slices or maps, use +k8s:eachVal=+k8s:update=NoModify for per-item immutability. On lists, +k8s:eachVal=+k8s:update=NoModify requires listType=map or unique=map, otherwise content changes are not detectable. Examples: +k8s:update=NoModify +k8s:update=NoUnset for set-once fields, +k8s:update=NoSet for fields that must be set at creation or never, +k8s:update=NoAddItem +k8s:update=NoRemoveItem on a listType=map field to freeze the structural shape of the list.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:update=NoModify&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:update=NoUnset&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Token &lt;span style="color:#666">*&lt;/span>&lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;token,omitempty&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:listType=map&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:listMapKey=name&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:update=NoAddItem&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:update=NoRemoveItem&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Ports []Port &lt;span style="color:#b44">`json:&amp;#34;ports&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> Port &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Name &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;name&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Port &lt;span style="color:#0b0;font-weight:bold">int32&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;port&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:listType=map&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:listMapKey=name&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:eachVal=+k8s:update=NoModify&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Ports []Port &lt;span style="color:#b44">`json:&amp;#34;ports&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tag-zeroOrOneOfMember">&lt;code>+k8s:zeroOrOneOfMember&lt;/code>&lt;/h3>
&lt;p>Indicates that this field is a member of a zero-or-one-of union.&lt;/p>
&lt;p>A zero-or-one-of union allows at most one member to be set. Unlike regular unions, having no members set is valid.&lt;/p>
&lt;p>Warning: This tag should only be used on sets of list items, and never on struct fields directly.&lt;/p>
&lt;ul>
&lt;li>Argument &lt;code>union&lt;/code> (&lt;code>&amp;lt;string&amp;gt;&lt;/code>): the name of the union, if more than one exists.&lt;/li>
&lt;li>Argument &lt;code>memberName&lt;/code> (&lt;code>&amp;lt;string&amp;gt;&lt;/code>): the custom member name for this member.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> MyStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:listType=map&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:listMapKey=type&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:item(type: &amp;#34;Foo&amp;#34;)=+k8s:zeroOrOneOfMember&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:item(type: &amp;#34;Bar&amp;#34;)=+k8s:zeroOrOneOfMember&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Conditions []Condition &lt;span style="color:#b44">`json:&amp;#34;conditions&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> Condition &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Type &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;type&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Status &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;status&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="testing-only-tags">Testing-only tags&lt;/h3>
&lt;p>&lt;code>validation-gen&lt;/code> also registers a few tags that are only useful in generator tests:&lt;/p>
&lt;ul>
&lt;li>&lt;code>+k8s:validateError&lt;/code>: Always fails code generation (useful for testing).&lt;/li>
&lt;li>&lt;code>+k8s:validateFalse&lt;/code>: Always fails validation (useful for testing).&lt;/li>
&lt;li>&lt;code>+k8s:validateTrue&lt;/code>: Always passes validation (useful for testing).&lt;/li>
&lt;li>&lt;code>+k8s:validateTrueAlpha&lt;/code>: Always passes validation (useful for testing).&lt;/li>
&lt;li>&lt;code>+k8s:validateTrueBeta&lt;/code>: Always passes validation (useful for testing).&lt;/li>
&lt;/ul>
&lt;p>&lt;code>+k8s:validateError&lt;/code> payload:&lt;/p>
&lt;ul>
&lt;li>Payload &lt;code>&amp;lt;string&amp;gt;&lt;/code>: This string will be included in the error message.&lt;/li>
&lt;/ul>
&lt;p>&lt;code>+k8s:validateFalse&lt;/code>, &lt;code>+k8s:validateTrue&lt;/code>, &lt;code>+k8s:validateTrueAlpha&lt;/code>, and &lt;code>+k8s:validateTrueBeta&lt;/code> arguments and payloads:&lt;/p>
&lt;ul>
&lt;li>Argument &lt;code>flags&lt;/code> (&lt;code>&amp;lt;comma-separated-list-of-flag-string&amp;gt;&lt;/code>): values: ShortCircuit, NonError.&lt;/li>
&lt;li>Argument &lt;code>typeArg&lt;/code> (&lt;code>&amp;lt;string&amp;gt;&lt;/code>): The type arg in generated code (must be the value-type, not pointer).&lt;/li>
&lt;li>Argument &lt;code>cohort&lt;/code> (&lt;code>&amp;lt;string&amp;gt;&lt;/code>): An optional cohort name to group multiple validations.&lt;/li>
&lt;li>Payload &lt;code>&amp;lt;none&amp;gt;&lt;/code>.&lt;/li>
&lt;li>Payload &lt;code>&amp;lt;string&amp;gt;&lt;/code>: The generated code will include this string.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a2f;font-weight:bold">type&lt;/span> FixtureStruct &lt;span style="color:#a2f;font-weight:bold">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#080;font-style:italic">// +k8s:validateFalse=&amp;#34;field FixtureStruct.Name&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Name &lt;span style="color:#0b0;font-weight:bold">string&lt;/span> &lt;span style="color:#b44">`json:&amp;#34;name&amp;#34;`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="review-checklist">Review checklist&lt;/h2>
&lt;p>Use this as a quick pass when reviewing a PR that adds declarative validation:&lt;/p>
&lt;ul>
&lt;li>Are the tags on the versioned API types?&lt;/li>
&lt;li>Did the PR regenerate &lt;code>zz_generated.validations.go&lt;/code>?&lt;/li>
&lt;li>Did the PR regenerate &lt;code>test/declarative_validation/&amp;lt;group&amp;gt;/&amp;lt;kind&amp;gt;/zz_generated.validations.main_test.go&lt;/code>?&lt;/li>
&lt;li>Did the PR regenerate &lt;code>test/declarative_validation/&amp;lt;group&amp;gt;/&amp;lt;kind&amp;gt;/zz_generated.validations.&amp;lt;api-version-*&amp;gt;_test.go&lt;/code>?&lt;/li>
&lt;li>For migrations, does handwritten validation still match the generated result?&lt;/li>
&lt;li>For lifecycle wrappers, is &lt;code>since:&lt;/code> set to the version where the rule entered that stage?&lt;/li>
&lt;li>For cases where the field is uses as a subresource (ex: &lt;code>spec.Status.*&lt;/code> fields), is the necessary &lt;code>+k8s:supportsSubresource&lt;/code> or &lt;code>+k8s:isSubresource&lt;/code> set?&lt;/li>
&lt;/ul></description></item><item><title>Docs: CRI API version skew policy</title><link>https://deploy-preview-776--kubernetes-contributor.netlify.app/docs/code/cri-api-version-skew-policy/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-776--kubernetes-contributor.netlify.app/docs/code/cri-api-version-skew-policy/</guid><description>
&lt;p>CRI is a plugin interface which enables the kubelet to use a wide variety of container runtimes,
without the need to recompile. CRI consists of a protocol buffers and gRPC API.
Read more about CRI API at &lt;a href="https://kubernetes.io/docs/concepts/architecture/cri/"
target="_blank" rel="noopener">kubernetes docs&lt;/a>
.&lt;/p>
&lt;p>The CRI API is &lt;strong>only&lt;/strong> intended to be used for the kubelet to container runtime
interactions, or for node-level troubleshooting using a tool such as &lt;code>crictl&lt;/code>.
It is &lt;strong>not&lt;/strong> a common purpose container runtime API for general use, and is &lt;strong>intended&lt;/strong>
to be Kubernetes-centric. This is why there may be an undocumented logic
within a container runtimes that assumes the order or specific parameters
of call(s) that the kubelet makes. Attempts to call CRI API in a different order
by a client different than the kubelet, might result in unrecoverable error.
Whenever discovered, this logic is being documented and avoided.&lt;/p>
&lt;h2 id="version-skew-on-a-node">Version skew on a node&lt;/h2>
&lt;p>On a single Node there may be installed multiple components implementing
different versions of CRI API.&lt;/p>
&lt;p>For example, on a single node there might be:&lt;/p>
&lt;ul>
&lt;li>&lt;em>Kubelet&lt;/em> may call into &lt;em>Container Runtime&lt;/em> (e.g. &lt;a href="https://containerd.io"
target="_blank" rel="noopener">containerd&lt;/a>
)
and &lt;em>Image Service Proxy&lt;/em> (e.g. &lt;a href="https://github.com/containerd/stargz-snapshotter"
target="_blank" rel="noopener">stargz-snapshotter&lt;/a>
).
&lt;em>Container Runtime&lt;/em> may be versioned with the OS Image, &lt;em>Kubelet&lt;/em> is installed
by system administrator and &lt;em>Image Service proxy&lt;/em> is versioned by the third party vendor.&lt;/li>
&lt;li>&lt;em>Image Service Proxy&lt;/em> calls into &lt;em>Container Runtime&lt;/em>.&lt;/li>
&lt;li>&lt;em>CRI tools&lt;/em> (e.g. &lt;a href="https://kubernetes.io/docs/tasks/debug/debug-cluster/crictl/"
target="_blank" rel="noopener">crictl&lt;/a>
)
may be installed by end user to troubleshoot, same as a third party daemonsets.
All of them are used to call into the &lt;em>Container Runtime&lt;/em> to collect container information.&lt;/li>
&lt;/ul>
&lt;p>So on a single node it may happen that &lt;em>Container Runtime&lt;/em> is serving a newer
version&amp;rsquo;d kubelet and older versioned crictl. This is a supported scenario within
the version skew policy.&lt;/p>
&lt;h3 id="version-skew-policy-for-cri-api">Version Skew Policy for CRI API&lt;/h3>
&lt;p>CRI API has two versions:&lt;/p>
&lt;ul>
&lt;li>Major semantic version (known versions are
&lt;code>v1alpha2&lt;/code> (&lt;a href="https://kubernetes.io/blog/2022/12/09/kubernetes-v1-26-release/#cri-v1alpha2-removed"
target="_blank" rel="noopener">removed in 1.26&lt;/a>
), &lt;code>v1&lt;/code>).&lt;/li>
&lt;li>Kubernetes version (for example: &lt;code>@1.23&lt;/code>). Note, the &lt;code>cri-api&lt;/code> Golang library
is versioned as &lt;code>0.23&lt;/code> as it doesn&amp;rsquo;t guarantee Go types backward compatibility.&lt;/li>
&lt;/ul>
&lt;p>Major semantic version (e.g. &lt;code>v1&lt;/code>) is used to introduce breaking changes
and major new features that are incompatible with the current API.&lt;/p>
&lt;p>Kubernetes version is used to indicate a specific feature set implemented
on top of the major semantic version. All changes made without the change
of a major semantic version API must be backward and forward compatible.&lt;/p>
&lt;ul>
&lt;li>&lt;em>Kubelet&lt;/em> must work with the older &lt;em>Container Runtime&lt;/em> if it implements
the same semantic version of CRI API (e.g. &lt;code>v1&lt;/code>) of up to three Kubernetes minor
versions back. New features implemented in CRI API must be gracefully degraded.
For example, &lt;em>Kubelet&lt;/em> of version 1.26 must work with &lt;em>Container Runtime&lt;/em>
implementing &lt;code>k8s.io/cri-api@v0.23.0&lt;/code>+.&lt;/li>
&lt;li>&lt;em>Kubelet&lt;/em> must work with &lt;em>Container Runtime&lt;/em> if it implements
the same semantic version of CRI API (e.g. &lt;code>v1&lt;/code>) of up to
three minor versions up. New features implemented in CRI API must not change
behavior of old method calls and response values. For example, &lt;em>Kubelet&lt;/em> of
version 1.22 must work with &lt;em>Container Runtime&lt;/em> implementing &lt;code>k8s.io/cri-api@v0.25.5&lt;/code>.&lt;/li>
&lt;/ul>
&lt;h2 id="versioning">Versioning&lt;/h2>
&lt;p>This library contains go classes generated from the CRI API protocol buffers and gRPC API.&lt;/p>
&lt;p>The library versioned as &lt;code>0.XX&lt;/code> as Kubernetes doesn&amp;rsquo;t provide any guarantees
on backward compatibility of Go wrappers between versions. However CRI API itself
(protocol buffers and gRPC API) is marked as stable &lt;code>v1&lt;/code> version and it is
backward compatible between versions.&lt;/p>
&lt;p>Versions like &lt;code>v0.&amp;lt;minor&amp;gt;.&amp;lt;patch&amp;gt;&lt;/code> (e.g. &lt;code>v0.25.5&lt;/code>) are considered stable.
It is discouraged to introduce CRI API changes in patch releases and recommended
to use versions like &lt;code>v0.&amp;lt;minor&amp;gt;.0&lt;/code>.&lt;/p>
&lt;p>All alpha and beta versions (e.g. &lt;code>k8s.io/cri-api@v0.26.0-beta.0&lt;/code>) should be
backward and forward compatible.&lt;/p>
&lt;h2 id="feature-development">Feature development&lt;/h2>
&lt;p>Some features development requires changes in CRI API and corresponding changes
in &lt;em>Container Runtime&lt;/em>. Coordinating between Kubernetes branches and release
versions and &lt;em>Container Runtime&lt;/em> versions is not always trivial.&lt;/p>
&lt;p>The recommended feature development flow is following:&lt;/p>
&lt;ul>
&lt;li>Review proposed CRI API changes during the KEP review stage.
Some field names and types may not be spelled out exactly at this stage.&lt;/li>
&lt;li>Locally implement a prototype that implement changes in both - Kubernetes and Container Runtime.&lt;/li>
&lt;li>Submit a Pull Request for Kubernetes implementing CRI API changes alongside the feature code.
Feature must be developed to degrade gracefully when used with older Container Runtime
according to the Version Skew policy.&lt;/li>
&lt;li>Once PR is merged, wait for the next Kubernetes release tag being produced.
Find the corresponding CRI API tag (e.g. &lt;code>k8s.io/cri-api@v0.26.0-beta.0&lt;/code>).&lt;/li>
&lt;li>This tag can be used to implement the feature in Container Runtime. It is recommended
to switch to the stable tag like (&lt;code>k8s.io/cri-api@v0.26.0&lt;/code>) once available.&lt;/li>
&lt;/ul>
&lt;h3 id="designing-new-cri-apis">Designing new CRI APIs&lt;/h3>
&lt;p>The following are considerations to take into account designing new features:&lt;/p>
&lt;ol>
&lt;li>The intended behavior, expectations, and call sequence, must be documented directly
in the protocol definition to simplify runtime adoption.&lt;/li>
&lt;li>The CRI API change must be as simple as possible. Choosing between simplicity and
expressiveness, simplicity has a preference.&lt;/li>
&lt;li>Existing fields must be reused only if their logical meaning allows it
and does not interfere with the existing features. Changing the expected value
format or call sequence may break things in a way that is hard to test and should be avoided.&lt;/li>
&lt;/ol>
&lt;h3 id="feature-testing">Feature testing&lt;/h3>
&lt;p>It is highly encouraged to add critest to every new CRI API.
Read about CRI API &lt;a href="https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/validation.md"
target="_blank" rel="noopener">validation&lt;/a>
.&lt;/p>
&lt;h2 id="whats-next">What&amp;rsquo;s next&lt;/h2>
&lt;ul>
&lt;li>What is &lt;a href="https://kubernetes.io/docs/concepts/architecture/cri/"
target="_blank" rel="noopener">Container Runtime Interface (CRI)&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://deploy-preview-776--kubernetes-contributor.netlify.app/docs/code/cri-api-dev-policies"
>Kubernetes feature development and container runtimes&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://kubernetes.io/docs/setup/production-environment/container-runtimes/"
target="_blank" rel="noopener">Installing Container Runtimes&lt;/a>
&lt;/li>
&lt;/ul></description></item><item><title>Docs: Kubernetes feature development and container runtimes</title><link>https://deploy-preview-776--kubernetes-contributor.netlify.app/docs/code/cri-api-dev-policies/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-776--kubernetes-contributor.netlify.app/docs/code/cri-api-dev-policies/</guid><description>
&lt;p>CRI is a plugin interface which enables the kubelet to use a wide variety of container runtimes,
without the need to recompile. CRI consists of a protocol buffers and gRPC API.
Read more about CRI API at &lt;a href="https://kubernetes.io/docs/concepts/architecture/cri/"
target="_blank" rel="noopener">kubernetes docs&lt;/a>
.&lt;/p>
&lt;p>The mechanics of a feature development that requires new CRI APIs is covered in
documentation on CRI API &lt;a href="https://deploy-preview-776--kubernetes-contributor.netlify.app/docs/code/cri-api-version-skew-policy#feature-development"
>feature-development&lt;/a>
.
This article defines policies for developing new Kubernetes features
that require CRI API changes. The goal of these policies is to ensure great user
experience for people trying the new feature early, adopting it when it is
enabled by default, and relying on it as a GA functionality.&lt;/p>
&lt;div class="alert alert-warning" role="alert">
&lt;h4 class="alert-heading">Notice&lt;/h4>
This document establishes development policies for new features requiring
adherence to the policy by two currently-participating runtime. This is not
a commitment from the Kubernetes community to support these features. Also
the list of participating container runtimes may change depending on the community
engagement.
&lt;/div>
&lt;h2 id="participating-container-runtimes">Participating container runtimes&lt;/h2>
&lt;p>Features and CRI API are supposed to be portable and generic and not limited to
a specific container runtime. However at this moment SIG Node requires every
feature to work on two container runtimes: &lt;a href="https://containerd.io/"
target="_blank" rel="noopener">containerd&lt;/a>
and &lt;a href="https://cri-o.io/"
target="_blank" rel="noopener">CRI-O&lt;/a>
. These are two runtimes that are tested as part
of a Kubernetes development and release process to refer features portability.
When this document refers to two container runtimes, it assumes both -
containerd and CRI-O. If any other container runtimes begin working actively
with the Kubernetes community, or one of existing container runtimes will stop
engagement, this document will be updated.&lt;/p>
&lt;h2 id="same-maturity-level-for-beta-and-ga">Same maturity level (for beta and GA)&lt;/h2>
&lt;p>Implementation of an API needed for a Kubernetes feature in a container runtime
&lt;strong>must&lt;/strong> be at least the same maturity as in k8s at a moment of Kubernetes release.
This is similar to the &lt;a href="https://kubernetes.io/docs/reference/using-api/deprecation-policy/#deprecating-a-feature-or-behavior"
target="_blank" rel="noopener">deprecation policy&lt;/a>
when one feature is replacing another.&lt;/p>
&lt;p>With containerd and CRI-O it means that for the GA features, there should be a
release of containerd and CRI-O implementing APIs needed for the feature in
those container runtimes. And those APIs &lt;strong>must not&lt;/strong> be marked as experimental
features (&lt;a href="https://containerd.io/releases/#experimental-features"
target="_blank" rel="noopener">containerd experimental features&lt;/a>
).
For the beta, neither container runtime has a notion of beta feature and
realistically the same maturity criteria applies as for GA.&lt;/p>
&lt;p>Note, beta releases of containerd and CRI-O have a different semantic than the
beta feature in Kubernetes. Beta releases on container runtimes today
are referring to the release readiness rather than feature completeness.&lt;/p>
&lt;h2 id="same-maturity-level-for-alpha">Same maturity level (for alpha)&lt;/h2>
&lt;p>There should be at least one implementation of an API needed for the Kubernetes
feature merged into the container runtime development branch (main) or marked as
experimental. An e2e test which demonstrates that the feature is working should be
merged alongside the code. Note, tests may run against the default branch of a
container runtime and the feature can be still not shipped.&lt;/p>
&lt;p>The actual container runtime release may be delayed to the later stage, but
Kubernetes highly encourages fast availability of a release of a container
runtime that can be tested by early adopters.&lt;/p>
&lt;h2 id="minimal-number-of-implementations">Minimal number of implementations&lt;/h2>
&lt;p>Both containerd and CRI-O &lt;strong>must&lt;/strong> have a GA release with the implementations of an
API needed for a Kubernetes feature before this Kubernetes feature can be
promoted to GA.&lt;/p>
&lt;h2 id="safe-kubernetes-defaults">Safe Kubernetes defaults&lt;/h2>
&lt;p>The feature cannot be enabled by default in Kubernetes as a beta feature before
the required APIs are implemented in both container runtimes (containerd and
CRI-O) and there is a GA release of a container runtime for each. The feature
can be marked as beta, but disabled by default, if there is only one container
runtime implementation of a required API that is released as GA. Note, as for
any Kubernetes features, at least one release with the beta feature enabled by
default is required before it is progressing to GA.&lt;/p>
&lt;h2 id="guarantee-portability">Guarantee portability&lt;/h2>
&lt;p>The feature design (KEP PR) MUST be lgtm-ed by container runtime maintainers of
CRI-O and containerd.&lt;/p>
&lt;p>The feature can only be merged as alpha in Kubernetes, if there is an agreement
from both container runtime maintainers on the feature design in general and API
shape. Gaining this agreement will often involve authoring the pull request
demonstrating an API implementation to the both container runtime repositories
or an alternative way for container runtime maintainers to confirm viability of
suggested CRI APIs.&lt;/p>
&lt;h2 id="guaranteed-implementation">Guaranteed implementation&lt;/h2>
&lt;p>CRI API can only be merged if there is a PR in both - Kubernetes repository and
container runtime repository (at least one) utilizing this API and demoing the
feature working end to end. See CRI API
&lt;a href="https://deploy-preview-776--kubernetes-contributor.netlify.app/docs/code/cri-api-version-skew-policy#feature-development"
>feature-development&lt;/a>
documentation.&lt;/p>
&lt;h2 id="features-discoverability">Features discoverability&lt;/h2>
&lt;p>Kubernetes features that depend on the environment or special container runtime
capabilities &lt;strong>must&lt;/strong> have its own explicit API configuration (like Pod API or Node
API) and &lt;strong>must&lt;/strong> not depend on the cluster or node configuration that is not
clearly exposed via these APIs. For example, it is OK to have Windows specific
features that are configured via Pod API. But it is not OK to design a feature
that will work on one container runtime and incompatible with the other
container runtime. There are three exceptions to this case:&lt;/p>
&lt;ul>
&lt;li>there will be a different behavior during the feature adoption period while
older runtime versions do not support the API yet. In those cases, attempting
to try the feature &lt;strong>must&lt;/strong> result in failing as fast as possible.&lt;/li>
&lt;li>LTS and older versions of container runtimes may not have an implementation of
an API and still be widely used by Kubernetes end users.&lt;/li>
&lt;li>If any of container runtime underlying systems cannot support the feature
in-principle (e.g. &lt;a href="https://katacontainers.io/"
target="_blank" rel="noopener">kata containers&lt;/a>
with CRI-O
may have limitations), while CRI-O still supports the feature without these
systems configured, this &lt;strong>must&lt;/strong> be designed as part of a normal operation.
In this case, Pod or Node APIs &lt;strong>must&lt;/strong> handle these cases gracefully and
those &lt;strong>must&lt;/strong> be documented clearly.&lt;/li>
&lt;/ul>
&lt;h2 id="whats-next">What&amp;rsquo;s next&lt;/h2>
&lt;ul>
&lt;li>What is &lt;a href="https://kubernetes.io/docs/concepts/architecture/cri/"
target="_blank" rel="noopener">Container Runtime Interface (CRI)&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://deploy-preview-776--kubernetes-contributor.netlify.app/docs/code/cri-api-version-skew-policy"
>CRI API version skew policy&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://kubernetes.io/docs/setup/production-environment/container-runtimes/"
target="_blank" rel="noopener">Installing Container Runtimes&lt;/a>
&lt;/li>
&lt;/ul></description></item></channel></rss>