Skip to content

Commit

Permalink
Remove direct handling of xfcc cert header for scaling engine client …
Browse files Browse the repository at this point in the history
…in api
  • Loading branch information
bonzofenix committed Dec 15, 2024
1 parent 1928e0e commit a566ba5
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/autoscaler/api/publicapiserver/scaling_history_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"code.cloudfoundry.org/app-autoscaler/src/autoscaler/api/config"
"code.cloudfoundry.org/app-autoscaler/src/autoscaler/helpers"
"code.cloudfoundry.org/app-autoscaler/src/autoscaler/helpers/auth"
"code.cloudfoundry.org/lager/v3"
)

Expand Down Expand Up @@ -49,12 +48,6 @@ func NewScalingHistoryHandler(logger lager.Logger, conf *config.Config) (*Scalin
conf: conf,
}

if conf.CfInstanceCert != "" {
seClient.Transport = &TransportWithXFCC{
Cert: auth.NewCert(conf.CfInstanceCert),
}
}

if client, err := internalscalingenginehistory.NewClient(conf.ScalingEngine.ScalingEngineUrl, internalscalingenginehistory.WithClient(seClient)); err != nil {
return nil, fmt.Errorf("error creating ogen scaling history client: %w", err)
} else {
Expand All @@ -64,23 +57,6 @@ func NewScalingHistoryHandler(logger lager.Logger, conf *config.Config) (*Scalin
return newHandler, nil
}

type TransportWithXFCC struct {
Cert *auth.Cert
Base http.RoundTripper
}

func (t *TransportWithXFCC) base() http.RoundTripper {
if t.Base != nil {
return t.Base
}
return http.DefaultTransport
}

func (t *TransportWithXFCC) RoundTrip(req *http.Request) (*http.Response, error) {
req.Header.Add("X-Forwarded-Client-Cert", t.Cert.GetXFCCHeader())
return t.base().RoundTrip(req)
}

func (h *ScalingHistoryHandler) NewError(_ context.Context, _ error) *scalinghistory.ErrorStatusCode {
result := &scalinghistory.ErrorStatusCode{}
result.SetStatusCode(http.StatusInternalServerError)
Expand Down

0 comments on commit a566ba5

Please sign in to comment.