Skip to content

Commit 42abc2a

Browse files
committed
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 <[email protected]>
1 parent b82260f commit 42abc2a

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

pkg/apis/apps/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ type StatefulSetSpec struct {
198198
// the network identity of the set. Pods get DNS/hostnames that follow the
199199
// pattern: pod-specific-string.serviceName.default.svc.cluster.local
200200
// where "pod-specific-string" is managed by the StatefulSet controller.
201+
// +optional
201202
ServiceName string
202203

203204
// PodManagementPolicy controls how pods are created during initial scale up,

staging/src/k8s.io/api/apps/v1/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ type StatefulSetSpec struct {
220220
// the network identity of the set. Pods get DNS/hostnames that follow the
221221
// pattern: pod-specific-string.serviceName.default.svc.cluster.local
222222
// where "pod-specific-string" is managed by the StatefulSet controller.
223+
// +optional
223224
ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"`
224225

225226
// podManagementPolicy controls how pods are created during initial scale up,

staging/src/k8s.io/api/apps/v1beta1/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ type StatefulSetSpec struct {
259259
// the network identity of the set. Pods get DNS/hostnames that follow the
260260
// pattern: pod-specific-string.serviceName.default.svc.cluster.local
261261
// where "pod-specific-string" is managed by the StatefulSet controller.
262+
// +optional
262263
ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"`
263264

264265
// podManagementPolicy controls how pods are created during initial scale up,

staging/src/k8s.io/api/apps/v1beta2/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ type StatefulSetSpec struct {
269269
// the network identity of the set. Pods get DNS/hostnames that follow the
270270
// pattern: pod-specific-string.serviceName.default.svc.cluster.local
271271
// where "pod-specific-string" is managed by the StatefulSet controller.
272+
// +optional
272273
ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"`
273274

274275
// podManagementPolicy controls how pods are created during initial scale up,

0 commit comments

Comments
 (0)