-
Notifications
You must be signed in to change notification settings - Fork 203
Add omitempty to MCPGroupStatus Servers and ServerCount JSON tags #4537
Copy link
Copy link
Open
Labels
apiItems related to the APIItems related to the APIkubernetesItems related to KubernetesItems related to Kubernetesoperatortech-debt
Description
Summary
MCPGroupStatus.Servers and MCPGroupStatus.ServerCount are missing omitempty in their JSON struct tags, while every other +optional field in the same struct (ObservedGeneration, Phase, RemoteProxies, RemoteProxyCount, Conditions) has it. This should be fixed for consistency before the API stabilizes.
File to change
cmd/thv-operator/api/v1alpha1/mcpgroup_types.go — lines 30 and 34
Current code
// Servers lists MCPServer names in this group
// +optional
Servers []string `json:"servers"`
// ServerCount is the number of MCPServers
// +optional
ServerCount int `json:"serverCount"`Expected code
// Servers lists MCPServer names in this group
// +optional
Servers []string `json:"servers,omitempty"`
// ServerCount is the number of MCPServers
// +optional
ServerCount int `json:"serverCount,omitempty"`Why
- Inconsistent with sibling fields
RemoteProxiesandRemoteProxyCountwhich both haveomitempty - Inconsistent with every other
+optionalfield in the struct - Without
omitempty, empty values serialize as"servers": nulland"serverCount": 0instead of being omitted - Standard Kubernetes convention is
omitemptyfor optional status fields
Verification
After making the change, run:
task lint
task test
task gen # regenerate any generated code if neededConfirm the CRD manifests are updated if task gen produces changes — commit those too.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
apiItems related to the APIItems related to the APIkubernetesItems related to KubernetesItems related to Kubernetesoperatortech-debt