Skip to content

Commit

Permalink
Add SidecarTimeout to MeshConfig.
Browse files Browse the repository at this point in the history
  • Loading branch information
cybwan committed Aug 31, 2023
1 parent cd40e30 commit 2ad94e6
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions charts/fsm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ The following table lists the configurable parameters of the fsm chart and their
| fsm.sidecarDrivers[0].sidecarImage | string | `"flomesh/pipy:0.90.2-41"` | Sidecar image for Linux workloads |
| fsm.sidecarImage | string | `""` | Sidecar image for Linux workloads |
| fsm.sidecarLogLevel | string | `"error"` | Log level for the proxy sidecar. Non developers should generally never set this value. In production environments the LogLevel should be set to `error` |
| fsm.sidecarTimeout | int | `60` | Sets connect/idle/read/write timeout |
| fsm.tracing.address | string | `""` | Address of the tracing collector service (must contain the namespace). When left empty, this is computed in helper template to "jaeger.<fsm-namespace>.svc.cluster.local". Please override for BYO-tracing as documented in tracing.md |
| fsm.tracing.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].key | string | `"kubernetes.io/os"` | |
| fsm.tracing.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].operator | string | `"In"` | |
Expand Down
1 change: 1 addition & 0 deletions charts/fsm/templates/preset-mesh-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ data:
"sidecarClass": {{.Values.fsm.sidecarClass | mustToJson }},
"sidecarImage": {{.Values.fsm.sidecarImage | mustToJson }},
"sidecarDrivers": {{.Values.fsm.sidecarDrivers | mustToJson }},
"sidecarTimeout": {{.Values.fsm.sidecarTimeout | mustToJson}},
"localProxyMode": {{.Values.fsm.localProxyMode | mustToJson}},
"localDNSProxy": {{.Values.fsm.localDNSProxy | mustToJson}}
},
Expand Down
10 changes: 10 additions & 0 deletions charts/fsm/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"meshName",
"maxDataPlaneConnections",
"sidecarLogLevel",
"sidecarTimeout",
"controllerLogLevel",
"enforceSingleMesh",
"deployJaeger",
Expand Down Expand Up @@ -1028,6 +1029,15 @@
"30s"
]
},
"sidecarTimeout": {
"$id": "#/properties/fsm/properties/sidecarTimeout",
"type": "integer",
"title": "The sidecarTimeout schema",
"description": "Sets connect/idle/read/write timeout",
"examples": [
"60"
]
},
"sidecarLogLevel": {
"$id": "#/properties/fsm/properties/sidecarLogLevel",
"type": "string",
Expand Down
3 changes: 3 additions & 0 deletions charts/fsm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ fsm:
# -- Sets the resync interval for regular proxy broadcast updates, set to 0s to not enforce any resync
configResyncInterval: "90s"

# -- Sets connect/idle/read/write timeout
sidecarTimeout: 60

# -- Controller log verbosity
controllerLogLevel: info

Expand Down
9 changes: 9 additions & 0 deletions cmd/fsm-bootstrap/crds/config.flomesh.io_meshconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ spec:
description: MaxDataPlaneConnections defines the maximum allowed
data plane connections from a proxy sidecar to the FSM controller.
type: integer
sidecarTimeout:
description: connect/idle/read/write timeout
type: integer
resources:
description: Resources defines the compute resources for the sidecar.
properties:
Expand Down Expand Up @@ -918,6 +921,9 @@ spec:
description: MaxDataPlaneConnections defines the maximum allowed
data plane connections from a proxy sidecar to the FSM controller.
type: integer
sidecarTimeout:
description: connect/idle/read/write timeout
type: integer
resources:
description: Resources defines the compute resources for the sidecar.
properties:
Expand Down Expand Up @@ -1773,6 +1779,9 @@ spec:
description: MaxDataPlaneConnections defines the maximum allowed
data plane connections from a proxy sidecar to the FSM controller.
type: integer
sidecarTimeout:
description: connect/idle/read/write timeout
type: integer
resources:
description: Resources defines the compute resources for the sidecar.
properties:
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/config/v1alpha1/mesh_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ type SidecarSpec struct {
// ConfigResyncInterval defines the resync interval for regular proxy broadcast updates.
ConfigResyncInterval string `json:"configResyncInterval,omitempty"`

// SidecarTimeout defines the connect/idle/read/write timeout.
SidecarTimeout int `json:"sidecarTimeout,omitempty"`

// Resources defines the compute resources for the sidecar.
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/config/v1alpha2/mesh_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ type SidecarSpec struct {
// ConfigResyncInterval defines the resync interval for regular proxy broadcast updates.
ConfigResyncInterval string `json:"configResyncInterval,omitempty"`

// SidecarTimeout defines the connect/idle/read/write timeout.
SidecarTimeout int `json:"sidecarTimeout,omitempty"`

// Resources defines the compute resources for the sidecar.
Resources corev1.ResourceRequirements `json:"resources,omitempty"`

Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/config/v1alpha3/mesh_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ type SidecarSpec struct {
// ConfigResyncInterval defines the resync interval for regular proxy broadcast updates.
ConfigResyncInterval string `json:"configResyncInterval,omitempty"`

// SidecarTimeout defines the connect/idle/read/write timeout.
SidecarTimeout int `json:"sidecarTimeout,omitempty"`

// Resources defines the compute resources for the sidecar.
Resources corev1.ResourceRequirements `json:"resources,omitempty"`

Expand Down
9 changes: 9 additions & 0 deletions pkg/configurator/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,15 @@ func (c *Client) GetMaxDataPlaneConnections() int {
return c.getMeshConfig().Spec.Sidecar.MaxDataPlaneConnections
}

// GetSidecarTimeout returns connect/idle/read/write timeout
func (c *Client) GetSidecarTimeout() int {
timeout := c.getMeshConfig().Spec.Sidecar.SidecarTimeout
if timeout <= 0 {
timeout = 60
}
return timeout
}

// GetSidecarLogLevel returns the sidecar log level
func (c *Client) GetSidecarLogLevel() string {
logLevel := c.getMeshConfig().Spec.Sidecar.LogLevel
Expand Down
14 changes: 14 additions & 0 deletions pkg/configurator/mock_client_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/configurator/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ type Configurator interface {
// GetMaxDataPlaneConnections returns the max data plane connections allowed, 0 if disabled
GetMaxDataPlaneConnections() int

// GetSidecarTimeout returns connect/idle/read/write timeout
GetSidecarTimeout() int

// GetFSMLogLevel returns the configured FSM log level
GetFSMLogLevel() string

Expand Down
1 change: 1 addition & 0 deletions pkg/messaging/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ func getProxyUpdateEvent(msg events.PubSubMessage) *proxyUpdateEvent {
prevSpec.Traffic.ServiceAccessMode != newSpec.Traffic.ServiceAccessMode ||
prevSpec.Observability.Tracing != newSpec.Observability.Tracing ||
prevSpec.Sidecar.LogLevel != newSpec.Sidecar.LogLevel ||
prevSpec.Sidecar.SidecarTimeout != newSpec.Sidecar.SidecarTimeout ||
prevSpec.Traffic.InboundExternalAuthorization.Enable != newSpec.Traffic.InboundExternalAuthorization.Enable ||
// Only trigger an update on InboundExternalAuthorization field changes if the new spec has the 'Enable' flag set to true.
(newSpec.Traffic.InboundExternalAuthorization.Enable && (prevSpec.Traffic.InboundExternalAuthorization != newSpec.Traffic.InboundExternalAuthorization)) ||
Expand Down
1 change: 1 addition & 0 deletions pkg/sidecar/providers/pipy/repo/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ func features(s *Server, proxy *pipy.Proxy, pipyConf *PipyConf) {
meshConf := mc.GetConfigurator()
proxy.MeshConf = meshConf
pipyConf.setSidecarLogLevel((*meshConf).GetMeshConfig().Spec.Sidecar.LogLevel)
pipyConf.setSidecarTimeout((*meshConf).GetMeshConfig().Spec.Sidecar.SidecarTimeout)
pipyConf.setEnableSidecarActiveHealthChecks((*meshConf).GetFeatureFlags().EnableSidecarActiveHealthChecks)
pipyConf.setEnableAutoDefaultRoute((*meshConf).GetFeatureFlags().EnableAutoDefaultRoute)
pipyConf.setEnableEgress((*meshConf).IsEgressEnabled())
Expand Down
7 changes: 7 additions & 0 deletions pkg/sidecar/providers/pipy/repo/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ func (p *PipyConf) setSidecarLogLevel(sidecarLogLevel string) (update bool) {
return
}

func (p *PipyConf) setSidecarTimeout(sidecarTimeout int) (update bool) {
if update = p.Spec.SidecarTimeout != sidecarTimeout; update {
p.Spec.SidecarTimeout = sidecarTimeout
}
return
}

func (p *PipyConf) setLocalDNSProxy(enable bool, primary, secondary string) {
if enable {
p.Spec.LocalDNSProxy = new(LocalDNSProxy)
Expand Down
1 change: 1 addition & 0 deletions pkg/sidecar/providers/pipy/repo/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ type LocalDNSProxy struct {
// MeshConfigSpec represents the spec of mesh config
type MeshConfigSpec struct {
SidecarLogLevel string
SidecarTimeout int
Traffic TrafficSpec
FeatureFlags FeatureFlags
Probes struct {
Expand Down

0 comments on commit 2ad94e6

Please sign in to comment.