Mark StatefulSet's .spec.serviceName optional

The API reference doc
(https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/stateful-set-v1/#StatefulSetSpec)
mentions .spec.serviceName field is required, because it doesn't have
optional tag, nor omitempty. In practice this field is optional, and can
be empty. This change explicitly marks the field optional.

Signed-off-by: Maciej Szulik <soltysh@gmail.com>
This commit is contained in:
Maciej Szulik 2025-02-18 11:05:41 +01:00
parent b82260f003
commit 42abc2a73b
No known key found for this signature in database
GPG Key ID: F15E55D276FA84C4
4 changed files with 4 additions and 0 deletions

View File

@ -198,6 +198,7 @@ type StatefulSetSpec struct {
// the network identity of the set. Pods get DNS/hostnames that follow the // the network identity of the set. Pods get DNS/hostnames that follow the
// pattern: pod-specific-string.serviceName.default.svc.cluster.local // pattern: pod-specific-string.serviceName.default.svc.cluster.local
// where "pod-specific-string" is managed by the StatefulSet controller. // where "pod-specific-string" is managed by the StatefulSet controller.
// +optional
ServiceName string ServiceName string
// PodManagementPolicy controls how pods are created during initial scale up, // PodManagementPolicy controls how pods are created during initial scale up,

View File

@ -220,6 +220,7 @@ type StatefulSetSpec struct {
// the network identity of the set. Pods get DNS/hostnames that follow the // the network identity of the set. Pods get DNS/hostnames that follow the
// pattern: pod-specific-string.serviceName.default.svc.cluster.local // pattern: pod-specific-string.serviceName.default.svc.cluster.local
// where "pod-specific-string" is managed by the StatefulSet controller. // where "pod-specific-string" is managed by the StatefulSet controller.
// +optional
ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"` ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"`
// podManagementPolicy controls how pods are created during initial scale up, // podManagementPolicy controls how pods are created during initial scale up,

View File

@ -259,6 +259,7 @@ type StatefulSetSpec struct {
// the network identity of the set. Pods get DNS/hostnames that follow the // the network identity of the set. Pods get DNS/hostnames that follow the
// pattern: pod-specific-string.serviceName.default.svc.cluster.local // pattern: pod-specific-string.serviceName.default.svc.cluster.local
// where "pod-specific-string" is managed by the StatefulSet controller. // where "pod-specific-string" is managed by the StatefulSet controller.
// +optional
ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"` ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"`
// podManagementPolicy controls how pods are created during initial scale up, // podManagementPolicy controls how pods are created during initial scale up,

View File

@ -269,6 +269,7 @@ type StatefulSetSpec struct {
// the network identity of the set. Pods get DNS/hostnames that follow the // the network identity of the set. Pods get DNS/hostnames that follow the
// pattern: pod-specific-string.serviceName.default.svc.cluster.local // pattern: pod-specific-string.serviceName.default.svc.cluster.local
// where "pod-specific-string" is managed by the StatefulSet controller. // where "pod-specific-string" is managed by the StatefulSet controller.
// +optional
ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"` ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"`
// podManagementPolicy controls how pods are created during initial scale up, // podManagementPolicy controls how pods are created during initial scale up,