Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/apis/scheduling/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ type PodGroupSpec struct {
// NetworkTopology defines the NetworkTopology config, this field works in conjunction with network topology feature and hyperNode CRD.
// +optional
NetworkTopology *NetworkTopologySpec

// Preemptable indicates whether the PodGroup can be preempted by other PodGroups.
// When nil or true, the PodGroup can be preempted for compatibility.
// When false, the PodGroup cannot be preempted.
// +optional
Preemptable *bool
}

// NetworkTopologyMode represents the networkTopology mode, valid values are "hard" and "soft".
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/scheduling/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ type PodGroupSpec struct {
// NetworkTopology defines the NetworkTopology config, this field works in conjunction with network topology feature and hyperNode CRD.
// +optional
NetworkTopology *NetworkTopologySpec `json:"networkTopology,omitempty" protobuf:"bytes,5,opt,name=networkTopology"`

// Preemptable indicates whether the PodGroup can be preempted by other PodGroups.
// When nil or true, the PodGroup can be preempted for compatibility.
// When false, the PodGroup cannot be preempted.
// +optional
Preemptable *bool `json:"preemptable,omitempty" protobuf:"bytes,6,opt,name=preemptable"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The protobuf tag for Preemptable uses bytes, which is incorrect for a boolean type. For protobuf encoding, boolean values should be encoded as varint.

While this might appear to work in some contexts, it's semantically incorrect and can lead to compatibility and serialization issues with other standard Kubernetes tooling or future versions of protobuf.

For reference, standard Kubernetes API types use varint for *bool fields (e.g., core/v1.SecurityContext.AllowPrivilegeEscalation). Using the correct type ensures proper serialization and interoperability.

Please change bytes to varint.

Suggested change
Preemptable *bool `json:"preemptable,omitempty" protobuf:"bytes,6,opt,name=preemptable"`
Preemptable *bool `json:"preemptable,omitempty" protobuf:"varint,6,opt,name=preemptable"`

}

type NetworkTopologyMode string
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/scheduling/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/apis/scheduling/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/apis/scheduling/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.