Skip to content

Commit

Permalink
Make max bindings count configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
MarekMichali committed Oct 11, 2024
1 parent aed2188 commit 3387f00
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/broker/bind_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type BindingConfig struct {
ExpirationSeconds int `envconfig:"default=600"`
MaxExpirationSeconds int `envconfig:"default=7200"`
MinExpirationSeconds int `envconfig:"default=600"`
MaxBindingsCount int `envconfig:"default=10"`
}

type BindEndpoint struct {
Expand Down Expand Up @@ -114,7 +115,7 @@ func (b *BindEndpoint) Bind(ctx context.Context, instanceID, bindingID string, d

bindingCount := len(bindingList)
// dont forget expired bindings, talk with WW
if bindingCount >= 10 {
if bindingCount >= b.config.MaxBindingsCount {
message := fmt.Sprintf("maximum number of bindings reached: %d", bindingCount)
return domain.Binding{}, apiresponses.NewFailureResponse(fmt.Errorf(message), http.StatusBadRequest, message)
}
Expand Down
2 changes: 2 additions & 0 deletions resources/keb/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ spec:
value: "{{ .Values.binding.expirationSeconds}}"
- name: APP_BROKER_BINDING_MAX_EXPIRATION_SECONDS
value: "{{ .Values.binding.maxExpirationSeconds}}"
- name: APP_BROKER_BINDING_MAX_BINDINGS_COUNT
value: "{{ .Values.binding.maxBindingsCount}}"
- name: APP_BROKER_ONLY_SINGLE_TRIAL_PER_GA
value: "{{ .Values.onlySingleTrialPerGA }}"
- name: APP_BROKER_URL
Expand Down
1 change: 1 addition & 0 deletions resources/keb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ binding:
maxExpirationSeconds: 7200
# minExpirationSeconds can't be lower than 600 seconds. Forced by Gardener
minExpirationSeconds: 600
maxBindingsCount: 10

service:
type: ClusterIP
Expand Down

0 comments on commit 3387f00

Please sign in to comment.