Skip to content

Commit 546d034

Browse files
Merge pull request #54436 from msau42/sc-api
Automatic merge from submit-queue (batch tested with PRs 54436, 53148, 55153, 55614, 55484). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Add VolumeBindingMode to StorageClass API **What this PR does / why we need it**: Adds a new field `VolumeBindingMode` to `StorageClass`, as specified in kubernetes/community#1168 **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #54434 **Special notes for your reviewer**: API changes only. The scheduler and PV controller work will be submitted as a separate PR. **Release note**: NONE @kubernetes/sig-storage-pr-reviews Kubernetes-commit: 5c59d66a412ec995263f62553dfaa0b2ae33769b
2 parents a78848b + 0705b7f commit 546d034

10 files changed

+240
-77
lines changed

storage/v1/generated.pb.go

Lines changed: 81 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

storage/v1/generated.proto

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

storage/v1/types.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ type StorageClass struct {
5959
// AllowVolumeExpansion shows whether the storage class allow volume expand
6060
// +optional
6161
AllowVolumeExpansion *bool `json:"allowVolumeExpansion,omitempty" protobuf:"varint,6,opt,name=allowVolumeExpansion"`
62+
63+
// VolumeBindingMode indicates how PersistentVolumeClaims should be
64+
// provisioned and bound. When unset, VolumeBindingImmediate is used.
65+
// This field is alpha-level and is only honored by servers that enable
66+
// the VolumeScheduling feature.
67+
// +optional
68+
VolumeBindingMode *VolumeBindingMode `json:"volumeBindingMode,omitempty" protobuf:"bytes,7,opt,name=volumeBindingMode"`
6269
}
6370

6471
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -74,3 +81,18 @@ type StorageClassList struct {
7481
// Items is the list of StorageClasses
7582
Items []StorageClass `json:"items" protobuf:"bytes,2,rep,name=items"`
7683
}
84+
85+
// VolumeBindingMode indicates how PersistentVolumeClaims should be bound.
86+
type VolumeBindingMode string
87+
88+
const (
89+
// VolumeBindingImmediate indicates that PersistentVolumeClaims should be
90+
// immediately provisioned and bound. This is the default mode.
91+
VolumeBindingImmediate VolumeBindingMode = "Immediate"
92+
93+
// VolumeBindingWaitForFirstConsumer indicates that PersistentVolumeClaims
94+
// should not be provisioned and bound until the first Pod is created that
95+
// references the PeristentVolumeClaim. The volume provisioning and
96+
// binding will occur during Pod scheduing.
97+
VolumeBindingWaitForFirstConsumer VolumeBindingMode = "WaitForFirstConsumer"
98+
)

storage/v1/types_swagger_doc_generated.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var map_StorageClass = map[string]string{
3535
"reclaimPolicy": "Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete.",
3636
"mountOptions": "Dynamically provisioned PersistentVolumes of this storage class are created with these mountOptions, e.g. [\"ro\", \"soft\"]. Not validated - mount of the PVs will simply fail if one is invalid.",
3737
"allowVolumeExpansion": "AllowVolumeExpansion shows whether the storage class allow volume expand",
38+
"volumeBindingMode": "VolumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. When unset, VolumeBindingImmediate is used. This field is alpha-level and is only honored by servers that enable the VolumeScheduling feature.",
3839
}
3940

4041
func (StorageClass) SwaggerDoc() map[string]string {

storage/v1/zz_generated.deepcopy.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ func (in *StorageClass) DeepCopyInto(out *StorageClass) {
6060
**out = **in
6161
}
6262
}
63+
if in.VolumeBindingMode != nil {
64+
in, out := &in.VolumeBindingMode, &out.VolumeBindingMode
65+
if *in == nil {
66+
*out = nil
67+
} else {
68+
*out = new(VolumeBindingMode)
69+
**out = **in
70+
}
71+
}
6372
return
6473
}
6574

0 commit comments

Comments
 (0)