Browse code

Merge pull request #9663 from sjenning/string-data

Merged by openshift-bot

OpenShift Bot authored on 2016/08/05 23:44:04
Showing 10 changed files
... ...
@@ -20204,6 +20204,10 @@
20204 20204
       "type": "object",
20205 20205
       "description": "Data contains the secret data. Each key must be a valid DNS_SUBDOMAIN or leading dot followed by valid DNS_SUBDOMAIN. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4"
20206 20206
      },
20207
+     "stringData": {
20208
+      "type": "object",
20209
+      "description": "stringData allows specifying non-binary secret data in string form. It is provided as a write-only convenience method. All keys and values are merged into the data field on write, overwriting any existing values. It is never output when reading from the API."
20210
+     },
20207 20211
      "type": {
20208 20212
       "type": "string",
20209 20213
       "description": "Used to facilitate programmatic handling of secret data."
... ...
@@ -25325,6 +25325,10 @@
25325 25325
       "type": "object",
25326 25326
       "description": "Data contains the secret data. Each key must be a valid DNS_SUBDOMAIN or leading dot followed by valid DNS_SUBDOMAIN. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4"
25327 25327
      },
25328
+     "stringData": {
25329
+      "type": "object",
25330
+      "description": "stringData allows specifying non-binary secret data in string form. It is provided as a write-only convenience method. All keys and values are merged into the data field on write, overwriting any existing values. It is never output when reading from the API."
25331
+     },
25328 25332
      "type": {
25329 25333
       "type": "string",
25330 25334
       "description": "Used to facilitate programmatic handling of secret data."
... ...
@@ -20200,6 +20200,10 @@
20200 20200
       "type": "object",
20201 20201
       "description": "Data contains the secret data. Each key must be a valid DNS_SUBDOMAIN or leading dot followed by valid DNS_SUBDOMAIN. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4"
20202 20202
      },
20203
+     "stringData": {
20204
+      "type": "object",
20205
+      "description": "stringData allows specifying non-binary secret data in string form. It is provided as a write-only convenience method. All keys and values are merged into the data field on write, overwriting any existing values. It is never output when reading from the API."
20206
+     },
20203 20207
      "type": {
20204 20208
       "type": "string",
20205 20209
       "description": "Used to facilitate programmatic handling of secret data."
... ...
@@ -43,6 +43,7 @@ func addConversionFuncs(scheme *runtime.Scheme) {
43 43
 		Convert_v1_Pod_To_api_Pod,
44 44
 		Convert_v1_PodSpec_To_api_PodSpec,
45 45
 		Convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec,
46
+		Convert_v1_Secret_To_api_Secret,
46 47
 		Convert_v1_ServiceSpec_To_api_ServiceSpec,
47 48
 		Convert_v1_ResourceList_To_api_ResourceList,
48 49
 
... ...
@@ -619,6 +620,24 @@ func Convert_api_ServiceSpec_To_v1_ServiceSpec(in *api.ServiceSpec, out *Service
619 619
 	return nil
620 620
 }
621 621
 
622
+func Convert_v1_Secret_To_api_Secret(in *Secret, out *api.Secret, s conversion.Scope) error {
623
+	if err := autoConvert_v1_Secret_To_api_Secret(in, out, s); err != nil {
624
+		return err
625
+	}
626
+
627
+	// StringData overwrites Data
628
+	if len(in.StringData) > 0 {
629
+		if out.Data == nil {
630
+			out.Data = map[string][]byte{}
631
+		}
632
+		for k, v := range in.StringData {
633
+			out.Data[k] = []byte(v)
634
+		}
635
+	}
636
+
637
+	return nil
638
+}
639
+
622 640
 func Convert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *api.ServiceSpec, s conversion.Scope) error {
623 641
 	if err := autoConvert_v1_ServiceSpec_To_api_ServiceSpec(in, out, s); err != nil {
624 642
 		return err
... ...
@@ -5782,10 +5782,6 @@ func autoConvert_v1_Secret_To_api_Secret(in *Secret, out *api.Secret, s conversi
5782 5782
 	return nil
5783 5783
 }
5784 5784
 
5785
-func Convert_v1_Secret_To_api_Secret(in *Secret, out *api.Secret, s conversion.Scope) error {
5786
-	return autoConvert_v1_Secret_To_api_Secret(in, out, s)
5787
-}
5788
-
5789 5785
 func autoConvert_api_Secret_To_v1_Secret(in *api.Secret, out *Secret, s conversion.Scope) error {
5790 5786
 	if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
5791 5787
 		return err
... ...
@@ -2860,6 +2860,15 @@ func DeepCopy_v1_Secret(in Secret, out *Secret, c *conversion.Cloner) error {
2860 2860
 	} else {
2861 2861
 		out.Data = nil
2862 2862
 	}
2863
+	if in.StringData != nil {
2864
+		in, out := in.StringData, &out.StringData
2865
+		*out = make(map[string]string)
2866
+		for key, val := range in {
2867
+			(*out)[key] = val
2868
+		}
2869
+	} else {
2870
+		out.StringData = nil
2871
+	}
2863 2872
 	out.Type = in.Type
2864 2873
 	return nil
2865 2874
 }
... ...
@@ -6972,6 +6972,23 @@ func (m *Secret) MarshalTo(data []byte) (int, error) {
6972 6972
 	i++
6973 6973
 	i = encodeVarintGenerated(data, i, uint64(len(m.Type)))
6974 6974
 	i += copy(data[i:], m.Type)
6975
+	if len(m.StringData) > 0 {
6976
+		for k := range m.StringData {
6977
+			data[i] = 0x22
6978
+			i++
6979
+			v := m.StringData[k]
6980
+			mapSize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v)))
6981
+			i = encodeVarintGenerated(data, i, uint64(mapSize))
6982
+			data[i] = 0xa
6983
+			i++
6984
+			i = encodeVarintGenerated(data, i, uint64(len(k)))
6985
+			i += copy(data[i:], k)
6986
+			data[i] = 0x12
6987
+			i++
6988
+			i = encodeVarintGenerated(data, i, uint64(len(v)))
6989
+			i += copy(data[i:], v)
6990
+		}
6991
+	}
6975 6992
 	return i, nil
6976 6993
 }
