From faa112bad136eabe8220165c842ea10994023a79 Mon Sep 17 00:00:00 2001 From: Paul Morie Date: Fri, 6 May 2016 23:18:54 -0400 Subject: [PATCH 1/3] Add selector to PersistentVolumeClaim --- pkg/api/types.go | 2 ++ pkg/api/v1/types.go | 2 ++ pkg/api/validation/validation.go | 3 ++ pkg/api/validation/validation_test.go | 31 +++++++++++++++++++ pkg/controller/persistentvolume/index_test.go | 4 +-- 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/pkg/api/types.go b/pkg/api/types.go index 4847ba434c5..5022d3596a7 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -364,6 +364,8 @@ type PersistentVolumeClaimList struct { type PersistentVolumeClaimSpec struct { // Contains the types of access modes required AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty"` + // A label query over volumes to consider for binding + Selector *unversioned.LabelSelector `json:"selector,omitempty"` // Resources represents the minimum resources required Resources ResourceRequirements `json:"resources,omitempty"` // VolumeName is the binding reference to the PersistentVolume backing this claim diff --git a/pkg/api/v1/types.go b/pkg/api/v1/types.go index 382c5513fbe..40710df01db 100644 --- a/pkg/api/v1/types.go +++ b/pkg/api/v1/types.go @@ -456,6 +456,8 @@ type PersistentVolumeClaimSpec struct { // AccessModes contains the desired access modes the volume should have. // More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#access-modes-1 AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" protobuf:"bytes,1,rep,name=accessModes,casttype=PersistentVolumeAccessMode"` + // A label query over volumes to consider for binding. + Selector *unversioned.LabelSelector `json:"selector,omitempty"` // Resources represents the minimum resources the volume should have. // More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#resources Resources ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,2,opt,name=resources"` diff --git a/pkg/api/validation/validation.go b/pkg/api/validation/validation.go index 1144cefb249..4ef99202f01 100644 --- a/pkg/api/validation/validation.go +++ b/pkg/api/validation/validation.go @@ -992,6 +992,9 @@ func ValidatePersistentVolumeClaim(pvc *api.PersistentVolumeClaim) field.ErrorLi if len(pvc.Spec.AccessModes) == 0 { allErrs = append(allErrs, field.Required(specPath.Child("accessModes"), "at least 1 accessMode is required")) } + if pvc.Spec.Selector != nil { + allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(pvc.Spec.Selector, specPath.Child("selector"))...) + } for _, mode := range pvc.Spec.AccessModes { if mode != api.ReadWriteOnce && mode != api.ReadOnlyMany && mode != api.ReadWriteMany { allErrs = append(allErrs, field.NotSupported(specPath.Child("accessModes"), mode, supportedAccessModes.List())) diff --git a/pkg/api/validation/validation_test.go b/pkg/api/validation/validation_test.go index 9e7bbdb23de..e6d34577505 100644 --- a/pkg/api/validation/validation_test.go +++ b/pkg/api/validation/validation_test.go @@ -459,6 +459,37 @@ func TestValidatePersistentVolumeClaim(t *testing.T) { "good-claim": { isExpectedFailure: false, claim: testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{ + Selector: &unversioned.LabelSelector{ + MatchExpressions: []unversioned.LabelSelectorRequirement{ + { + Key: "key2", + Operator: "Exists", + }, + }, + }, + AccessModes: []api.PersistentVolumeAccessMode{ + api.ReadWriteOnce, + api.ReadOnlyMany, + }, + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceStorage): resource.MustParse("10G"), + }, + }, + }), + }, + "invalid-label-selector": { + isExpectedFailure: true, + claim: testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{ + Selector: &unversioned.LabelSelector{ + MatchExpressions: []unversioned.LabelSelectorRequirement{ + { + Key: "key2", + Operator: "InvalidOp", + Values: []string{"value1", "value2"}, + }, + }, + }, AccessModes: []api.PersistentVolumeAccessMode{ api.ReadWriteOnce, api.ReadOnlyMany, diff --git a/pkg/controller/persistentvolume/index_test.go b/pkg/controller/persistentvolume/index_test.go index 47a66a8bc05..147dbe0315c 100644 --- a/pkg/controller/persistentvolume/index_test.go +++ b/pkg/controller/persistentvolume/index_test.go @@ -228,8 +228,8 @@ func TestAllPossibleAccessModes(t *testing.T) { // the mock PVs creates contain 2 types of accessmodes: RWO+ROX and RWO+ROW+RWX possibleModes := index.allPossibleMatchingAccessModes([]api.PersistentVolumeAccessMode{api.ReadWriteOnce}) - if len(possibleModes) != 2 { - t.Errorf("Expected 2 arrays of modes that match RWO, but got %v", len(possibleModes)) + if len(possibleModes) != 3 { + t.Errorf("Expected 3 arrays of modes that match RWO, but got %v", len(possibleModes)) } for _, m := range possibleModes { if !contains(m, api.ReadWriteOnce) { From 4ffa3c675454aa7467b32adb045c95b0c9121b80 Mon Sep 17 00:00:00 2001 From: Paul Morie Date: Thu, 19 May 2016 16:52:29 -0400 Subject: [PATCH 2/3] Add label selector to match criteria for claims to volumes --- .../persistentvolume/binder_test.go | 49 ++++++++++- .../persistentvolume/framework_test.go | 20 +++++ pkg/controller/persistentvolume/index.go | 24 ++++- pkg/controller/persistentvolume/index_test.go | 87 +++++++++++++++++++ 4 files changed, 175 insertions(+), 5 deletions(-) diff --git a/pkg/controller/persistentvolume/binder_test.go b/pkg/controller/persistentvolume/binder_test.go index b981c17d919..018d412d01a 100644 --- a/pkg/controller/persistentvolume/binder_test.go +++ b/pkg/controller/persistentvolume/binder_test.go @@ -28,6 +28,11 @@ import ( // controllerTest.testCall *once*. // 3. Compare resulting volumes and claims with expected volumes and claims. func TestSync(t *testing.T) { + labels := map[string]string{ + "foo": "true", + "bar": "false", + } + tests := []controllerTest{ // [Unit test set 1] User did not care which PV they get. // Test the matching with no claim.Spec.VolumeName and with various @@ -140,13 +145,32 @@ func TestSync(t *testing.T) { { // syncClaim completes binding - simulates controller crash after // PVC.VolumeName is saved - "10 - complete bind after crash - PVC bound", + "1-10 - complete bind after crash - PVC bound", newVolumeArray("volume1-10", "1Gi", "uid1-10", "claim1-10", api.VolumeBound, api.PersistentVolumeReclaimRetain, annBoundByController), newVolumeArray("volume1-10", "1Gi", "uid1-10", "claim1-10", api.VolumeBound, api.PersistentVolumeReclaimRetain, annBoundByController), newClaimArray("claim1-10", "uid1-10", "1Gi", "volume1-10", api.ClaimPending, annBoundByController, annBindCompleted), newClaimArray("claim1-10", "uid1-10", "1Gi", "volume1-10", api.ClaimBound, annBoundByController, annBindCompleted), noevents, noerrors, testSyncClaim, }, + { + // syncClaim binds a claim only when the label selector matches the volume + "1-11 - bind when selector matches", + withLabels(labels, newVolumeArray("volume1-1", "1Gi", "", "", api.VolumePending, api.PersistentVolumeReclaimRetain)), + withLabels(labels, newVolumeArray("volume1-1", "1Gi", "uid1-1", "claim1-1", api.VolumeBound, api.PersistentVolumeReclaimRetain, annBoundByController)), + withLabelSelector(labels, newClaimArray("claim1-1", "uid1-1", "1Gi", "", api.ClaimPending)), + withLabelSelector(labels, newClaimArray("claim1-1", "uid1-1", "1Gi", "volume1-1", api.ClaimBound, annBoundByController, annBindCompleted)), + noevents, noerrors, testSyncClaim, + }, + { + // syncClaim does not bind a claim when the label selector doesn't match + "1-12 - do not bind when selector does not match", + newVolumeArray("volume1-1", "1Gi", "", "", api.VolumePending, api.PersistentVolumeReclaimRetain), + newVolumeArray("volume1-1", "1Gi", "", "", api.VolumePending, api.PersistentVolumeReclaimRetain), + withLabelSelector(labels, newClaimArray("claim1-1", "uid1-1", "1Gi", "", api.ClaimPending)), + withLabelSelector(labels, newClaimArray("claim1-1", "uid1-1", "1Gi", "", api.ClaimPending)), + noevents, noerrors, testSyncClaim, + }, + // [Unit test set 2] User asked for a specific PV. // Test the binding when pv.ClaimRef is already set by controller or // by user. @@ -220,6 +244,18 @@ func TestSync(t *testing.T) { newClaimArray("claim2-7", "uid2-7", "10Gi", "volume2-7", api.ClaimBound, annBoundByController), noevents, noerrors, testSyncClaimError, }, + { + // syncClaim with claim pre-bound to a PV that exists and is + // unbound, but does not match the selector. Check it gets bound + // and no annBoundByController is set. + "2-8 - claim prebound to unbound volume that does not match the selector", + newVolumeArray("volume2-3", "1Gi", "", "", api.VolumePending, api.PersistentVolumeReclaimRetain), + newVolumeArray("volume2-3", "1Gi", "uid2-3", "claim2-3", api.VolumeBound, api.PersistentVolumeReclaimRetain, annBoundByController), + withLabelSelector(labels, newClaimArray("claim2-3", "uid2-3", "10Gi", "volume2-3", api.ClaimPending)), + withLabelSelector(labels, newClaimArray("claim2-3", "uid2-3", "10Gi", "volume2-3", api.ClaimBound, annBindCompleted)), + noevents, noerrors, testSyncClaim, + }, + // [Unit test set 3] Syncing bound claim { // syncClaim with claim bound and its claim.Spec.VolumeName is @@ -283,6 +319,17 @@ func TestSync(t *testing.T) { newClaimArray("claim3-6", "uid3-6", "10Gi", "volume3-6", api.ClaimLost, annBindCompleted), []string{"Warning ClaimMisbound"}, noerrors, testSyncClaim, }, + { + // syncClaim with claim bound to unbound volume. Check it's bound + // even if the claim's selector doesn't match the volume. Also + // check that Pending phase is set to Bound + "3-7 - bound claim with unbound volume where selector doesn't match", + newVolumeArray("volume3-3", "10Gi", "", "", api.VolumePending, api.PersistentVolumeReclaimRetain), + newVolumeArray("volume3-3", "10Gi", "uid3-3", "claim3-3", api.VolumeBound, api.PersistentVolumeReclaimRetain, annBoundByController), + withLabelSelector(labels, newClaimArray("claim3-3", "uid3-3", "10Gi", "volume3-3", api.ClaimPending, annBoundByController, annBindCompleted)), + withLabelSelector(labels, newClaimArray("claim3-3", "uid3-3", "10Gi", "volume3-3", api.ClaimBound, annBoundByController, annBindCompleted)), + noevents, noerrors, testSyncClaim, + }, // [Unit test set 4] All syncVolume tests. { // syncVolume with pending volume. Check it's marked as Available. diff --git a/pkg/controller/persistentvolume/framework_test.go b/pkg/controller/persistentvolume/framework_test.go index 6096799dc93..5a7a2ed7779 100644 --- a/pkg/controller/persistentvolume/framework_test.go +++ b/pkg/controller/persistentvolume/framework_test.go @@ -32,6 +32,7 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/client/cache" clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" @@ -575,6 +576,25 @@ func newVolume(name, capacity, boundToClaimUID, boundToClaimName string, phase a return &volume } +// withLabels applies the given labels to the first volume in the array and +// returns the array. Meant to be used to compose volumes specified inline in +// a test. +func withLabels(labels map[string]string, volumes []*api.PersistentVolume) []*api.PersistentVolume { + volumes[0].Labels = labels + return volumes +} + +// withLabelSelector sets the label selector of the first claim in the array +// to be MatchLabels of the given label set and returns the array. Meant +// to be used to compose claims specified inline in a test. +func withLabelSelector(labels map[string]string, claims []*api.PersistentVolumeClaim) []*api.PersistentVolumeClaim { + claims[0].Spec.Selector = &unversioned.LabelSelector{ + MatchLabels: labels, + } + + return claims +} + // newVolumeArray returns array with a single volume that would be returned by // newVolume() with the same parameters. func newVolumeArray(name, capacity, boundToClaimUID, boundToClaimName string, phase api.PersistentVolumePhase, reclaimPolicy api.PersistentVolumeReclaimPolicy, annotations ...string) []*api.PersistentVolume { diff --git a/pkg/controller/persistentvolume/index.go b/pkg/controller/persistentvolume/index.go index d083ea9008b..4228b3b968f 100644 --- a/pkg/controller/persistentvolume/index.go +++ b/pkg/controller/persistentvolume/index.go @@ -21,7 +21,9 @@ import ( "sort" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/client/cache" + "k8s.io/kubernetes/pkg/labels" ) // persistentVolumeOrderedIndex is a cache.Store that keeps persistent volumes indexed by AccessModes and ordered by storage capacity. @@ -83,6 +85,16 @@ func (pvIndex *persistentVolumeOrderedIndex) findByClaim(claim *api.PersistentVo requestedQty := claim.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)] requestedSize := requestedQty.Value() + var selector labels.Selector + if claim.Spec.Selector != nil { + internalSelector, err := unversioned.LabelSelectorAsSelector(claim.Spec.Selector) + if err != nil { + // should be unreachable code due to validation + return nil, fmt.Errorf("error creating internal label selector for claim: %v: %v", claimToClaimKey(claim), err) + } + selector = internalSelector + } + for _, modes := range allPossibleModes { volumes, err := pvIndex.listByAccessModes(modes) if err != nil { @@ -97,14 +109,18 @@ func (pvIndex *persistentVolumeOrderedIndex) findByClaim(claim *api.PersistentVo // the claim. for _, volume := range volumes { if isVolumeBoundToClaim(volume, claim) { - // Exact match! No search required. This catches both volumes - // pre-bound by user and volumes dynamically provisioned by the - // controller. + // this claim and volume are bound; return it, + // whether the claim is prebound or for volumes + // intended for dynamic provisioning v1 return volume, nil } + // filter out: + // - volumes bound to another claim + // - volumes whose labels don't match the claim's selector, if specified if volume.Spec.ClaimRef != nil { - // This volume waits for exact claim or is alredy bound. + continue + } else if selector != nil && !selector.Matches(labels.Set(volume.Labels)) { continue } diff --git a/pkg/controller/persistentvolume/index_test.go b/pkg/controller/persistentvolume/index_test.go index 147dbe0315c..4fdb9c15ae5 100644 --- a/pkg/controller/persistentvolume/index_test.go +++ b/pkg/controller/persistentvolume/index_test.go @@ -23,6 +23,7 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/api/unversioned" ) func TestMatchVolume(t *testing.T) { @@ -103,6 +104,72 @@ func TestMatchVolume(t *testing.T) { }, }, }, + "successful-no-match-due-to-label": { + expectedMatch: "", + claim: &api.PersistentVolumeClaim{ + ObjectMeta: api.ObjectMeta{ + Name: "claim01", + Namespace: "myns", + }, + Spec: api.PersistentVolumeClaimSpec{ + Selector: &unversioned.LabelSelector{ + MatchLabels: map[string]string{ + "should-not-exist": "true", + }, + }, + AccessModes: []api.PersistentVolumeAccessMode{api.ReadOnlyMany, api.ReadWriteOnce}, + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceStorage): resource.MustParse("999G"), + }, + }, + }, + }, + }, + "successful-no-match-due-to-size-constraint-with-label-selector": { + expectedMatch: "", + claim: &api.PersistentVolumeClaim{ + ObjectMeta: api.ObjectMeta{ + Name: "claim01", + Namespace: "myns", + }, + Spec: api.PersistentVolumeClaimSpec{ + Selector: &unversioned.LabelSelector{ + MatchLabels: map[string]string{ + "should-exist": "true", + }, + }, + AccessModes: []api.PersistentVolumeAccessMode{api.ReadOnlyMany, api.ReadWriteOnce}, + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceStorage): resource.MustParse("20000G"), + }, + }, + }, + }, + }, + "successful-match-due-with-constraint-and-label-selector": { + expectedMatch: "gce-pd-2", + claim: &api.PersistentVolumeClaim{ + ObjectMeta: api.ObjectMeta{ + Name: "claim01", + Namespace: "myns", + }, + Spec: api.PersistentVolumeClaimSpec{ + Selector: &unversioned.LabelSelector{ + MatchLabels: map[string]string{ + "should-exist": "true", + }, + }, + AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce}, + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceStorage): resource.MustParse("10000G"), + }, + }, + }, + }, + }, } for name, scenario := range scenarios { @@ -486,6 +553,26 @@ func createTestVolumes() []*api.PersistentVolume { }, }, }, + { + ObjectMeta: api.ObjectMeta{ + UID: "gce-pd-2", + Name: "gce0022", + Labels: map[string]string{ + "should-exist": "true", + }, + }, + Spec: api.PersistentVolumeSpec{ + Capacity: api.ResourceList{ + api.ResourceName(api.ResourceStorage): resource.MustParse("10000G"), + }, + PersistentVolumeSource: api.PersistentVolumeSource{ + GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{}, + }, + AccessModes: []api.PersistentVolumeAccessMode{ + api.ReadWriteOnce, + }, + }, + }, } } From acfcb735339cc60da903524fe5c7032798aca09c Mon Sep 17 00:00:00 2001 From: Paul Morie Date: Tue, 31 May 2016 09:32:23 -0400 Subject: [PATCH 3/3] Regen for pv selector --- api/swagger-spec/apps_v1alpha1.json | 4 + api/swagger-spec/v1.json | 46 ++ docs/api-reference/v1/definitions.html | 98 +++- pkg/api/deep_copy_generated.go | 9 + pkg/api/types.generated.go | 174 ++++-- pkg/api/v1/conversion_generated.go | 2 + pkg/api/v1/deep_copy_generated.go | 9 + pkg/api/v1/generated.pb.go | 635 ++++++++++++---------- pkg/api/v1/generated.proto | 3 + pkg/api/v1/types.generated.go | 174 ++++-- pkg/api/v1/types.go | 2 +- pkg/api/v1/types_swagger_doc_generated.go | 1 + pkg/apis/apps/types.generated.go | 2 +- pkg/apis/apps/v1alpha1/types.generated.go | 2 +- 14 files changed, 769 insertions(+), 392 deletions(-) diff --git a/api/swagger-spec/apps_v1alpha1.json b/api/swagger-spec/apps_v1alpha1.json index 3d7b59baefb..34e122437da 100644 --- a/api/swagger-spec/apps_v1alpha1.json +++ b/api/swagger-spec/apps_v1alpha1.json @@ -2494,6 +2494,10 @@ }, "description": "AccessModes contains the desired access modes the volume should have. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#access-modes-1" }, + "selector": { + "$ref": "unversioned.LabelSelector", + "description": "A label query over volumes to consider for binding." + }, "resources": { "$ref": "v1.ResourceRequirements", "description": "Resources represents the minimum resources the volume should have. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#resources" diff --git a/api/swagger-spec/v1.json b/api/swagger-spec/v1.json index 711b5ae7c1c..e637cf516a3 100644 --- a/api/swagger-spec/v1.json +++ b/api/swagger-spec/v1.json @@ -16980,6 +16980,10 @@ }, "description": "AccessModes contains the desired access modes the volume should have. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#access-modes-1" }, + "selector": { + "$ref": "unversioned.LabelSelector", + "description": "A label query over volumes to consider for binding." + }, "resources": { "$ref": "v1.ResourceRequirements", "description": "Resources represents the minimum resources the volume should have. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#resources" @@ -16994,6 +16998,48 @@ "id": "v1.PersistentVolumeAccessMode", "properties": {} }, + "unversioned.LabelSelector": { + "id": "unversioned.LabelSelector", + "description": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + "properties": { + "matchLabels": { + "type": "object", + "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed." + }, + "matchExpressions": { + "type": "array", + "items": { + "$ref": "unversioned.LabelSelectorRequirement" + }, + "description": "matchExpressions is a list of label selector requirements. The requirements are ANDed." + } + } + }, + "unversioned.LabelSelectorRequirement": { + "id": "unversioned.LabelSelectorRequirement", + "description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + "required": [ + "key", + "operator" + ], + "properties": { + "key": { + "type": "string", + "description": "key is the label key that the selector applies to." + }, + "operator": { + "type": "string", + "description": "operator represents a key's relationship to a set of values. Valid operators ard In, NotIn, Exists and DoesNotExist." + }, + "values": { + "type": "array", + "items": { + "type": "string" + }, + "description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch." + } + } + }, "v1.ResourceRequirements": { "id": "v1.ResourceRequirements", "description": "ResourceRequirements describes the compute resource requirements.", diff --git a/docs/api-reference/v1/definitions.html b/docs/api-reference/v1/definitions.html index 24be9495605..679687ab9db 100755 --- a/docs/api-reference/v1/definitions.html +++ b/docs/api-reference/v1/definitions.html @@ -845,6 +845,13 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; } +

selector

+

A label query over volumes to consider for binding.

+

false

+

unversioned.LabelSelector

+ + +

resources

Resources represents the minimum resources the volume should have. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#resources

false

@@ -2759,6 +2766,47 @@ Populated by the system when a graceful deletion is requested. Read-only. More i + +
+

unversioned.LabelSelector

+
+

A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.

+
+ +++++++ + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionRequiredSchemaDefault

matchLabels

matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.

false

object

matchExpressions

matchExpressions is a list of label selector requirements. The requirements are ANDed.

false

unversioned.LabelSelectorRequirement array

+

v1.EndpointSubset

@@ -7428,6 +7476,54 @@ The resulting set of endpoints can be viewed as:
+
+
+

unversioned.LabelSelectorRequirement

+
+

A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.

+
+ +++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionRequiredSchemaDefault

key

key is the label key that the selector applies to.

true

string

operator

operator represents a key’s relationship to a set of values. Valid operators ard In, NotIn, Exists and DoesNotExist.

true

string

values

values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.

false

string array

+

v1.ContainerStateWaiting

@@ -7991,7 +8087,7 @@ The resulting set of endpoints can be viewed as:
diff --git a/pkg/api/deep_copy_generated.go b/pkg/api/deep_copy_generated.go index ec1cd7ce7dd..d7cd009ef04 100644 --- a/pkg/api/deep_copy_generated.go +++ b/pkg/api/deep_copy_generated.go @@ -1772,6 +1772,15 @@ func DeepCopy_api_PersistentVolumeClaimSpec(in PersistentVolumeClaimSpec, out *P } else { out.AccessModes = nil } + if in.Selector != nil { + in, out := in.Selector, &out.Selector + *out = new(unversioned.LabelSelector) + if err := unversioned.DeepCopy_unversioned_LabelSelector(*in, *out, c); err != nil { + return err + } + } else { + out.Selector = nil + } if err := DeepCopy_api_ResourceRequirements(in.Resources, &out.Resources, c); err != nil { return err } diff --git a/pkg/api/types.generated.go b/pkg/api/types.generated.go index 37a3bcea03b..4583d2150c1 100644 --- a/pkg/api/types.generated.go +++ b/pkg/api/types.generated.go @@ -8161,15 +8161,16 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [3]bool + var yyq2 [4]bool _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false yyq2[0] = len(x.AccessModes) != 0 - yyq2[1] = true - yyq2[2] = x.VolumeName != "" + yyq2[1] = x.Selector != nil + yyq2[2] = true + yyq2[3] = x.VolumeName != "" var yynn2 int if yyr2 || yy2arr2 { - r.EncodeArrayStart(3) + r.EncodeArrayStart(4) } else { yynn2 = 0 for _, b := range yyq2 { @@ -8216,25 +8217,60 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[1] { - yy7 := &x.Resources - yy7.CodecEncodeSelf(e) + if x.Selector == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else if z.HasExtensions() && z.EncExt(x.Selector) { + } else { + z.EncFallback(x.Selector) + } + } } else { r.EncodeNil() } } else { if yyq2[1] { z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("resources")) + r.EncodeString(codecSelferC_UTF81234, string("selector")) z.EncSendContainerState(codecSelfer_containerMapValue1234) - yy9 := &x.Resources - yy9.CodecEncodeSelf(e) + if x.Selector == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else if z.HasExtensions() && z.EncExt(x.Selector) { + } else { + z.EncFallback(x.Selector) + } + } } } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[2] { - yym12 := z.EncBinary() - _ = yym12 + yy10 := &x.Resources + yy10.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("resources")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.Resources + yy12.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeName)) @@ -8243,12 +8279,12 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2[2] { + if yyq2[3] { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("volumeName")) z.EncSendContainerState(codecSelfer_containerMapValue1234) - yym13 := z.EncBinary() - _ = yym13 + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeName)) @@ -8328,12 +8364,29 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromMap(l int, d *codec1978.D h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv4), d) } } + case "selector": + if r.TryDecodeAsNil() { + if x.Selector != nil { + x.Selector = nil + } + } else { + if x.Selector == nil { + x.Selector = new(pkg2_unversioned.LabelSelector) + } + yym7 := z.DecBinary() + _ = yym7 + if false { + } else if z.HasExtensions() && z.DecExt(x.Selector) { + } else { + z.DecFallback(x.Selector, false) + } + } case "resources": if r.TryDecodeAsNil() { x.Resources = ResourceRequirements{} } else { - yyv6 := &x.Resources - yyv6.CodecDecodeSelf(d) + yyv8 := &x.Resources + yyv8.CodecDecodeSelf(d) } case "volumeName": if r.TryDecodeAsNil() { @@ -8352,16 +8405,16 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromArray(l int, d *codec1978 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj8 int - var yyb8 bool - var yyhl8 bool = l >= 0 - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb8 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb8 { + if yyb10 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -8369,21 +8422,48 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromArray(l int, d *codec1978 if r.TryDecodeAsNil() { x.AccessModes = nil } else { - yyv9 := &x.AccessModes - yym10 := z.DecBinary() - _ = yym10 + yyv11 := &x.AccessModes + yym12 := z.DecBinary() + _ = yym12 if false { } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv9), d) + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv11), d) } } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb8 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb8 { + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.Selector != nil { + x.Selector = nil + } + } else { + if x.Selector == nil { + x.Selector = new(pkg2_unversioned.LabelSelector) + } + yym14 := z.DecBinary() + _ = yym14 + if false { + } else if z.HasExtensions() && z.DecExt(x.Selector) { + } else { + z.DecFallback(x.Selector, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -8391,16 +8471,16 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromArray(l int, d *codec1978 if r.TryDecodeAsNil() { x.Resources = ResourceRequirements{} } else { - yyv11 := &x.Resources - yyv11.CodecDecodeSelf(d) + yyv15 := &x.Resources + yyv15.CodecDecodeSelf(d) } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb8 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb8 { + if yyb10 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -8411,17 +8491,17 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromArray(l int, d *codec1978 x.VolumeName = string(r.DecodeString()) } for { - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb8 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb8 { + if yyb10 { break } z.DecSendContainerState(codecSelfer_containerArrayElem1234) - z.DecStructFieldNotFound(yyj8-1, "") + z.DecStructFieldNotFound(yyj10-1, "") } z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } @@ -53208,7 +53288,7 @@ func (x codecSelfer1234) decSlicePersistentVolumeClaim(v *[]PersistentVolumeClai yyrg1 := len(yyv1) > 0 yyv21 := yyv1 - yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 344) + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 352) if yyrt1 { if yyrl1 <= cap(yyv1) { yyv1 = yyv1[:yyrl1] diff --git a/pkg/api/v1/conversion_generated.go b/pkg/api/v1/conversion_generated.go index 3d1ce27a92c..e1ad00bfc28 100644 --- a/pkg/api/v1/conversion_generated.go +++ b/pkg/api/v1/conversion_generated.go @@ -3790,6 +3790,7 @@ func autoConvert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(i } else { out.AccessModes = nil } + out.Selector = in.Selector if err := Convert_v1_ResourceRequirements_To_api_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { return err } @@ -3811,6 +3812,7 @@ func autoConvert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec(i } else { out.AccessModes = nil } + out.Selector = in.Selector if err := Convert_api_ResourceRequirements_To_v1_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { return err } diff --git a/pkg/api/v1/deep_copy_generated.go b/pkg/api/v1/deep_copy_generated.go index 6f2b1e15331..f61e4961995 100644 --- a/pkg/api/v1/deep_copy_generated.go +++ b/pkg/api/v1/deep_copy_generated.go @@ -1719,6 +1719,15 @@ func DeepCopy_v1_PersistentVolumeClaimSpec(in PersistentVolumeClaimSpec, out *Pe } else { out.AccessModes = nil } + if in.Selector != nil { + in, out := in.Selector, &out.Selector + *out = new(unversioned.LabelSelector) + if err := unversioned.DeepCopy_unversioned_LabelSelector(*in, *out, c); err != nil { + return err + } + } else { + out.Selector = nil + } if err := DeepCopy_v1_ResourceRequirements(in.Resources, &out.Resources, c); err != nil { return err } diff --git a/pkg/api/v1/generated.pb.go b/pkg/api/v1/generated.pb.go index c78a2c03504..06d343babab 100644 --- a/pkg/api/v1/generated.pb.go +++ b/pkg/api/v1/generated.pb.go @@ -4619,6 +4619,16 @@ func (m *PersistentVolumeClaimSpec) MarshalTo(data []byte) (int, error) { i++ i = encodeVarintGenerated(data, i, uint64(len(m.VolumeName))) i += copy(data[i:], m.VolumeName) + if m.Selector != nil { + data[i] = 0x22 + i++ + i = encodeVarintGenerated(data, i, uint64(m.Selector.Size())) + n85, err := m.Selector.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n85 + } return i, nil } @@ -4671,11 +4681,11 @@ func (m *PersistentVolumeClaimStatus) MarshalTo(data []byte) (int, error) { data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64((&v).Size())) - n85, err := (&v).MarshalTo(data[i:]) + n86, err := (&v).MarshalTo(data[i:]) if err != nil { return 0, err } - i += n85 + i += n86 } } return i, nil @@ -4729,11 +4739,11 @@ func (m *PersistentVolumeList) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) - n86, err := m.ListMeta.MarshalTo(data[i:]) + n87, err := m.ListMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n86 + i += n87 if len(m.Items) > 0 { for _, msg := range m.Items { data[i] = 0x12 @@ -4768,142 +4778,142 @@ func (m *PersistentVolumeSource) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.GCEPersistentDisk.Size())) - n87, err := m.GCEPersistentDisk.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n87 - } - if m.AWSElasticBlockStore != nil { - data[i] = 0x12 - i++ - i = encodeVarintGenerated(data, i, uint64(m.AWSElasticBlockStore.Size())) - n88, err := m.AWSElasticBlockStore.MarshalTo(data[i:]) + n88, err := m.GCEPersistentDisk.MarshalTo(data[i:]) if err != nil { return 0, err } i += n88 } - if m.HostPath != nil { - data[i] = 0x1a + if m.AWSElasticBlockStore != nil { + data[i] = 0x12 i++ - i = encodeVarintGenerated(data, i, uint64(m.HostPath.Size())) - n89, err := m.HostPath.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.AWSElasticBlockStore.Size())) + n89, err := m.AWSElasticBlockStore.MarshalTo(data[i:]) if err != nil { return 0, err } i += n89 } - if m.Glusterfs != nil { - data[i] = 0x22 + if m.HostPath != nil { + data[i] = 0x1a i++ - i = encodeVarintGenerated(data, i, uint64(m.Glusterfs.Size())) - n90, err := m.Glusterfs.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.HostPath.Size())) + n90, err := m.HostPath.MarshalTo(data[i:]) if err != nil { return 0, err } i += n90 } - if m.NFS != nil { - data[i] = 0x2a + if m.Glusterfs != nil { + data[i] = 0x22 i++ - i = encodeVarintGenerated(data, i, uint64(m.NFS.Size())) - n91, err := m.NFS.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.Glusterfs.Size())) + n91, err := m.Glusterfs.MarshalTo(data[i:]) if err != nil { return 0, err } i += n91 } - if m.RBD != nil { - data[i] = 0x32 + if m.NFS != nil { + data[i] = 0x2a i++ - i = encodeVarintGenerated(data, i, uint64(m.RBD.Size())) - n92, err := m.RBD.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.NFS.Size())) + n92, err := m.NFS.MarshalTo(data[i:]) if err != nil { return 0, err } i += n92 } - if m.ISCSI != nil { - data[i] = 0x3a + if m.RBD != nil { + data[i] = 0x32 i++ - i = encodeVarintGenerated(data, i, uint64(m.ISCSI.Size())) - n93, err := m.ISCSI.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.RBD.Size())) + n93, err := m.RBD.MarshalTo(data[i:]) if err != nil { return 0, err } i += n93 } - if m.Cinder != nil { - data[i] = 0x42 + if m.ISCSI != nil { + data[i] = 0x3a i++ - i = encodeVarintGenerated(data, i, uint64(m.Cinder.Size())) - n94, err := m.Cinder.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.ISCSI.Size())) + n94, err := m.ISCSI.MarshalTo(data[i:]) if err != nil { return 0, err } i += n94 } - if m.CephFS != nil { - data[i] = 0x4a + if m.Cinder != nil { + data[i] = 0x42 i++ - i = encodeVarintGenerated(data, i, uint64(m.CephFS.Size())) - n95, err := m.CephFS.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.Cinder.Size())) + n95, err := m.Cinder.MarshalTo(data[i:]) if err != nil { return 0, err } i += n95 } - if m.FC != nil { - data[i] = 0x52 + if m.CephFS != nil { + data[i] = 0x4a i++ - i = encodeVarintGenerated(data, i, uint64(m.FC.Size())) - n96, err := m.FC.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.CephFS.Size())) + n96, err := m.CephFS.MarshalTo(data[i:]) if err != nil { return 0, err } i += n96 } - if m.Flocker != nil { - data[i] = 0x5a + if m.FC != nil { + data[i] = 0x52 i++ - i = encodeVarintGenerated(data, i, uint64(m.Flocker.Size())) - n97, err := m.Flocker.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.FC.Size())) + n97, err := m.FC.MarshalTo(data[i:]) if err != nil { return 0, err } i += n97 } - if m.FlexVolume != nil { - data[i] = 0x62 + if m.Flocker != nil { + data[i] = 0x5a i++ - i = encodeVarintGenerated(data, i, uint64(m.FlexVolume.Size())) - n98, err := m.FlexVolume.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.Flocker.Size())) + n98, err := m.Flocker.MarshalTo(data[i:]) if err != nil { return 0, err } i += n98 } - if m.AzureFile != nil { - data[i] = 0x6a + if m.FlexVolume != nil { + data[i] = 0x62 i++ - i = encodeVarintGenerated(data, i, uint64(m.AzureFile.Size())) - n99, err := m.AzureFile.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.FlexVolume.Size())) + n99, err := m.FlexVolume.MarshalTo(data[i:]) if err != nil { return 0, err } i += n99 } - if m.VsphereVolume != nil { - data[i] = 0x72 + if m.AzureFile != nil { + data[i] = 0x6a i++ - i = encodeVarintGenerated(data, i, uint64(m.VsphereVolume.Size())) - n100, err := m.VsphereVolume.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.AzureFile.Size())) + n100, err := m.AzureFile.MarshalTo(data[i:]) if err != nil { return 0, err } i += n100 } + if m.VsphereVolume != nil { + data[i] = 0x72 + i++ + i = encodeVarintGenerated(data, i, uint64(m.VsphereVolume.Size())) + n101, err := m.VsphereVolume.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n101 + } return i, nil } @@ -4937,21 +4947,21 @@ func (m *PersistentVolumeSpec) MarshalTo(data []byte) (int, error) { data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64((&v).Size())) - n101, err := (&v).MarshalTo(data[i:]) + n102, err := (&v).MarshalTo(data[i:]) if err != nil { return 0, err } - i += n101 + i += n102 } } data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64(m.PersistentVolumeSource.Size())) - n102, err := m.PersistentVolumeSource.MarshalTo(data[i:]) + n103, err := m.PersistentVolumeSource.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n102 + i += n103 if len(m.AccessModes) > 0 { for _, s := range m.AccessModes { data[i] = 0x1a @@ -4971,11 +4981,11 @@ func (m *PersistentVolumeSpec) MarshalTo(data []byte) (int, error) { data[i] = 0x22 i++ i = encodeVarintGenerated(data, i, uint64(m.ClaimRef.Size())) - n103, err := m.ClaimRef.MarshalTo(data[i:]) + n104, err := m.ClaimRef.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n103 + i += n104 } data[i] = 0x2a i++ @@ -5032,27 +5042,27 @@ func (m *Pod) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n104, err := m.ObjectMeta.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n104 - data[i] = 0x12 - i++ - i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) - n105, err := m.Spec.MarshalTo(data[i:]) + n105, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } i += n105 - data[i] = 0x1a + data[i] = 0x12 i++ - i = encodeVarintGenerated(data, i, uint64(m.Status.Size())) - n106, err := m.Status.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) + n106, err := m.Spec.MarshalTo(data[i:]) if err != nil { return 0, err } i += n106 + data[i] = 0x1a + i++ + i = encodeVarintGenerated(data, i, uint64(m.Status.Size())) + n107, err := m.Status.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n107 return i, nil } @@ -5117,11 +5127,11 @@ func (m *PodAffinityTerm) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.LabelSelector.Size())) - n107, err := m.LabelSelector.MarshalTo(data[i:]) + n108, err := m.LabelSelector.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n107 + i += n108 } if len(m.Namespaces) > 0 { for _, s := range m.Namespaces { @@ -5267,19 +5277,19 @@ func (m *PodCondition) MarshalTo(data []byte) (int, error) { data[i] = 0x1a i++ i = encodeVarintGenerated(data, i, uint64(m.LastProbeTime.Size())) - n108, err := m.LastProbeTime.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n108 - data[i] = 0x22 - i++ - i = encodeVarintGenerated(data, i, uint64(m.LastTransitionTime.Size())) - n109, err := m.LastTransitionTime.MarshalTo(data[i:]) + n109, err := m.LastProbeTime.MarshalTo(data[i:]) if err != nil { return 0, err } i += n109 + data[i] = 0x22 + i++ + i = encodeVarintGenerated(data, i, uint64(m.LastTransitionTime.Size())) + n110, err := m.LastTransitionTime.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n110 data[i] = 0x2a i++ i = encodeVarintGenerated(data, i, uint64(len(m.Reason))) @@ -5378,11 +5388,11 @@ func (m *PodList) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) - n110, err := m.ListMeta.MarshalTo(data[i:]) + n111, err := m.ListMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n110 + i += n111 if len(m.Items) > 0 { for _, msg := range m.Items { data[i] = 0x12 @@ -5442,11 +5452,11 @@ func (m *PodLogOptions) MarshalTo(data []byte) (int, error) { data[i] = 0x2a i++ i = encodeVarintGenerated(data, i, uint64(m.SinceTime.Size())) - n111, err := m.SinceTime.MarshalTo(data[i:]) + n112, err := m.SinceTime.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n111 + i += n112 } data[i] = 0x30 i++ @@ -5510,11 +5520,11 @@ func (m *PodSecurityContext) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.SELinuxOptions.Size())) - n112, err := m.SELinuxOptions.MarshalTo(data[i:]) + n113, err := m.SELinuxOptions.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n112 + i += n113 } if m.RunAsUser != nil { data[i] = 0x10 @@ -5660,11 +5670,11 @@ func (m *PodSpec) MarshalTo(data []byte) (int, error) { data[i] = 0x72 i++ i = encodeVarintGenerated(data, i, uint64(m.SecurityContext.Size())) - n113, err := m.SecurityContext.MarshalTo(data[i:]) + n114, err := m.SecurityContext.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n113 + i += n114 } if len(m.ImagePullSecrets) > 0 { for _, msg := range m.ImagePullSecrets { @@ -5744,11 +5754,11 @@ func (m *PodStatus) MarshalTo(data []byte) (int, error) { data[i] = 0x3a i++ i = encodeVarintGenerated(data, i, uint64(m.StartTime.Size())) - n114, err := m.StartTime.MarshalTo(data[i:]) + n115, err := m.StartTime.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n114 + i += n115 } if len(m.ContainerStatuses) > 0 { for _, msg := range m.ContainerStatuses { @@ -5783,19 +5793,19 @@ func (m *PodStatusResult) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n115, err := m.ObjectMeta.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n115 - data[i] = 0x12 - i++ - i = encodeVarintGenerated(data, i, uint64(m.Status.Size())) - n116, err := m.Status.MarshalTo(data[i:]) + n116, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } i += n116 + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(m.Status.Size())) + n117, err := m.Status.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n117 return i, nil } @@ -5817,19 +5827,19 @@ func (m *PodTemplate) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n117, err := m.ObjectMeta.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n117 - data[i] = 0x12 - i++ - i = encodeVarintGenerated(data, i, uint64(m.Template.Size())) - n118, err := m.Template.MarshalTo(data[i:]) + n118, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } i += n118 + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(m.Template.Size())) + n119, err := m.Template.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n119 return i, nil } @@ -5851,11 +5861,11 @@ func (m *PodTemplateList) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) - n119, err := m.ListMeta.MarshalTo(data[i:]) + n120, err := m.ListMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n119 + i += n120 if len(m.Items) > 0 { for _, msg := range m.Items { data[i] = 0x12 @@ -5889,19 +5899,19 @@ func (m *PodTemplateSpec) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n120, err := m.ObjectMeta.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n120 - data[i] = 0x12 - i++ - i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) - n121, err := m.Spec.MarshalTo(data[i:]) + n121, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } i += n121 + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) + n122, err := m.Spec.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n122 return i, nil } @@ -5950,11 +5960,11 @@ func (m *PreferredSchedulingTerm) MarshalTo(data []byte) (int, error) { data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64(m.Preference.Size())) - n122, err := m.Preference.MarshalTo(data[i:]) + n123, err := m.Preference.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n122 + i += n123 return i, nil } @@ -5976,11 +5986,11 @@ func (m *Probe) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.Handler.Size())) - n123, err := m.Handler.MarshalTo(data[i:]) + n124, err := m.Handler.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n123 + i += n124 data[i] = 0x10 i++ i = encodeVarintGenerated(data, i, uint64(m.InitialDelaySeconds)) @@ -6053,11 +6063,11 @@ func (m *RBDVolumeSource) MarshalTo(data []byte) (int, error) { data[i] = 0x3a i++ i = encodeVarintGenerated(data, i, uint64(m.SecretRef.Size())) - n124, err := m.SecretRef.MarshalTo(data[i:]) + n125, err := m.SecretRef.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n124 + i += n125 } data[i] = 0x40 i++ @@ -6088,11 +6098,11 @@ func (m *RangeAllocation) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n125, err := m.ObjectMeta.MarshalTo(data[i:]) + n126, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n125 + i += n126 data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64(len(m.Range))) @@ -6124,27 +6134,27 @@ func (m *ReplicationController) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n126, err := m.ObjectMeta.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n126 - data[i] = 0x12 - i++ - i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) - n127, err := m.Spec.MarshalTo(data[i:]) + n127, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } i += n127 - data[i] = 0x1a + data[i] = 0x12 i++ - i = encodeVarintGenerated(data, i, uint64(m.Status.Size())) - n128, err := m.Status.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) + n128, err := m.Spec.MarshalTo(data[i:]) if err != nil { return 0, err } i += n128 + data[i] = 0x1a + i++ + i = encodeVarintGenerated(data, i, uint64(m.Status.Size())) + n129, err := m.Status.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n129 return i, nil } @@ -6166,11 +6176,11 @@ func (m *ReplicationControllerList) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) - n129, err := m.ListMeta.MarshalTo(data[i:]) + n130, err := m.ListMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n129 + i += n130 if len(m.Items) > 0 { for _, msg := range m.Items { data[i] = 0x12 @@ -6227,11 +6237,11 @@ func (m *ReplicationControllerSpec) MarshalTo(data []byte) (int, error) { data[i] = 0x1a i++ i = encodeVarintGenerated(data, i, uint64(m.Template.Size())) - n130, err := m.Template.MarshalTo(data[i:]) + n131, err := m.Template.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n130 + i += n131 } return i, nil } @@ -6289,11 +6299,11 @@ func (m *ResourceFieldSelector) MarshalTo(data []byte) (int, error) { data[i] = 0x1a i++ i = encodeVarintGenerated(data, i, uint64(m.Divisor.Size())) - n131, err := m.Divisor.MarshalTo(data[i:]) + n132, err := m.Divisor.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n131 + i += n132 return i, nil } @@ -6315,27 +6325,27 @@ func (m *ResourceQuota) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n132, err := m.ObjectMeta.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n132 - data[i] = 0x12 - i++ - i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) - n133, err := m.Spec.MarshalTo(data[i:]) + n133, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } i += n133 - data[i] = 0x1a + data[i] = 0x12 i++ - i = encodeVarintGenerated(data, i, uint64(m.Status.Size())) - n134, err := m.Status.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) + n134, err := m.Spec.MarshalTo(data[i:]) if err != nil { return 0, err } i += n134 + data[i] = 0x1a + i++ + i = encodeVarintGenerated(data, i, uint64(m.Status.Size())) + n135, err := m.Status.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n135 return i, nil } @@ -6357,11 +6367,11 @@ func (m *ResourceQuotaList) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) - n135, err := m.ListMeta.MarshalTo(data[i:]) + n136, err := m.ListMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n135 + i += n136 if len(m.Items) > 0 { for _, msg := range m.Items { data[i] = 0x12 @@ -6407,11 +6417,11 @@ func (m *ResourceQuotaSpec) MarshalTo(data []byte) (int, error) { data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64((&v).Size())) - n136, err := (&v).MarshalTo(data[i:]) + n137, err := (&v).MarshalTo(data[i:]) if err != nil { return 0, err } - i += n136 + i += n137 } } if len(m.Scopes) > 0 { @@ -6462,11 +6472,11 @@ func (m *ResourceQuotaStatus) MarshalTo(data []byte) (int, error) { data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64((&v).Size())) - n137, err := (&v).MarshalTo(data[i:]) + n138, err := (&v).MarshalTo(data[i:]) if err != nil { return 0, err } - i += n137 + i += n138 } } if len(m.Used) > 0 { @@ -6484,11 +6494,11 @@ func (m *ResourceQuotaStatus) MarshalTo(data []byte) (int, error) { data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64((&v).Size())) - n138, err := (&v).MarshalTo(data[i:]) + n139, err := (&v).MarshalTo(data[i:]) if err != nil { return 0, err } - i += n138 + i += n139 } } return i, nil @@ -6524,11 +6534,11 @@ func (m *ResourceRequirements) MarshalTo(data []byte) (int, error) { data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64((&v).Size())) - n139, err := (&v).MarshalTo(data[i:]) + n140, err := (&v).MarshalTo(data[i:]) if err != nil { return 0, err } - i += n139 + i += n140 } } if len(m.Requests) > 0 { @@ -6546,11 +6556,11 @@ func (m *ResourceRequirements) MarshalTo(data []byte) (int, error) { data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64((&v).Size())) - n140, err := (&v).MarshalTo(data[i:]) + n141, err := (&v).MarshalTo(data[i:]) if err != nil { return 0, err } - i += n140 + i += n141 } } return i, nil @@ -6608,11 +6618,11 @@ func (m *Secret) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n141, err := m.ObjectMeta.MarshalTo(data[i:]) + n142, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n141 + i += n142 if len(m.Data) > 0 { for k := range m.Data { data[i] = 0x12 @@ -6655,11 +6665,11 @@ func (m *SecretKeySelector) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.LocalObjectReference.Size())) - n142, err := m.LocalObjectReference.MarshalTo(data[i:]) + n143, err := m.LocalObjectReference.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n142 + i += n143 data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64(len(m.Key))) @@ -6685,11 +6695,11 @@ func (m *SecretList) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) - n143, err := m.ListMeta.MarshalTo(data[i:]) + n144, err := m.ListMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n143 + i += n144 if len(m.Items) > 0 { for _, msg := range m.Items { data[i] = 0x12 @@ -6758,11 +6768,11 @@ func (m *SecurityContext) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.Capabilities.Size())) - n144, err := m.Capabilities.MarshalTo(data[i:]) + n145, err := m.Capabilities.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n144 + i += n145 } if m.Privileged != nil { data[i] = 0x10 @@ -6778,11 +6788,11 @@ func (m *SecurityContext) MarshalTo(data []byte) (int, error) { data[i] = 0x1a i++ i = encodeVarintGenerated(data, i, uint64(m.SELinuxOptions.Size())) - n145, err := m.SELinuxOptions.MarshalTo(data[i:]) + n146, err := m.SELinuxOptions.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n145 + i += n146 } if m.RunAsUser != nil { data[i] = 0x20 @@ -6830,11 +6840,11 @@ func (m *SerializedReference) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.Reference.Size())) - n146, err := m.Reference.MarshalTo(data[i:]) + n147, err := m.Reference.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n146 + i += n147 return i, nil } @@ -6856,27 +6866,27 @@ func (m *Service) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n147, err := m.ObjectMeta.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n147 - data[i] = 0x12 - i++ - i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) - n148, err := m.Spec.MarshalTo(data[i:]) + n148, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } i += n148 - data[i] = 0x1a + data[i] = 0x12 i++ - i = encodeVarintGenerated(data, i, uint64(m.Status.Size())) - n149, err := m.Status.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) + n149, err := m.Spec.MarshalTo(data[i:]) if err != nil { return 0, err } i += n149 + data[i] = 0x1a + i++ + i = encodeVarintGenerated(data, i, uint64(m.Status.Size())) + n150, err := m.Status.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n150 return i, nil } @@ -6898,11 +6908,11 @@ func (m *ServiceAccount) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n150, err := m.ObjectMeta.MarshalTo(data[i:]) + n151, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n150 + i += n151 if len(m.Secrets) > 0 { for _, msg := range m.Secrets { data[i] = 0x12 @@ -6948,11 +6958,11 @@ func (m *ServiceAccountList) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) - n151, err := m.ListMeta.MarshalTo(data[i:]) + n152, err := m.ListMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n151 + i += n152 if len(m.Items) > 0 { for _, msg := range m.Items { data[i] = 0x12 @@ -6986,11 +6996,11 @@ func (m *ServiceList) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) - n152, err := m.ListMeta.MarshalTo(data[i:]) + n153, err := m.ListMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n152 + i += n153 if len(m.Items) > 0 { for _, msg := range m.Items { data[i] = 0x12 @@ -7035,11 +7045,11 @@ func (m *ServicePort) MarshalTo(data []byte) (int, error) { data[i] = 0x22 i++ i = encodeVarintGenerated(data, i, uint64(m.TargetPort.Size())) - n153, err := m.TargetPort.MarshalTo(data[i:]) + n154, err := m.TargetPort.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n153 + i += n154 data[i] = 0x28 i++ i = encodeVarintGenerated(data, i, uint64(m.NodePort)) @@ -7194,11 +7204,11 @@ func (m *ServiceStatus) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.LoadBalancer.Size())) - n154, err := m.LoadBalancer.MarshalTo(data[i:]) + n155, err := m.LoadBalancer.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n154 + i += n155 return i, nil } @@ -7220,11 +7230,11 @@ func (m *TCPSocketAction) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.Port.Size())) - n155, err := m.Port.MarshalTo(data[i:]) + n156, err := m.Port.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n155 + i += n156 return i, nil } @@ -7314,11 +7324,11 @@ func (m *Volume) MarshalTo(data []byte) (int, error) { data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64(m.VolumeSource.Size())) - n156, err := m.VolumeSource.MarshalTo(data[i:]) + n157, err := m.VolumeSource.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n156 + i += n157 return i, nil } @@ -7379,163 +7389,163 @@ func (m *VolumeSource) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.HostPath.Size())) - n157, err := m.HostPath.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n157 - } - if m.EmptyDir != nil { - data[i] = 0x12 - i++ - i = encodeVarintGenerated(data, i, uint64(m.EmptyDir.Size())) - n158, err := m.EmptyDir.MarshalTo(data[i:]) + n158, err := m.HostPath.MarshalTo(data[i:]) if err != nil { return 0, err } i += n158 } - if m.GCEPersistentDisk != nil { - data[i] = 0x1a + if m.EmptyDir != nil { + data[i] = 0x12 i++ - i = encodeVarintGenerated(data, i, uint64(m.GCEPersistentDisk.Size())) - n159, err := m.GCEPersistentDisk.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.EmptyDir.Size())) + n159, err := m.EmptyDir.MarshalTo(data[i:]) if err != nil { return 0, err } i += n159 } - if m.AWSElasticBlockStore != nil { - data[i] = 0x22 + if m.GCEPersistentDisk != nil { + data[i] = 0x1a i++ - i = encodeVarintGenerated(data, i, uint64(m.AWSElasticBlockStore.Size())) - n160, err := m.AWSElasticBlockStore.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.GCEPersistentDisk.Size())) + n160, err := m.GCEPersistentDisk.MarshalTo(data[i:]) if err != nil { return 0, err } i += n160 } - if m.GitRepo != nil { - data[i] = 0x2a + if m.AWSElasticBlockStore != nil { + data[i] = 0x22 i++ - i = encodeVarintGenerated(data, i, uint64(m.GitRepo.Size())) - n161, err := m.GitRepo.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.AWSElasticBlockStore.Size())) + n161, err := m.AWSElasticBlockStore.MarshalTo(data[i:]) if err != nil { return 0, err } i += n161 } - if m.Secret != nil { - data[i] = 0x32 + if m.GitRepo != nil { + data[i] = 0x2a i++ - i = encodeVarintGenerated(data, i, uint64(m.Secret.Size())) - n162, err := m.Secret.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.GitRepo.Size())) + n162, err := m.GitRepo.MarshalTo(data[i:]) if err != nil { return 0, err } i += n162 } - if m.NFS != nil { - data[i] = 0x3a + if m.Secret != nil { + data[i] = 0x32 i++ - i = encodeVarintGenerated(data, i, uint64(m.NFS.Size())) - n163, err := m.NFS.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.Secret.Size())) + n163, err := m.Secret.MarshalTo(data[i:]) if err != nil { return 0, err } i += n163 } - if m.ISCSI != nil { - data[i] = 0x42 + if m.NFS != nil { + data[i] = 0x3a i++ - i = encodeVarintGenerated(data, i, uint64(m.ISCSI.Size())) - n164, err := m.ISCSI.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.NFS.Size())) + n164, err := m.NFS.MarshalTo(data[i:]) if err != nil { return 0, err } i += n164 } - if m.Glusterfs != nil { - data[i] = 0x4a + if m.ISCSI != nil { + data[i] = 0x42 i++ - i = encodeVarintGenerated(data, i, uint64(m.Glusterfs.Size())) - n165, err := m.Glusterfs.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.ISCSI.Size())) + n165, err := m.ISCSI.MarshalTo(data[i:]) if err != nil { return 0, err } i += n165 } - if m.PersistentVolumeClaim != nil { - data[i] = 0x52 + if m.Glusterfs != nil { + data[i] = 0x4a i++ - i = encodeVarintGenerated(data, i, uint64(m.PersistentVolumeClaim.Size())) - n166, err := m.PersistentVolumeClaim.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.Glusterfs.Size())) + n166, err := m.Glusterfs.MarshalTo(data[i:]) if err != nil { return 0, err } i += n166 } - if m.RBD != nil { - data[i] = 0x5a + if m.PersistentVolumeClaim != nil { + data[i] = 0x52 i++ - i = encodeVarintGenerated(data, i, uint64(m.RBD.Size())) - n167, err := m.RBD.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.PersistentVolumeClaim.Size())) + n167, err := m.PersistentVolumeClaim.MarshalTo(data[i:]) if err != nil { return 0, err } i += n167 } - if m.FlexVolume != nil { - data[i] = 0x62 + if m.RBD != nil { + data[i] = 0x5a i++ - i = encodeVarintGenerated(data, i, uint64(m.FlexVolume.Size())) - n168, err := m.FlexVolume.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.RBD.Size())) + n168, err := m.RBD.MarshalTo(data[i:]) if err != nil { return 0, err } i += n168 } - if m.Cinder != nil { - data[i] = 0x6a + if m.FlexVolume != nil { + data[i] = 0x62 i++ - i = encodeVarintGenerated(data, i, uint64(m.Cinder.Size())) - n169, err := m.Cinder.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.FlexVolume.Size())) + n169, err := m.FlexVolume.MarshalTo(data[i:]) if err != nil { return 0, err } i += n169 } - if m.CephFS != nil { - data[i] = 0x72 + if m.Cinder != nil { + data[i] = 0x6a i++ - i = encodeVarintGenerated(data, i, uint64(m.CephFS.Size())) - n170, err := m.CephFS.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.Cinder.Size())) + n170, err := m.Cinder.MarshalTo(data[i:]) if err != nil { return 0, err } i += n170 } - if m.Flocker != nil { - data[i] = 0x7a + if m.CephFS != nil { + data[i] = 0x72 i++ - i = encodeVarintGenerated(data, i, uint64(m.Flocker.Size())) - n171, err := m.Flocker.MarshalTo(data[i:]) + i = encodeVarintGenerated(data, i, uint64(m.CephFS.Size())) + n171, err := m.CephFS.MarshalTo(data[i:]) if err != nil { return 0, err } i += n171 } + if m.Flocker != nil { + data[i] = 0x7a + i++ + i = encodeVarintGenerated(data, i, uint64(m.Flocker.Size())) + n172, err := m.Flocker.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n172 + } if m.DownwardAPI != nil { data[i] = 0x82 i++ data[i] = 0x1 i++ i = encodeVarintGenerated(data, i, uint64(m.DownwardAPI.Size())) - n172, err := m.DownwardAPI.MarshalTo(data[i:]) + n173, err := m.DownwardAPI.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n172 + i += n173 } if m.FC != nil { data[i] = 0x8a @@ -7543,11 +7553,11 @@ func (m *VolumeSource) MarshalTo(data []byte) (int, error) { data[i] = 0x1 i++ i = encodeVarintGenerated(data, i, uint64(m.FC.Size())) - n173, err := m.FC.MarshalTo(data[i:]) + n174, err := m.FC.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n173 + i += n174 } if m.AzureFile != nil { data[i] = 0x92 @@ -7555,11 +7565,11 @@ func (m *VolumeSource) MarshalTo(data []byte) (int, error) { data[i] = 0x1 i++ i = encodeVarintGenerated(data, i, uint64(m.AzureFile.Size())) - n174, err := m.AzureFile.MarshalTo(data[i:]) + n175, err := m.AzureFile.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n174 + i += n175 } if m.ConfigMap != nil { data[i] = 0x9a @@ -7567,11 +7577,11 @@ func (m *VolumeSource) MarshalTo(data []byte) (int, error) { data[i] = 0x1 i++ i = encodeVarintGenerated(data, i, uint64(m.ConfigMap.Size())) - n175, err := m.ConfigMap.MarshalTo(data[i:]) + n176, err := m.ConfigMap.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n175 + i += n176 } if m.VsphereVolume != nil { data[i] = 0xa2 @@ -7579,11 +7589,11 @@ func (m *VolumeSource) MarshalTo(data []byte) (int, error) { data[i] = 0x1 i++ i = encodeVarintGenerated(data, i, uint64(m.VsphereVolume.Size())) - n176, err := m.VsphereVolume.MarshalTo(data[i:]) + n177, err := m.VsphereVolume.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n176 + i += n177 } return i, nil } @@ -7635,11 +7645,11 @@ func (m *WeightedPodAffinityTerm) MarshalTo(data []byte) (int, error) { data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64(m.PodAffinityTerm.Size())) - n177, err := m.PodAffinityTerm.MarshalTo(data[i:]) + n178, err := m.PodAffinityTerm.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n177 + i += n178 return i, nil } @@ -9026,6 +9036,10 @@ func (m *PersistentVolumeClaimSpec) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = len(m.VolumeName) n += 1 + l + sovGenerated(uint64(l)) + if m.Selector != nil { + l = m.Selector.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -23562,6 +23576,39 @@ func (m *PersistentVolumeClaimSpec) Unmarshal(data []byte) error { } m.VolumeName = string(data[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Selector == nil { + m.Selector = &k8s_io_kubernetes_pkg_api_unversioned.LabelSelector{} + } + if err := m.Selector.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(data[iNdEx:]) diff --git a/pkg/api/v1/generated.proto b/pkg/api/v1/generated.proto index bd4dbe7ab7b..0d132d0aa15 100644 --- a/pkg/api/v1/generated.proto +++ b/pkg/api/v1/generated.proto @@ -1581,6 +1581,9 @@ message PersistentVolumeClaimSpec { // More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#access-modes-1 repeated string accessModes = 1; + // A label query over volumes to consider for binding. + optional k8s.io.kubernetes.pkg.api.unversioned.LabelSelector selector = 4; + // Resources represents the minimum resources the volume should have. // More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#resources optional ResourceRequirements resources = 2; diff --git a/pkg/api/v1/types.generated.go b/pkg/api/v1/types.generated.go index 4e66fdb43c2..95f8b2e6446 100644 --- a/pkg/api/v1/types.generated.go +++ b/pkg/api/v1/types.generated.go @@ -8164,15 +8164,16 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [3]bool + var yyq2 [4]bool _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false yyq2[0] = len(x.AccessModes) != 0 - yyq2[1] = true - yyq2[2] = x.VolumeName != "" + yyq2[1] = x.Selector != nil + yyq2[2] = true + yyq2[3] = x.VolumeName != "" var yynn2 int if yyr2 || yy2arr2 { - r.EncodeArrayStart(3) + r.EncodeArrayStart(4) } else { yynn2 = 0 for _, b := range yyq2 { @@ -8219,25 +8220,60 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[1] { - yy7 := &x.Resources - yy7.CodecEncodeSelf(e) + if x.Selector == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else if z.HasExtensions() && z.EncExt(x.Selector) { + } else { + z.EncFallback(x.Selector) + } + } } else { r.EncodeNil() } } else { if yyq2[1] { z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("resources")) + r.EncodeString(codecSelferC_UTF81234, string("selector")) z.EncSendContainerState(codecSelfer_containerMapValue1234) - yy9 := &x.Resources - yy9.CodecEncodeSelf(e) + if x.Selector == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else if z.HasExtensions() && z.EncExt(x.Selector) { + } else { + z.EncFallback(x.Selector) + } + } } } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[2] { - yym12 := z.EncBinary() - _ = yym12 + yy10 := &x.Resources + yy10.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("resources")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.Resources + yy12.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeName)) @@ -8246,12 +8282,12 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2[2] { + if yyq2[3] { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("volumeName")) z.EncSendContainerState(codecSelfer_containerMapValue1234) - yym13 := z.EncBinary() - _ = yym13 + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeName)) @@ -8331,12 +8367,29 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromMap(l int, d *codec1978.D h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv4), d) } } + case "selector": + if r.TryDecodeAsNil() { + if x.Selector != nil { + x.Selector = nil + } + } else { + if x.Selector == nil { + x.Selector = new(pkg2_unversioned.LabelSelector) + } + yym7 := z.DecBinary() + _ = yym7 + if false { + } else if z.HasExtensions() && z.DecExt(x.Selector) { + } else { + z.DecFallback(x.Selector, false) + } + } case "resources": if r.TryDecodeAsNil() { x.Resources = ResourceRequirements{} } else { - yyv6 := &x.Resources - yyv6.CodecDecodeSelf(d) + yyv8 := &x.Resources + yyv8.CodecDecodeSelf(d) } case "volumeName": if r.TryDecodeAsNil() { @@ -8355,16 +8408,16 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromArray(l int, d *codec1978 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj8 int - var yyb8 bool - var yyhl8 bool = l >= 0 - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb8 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb8 { + if yyb10 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -8372,21 +8425,48 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromArray(l int, d *codec1978 if r.TryDecodeAsNil() { x.AccessModes = nil } else { - yyv9 := &x.AccessModes - yym10 := z.DecBinary() - _ = yym10 + yyv11 := &x.AccessModes + yym12 := z.DecBinary() + _ = yym12 if false { } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv9), d) + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv11), d) } } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb8 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb8 { + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.Selector != nil { + x.Selector = nil + } + } else { + if x.Selector == nil { + x.Selector = new(pkg2_unversioned.LabelSelector) + } + yym14 := z.DecBinary() + _ = yym14 + if false { + } else if z.HasExtensions() && z.DecExt(x.Selector) { + } else { + z.DecFallback(x.Selector, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -8394,16 +8474,16 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromArray(l int, d *codec1978 if r.TryDecodeAsNil() { x.Resources = ResourceRequirements{} } else { - yyv11 := &x.Resources - yyv11.CodecDecodeSelf(d) + yyv15 := &x.Resources + yyv15.CodecDecodeSelf(d) } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb8 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb8 { + if yyb10 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -8414,17 +8494,17 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromArray(l int, d *codec1978 x.VolumeName = string(r.DecodeString()) } for { - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb8 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb8 { + if yyb10 { break } z.DecSendContainerState(codecSelfer_containerArrayElem1234) - z.DecStructFieldNotFound(yyj8-1, "") + z.DecStructFieldNotFound(yyj10-1, "") } z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } @@ -53380,7 +53460,7 @@ func (x codecSelfer1234) decSlicePersistentVolumeClaim(v *[]PersistentVolumeClai yyrg1 := len(yyv1) > 0 yyv21 := yyv1 - yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 344) + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 352) if yyrt1 { if yyrl1 <= cap(yyv1) { yyv1 = yyv1[:yyrl1] diff --git a/pkg/api/v1/types.go b/pkg/api/v1/types.go index 40710df01db..643e667f481 100644 --- a/pkg/api/v1/types.go +++ b/pkg/api/v1/types.go @@ -457,7 +457,7 @@ type PersistentVolumeClaimSpec struct { // More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#access-modes-1 AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" protobuf:"bytes,1,rep,name=accessModes,casttype=PersistentVolumeAccessMode"` // A label query over volumes to consider for binding. - Selector *unversioned.LabelSelector `json:"selector,omitempty"` + Selector *unversioned.LabelSelector `json:"selector,omitempty" protobuf:"bytes,4,opt,name=selector"` // Resources represents the minimum resources the volume should have. // More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#resources Resources ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,2,opt,name=resources"` diff --git a/pkg/api/v1/types_swagger_doc_generated.go b/pkg/api/v1/types_swagger_doc_generated.go index c18b5e7e4b2..014d608f690 100644 --- a/pkg/api/v1/types_swagger_doc_generated.go +++ b/pkg/api/v1/types_swagger_doc_generated.go @@ -998,6 +998,7 @@ func (PersistentVolumeClaimList) SwaggerDoc() map[string]string { var map_PersistentVolumeClaimSpec = map[string]string{ "": "PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes", "accessModes": "AccessModes contains the desired access modes the volume should have. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#access-modes-1", + "selector": "A label query over volumes to consider for binding.", "resources": "Resources represents the minimum resources the volume should have. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#resources", "volumeName": "VolumeName is the binding reference to the PersistentVolume backing this claim.", } diff --git a/pkg/apis/apps/types.generated.go b/pkg/apis/apps/types.generated.go index 9903f8e1357..a084509225a 100644 --- a/pkg/apis/apps/types.generated.go +++ b/pkg/apis/apps/types.generated.go @@ -1434,7 +1434,7 @@ func (x codecSelfer1234) decSliceapi_PersistentVolumeClaim(v *[]pkg2_api.Persist yyrg1 := len(yyv1) > 0 yyv21 := yyv1 - yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 344) + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 352) if yyrt1 { if yyrl1 <= cap(yyv1) { yyv1 = yyv1[:yyrl1] diff --git a/pkg/apis/apps/v1alpha1/types.generated.go b/pkg/apis/apps/v1alpha1/types.generated.go index a548f53133b..a544c4e6ad0 100644 --- a/pkg/apis/apps/v1alpha1/types.generated.go +++ b/pkg/apis/apps/v1alpha1/types.generated.go @@ -1464,7 +1464,7 @@ func (x codecSelfer1234) decSlicev1_PersistentVolumeClaim(v *[]pkg2_v1.Persisten yyrg1 := len(yyv1) > 0 yyv21 := yyv1 - yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 344) + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 352) if yyrt1 { if yyrl1 <= cap(yyv1) { yyv1 = yyv1[:yyrl1]