Skip to content

Commit

Permalink
remove custom metrics authentication details from the binding configs
Browse files Browse the repository at this point in the history
  • Loading branch information
asalan316 committed Oct 22, 2024
1 parent 1cd4ac9 commit 979581a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"configuration": {
"custom_metrics": {
"auth": {
"credential_type": ""
},
"metric_submission_strategy": {
"allow_from": "bound_app"
}
Expand Down
4 changes: 2 additions & 2 deletions src/autoscaler/api/broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ func (b *Broker) Bind(ctx context.Context, instanceID string, bindingID string,
}
// set the default custom metrics strategy if not provided
if bindingConfiguration.GetCustomMetricsStrategy() == "" {
bindingConfiguration.SetDefaultCustomMetricsStrategy(models.CustomMetricsSameApp)
bindingConfiguration.SetCustomMetricsStrategy(models.CustomMetricsSameApp)
}
logger.Info("binding-configuration", lager.Data{"bindingConfiguration": bindingConfiguration})

Expand Down Expand Up @@ -712,7 +712,7 @@ func (b *Broker) GetBinding(ctx context.Context, instanceID string, bindingID st
return result, err
}
bindingConfig := &models.BindingConfig{}
bindingConfig.SetDefaultCustomMetricsStrategy(serviceBinding.CustomMetricsStrategy)
bindingConfig.SetCustomMetricsStrategy(serviceBinding.CustomMetricsStrategy)

policy, err := b.policydb.GetAppPolicy(ctx, serviceBinding.AppID)
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions src/autoscaler/api/broker/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ var _ = Describe("Broker", func() {
Context("with configuration and policy", func() {
BeforeEach(func() {
bindingConfig = &models.BindingConfig{Configuration: models.Configuration{CustomMetrics: models.CustomMetricsConfig{
Auth: models.Auth{},
MetricSubmissionStrategy: models.MetricsSubmissionStrategy{AllowFrom: "bound_app"},
},
}}
Expand All @@ -210,7 +209,6 @@ var _ = Describe("Broker", func() {
Context("with configuration only", func() {
BeforeEach(func() {
bindingConfig = &models.BindingConfig{Configuration: models.Configuration{CustomMetrics: models.CustomMetricsConfig{
Auth: models.Auth{},
MetricSubmissionStrategy: models.MetricsSubmissionStrategy{AllowFrom: "bound_app"},
},
}}
Expand Down
6 changes: 1 addition & 5 deletions src/autoscaler/models/binding_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ type Configuration struct {
}

type CustomMetricsConfig struct {
Auth Auth `json:"auth,omitempty"`
MetricSubmissionStrategy MetricsSubmissionStrategy `json:"metric_submission_strategy"`
}

type Auth struct {
CredentialType string `json:"credential_type"`
}
type MetricsSubmissionStrategy struct {
AllowFrom string `json:"allow_from"`
}
Expand All @@ -43,6 +39,6 @@ func (b *BindingConfig) GetCustomMetricsStrategy() string {
return b.Configuration.CustomMetrics.MetricSubmissionStrategy.AllowFrom
}

func (b *BindingConfig) SetDefaultCustomMetricsStrategy(allowFrom string) {
func (b *BindingConfig) SetCustomMetricsStrategy(allowFrom string) {
b.Configuration.CustomMetrics.MetricSubmissionStrategy.AllowFrom = allowFrom
}

0 comments on commit 979581a

Please sign in to comment.