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

Commit

Permalink
Store in-progress and external properties in instance and binding sta…
Browse files Browse the repository at this point in the history
…tus. (#1250)
  • Loading branch information
staebler authored and pmorie committed Sep 28, 2017
1 parent 6ab6492 commit 0c0035c
Show file tree
Hide file tree
Showing 21 changed files with 4,196 additions and 1,149 deletions.
18 changes: 18 additions & 0 deletions pkg/apis/servicecatalog/testing/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,24 @@ func FuzzerFor(t *testing.T, version schema.GroupVersion, src rand.Source) *fuzz
}
bs.Parameters = parameters
},
func(bs *servicecatalog.ServiceInstancePropertiesState, c fuzz.Continue) {
c.FuzzNoCustom(bs)
parameters, err := createParameter(c)
if err != nil {
t.Errorf("Failed to create parameter object: %v", err)
return
}
bs.Parameters = parameters
},
func(bs *servicecatalog.ServiceInstanceCredentialPropertiesState, c fuzz.Continue) {
c.FuzzNoCustom(bs)
parameters, err := createParameter(c)
if err != nil {
t.Errorf("Failed to create parameter object: %v", err)
return
}
bs.Parameters = parameters
},
func(sc *servicecatalog.ServiceClass, c fuzz.Continue) {
c.FuzzNoCustom(sc)
metadata, err := createServiceMetadata(c)
Expand Down
53 changes: 53 additions & 0 deletions pkg/apis/servicecatalog/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,15 @@ type ServiceInstanceStatus struct {

// OperationStartTime is the time at which the current operation began.
OperationStartTime *metav1.Time

// InProgressProperties is the properties state of the ServiceInstance when
// a Provision or Update is in progress. If the current operation is a
// Deprovision, this will be nil.
InProgressProperties *ServiceInstancePropertiesState

// ExternalProperties is the properties state of the ServiceInstance which the
// broker knows about.
ExternalProperties *ServiceInstancePropertiesState
}

// ServiceInstanceCondition contains condition information about an Instance.
Expand Down Expand Up @@ -529,6 +538,26 @@ const (
ServiceInstanceOperationDeprovision ServiceInstanceOperation = "Deprovision"
)

// ServiceInstancePropertiesState is the state of a ServiceInstance that
// the ServiceBroker knows about.
type ServiceInstancePropertiesState struct {
// ExternalServicePlanName is the name of the plan that the broker knows this
// ServiceInstance to be on. This is the human readable plan name from the
// OSB API.
ExternalServicePlanName string

// Parameters is a blob of the parameters and their values that the broker
// knows about for this ServiceInstance. If a parameter was sourced from
// a secret, its value will be "<redacted>" in this blob.
Parameters *runtime.RawExtension

// ParametersChecksum is the checksum of the parameters that were sent.
ParametersChecksum string

// UserInfo is information about the user that made the request.
UserInfo *UserInfo
}

// ServiceInstanceCredentialList is a list of ServiceInstanceCredentials.
type ServiceInstanceCredentialList struct {
metav1.TypeMeta
Expand Down Expand Up @@ -612,6 +641,15 @@ type ServiceInstanceCredentialStatus struct {

// OperationStartTime is the time at which the current operation began.
OperationStartTime *metav1.Time

// InProgressProperties is the properties state of the
// ServiceInstanceCredential when a Bind is in progress. If the current
// operation is an Unbind, this will be nil.
InProgressProperties *ServiceInstanceCredentialPropertiesState

// ExternalProperties is the properties state of the
// ServiceInstanceCredential which the broker knows about.
ExternalProperties *ServiceInstanceCredentialPropertiesState
}

// ServiceInstanceCredentialCondition condition information for a ServiceInstanceCredential.
Expand Down Expand Up @@ -665,6 +703,21 @@ const (
FinalizerServiceCatalog string = "kubernetes-incubator/service-catalog"
)

// ServiceInstanceCredentialPropertiesState is the state of a
// ServiceInstanceCredential that the ServiceBroker knows about.
type ServiceInstanceCredentialPropertiesState struct {
// Parameters is a blob of the parameters and their values that the broker
// knows about for this ServiceInstanceCredential. If a parameter was
// sourced from a secret, its value will be "<redacted>" in this blob.
Parameters *runtime.RawExtension

// ParametersChecksum is the checksum of the parameters that were sent.
ParametersChecksum string

// UserInfo is information about the user that made the request.
UserInfo *UserInfo
}

// ParametersFromSource represents the source of a set of Parameters
type ParametersFromSource struct {
// The Secret key to select from.
Expand Down
8 changes: 8 additions & 0 deletions pkg/apis/servicecatalog/unstructured_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ func doUnstructuredRoundTrip(t *testing.T, group testapi.TestGroup, kind string)
}
bs.Parameters = nil
},
func(ps *servicecatalog.ServiceInstancePropertiesState, c fuzz.Continue) {
c.FuzzNoCustom(ps)
ps.Parameters = nil
},
func(ps *servicecatalog.ServiceInstanceCredentialPropertiesState, c fuzz.Continue) {
c.FuzzNoCustom(ps)
ps.Parameters = nil
},
).Fuzz(internalObj)

item, err := api.Scheme.New(group.GroupVersion().WithKind(kind))
Expand Down
Loading

0 comments on commit 0c0035c

Please sign in to comment.