Skip to content

Instantly share code, notes, and snippets.

@aaron-prindle
Created October 20, 2025 20:26
Show Gist options
  • Save aaron-prindle/4a7aec96960154029a4730507682aa4c to your computer and use it in GitHub Desktop.
Save aaron-prindle/4a7aec96960154029a4730507682aa4c to your computer and use it in GitHub Desktop.
KAL output before `batch` K8s API group optionalrequired updates
aprindle@aprindle-ssd-v2 ~/kubernetes [(HEAD detached at JoelSpeed/enable-kal-optionalorrequired-apiserver-internal)]./hack/verify-golangci-lint.sh ./staging/src/k8s.io/api/batch/...
installing golangci-lint, logcheck kube-api-linter and sorted plugins from hack/tools/golangci-lint into /usr/local/google/home/aprindle/kubernetes/_output/local/bin
running /usr/local/google/home/aprindle/kubernetes/_output/local/bin/golangci-lint run --color=always --config=/usr/local/google/home/aprindle/kubernetes/hack/golangci.yaml ./staging/src/k8s.io/api/batch/...
ERROR: level=warning msg="[linters_context] gocritic: no need to enable check \"deprecatedComment\": it's already enabled"
ERROR: staging/src/k8s.io/api/batch/v1/types.go:191:2: optionalorrequired: field Operator must be marked as optional or required (kubeapilinter)
ERROR: Operator PodFailurePolicyOnExitCodesOperator `json:"operator" protobuf:"bytes,2,req,name=operator"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1/types.go:199:2: optionalorrequired: field Values must be marked as optional or required (kubeapilinter)
ERROR: Values []int32 `json:"values" protobuf:"varint,3,rep,name=values"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1/types.go:207:2: optionalorrequired: field Type must be marked as optional or required (kubeapilinter)
ERROR: Type corev1.PodConditionType `json:"type" protobuf:"bytes,1,req,name=type"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1/types.go:232:2: optionalorrequired: field Action must be marked as optional or required (kubeapilinter)
ERROR: Action PodFailurePolicyAction `json:"action" protobuf:"bytes,1,req,name=action"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1/types.go:254:2: optionalorrequired: field Rules must be marked as optional or required (kubeapilinter)
ERROR: Rules []PodFailurePolicyRule `json:"rules" protobuf:"bytes,1,opt,name=rules"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1/types.go:266:2: optionalorrequired: field Rules must be marked as optional or required (kubeapilinter)
ERROR: Rules []SuccessPolicyRule `json:"rules" protobuf:"bytes,1,opt,name=rules"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1/types.go:403:2: optionalorrequired: field Template must be marked as optional or required (kubeapilinter)
ERROR: Template corev1.PodTemplateSpec `json:"template" protobuf:"bytes,6,opt,name=template"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1/types.go:588:2: optionalorrequired: field Ready must be marked as optional or required (kubeapilinter)
ERROR: Ready *int32 `json:"ready,omitempty" protobuf:"varint,9,opt,name=ready"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1/types.go:648:2: optionalorrequired: field Type must be marked as optional or required (kubeapilinter)
ERROR: Type JobConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=JobConditionType"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1/types.go:650:2: optionalorrequired: field Status must be marked as optional or required (kubeapilinter)
ERROR: Status corev1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1/types.go:721:2: optionalorrequired: field Schedule must be marked as optional or required (kubeapilinter)
ERROR: Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1/types.go:755:2: optionalorrequired: field JobTemplate must be marked as optional or required (kubeapilinter)
ERROR: JobTemplate JobTemplateSpec `json:"jobTemplate" protobuf:"bytes,5,opt,name=jobTemplate"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1beta1/types.go:87:2: optionalorrequired: field Schedule must be marked as optional or required (kubeapilinter)
ERROR: Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"`
ERROR: ^
ERROR: staging/src/k8s.io/api/batch/v1beta1/types.go:121:2: optionalorrequired: field JobTemplate must be marked as optional or required (kubeapilinter)
ERROR: JobTemplate JobTemplateSpec `json:"jobTemplate" protobuf:"bytes,5,opt,name=jobTemplate"`
ERROR: ^
14 issues:
* kubeapilinter: 14
Please review the above warnings. You can test via "./hack/verify-golangci-lint.sh ./staging/src/k8s.io/api/batch/..."
If the above warnings do not make sense, you can exempt this warning with a comment
(if your reviewer is okay with it).
In general please prefer to fix the error, we have already disabled specific lints
that the project chooses to ignore.
See: https://golangci-lint.run/usage/false-positives/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment