Skip to content

ci: fix commentstart, conditions, defaultorrequired, optionalorrequired and defaults findings in api types - #1314

Open
Mesut Oezdil (mesutoezdil) wants to merge 2 commits into
agent-substrate:mainfrom
mesutoezdil:feat/kube-api-linter-fix-doc-findings
Open

ci: fix commentstart, conditions, defaultorrequired, optionalorrequired and defaults findings in api types#1314
Mesut Oezdil (mesutoezdil) wants to merge 2 commits into
agent-substrate:mainfrom
mesutoezdil:feat/kube-api-linter-fix-doc-findings

Conversation

@mesutoezdil

Copy link
Copy Markdown
Contributor

Stacked on #416 (the diff here includes that PR's commit until it merges, then shrinks to just this one).

Removes the file-wide exclusions #416 added and fixes the findings they were covering: commentstart (field godocs now start with the serialized field name), conditions (moved Conditions to the first position in ActorTemplateStatus with listType, listMapKey and patch markers), defaultorrequired (SandboxConfigSpec.SandboxClass had both a default and required, now optional with omitempty), optionalorrequired (missing +optional markers on ActorTemplateStatus fields), and defaults (configured preferredDefaultMarker to kubebuilder:default). Generated CRDs regenerated. Structural schema changes are only the conditions listType/listMapKey and sandboxClass no longer required (it is defaulted); the rest is description text.

Introduces the kube-api-linter tool (hack/tools/kube-api-linter) and
.golangci-kal.yaml, wired into hack/verify-all.sh. Every finding
currently produced against pkg/api/v1alpha1 is excluded precisely by
field, some because the fix needs a Go API change (tracked in agent-substrate#207)
and some file-wide for now (commentstart, conditions,
defaultorrequired, optionalorrequired, defaults).

This PR makes no content changes to the API types, so it carries no
review burden beyond the tool and config themselves. Follow-up PRs
remove the file-wide exclusions and fix those findings by class.
…ed and defaults findings in api types

Removes the file-wide exclusions added in the tool-introduction PR and
fixes every finding they were covering, including a few new ones from
fields added since that PR was written (SystemInfoDataSource's data
source fields, Capabilities.Add/Drop, Container.Resources,
ContainerResources.Limits, ContainerReadyz.TimeoutSeconds, and all of
csidriverconfig_types.go, which was not covered by any prior pass).

- commentstart: field godocs now start with the serialized field name.
- conditions: Conditions moved to the first position in
  ActorTemplateStatus and got the listType, listMapKey and patch
  markers.
- defaultorrequired: SandboxConfigSpec.SandboxClass had both a default
  and required; now optional with omitempty, matching the same field
  on WorkerPoolSpec and ActorTemplateSpec.
- optionalorrequired: missing +optional/+required markers added on
  ActorTemplateStatus, SystemInfoDataSource and CSIDriverConfig
  fields.
- defaults: configured preferredDefaultMarker to kubebuilder:default
  since CRDs are generated with controller-gen, and added the
  omitzero tag SnapshotsConfig.OnResume needs for its default.

hack/verify/kube-api-linter.sh passes with 0 issues. Generated CRDs
regenerated; the only structural schema changes are the conditions
listType/listMapKey and sandboxClass no longer required (it is
defaulted, so behavior is unchanged), the rest is description text
and the two new +optional/+required markers.
@mesutoezdil
Mesut Oezdil (mesutoezdil) force-pushed the feat/kube-api-linter-fix-doc-findings branch from 04239f8 to a339cf1 Compare August 29, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant