Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

#1148: Support updates to Instances #1289

Merged
merged 2 commits into from
Oct 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkg/apis/servicecatalog/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,6 @@ type ExtraValue []string
// +genclient=true

// ServiceInstance represents a provisioned instance of a ServiceClass.
// Currently, the spec field cannot be changed once a ServiceInstance is
// created. Spec changes submitted by users will be ignored.
//
// In the future, this will be allowed and will represent the intention that
// the ServiceInstance should have the plan and/or parameters updated at the
// ServiceBroker.
type ServiceInstance struct {
metav1.TypeMeta
metav1.ObjectMeta
Expand Down Expand Up @@ -449,6 +443,12 @@ type ServiceInstanceSpec struct {
// end-user. User-provided values for this field are not saved.
// +optional
UserInfo *UserInfo

// UpdateRequests is a strictly increasing, non-negative integer counter that
// can be manually incremented by a user to manually trigger an update. This
// allows for parameters to be updated with any out-of-band changes that have
// been made to the secrets from which the parameters are sourced.
UpdateRequests int64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's non-negative as the comment says, shall we use the uint64 type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#primitive-types

Do not use unsigned integers, due to inconsistent support across languages and libraries. Just validate that the integer is non-negative if that's the case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

}

// ServiceInstanceStatus represents the current status of an Instance.
Expand Down
197 changes: 125 additions & 72 deletions pkg/apis/servicecatalog/v1alpha1/types.generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -6856,7 +6856,7 @@ func (x *ServiceInstanceSpec) CodecEncodeSelf(e *codec1978.Encoder) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [8]bool
var yyq2 [9]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[1] = x.ExternalServicePlanName != ""
Expand All @@ -6867,9 +6867,9 @@ func (x *ServiceInstanceSpec) CodecEncodeSelf(e *codec1978.Encoder) {
yyq2[7] = x.UserInfo != nil
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(8)
r.EncodeArrayStart(9)
} else {
yynn2 = 2
yynn2 = 3
for _, b := range yyq2 {
if b {
yynn2++
Expand Down Expand Up @@ -7082,6 +7082,25 @@ func (x *ServiceInstanceSpec) CodecEncodeSelf(e *codec1978.Encoder) {
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yym28 := z.EncBinary()
_ = yym28
if false {
} else {
r.EncodeInt(int64(x.UpdateRequests))
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("updateRequests"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym29 := z.EncBinary()
_ = yym29
if false {
} else {
r.EncodeInt(int64(x.UpdateRequests))
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
Expand Down Expand Up @@ -7243,6 +7262,18 @@ func (x *ServiceInstanceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder
}
x.UserInfo.CodecDecodeSelf(d)
}
case "updateRequests":
if r.TryDecodeAsNil() {
x.UpdateRequests = 0
} else {
yyv17 := &x.UpdateRequests
yym18 := z.DecBinary()
_ = yym18
if false {
} else {
*((*int64)(yyv17)) = int64(r.DecodeInt(64))
}
}
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
Expand All @@ -7254,60 +7285,60 @@ func (x *ServiceInstanceSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj17 int
var yyb17 bool
var yyhl17 bool = l >= 0
yyj17++
if yyhl17 {
yyb17 = yyj17 > l
var yyj19 int
var yyb19 bool
var yyhl19 bool = l >= 0
yyj19++
if yyhl19 {
yyb19 = yyj19 > l
} else {
yyb17 = r.CheckBreak()
yyb19 = r.CheckBreak()
}
if yyb17 {
if yyb19 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ExternalServiceClassName = ""
} else {
yyv18 := &x.ExternalServiceClassName
yym19 := z.DecBinary()
_ = yym19
yyv20 := &x.ExternalServiceClassName
yym21 := z.DecBinary()
_ = yym21
if false {
} else {
*((*string)(yyv18)) = r.DecodeString()
*((*string)(yyv20)) = r.DecodeString()
}
}
yyj17++
if yyhl17 {
yyb17 = yyj17 > l
yyj19++
if yyhl19 {
yyb19 = yyj19 > l
} else {
yyb17 = r.CheckBreak()
yyb19 = r.CheckBreak()
}
if yyb17 {
if yyb19 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ExternalServicePlanName = ""
} else {
yyv20 := &x.ExternalServicePlanName
yym21 := z.DecBinary()
_ = yym21
yyv22 := &x.ExternalServicePlanName
yym23 := z.DecBinary()
_ = yym23
if false {
} else {
*((*string)(yyv20)) = r.DecodeString()
*((*string)(yyv22)) = r.DecodeString()
}
}
yyj17++
if yyhl17 {
yyb17 = yyj17 > l
yyj19++
if yyhl19 {
yyb19 = yyj19 > l
} else {
yyb17 = r.CheckBreak()
yyb19 = r.CheckBreak()
}
if yyb17 {
if yyb19 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
Expand All @@ -7322,13 +7353,13 @@ func (x *ServiceInstanceSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
}
x.ServiceClassRef.CodecDecodeSelf(d)
}
yyj17++
if yyhl17 {
yyb17 = yyj17 > l
yyj19++
if yyhl19 {
yyb19 = yyj19 > l
} else {
yyb17 = r.CheckBreak()
yyb19 = r.CheckBreak()
}
if yyb17 {
if yyb19 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
Expand All @@ -7343,13 +7374,13 @@ func (x *ServiceInstanceSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
}
x.ServicePlanRef.CodecDecodeSelf(d)
}
yyj17++
if yyhl17 {
yyb17 = yyj17 > l
yyj19++
if yyhl19 {
yyb19 = yyj19 > l
} else {
yyb17 = r.CheckBreak()
yyb19 = r.CheckBreak()
}
if yyb17 {
if yyb19 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
Expand All @@ -7362,67 +7393,67 @@ func (x *ServiceInstanceSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
if x.Parameters == nil {
x.Parameters = new(pkg4_runtime.RawExtension)
}
yym25 := z.DecBinary()
_ = yym25
yym27 := z.DecBinary()
_ = yym27
if false {
} else if z.HasExtensions() && z.DecExt(x.Parameters) {
} else if !yym25 && z.IsJSONHandle() {
} else if !yym27 && z.IsJSONHandle() {
z.DecJSONUnmarshal(x.Parameters)
} else {
z.DecFallback(x.Parameters, false)
}
}
yyj17++
if yyhl17 {
yyb17 = yyj17 > l
yyj19++
if yyhl19 {
yyb19 = yyj19 > l
} else {
yyb17 = r.CheckBreak()
yyb19 = r.CheckBreak()
}
if yyb17 {
if yyb19 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ParametersFrom = nil
} else {
yyv26 := &x.ParametersFrom
yym27 := z.DecBinary()
_ = yym27
yyv28 := &x.ParametersFrom
yym29 := z.DecBinary()
_ = yym29
if false {
} else {
h.decSliceParametersFromSource((*[]ParametersFromSource)(yyv26), d)
h.decSliceParametersFromSource((*[]ParametersFromSource)(yyv28), d)
}
}
yyj17++
if yyhl17 {
yyb17 = yyj17 > l
yyj19++
if yyhl19 {
yyb19 = yyj19 > l
} else {
yyb17 = r.CheckBreak()
yyb19 = r.CheckBreak()
}
if yyb17 {
if yyb19 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ExternalID = ""
} else {
yyv28 := &x.ExternalID
yym29 := z.DecBinary()
_ = yym29
yyv30 := &x.ExternalID
yym31 := z.DecBinary()
_ = yym31
if false {
} else {
*((*string)(yyv28)) = r.DecodeString()
*((*string)(yyv30)) = r.DecodeString()
}
}
yyj17++
if yyhl17 {
yyb17 = yyj17 > l
yyj19++
if yyhl19 {
yyb19 = yyj19 > l
} else {
yyb17 = r.CheckBreak()
yyb19 = r.CheckBreak()
}
if yyb17 {
if yyb19 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
Expand All @@ -7437,18 +7468,40 @@ func (x *ServiceInstanceSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
}
x.UserInfo.CodecDecodeSelf(d)
}
yyj19++
if yyhl19 {
yyb19 = yyj19 > l
} else {
yyb19 = r.CheckBreak()
}
if yyb19 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.UpdateRequests = 0
} else {
yyv33 := &x.UpdateRequests
yym34 := z.DecBinary()
_ = yym34
if false {
} else {
*((*int64)(yyv33)) = int64(r.DecodeInt(64))
}
}
for {
yyj17++
if yyhl17 {
yyb17 = yyj17 > l
yyj19++
if yyhl19 {
yyb19 = yyj19 > l
} else {
yyb17 = r.CheckBreak()
yyb19 = r.CheckBreak()
}
if yyb17 {
if yyb19 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj17-1, "")
z.DecStructFieldNotFound(yyj19-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
Expand Down Expand Up @@ -12422,7 +12475,7 @@ func (x codecSelfer1234) decSliceServiceInstance(v *[]ServiceInstance, d *codec1

yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 464)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 472)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/servicecatalog/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,12 @@ type ServiceInstanceSpec struct {
// end-user. User-provided values for this field are not saved.
// +optional
UserInfo *UserInfo `json:"userInfo,omitempty"`

// UpdateRequests is a strictly increasing, non-negative integer counter that
// can be manually incremented by a user to manually trigger an update. This
// allows for parameters to be updated with any out-of-band changes that have
// been made to the secrets from which the parameters are sourced.
UpdateRequests int64 `json:"updateRequests"`
}

// ServiceInstanceStatus represents the current status of an Instance.
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/servicecatalog/v1alpha1/zz_generated.conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ func autoConvert_v1alpha1_ServiceInstanceSpec_To_servicecatalog_ServiceInstanceS
out.ParametersFrom = *(*[]servicecatalog.ParametersFromSource)(unsafe.Pointer(&in.ParametersFrom))
out.ExternalID = in.ExternalID
out.UserInfo = (*servicecatalog.UserInfo)(unsafe.Pointer(in.UserInfo))
out.UpdateRequests = in.UpdateRequests
return nil
}

Expand All @@ -752,6 +753,7 @@ func autoConvert_servicecatalog_ServiceInstanceSpec_To_v1alpha1_ServiceInstanceS
out.ParametersFrom = *(*[]ParametersFromSource)(unsafe.Pointer(&in.ParametersFrom))
out.ExternalID = in.ExternalID
out.UserInfo = (*UserInfo)(unsafe.Pointer(in.UserInfo))
out.UpdateRequests = in.UpdateRequests
return nil
}

Expand Down
Loading