6977 6994
 
... ...
@@ -10532,6 +10549,14 @@ func (m *Secret) Size() (n int) {
10532 10532
 	}
10533 10533
 	l = len(m.Type)
10534 10534
 	n += 1 + l + sovGenerated(uint64(l))
10535
+	if len(m.StringData) > 0 {
10536
+		for k, v := range m.StringData {
10537
+			_ = k
10538
+			_ = v
10539
+			mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v)))
10540
+			n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize))
10541
+		}
10542
+	}
10535 10543
 	return n
10536 10544
 }
10537 10545
 
... ...
@@ -32593,6 +32618,117 @@ func (m *Secret) Unmarshal(data []byte) error {
32593 32593
 			}
32594 32594
 			m.Type = SecretType(data[iNdEx:postIndex])
32595 32595
 			iNdEx = postIndex
32596
+		case 4:
32597
+			if wireType != 2 {
32598
+				return fmt.Errorf("proto: wrong wireType = %d for field StringData", wireType)
32599
+			}
32600
+			var msglen int
32601
+			for shift := uint(0); ; shift += 7 {
32602
+				if shift >= 64 {
32603
+					return ErrIntOverflowGenerated
32604
+				}
32605
+				if iNdEx >= l {
32606
+					return io.ErrUnexpectedEOF
32607
+				}
32608
+				b := data[iNdEx]
32609
+				iNdEx++
32610
+				msglen |= (int(b) & 0x7F) << shift
32611
+				if b < 0x80 {
32612
+					break
32613
+				}
32614
+			}
32615
+			if msglen < 0 {
32616
+				return ErrInvalidLengthGenerated
32617
+			}
32618
+			postIndex := iNdEx + msglen
32619
+			if postIndex > l {
32620
+				return io.ErrUnexpectedEOF
32621
+			}
32622
+			var keykey uint64
32623
+			for shift := uint(0); ; shift += 7 {
32624
+				if shift >= 64 {
32625
+					return ErrIntOverflowGenerated
32626
+				}
32627
+				if iNdEx >= l {
32628
+					return io.ErrUnexpectedEOF
32629
+				}
32630
+				b := data[iNdEx]
32631
+				iNdEx++
32632
+				keykey |= (uint64(b) & 0x7F) << shift
32633
+				if b < 0x80 {
32634
+					break
32635
+				}
32636
+			}
32637
+			var stringLenmapkey uint64
32638
+			for shift := uint(0); ; shift += 7 {
32639
+				if shift >= 64 {
32640
+					return ErrIntOverflowGenerated
32641
+				}
32642
+				if iNdEx >= l {
32643
+					return io.ErrUnexpectedEOF
32644
+				}
32645
+				b := data[iNdEx]
32646
+				iNdEx++
32647
+				stringLenmapkey |= (uint64(b) & 0x7F) << shift
32648
+				if b < 0x80 {
32649
+					break
32650
+				}
32651
+			}
32652
+			intStringLenmapkey := int(stringLenmapkey)
32653
+			if intStringLenmapkey < 0 {
32654
+				return ErrInvalidLengthGenerated
32655
+			}
32656
+			postStringIndexmapkey := iNdEx + intStringLenmapkey
32657
+			if postStringIndexmapkey > l {
32658
+				return io.ErrUnexpectedEOF
32659
+			}
32660
+			mapkey := string(data[iNdEx:postStringIndexmapkey])
32661
+			iNdEx = postStringIndexmapkey
32662
+			var valuekey uint64
32663
+			for shift := uint(0); ; shift += 7 {
32664
+				if shift >= 64 {
32665
+					return ErrIntOverflowGenerated
32666
+				}
32667
+				if iNdEx >= l {
32668
+					return io.ErrUnexpectedEOF
32669
+				}
32670
+				b := data[iNdEx]
32671
+				iNdEx++
32672
+				valuekey |= (uint64(b) & 0x7F) << shift
32673
+				if b < 0x80 {
32674
+					break
32675
+				}
32676
+			}
32677
+			var stringLenmapvalue uint64
32678
+			for shift := uint(0); ; shift += 7 {
32679
+				if shift >= 64 {
32680
+					return ErrIntOverflowGenerated
32681
+				}
32682
+				if iNdEx >= l {
32683
+					return io.ErrUnexpectedEOF
32684
+				}
32685
+				b := data[iNdEx]
32686
+				iNdEx++
32687
+				stringLenmapvalue |= (uint64(b) & 0x7F) << shift
32688
+				if b < 0x80 {
32689
+					break
32690
+				}
32691
+			}
32692
+			intStringLenmapvalue := int(stringLenmapvalue)
32693
+			if intStringLenmapvalue < 0 {
32694
+				return ErrInvalidLengthGenerated
32695
+			}
32696
+			postStringIndexmapvalue := iNdEx + intStringLenmapvalue
32697
+			if postStringIndexmapvalue > l {
32698
+				return io.ErrUnexpectedEOF
32699
+			}
32700
+			mapvalue := string(data[iNdEx:postStringIndexmapvalue])
32701
+			iNdEx = postStringIndexmapvalue
32702
+			if m.StringData == nil {
32703
+				m.StringData = make(map[string]string)
32704
+			}
32705
+			m.StringData[mapkey] = mapvalue
32706
+			iNdEx = postIndex
32596 32707
 		default:
