Kinds: core workloads
Implementation, history and tests of the entries on the reference page Kinds: core workloads. Text in square brackets is added here to say what a moved sentence refers to.
webservice, worker
- History:
- go-kure/launcher#341 (the
DeploymentSpec-level surface thatwebserviceandworkershare withdeployment[until go-kure/launcher#1629 madedeploymenta raw kind]). - go-kure/launcher#1473 (
webserviceandworkerpublishtolerationsandtopologySpreadConstraints). - go-kure/launcher#280 (
workerandwebserviceare component lowering rules, not handlers). - go-kure/launcher#702 (both rules emit the component’s ServiceAccount as a
serviceaccountmember and turn each claim apvcvolume describes into a synthesizedpvctrait). - go-kure/launcher#546 (a
webservicecomponent name must be a valid Service name). - go-kure/launcher#959 (a leading digit in a
webservicecomponent name underRelaxedServiceNameValidation). - go-kure/launcher#1230 (the same rule below Kubernetes 1.36 and the
spec.featureGatessetting). - go-kure/launcher#787 (
deploymentObjectName,serviceObjectNameandserviceAccountObjectName). - go-kure/launcher#545 (an ingress
portNameon awebservicemust behttp).
- go-kure/launcher#341 (the
deployment
- History:
- go-kure/launcher#1629 (the kind takes the upstream
DeploymentSpec, strictly decoded, on thereplicasetrecipe: a breaking pre-GA change with no launcher default, noautomountServiceAccountToken: falsefill and an empty fill report. The reshaped form is therole-deploymentmember ofwebserviceandworker). - go-kure/launcher#412 (the raw
corev1scheduling surface:affinity,tolerationsandtopologySpreadConstraints; since go-kure/launcher#1629 they aretemplate.spec.*).
- go-kure/launcher#1629 (the kind takes the upstream
service
- History:
- go-kure/launcher#411 (the kind-named Service, an independent component).
- go-kure/launcher#383 (
targetPortis published as theTypes: [integer, string]union). - go-kure/launcher#790 (
type: ExternalName, the furtherServiceSpecfields, and the refusal ofexternalIPs,clusterIPsand a literalclusterIPaddress). - go-kure/launcher#1230 (
PreferSameZoneandPreferSameNodebelow Kubernetes 1.34, and a leading digit in the Service name below Kubernetes 1.36). - go-kure/launcher#690 (a headless Service,
clusterIP: None). - go-kure/launcher#959 (a leading digit in the Service name under
RelaxedServiceNameValidation). - go-kure/launcher#794 (
servicehas noApplyPolicy, deliberately). - go-kure/launcher#922 (the object kind policy,
oam.ObjectKindPolicy).
serviceaccount, persistentvolumeclaim, configmap
- History:
- go-kure/launcher#702 (
serviceaccount,persistentvolumeclaimandconfigmapas kind-named projections of one object each). - go-kure/launcher#741 (the
pvcandconfigmaptraits as twins of the kinds). - go-kure/launcher#742 (an unauthored
storageClassNamecomes from the ClusterProfilepvccapability). - go-kure/launcher#790 (the four claim-spec fields
selector,dataSourceRef,volumeNameandvolumeAttributesClassName). - go-kure/launcher#794 (
serviceaccountandconfigmaphave noApplyPolicy, deliberately). - go-kure/launcher#922 (the object kind policy,
oam.ObjectKindPolicy).
- go-kure/launcher#702 (
secret
- History:
- go-kure/launcher#790 (
secretas the kind-named projection of a v1 Secret).
- go-kure/launcher#790 (
namespace, limitrange, resourcequota
- History:
- go-kure/launcher#790 (
namespace,limitrangeandresourcequotaas kind-named projections of one core object each). - go-kure/launcher#788 (the transform sets the component label on every object a component owns).
- go-kure/launcher#790 (
- Tests:
TestCoreKindSchemas_CoverSpecholds each schema to the linked type by reflection. [“each schema” is the schema ofnamespace,limitrangeandresourcequota, and the test is incore_kinds_test.go]
persistentvolume
- History:
- go-kure/launcher#790 (
persistentvolumeas the kind-named projection of a v1 PersistentVolume). - go-kure/launcher#794 (
csiandflexVolumesources are not covered by the hostPath gate, a decided limit).
- go-kure/launcher#790 (
pod
- History:
- go-kure/launcher#790 (
podas the kind-named projection of a v1 Pod; image volumes held to the allowed registries and to the tag rule, a breaking change for a document, a chart or a source naming an untagged or:latestimage in a field held to the registry rule). - go-kure/launcher#1177 (the nested form of a
volumesentry (type: image,image: {reference: ...}) on the components with a volume schema of their own). - go-kure/launcher#788 (the transform sets the component label on every object a component owns).
- go-kure/launcher#790 (
- Tests:
- The list is held to the API server’s own defaulting code by
TestKubernetesDefaulters_MatchVendoredSource. It reads an excerpt of that code, copied unmodified from kubernetes/kubernetes at the release of the linkedk8s.io/apiunder its Apache-2.0 licence, intestdata/upstream/kubernetes/(see the next paragraph). The test walks the generatedSetObjectDefaults_function of the Pod, PodTemplate, ReplicationController and ReplicaSet objects and every defaulting function they call. It fails on a field the code defaults and the list does not hold, on a default the list states otherwise, and on a row the code does not set. The walk is closed: it accepts only the kinds of statement, expression and type, the unary operators and the calls the excerpt at the vendored tag uses, each listed in the test (a method by its receiver’s identity, a builtin only while no name of the excerpt shadows it), and fails on anything else, naming it and its position, rather than guess. It also fails on listed shapes it cannot follow: among others, a write through a copy of a field (read by name or through a dereference), a list element reached by anything but a range over that list, abreakout of a loop, a method called on the object, a variable shadowing one of an enclosing block, or a write it cannot place in the object. The trade-off is that a re-vendoring whose code uses a new shape or call fails the test until that shape is understood and listed, even when it changes no default. Most defaults are set by aSetDefaults_function. The exceptions are a port’sprotocoland theiscsi,rbdandscaleIOstrings, whichk8s.io/apideclares with a+defaultmarker and the generated functions apply, andhostPort, whichdefaultHostNetworkPortssets. A second test holds the numbers to the field comments of the linked types. [“The list” is the list of values the API server would replace with its default, in the item above; the first test is inkubernetes_defaulters_internal_test.go, “the next paragraph” is the next bullet, and the second test isTestPodSpecDefaultedZeros_MatchFieldDocs, inpod_defaulted_zero_internal_test.go] - The excerpt in
testdata/upstream/kubernetes/holds eight files of kubernetes/kubernetes under its Apache-2.0 licence, each with its header, and kubernetes/kubernetes’sLICENSE, the licence’s full text, at the same tag. ItsSOURCEfile names the tag and the git blob id of each file and ofLICENSE; the tests check each against its file, the tag against the linkedk8s.io/api, and fail whenLICENSEis missing.mise run vendor-k8s-defaulters vX.Y.Zre-fetches it when that module moves; it takes the Kubernetes tag, not the module version:k8s.io/apiv0.X.Y pairs with Kubernetes v1.X.Y. CI never runs it, and the tests need no network. [“The excerpt” is the one the first test in the previous bullet reads, and “the tests” are the tests ofkubernetes_defaulters_internal_test.gothat read it, among themTestKubernetesDefaulters_ExcerptMatchesLinkedRelease, which holds the tag to the linkedk8s.io/api] TestKindComponents_OmittedRequiredAndWrittenDefaultslists the four with that reason. [“the four” are the four fields the paragraph names: theactionand the exit codes'operatorof a container restart rule, and thesignerNameandkeyTypeof a pod certificate source; “that reason” is the reason the paragraph gives, and the test is inkind_api_sets_internal_test.go]- A test walks the linked
k8s.io/apitype and fails on a field whose name holdsimage, or whose type is the image volume source, that is neither held nor listed with a reason; an image field under another name and another type is not found by it. [the test isTestImageFields_HeldOrListed, inimage_fields_internal_test.go] - The test that walks the types fails on a field held to the registry rule and not to this
one. [“The test that walks the types” is
TestImageFields_HeldOrListed, named in the item for image volumes]
- The list is held to the API server’s own defaulting code by
replicaset
- History:
- go-kure/launcher#790 (
replicasetas the kind-named projection of an apps/v1 ReplicaSet). - go-kure/launcher#788 (the transform sets the component label on the object and its template).
- go-kure/launcher#790 (
- Tests:
- A test holds the probe list to every non-pointer
omitemptynumber or boolean underReplicaSetSpecwhose field comment states a non-zero default, the template’s metadata included, andTestKubernetesDefaulters_MatchVendoredSourceholds the whole list to the API server’s defaulting code for a ReplicaSet. [“the probe list” is the list of values the API server would replace with its default, and the first test isTestPodTemplateKindsDefaultedZeros_MatchFieldDocs, inpod_template_defaulted_zero_internal_test.go; the second is the test thepodentry names]
- A test holds the probe list to every non-pointer
replicationcontroller
- History:
- go-kure/launcher#790 (
replicationcontrolleras the kind-named projection of a v1 ReplicationController).
- go-kure/launcher#790 (
podtemplate
- History:
- go-kure/launcher#790 (
podtemplateas the kind-named projection of a v1 PodTemplate). - go-kure/launcher#794 (
security-contextwithpsaLevelalone is accepted on apodtemplate, as a declaration of the level). - go-kure/launcher#788 (the transform sets the component label on the object and its template).
- go-kure/launcher#790 (
storageclass, volumeattributesclass, priorityclass, runtimeclass, ingressclass, csidriver
- Implementation: One shared helper builds all six (
policyFreeKind, inkind_policy_free.go), for a kind to which no dimension of the environment policy applies;servicecidr,poddisruptionbudget,endpointslice, the four kinds of the RBAC API, the four of the Prometheus operator’s API, the four of Cilium’s BGP control plane and the five kinds of the Gateway API’s infrastructure objects are built on it too. The three kinds of cert-manager’s API, the two of VolSync’s,alertmanager,thanosrulerandprometheusare built onpolicyHeldKind(kind_policy_held.go): this helper, unchanged, with anApplyPolicythat asks one function of the kind whether the policy refuses the decoded value. It refuses or passes; it fills no default. A kind is a value of it naming the upstream type, an optional check of required fields, an optional list of required fields the type writes whether or not they were authored, and the base-library constructor; the helper is the rest: the strict decode of the property map into the upstream type under the package’s null contract, which refuses anulllist element by its path (decodeKindSpec), the refusal of a key written in two spellings (refuseUncarriedSpecValues), the refusal of a listed required field that was not authored (refuseUnauthoredRequired, which reads the authored properties, since the decoded value does not show the omission, and follows a list to each of its items), a config whoseApplyPolicydoes nothing, and aGeneratethat returns the constructor’s object, under the object name the config carries, with a deep copy of what was decoded, so two builds of one config share nothing. The config type is unexported: a component is only built from properties that went through the decode. [the sentence ondefaultedZeros, which follows on the reference page, is the rule this paragraph goes on from; the next bullet under Tests holds the rest of this paragraph, which names the tests that hold the helper’s kinds to the API defaults] - History:
- go-kure/launcher#790 (the six kinds as kind-named projections of one cluster-scoped object each).
- go-kure/launcher#788 (the transform sets the component label on every object a component owns).
- Tests:
- A kind that lists none suits a type only when none of its omit-when-zero numbers or
booleans has a non-zero API default;
TestPolicyFreeKinds_NoDefaultedZerosreads the field comments of every Kubernetes type built on it and fails on one whose comment states such a default in a form it recognises (Defaults to 1,Default is true). A default the comment words otherwise, or does not state, is not found, and a string’s default is not read from a comment. The types of the Prometheus operator’s API publish no field comment;TestMonitoringKinds_DefaultedZerosreads the default markers of their source instead, strings included. Cilium’s publish none either, and its module ships the CRDs:TestCiliumBGPKinds_DefaultsSitOnPointersholds every default of the four BGP CRDs to a field that is a pointer in the Go type. [“A kind that lists none” is a kind that lists nodefaultedZeros, in the sentence before it on the reference page;TestPolicyFreeKinds_NoDefaultedZerosis inkind_policy_free_internal_test.go] TestKindComponents_DefaultedEmptyListswalks every kind in its table of API sources, finds each list omitted when empty that its source gives a default (a CRD schema or a default marker) or whose field comment mentions a default, and holds each to an answer: refused, or not refused with the reason. A newly defaulted list fails it until it is answered. The three refused defaults are held to the API server’s defaulting code byTestKubernetesDefaulters_ListDefaultsMatchVendoredSource, from the excerpt thepodkind’s list is held to: the functions that reach those defaults are held to their exact statements, and each default to being the only write to its field or to anything beneath it. Two limits: the lists of the Kubernetes types are found from their field comments, so a list the API server defaults without its comment saying so is not found; and the table of kinds it walks is not itself proven to hold every kind component. [the test is inkind_defaulted_lists_internal_test.go; “it” is that test, and “the excerpt thepodkind’s list is held to” is the excerpt thepodentry describes]
- A kind that lists none suits a type only when none of its omit-when-zero numbers or
booleans has a non-zero API default;
horizontalpodautoscaler
- History:
- go-kure/launcher#790 (
horizontalpodautoscaleras the kind-named projection of anautoscaling/v2HorizontalPodAutoscaler).
- go-kure/launcher#790 (
- Tests:
- The type has no number or boolean that is omitted when zero, which
TestHorizontalPodAutoscalerSpec_NoOmittedZerosholds it to. [the test is inhorizontalpodautoscaler_internal_test.go]
- The type has no number or boolean that is omitted when zero, which
statefulset
- History:
- go-kure/launcher#1629 (the kind takes the upstream
StatefulSetSpec, strictly decoded, on thedeploymentrecipe: a breaking pre-GA change with no launcher default, noautomountServiceAccountToken: falsefill and nopolicyorbuiltinfill report. Claim templates are raw PersistentVolumeClaim objects; thepvccapability’s storage class on a claim template that authors none, and the storage maximum on each claim template, stay. The reshaped form is gone from the kind; the entries below describe the kind as it was before, and the claim template spelling and theupdateStrategystrictness they mention are no longer launcher’s: the API server’s own rules apply). - go-kure/launcher#690 (
statefulsetemits no Service, andserviceNameno longer defaults to the component name). - go-kure/launcher#790 (
affinity,tolerationsandtopologySpreadConstraintsas the rawcorev1shapes). - go-kure/launcher#546 (an authored
serviceNamethat is not a DNS-1123 label refused at conversion). - go-kure/launcher#959, go-kure/launcher#1230 (the name of the governing Service is checked).
- go-kure/launcher#1629 (the kind takes the upstream
daemonset
- History:
- go-kure/launcher#1629 (the kind takes the upstream
DaemonSetSpec, strictly decoded, on thereplicasetrecipe: a breaking pre-GA change with no launcher default, noautomountServiceAccountToken: falsefill and an empty fill report. The reshaped form is gone from the kind; the entries below describe the kind as it was before, and theupdateStrategystrictness they mention is no longer launcher’s: the API server’s own rules apply). - go-kure/launcher#340 (
updateStrategy,minReadySecondsandrevisionHistoryLimitas the DaemonSetSpec-level properties). - go-kure/launcher#412 (
tolerationSecondsand the toleration cross-field rules came with the shared parser). - go-kure/launcher#690 (
daemonsetemits no Service, andport > 0no longer adds one). - go-kure/launcher#545, go-kure/launcher#546 (the ClusterIP Service that
port > 0added held the component name to the Service-name rule and an ingressportNametohttp). - go-kure/launcher#790 (the raw
affinityandtopologySpreadConstraintsandsidecarsondaemonset, and the refusal of an authoredtemplateby the parser). - go-kure/launcher#383 (
maxUnavailableandmaxSurgepublished as theTypes: [integer, string]union). - go-kure/launcher#408 (authored-document validation did not check property shape, so a
selector:on adaemonsetwas ignored). 6aed090(feat(format): enforce policy and support securityContext on init/sidecar containers) is the in-repo precedent for shipping this class of tightening under an unchanged version string. [“this class of tightening” is the rejection of an undeclaredselectorthat the paragraph before it described on the reference page, which no longer carries it: since go-kure/launcher#1629selectoris a required property of the kind]
- go-kure/launcher#1629 (the kind takes the upstream
cronjob
- History:
- go-kure/launcher#1629 (the kind takes the upstream
CronJobSpec, strictly decoded, on thedeploymentrecipe: a breaking pre-GA change with no launcher default, noautomountServiceAccountToken: falsefill and an empty fill report. The hand-written JobSpec validation, the reshaped pod surface and the unlabelled object and job template are the differences from the entries below). - go-kure/launcher#790 (the raw
affinity,tolerationsandtopologySpreadConstraintsoncronjob[since go-kure/launcher#1629 they arejobTemplate.spec.template.spec.*]). - go-kure/launcher#787 (the CronJob name held to 52 characters).
- go-kure/launcher#1629 (the kind takes the upstream
job
- Implementation: The workflow annotates the Job once it is generated, and the handler
writes no annotation of its own: since go-kure/launcher#1629 the Job is kure’s
identity-only constructor plus a deep copy of the authored spec, so the Flux force
annotation that the
force-replacetrait asks for is never cleared. - History:
- go-kure/launcher#1629 (the kind takes the upstream
JobSpec, strictly decoded, on thedeploymentrecipe: a breaking pre-GA change with no launcher default, noautomountServiceAccountToken: falsefill and an empty fill report. The entries below that nameparseJobSpec, its validators or a reshaped property describe the form the kind had before). - go-kure/launcher#344 (the
jobcomponent, injob.go). - go-kure/launcher#790 (the raw
affinity,tolerationsandtopologySpreadConstraintsonjob;cronjobrefusesselector,manualSelectorandtemplateasjobdoes;schedulingrefused onjobandcronjob; an emptyonPodConditions: []besideonExitCodescounted in the publishedexclusivegroup; the reason for the refusal ofselectorandmanualSelectoralso given in a document). - go-kure/launcher#702 (
jobemits aJoband nothing else). - go-kure/launcher#787 (the Job name held to 63 characters, and to the rule for the hostname of the last index).
- go-kure/launcher#345 (
podFailurePolicypublished byjobandcronjobthrough the shared parser). - go-kure/launcher#410 (
onPodConditions[].statusdefaults toTrue). - go-kure/launcher#408 (
kurel buildcallsValidateAuthoredProperties, so an authored key and its shape are checked on the document itself). - go-kure/launcher#394 (every optional-field helper in
common.goroutes its presence check throughauthoredValue). - go-kure/launcher#406 (a Job’s pod template is immutable, and updating in place stays a failure by default).
- go-kure/launcher#782 (the
force-replacetrait sets theForceReplacedelivery intent on the component’s application). - So does
completionMode, which the sharedparseJobSpecread with a bare lookup until go-kure/launcher#570, oncronjobas well. [“So” means that the property reads an explicitnullas an omission, in the sentence before it on the reference page]
- go-kure/launcher#1629 (the kind takes the upstream
passthrough
- Implementation:
- Its config exposes
ComponentName() string(theoam.ComponentNamedinterface) so consumers can attribute the emitted resource to its owning OAM component. [“Its” is thepassthroughcomponent’s] - The validated object is deep-copied when the config is built, not aliased, so a caller
that keeps mutating the map it passed in cannot change what was validated. The copy
detaches nested maps and slices whatever their concrete type — the authored path only ever
yields
map[string]anyand[]any, but a Go-assembled body can hold amap[string]stringor a[]string, and those used to alias straight through. A null survives as a null rather than becoming an empty{}/[]. Two things it deliberately does not do: it does not chase pointers (a*Locationinside atime.Time,resource.Quantity’s*inf.Dec), and it does not reject the shapes it cannot fully detach. [“it” is the copy, and “the object” is theobjectproperty] - The copy is not what makes the rejection binding, and this section used to claim it
was.
Objectis an exported field, so a caller holding the config can assign a fresh map over it, and a struct literal or a JSON decode never runsToApplicationConfigat all — three routes reachingGeneratewith a body the arms never saw.Generatetherefore re-runs, on the map it is about to emit, every check that must hold of an emitted body: a non-emptyapiVersionandkind, and both list arms. Checking the bytes being emitted, rather than trusting a check that ran on some earlier map, is what closes those routes. [“The copy” is the deep copy in the paragraph before it, and “the rejection” is the refusal of a list, which the reference page describes, and of an empty object, which the paragraph after this one describes] - Those checks live in one function precisely so the two call sites cannot disagree about
what a valid body is. While they were split — the constructor checking identity,
Generatechecking only list shape — aPassthroughConfigholding an empty map passed both: non-nil, so it cleared the no-object guard, and carrying noitems, so it cleared both arms, leavingGenerateto emit a document consisting of nothing but the metadata it had just stamped on. [“Those checks” are the checks thatGenerateruns again, in the paragraph before it]
- Its config exposes
- History:
- go-kure/launcher#1162 (the emitted object holds JSON values only, so it can be deep-copied).
- go-kure/launcher#1167, go-kure/launcher#1170 (a number is emitted with its own digits, as
an
int64, afloat64or ajson.Number). - go-kure/launcher#1166 (a value with no JSON form is refused, naming the field).
- go-kure/launcher#1176 (a number beyond
float64range in the object is read as text and not refused). - go-kure/launcher#794 (the scope of the object, the environment policy check, the refusal of a core Secret under a policy that forbids explicit secrets, and the refusal of a workload or claim with an undeclared field).
- go-kure/launcher#790 (an image volume held to the registry allowlist and to the tag rule).
- go-kure/kure#1009 (the parse error kure gives an object whose decoder panicked, a
CiliumNetworkPolicywhoseicmpsfield leaves itstypeout). - go-kure/kure#1007 (a MetalLB
BGPPeeratmetallb.io/v1beta2is a registered kind). - go-kure/kure#1014 (an object of a registered kind that states
Kindorapiversionbeside the exact key is refused).
crd, manifests
- History:
- go-kure/launcher#794 (the environment policy check on every object a
manifestsorcrdsource yields, the refusal of a core Secret under a policy that forbids explicit secrets, and the refusal of a workload or claim with an undeclared field). - go-kure/launcher#790 (an image volume from a registry outside the allowed list refused,
and the table under
helmtemplatethat lists what built before and is refused now). - go-kure/kure#1012 (malformed JSON that the decoder cannot read past is a build error, where the build did not return on it).
- go-kure/kure#1007 (a MetalLB
BGPPeeratmetallb.io/v1beta2is a registered kind). - go-kure/kure#1014 (a list of a kind the scheme does not register, that states
items, is replaced by its items).
- go-kure/launcher#794 (the environment policy check on every object a