Skip to content

Commit

Permalink
Merge pull request #54436 from msau42/sc-api
Browse files Browse the repository at this point in the history
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
  • Loading branch information
k8s-publish-robot committed Nov 15, 2017
2 parents 55efefd + 8ba24d1 commit 70e9d79
Show file tree
Hide file tree
Showing 10 changed files with 240 additions and 77 deletions.
120 changes: 81 additions & 39 deletions storage/v1/generated.pb.go

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

7 changes: 7 additions & 0 deletions storage/v1/generated.proto

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

22 changes: 22 additions & 0 deletions storage/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ type StorageClass struct {
// AllowVolumeExpansion shows whether the storage class allow volume expand
// +optional
AllowVolumeExpansion *bool `json:"allowVolumeExpansion,omitempty" protobuf:"varint,6,opt,name=allowVolumeExpansion"`

// 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.
// +optional
VolumeBindingMode *VolumeBindingMode `json:"volumeBindingMode,omitempty" protobuf:"bytes,7,opt,name=volumeBindingMode"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand All @@ -74,3 +81,18 @@ type StorageClassList struct {
// Items is the list of StorageClasses
Items []StorageClass `json:"items" protobuf:"bytes,2,rep,name=items"`
}

// VolumeBindingMode indicates how PersistentVolumeClaims should be bound.
type VolumeBindingMode string

const (
// VolumeBindingImmediate indicates that PersistentVolumeClaims should be
// immediately provisioned and bound. This is the default mode.
VolumeBindingImmediate VolumeBindingMode = "Immediate"

// VolumeBindingWaitForFirstConsumer indicates that PersistentVolumeClaims
// should not be provisioned and bound until the first Pod is created that
// references the PeristentVolumeClaim. The volume provisioning and
// binding will occur during Pod scheduing.
VolumeBindingWaitForFirstConsumer VolumeBindingMode = "WaitForFirstConsumer"
)
1 change: 1 addition & 0 deletions storage/v1/types_swagger_doc_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var map_StorageClass = map[string]string{
"reclaimPolicy": "Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete.",
"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.",
"allowVolumeExpansion": "AllowVolumeExpansion shows whether the storage class allow volume expand",
"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.",
}

func (StorageClass) SwaggerDoc() map[string]string {
Expand Down
9 changes: 9 additions & 0 deletions storage/v1/zz_generated.deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ func (in *StorageClass) DeepCopyInto(out *StorageClass) {
**out = **in
}
}
if in.VolumeBindingMode != nil {
in, out := &in.VolumeBindingMode, &out.VolumeBindingMode
if *in == nil {
*out = nil
} else {
*out = new(VolumeBindingMode)
**out = **in
}
}
return
}

Expand Down
Loading

0 comments on commit 70e9d79

Please sign in to comment.