Merge pull request #135470 from Ignoramuss/optionalorrequired-scheduling

api: add +required markers to scheduling API
This commit is contained in:
Kubernetes Prow Robot
2026-01-21 21:21:28 +05:30
committed by GitHub
13 changed files with 34 additions and 13 deletions

View File

@@ -19029,9 +19029,6 @@
"type": "integer"
}
},
"required": [
"value"
],
"type": "object",
"x-kubernetes-group-version-kind": [
{

View File

@@ -40,9 +40,6 @@
"type": "integer"
}
},
"required": [
"value"
],
"type": "object",
"x-kubernetes-group-version-kind": [
{

View File

@@ -211,6 +211,14 @@ linters:
path: "staging/src/k8s.io/api/resource/(v1|v1beta2)/types.go"
- text: "field (CapacityRequirements.Requests|DeviceRequestAllocationResult.ConsumedCapacity) should not use a map type, use a list type with a unique name/identifier instead"
path: "staging/src/k8s.io/api/resource/(v1|v1beta1|v1beta2)/types.go"
# OptionalOrRequired is being enabled over time. For now, each API group should be added to this list until we comb through each group and fix the missing tags.
- text: "must be marked as optional or required"
path: "staging/src/k8s.io/api/(admission|apidiscovery|apiserverinternal|apps|authentication|authorization|autoscaling|batch|certificates|coordination|core|discovery|events|extensions|flowcontrol|imagepolicy|networking|node|policy|rbac|resource|storage|storagemigration)"
# OptionalOrRequired - Existing fields that are marked as both optional and required (based on standard optional vs kubebuilder:validation:Required) and should not be fixed.
- text: "field (PortStatus|IngressPortStatus)\\.Error must not be marked as both optional and required"
path: "staging/src/k8s.io/api/(core/v1|extensions/v1beta1|networking/(v1|v1beta1))"
- linters:
- forbidigo
@@ -396,7 +404,7 @@ linters:
# - "nophase" # Ensure field names do not have the word "phase" in them.
- "notimestamp" # Ensure fields are not named "timestamp", prefer "time".
# - "optionalfields" # Ensure fields marked optional have omitempty and pointers.
# - "optionalorrequired" # Every field should be marked as `+optional` xor `+required`.
- "optionalorrequired" # Every field should be marked as `+optional` xor `+required`.
# - "requiredfields" # Required fields should only be pointers when required based on the validity of the zero value, they should always have `omitempty`.
- "ssatags" # Ensure lists have a listType tag.
# - "uniquemarkers" # Ensure markers are not duplicated across field and type definitions.

View File

@@ -222,6 +222,14 @@ linters:
path: "staging/src/k8s.io/api/resource/(v1|v1beta2)/types.go"
- text: "field (CapacityRequirements.Requests|DeviceRequestAllocationResult.ConsumedCapacity) should not use a map type, use a list type with a unique name/identifier instead"
path: "staging/src/k8s.io/api/resource/(v1|v1beta1|v1beta2)/types.go"
# OptionalOrRequired is being enabled over time. For now, each API group should be added to this list until we comb through each group and fix the missing tags.
- text: "must be marked as optional or required"
path: "staging/src/k8s.io/api/(admission|apidiscovery|apiserverinternal|apps|authentication|authorization|autoscaling|batch|certificates|coordination|core|discovery|events|extensions|flowcontrol|imagepolicy|networking|node|policy|rbac|resource|storage|storagemigration)"
# OptionalOrRequired - Existing fields that are marked as both optional and required (based on standard optional vs kubebuilder:validation:Required) and should not be fixed.
- text: "field (PortStatus|IngressPortStatus)\\.Error must not be marked as both optional and required"
path: "staging/src/k8s.io/api/(core/v1|extensions/v1beta1|networking/(v1|v1beta1))"
- linters:
- forbidigo
@@ -405,7 +413,7 @@ linters:
# - "nophase" # Ensure field names do not have the word "phase" in them.
- "notimestamp" # Ensure fields are not named "timestamp", prefer "time".
# - "optionalfields" # Ensure fields marked optional have omitempty and pointers.
# - "optionalorrequired" # Every field should be marked as `+optional` xor `+required`.
- "optionalorrequired" # Every field should be marked as `+optional` xor `+required`.
# - "requiredfields" # Required fields should only be pointers when required based on the validity of the zero value, they should always have `omitempty`.
- "ssatags" # Ensure lists have a listType tag.
# - "uniquemarkers" # Ensure markers are not duplicated across field and type definitions.

View File

@@ -86,4 +86,12 @@
- text: "field Device.(Attributes|Capacity) should not use a map type, use a list type with a unique name/identifier instead"
path: "staging/src/k8s.io/api/resource/(v1|v1beta2)/types.go"
- text: "field (CapacityRequirements.Requests|DeviceRequestAllocationResult.ConsumedCapacity) should not use a map type, use a list type with a unique name/identifier instead"
path: "staging/src/k8s.io/api/resource/(v1|v1beta1|v1beta2)/types.go"
path: "staging/src/k8s.io/api/resource/(v1|v1beta1|v1beta2)/types.go"
# OptionalOrRequired is being enabled over time. For now, each API group should be added to this list until we comb through each group and fix the missing tags.
- text: "must be marked as optional or required"
path: "staging/src/k8s.io/api/(admission|apidiscovery|apiserverinternal|apps|authentication|authorization|autoscaling|batch|certificates|coordination|core|discovery|events|extensions|flowcontrol|imagepolicy|networking|node|policy|rbac|resource|storage|storagemigration)"
# OptionalOrRequired - Existing fields that are marked as both optional and required (based on standard optional vs kubebuilder:validation:Required) and should not be fixed.
- text: "field (PortStatus|IngressPortStatus)\\.Error must not be marked as both optional and required"
path: "staging/src/k8s.io/api/(core/v1|extensions/v1beta1|networking/(v1|v1beta1))"

View File

@@ -16,7 +16,7 @@ linters:
# - "nophase" # Ensure field names do not have the word "phase" in them.
- "notimestamp" # Ensure fields are not named "timestamp", prefer "time".
# - "optionalfields" # Ensure fields marked optional have omitempty and pointers.
# - "optionalorrequired" # Every field should be marked as `+optional` xor `+required`.
- "optionalorrequired" # Every field should be marked as `+optional` xor `+required`.
# - "requiredfields" # Required fields should only be pointers when required based on the validity of the zero value, they should always have `omitempty`.
- "ssatags" # Ensure lists have a listType tag.
# - "uniquemarkers" # Ensure markers are not duplicated across field and type definitions.

View File

@@ -53207,7 +53207,6 @@ func schema_k8sio_api_scheduling_v1_PriorityClass(ref common.ReferenceCallback)
},
},
},
Required: []string{"value"},
},
},
Dependencies: []string{
@@ -53416,7 +53415,6 @@ func schema_k8sio_api_scheduling_v1alpha1_PriorityClass(ref common.ReferenceCall
},
},
},
Required: []string{"value"},
},
},
Dependencies: []string{
@@ -53710,7 +53708,6 @@ func schema_k8sio_api_scheduling_v1beta1_PriorityClass(ref common.ReferenceCallb
},
},
},
Required: []string{"value"},
},
},
Dependencies: []string{

View File

@@ -39,6 +39,7 @@ message PriorityClass {
// value represents the integer value of this priority class. This is the actual priority that pods
// receive when they have the name of this class in their pod spec.
// +optional
optional int32 value = 2;
// globalDefault specifies whether this PriorityClass should be considered as

View File

@@ -37,6 +37,7 @@ type PriorityClass struct {
// value represents the integer value of this priority class. This is the actual priority that pods
// receive when they have the name of this class in their pod spec.
// +optional
Value int32 `json:"value" protobuf:"bytes,2,opt,name=value"`
// globalDefault specifies whether this PriorityClass should be considered as

View File

@@ -94,6 +94,7 @@ message PriorityClass {
// value represents the integer value of this priority class. This is the actual priority that pods
// receive when they have the name of this class in their pod spec.
// +optional
optional int32 value = 2;
// globalDefault specifies whether this PriorityClass should be considered as

View File

@@ -37,6 +37,7 @@ type PriorityClass struct {
// value represents the integer value of this priority class. This is the actual priority that pods
// receive when they have the name of this class in their pod spec.
// +optional
Value int32 `json:"value" protobuf:"bytes,2,opt,name=value"`
// globalDefault specifies whether this PriorityClass should be considered as

View File

@@ -40,6 +40,7 @@ message PriorityClass {
// value represents the integer value of this priority class. This is the actual priority that pods
// receive when they have the name of this class in their pod spec.
// +optional
optional int32 value = 2;
// globalDefault specifies whether this PriorityClass should be considered as

View File

@@ -41,6 +41,7 @@ type PriorityClass struct {
// value represents the integer value of this priority class. This is the actual priority that pods
// receive when they have the name of this class in their pod spec.
// +optional
Value int32 `json:"value" protobuf:"bytes,2,opt,name=value"`
// globalDefault specifies whether this PriorityClass should be considered as