32597 32708
 			iNdEx = preIndex
32598 32709
 			skippy, err := skipGenerated(data[iNdEx:])
... ...
@@ -2547,6 +2547,13 @@ message Secret {
2547 2547
   // Described in https://tools.ietf.org/html/rfc4648#section-4
2548 2548
   map<string, bytes> data = 2;
2549 2549
 
2550
+  // stringData allows specifying non-binary secret data in string form.
2551
+  // It is provided as a write-only convenience method.
2552
+  // All keys and values are merged into the data field on write, overwriting any existing values.
2553
+  // It is never output when reading from the API.
2554
+  // +genconversion=false
2555
+  map<string, string> stringData = 4;
2556
+
2550 2557
   // Used to facilitate programmatic handling of secret data.
2551 2558
   optional string type = 3;
2552 2559
 }
... ...
@@ -3103,6 +3103,13 @@ type Secret struct {
3103 3103
 	// Described in https://tools.ietf.org/html/rfc4648#section-4
3104 3104
 	Data map[string][]byte `json:"data,omitempty" protobuf:"bytes,2,rep,name=data"`
3105 3105
 
3106
+	// stringData allows specifying non-binary secret data in string form.
3107
+	// It is provided as a write-only convenience method.
3108
+	// All keys and values are merged into the data field on write, overwriting any existing values.
3109
+	// It is never output when reading from the API.
3110
+	// +genconversion=false
3111
+	StringData map[string]string `json:"stringData,omitempty" protobuf:"bytes,4,rep,name=stringData"`
3112
+
3106 3113
 	// Used to facilitate programmatic handling of secret data.
3107 3114
 	Type SecretType `json:"type,omitempty" protobuf:"bytes,3,opt,name=type,casttype=SecretType"`
3108 3115
 }
... ...
@@ -1548,10 +1548,11 @@ func (SELinuxOptions) SwaggerDoc() map[string]string {
1548 1548
 }
1549 1549
 
1550 1550
 var map_Secret = map[string]string{
1551
-	"":         "Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes.",
1552
-	"metadata": "Standard object's metadata. More info: http://releases.k8s.io/release-1.3/docs/devel/api-conventions.md#metadata",
1553
-	"data":     "Data contains the secret data. Each key must be a valid DNS_SUBDOMAIN or leading dot followed by valid DNS_SUBDOMAIN. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4",
1554
-	"type":     "Used to facilitate programmatic handling of secret data.",
1551
+	"":           "Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes.",
1552
+	"metadata":   "Standard object's metadata. More info: http://releases.k8s.io/release-1.3/docs/devel/api-conventions.md#metadata",
1553
+	"data":       "Data contains the secret data. Each key must be a valid DNS_SUBDOMAIN or leading dot followed by valid DNS_SUBDOMAIN. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4",
1554
+	"stringData": "stringData allows specifying non-binary secret data in string form. It is provided as a write-only convenience method. All keys and values are merged into the data field on write, overwriting any existing values. It is never output when reading from the API.",
1555
+	"type":       "Used to facilitate programmatic handling of secret data.",
1555 1556
 }
1556 1557
 
1557 1558
 func (Secret) SwaggerDoc() map[string]string {