Skip to content

Commit

Permalink
feat: add global-option setting in configmap (#699)
Browse files Browse the repository at this point in the history
Signed-off-by: sjcsjc123 <[email protected]>
  • Loading branch information
sjcsjc123 authored Jan 8, 2024
1 parent 1f7e98c commit c250e85
Show file tree
Hide file tree
Showing 7 changed files with 1,400 additions and 32 deletions.
15 changes: 11 additions & 4 deletions pkg/ingress/kube/configmap/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,21 @@ const (
type ItemEventHandler = func(name string)

type HigressConfig struct {
Tracing *Tracing `json:"tracing,omitempty"`
Gzip *Gzip `json:"gzip,omitempty"`
Tracing *Tracing `json:"tracing,omitempty"`
Gzip *Gzip `json:"gzip,omitempty"`
Downstream *Downstream `json:"downstream,omitempty"`
DisableXEnvoyHeaders bool `json:"disableXEnvoyHeaders,omitempty"`
AddXRealIpHeader bool `json:"addXRealIpHeader,omitempty"`
}

func NewDefaultHigressConfig() *HigressConfig {
globalOption := NewDefaultGlobalOption()
higressConfig := &HigressConfig{
Tracing: NewDefaultTracing(),
Gzip: NewDefaultGzip(),
Tracing: NewDefaultTracing(),
Gzip: NewDefaultGzip(),
Downstream: globalOption.Downstream,
DisableXEnvoyHeaders: globalOption.DisableXEnvoyHeaders,
AddXRealIpHeader: globalOption.AddXRealIpHeader,
}
return higressConfig
}
Expand Down
7 changes: 6 additions & 1 deletion pkg/ingress/kube/configmap/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,14 @@ func NewConfigmapMgr(XDSUpdater model.XDSUpdater, namespace string, higressConfi
configmapMgr.SetHigressConfig(NewDefaultHigressConfig())

tracingController := NewTracingController(namespace)
gzipController := NewGzipController(namespace)
configmapMgr.AddItemControllers(tracingController)

gzipController := NewGzipController(namespace)
configmapMgr.AddItemControllers(gzipController)

globalOptionController := NewGlobalOptionController(namespace)
configmapMgr.AddItemControllers(globalOptionController)

configmapMgr.initEventHandlers()

return configmapMgr
Expand Down
Loading

0 comments on commit c250e85

Please sign in to comment.