Skip to content
This repository was archived by the owner on Apr 14, 2024. It is now read-only.

Commit f0c7a18

Browse files
cybwanwanpf
authored andcommitted
fix issues (#194)
* update version to 1.3.9 * add HTTP1PerRequestLoadBalancing and HTTP2PerRequestLoadBalancing to mesh config. * Changed implementation of outbound per-request load balancing. * [fix] Explicitly release _session in onEnd event * upgrade pipy to 0.90.3-30. * upgrade pipy to 0.90.3-38. --------- Co-authored-by: wanpf <wanpf@qq.com>
1 parent 37fe08d commit f0c7a18

File tree

14 files changed

+107
-16
lines changed

14 files changed

+107
-16
lines changed

charts/osm/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ type: application
1414

1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
17-
version: 1.3.8
17+
version: 1.3.9
1818

1919
# This is the version number of the application being deployed. This version number should be
2020
# incremented each time you make changes to the application.
21-
appVersion: v1.3.8
21+
appVersion: v1.3.9
2222

2323
# This specifies the minimum Kubernetes version OSM is compatible with.
2424
kubeVersion: ">= 1.19.0-0"

charts/osm/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Open Service Mesh Edge Helm Chart
22

3-
![Version: 1.3.8](https://img.shields.io/badge/Version-1.3.8-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.3.8](https://img.shields.io/badge/AppVersion-v1.3.8-informational?style=flat-square)
3+
![Version: 1.3.9](https://img.shields.io/badge/Version-1.3.9-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.3.9](https://img.shields.io/badge/AppVersion-v1.3.9-informational?style=flat-square)
44

55
A Helm chart to install the [osm-edge](https://github.com/flomesh-io/osm-edge) control plane on Kubernetes.
66

@@ -130,6 +130,8 @@ The following table lists the configurable parameters of the osm chart and their
130130
| osm.grafana.port | int | `3000` | Grafana service's port |
131131
| osm.grafana.rendererImage | string | `"grafana/grafana-image-renderer:3.2.1"` | Image used for Grafana Renderer |
132132
| osm.grafana.tolerations | list | `[]` | Node tolerations applied to control plane pods. The specified tolerations allow pods to schedule onto nodes with matching taints. |
133+
| osm.http1PerRequestLoadBalancing | bool | `false` | Specifies a boolean indicating if load balancing based on request is enabled for http1. |
134+
| osm.http2PerRequestLoadBalancing | bool | `true` | Specifies a boolean indicating if load balancing based on request is enabled for http2. |
133135
| osm.image.digest | object | `{"osmBootstrap":"","osmCRDs":"","osmController":"","osmHealthcheck":"","osmInjector":"","osmInterceptor":"","osmPreinstall":"","osmSidecarInit":""}` | Image digest (defaults to latest compatible tag) |
134136
| osm.image.digest.osmBootstrap | string | `""` | osm-boostrap's image digest |
135137
| osm.image.digest.osmCRDs | string | `""` | osm-crds' image digest |
@@ -150,7 +152,7 @@ The following table lists the configurable parameters of the osm chart and their
150152
| osm.image.name.osmSidecarInit | string | `"osm-edge-sidecar-init"` | Sidecar init container's image name |
151153
| osm.image.pullPolicy | string | `"IfNotPresent"` | Container image pull policy for control plane containers |
152154
| osm.image.registry | string | `"flomesh"` | Container image registry for control plane images |
153-
| osm.image.tag | string | `"1.3.8"` | Container image tag for control plane images |
155+
| osm.image.tag | string | `"1.3.9"` | Container image tag for control plane images |
154156
| osm.imagePullSecrets | list | `[]` | `osm-controller` image pull secret |
155157
| osm.inboundPortExclusionList | list | `[]` | Specifies a global list of ports to exclude from inbound traffic interception by the sidecar proxy. If specified, must be a list of positive integers. |
156158
| osm.injector.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].key | string | `"kubernetes.io/os"` | |
@@ -330,15 +332,15 @@ The following table lists the configurable parameters of the osm chart and their
330332
| osm.remoteLogging.level | int | `2` | Level of the remote logging service |
331333
| osm.remoteLogging.port | int | `30514` | Port of the remote logging service |
332334
| osm.remoteLogging.sampledFraction | string | `"1.0"` | Sampled Fraction |
333-
| osm.repoServer | object | `{"codebase":"","image":"flomesh/pipy-repo:0.90.2-14","ipaddr":"127.0.0.1","standalone":false}` | Pipy RepoServer |
335+
| osm.repoServer | object | `{"codebase":"","image":"flomesh/pipy-repo:0.90.3-38","ipaddr":"127.0.0.1","standalone":false}` | Pipy RepoServer |
334336
| osm.repoServer.codebase | string | `""` | codebase is the folder used by osmController. |
335-
| osm.repoServer.image | string | `"flomesh/pipy-repo:0.90.2-14"` | Image used for Pipy RepoServer |
337+
| osm.repoServer.image | string | `"flomesh/pipy-repo:0.90.3-38"` | Image used for Pipy RepoServer |
336338
| osm.repoServer.ipaddr | string | `"127.0.0.1"` | ipaddr of host/service where Pipy RepoServer is installed |
337339
| osm.repoServer.standalone | bool | `false` | if false , Pipy RepoServer is installed within osmController pod. |
338340
| osm.sidecarClass | string | `"pipy"` | The class of the OSM Sidecar Driver |
339-
| osm.sidecarDrivers | list | `[{"proxyServerPort":6060,"sidecarImage":"flomesh/pipy:0.90.2-14","sidecarName":"pipy"},{"proxyServerPort":15128,"sidecarImage":"envoyproxy/envoy:v1.19.3","sidecarName":"envoy","sidecarWindowsImage":"envoyproxy/envoy-windows:latest"}]` | Sidecar drivers supported by osm-edge |
341+
| osm.sidecarDrivers | list | `[{"proxyServerPort":6060,"sidecarImage":"flomesh/pipy:0.90.3-38","sidecarName":"pipy"},{"proxyServerPort":15128,"sidecarImage":"envoyproxy/envoy:v1.19.3","sidecarName":"envoy","sidecarWindowsImage":"envoyproxy/envoy-windows:latest"}]` | Sidecar drivers supported by osm-edge |
340342
| osm.sidecarDrivers[0].proxyServerPort | int | `6060` | Remote destination port on which the Discovery Service listens for new connections from Sidecars. |
341-
| osm.sidecarDrivers[0].sidecarImage | string | `"flomesh/pipy:0.90.2-14"` | Sidecar image for Linux workloads |
343+
| osm.sidecarDrivers[0].sidecarImage | string | `"flomesh/pipy:0.90.3-38"` | Sidecar image for Linux workloads |
342344
| osm.sidecarDrivers[1].proxyServerPort | int | `15128` | Remote destination port on which the Discovery Service listens for new connections from Sidecars. |
343345
| osm.sidecarDrivers[1].sidecarImage | string | `"envoyproxy/envoy:v1.19.3"` | Sidecar image for Linux workloads |
344346
| osm.sidecarDrivers[1].sidecarWindowsImage | string | `"envoyproxy/envoy-windows:latest"` | Sidecar image for Windows workloads |

charts/osm/templates/preset-mesh-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ data:
2525
"interceptionMode": {{.Values.osm.trafficInterceptionMode | mustToJson}},
2626
"enableEgress": {{.Values.osm.enableEgress | mustToJson}},
2727
"enablePermissiveTrafficPolicyMode": {{.Values.osm.enablePermissiveTrafficPolicy | mustToJson}},
28+
"http1PerRequestLoadBalancing": {{.Values.osm.http1PerRequestLoadBalancing | mustToJson}},
29+
"http2PerRequestLoadBalancing": {{.Values.osm.http2PerRequestLoadBalancing | mustToJson}},
2830
"outboundPortExclusionList": {{.Values.osm.outboundPortExclusionList | mustToJson}},
2931
"inboundPortExclusionList": {{.Values.osm.inboundPortExclusionList | mustToJson}},
3032
"outboundIPRangeExclusionList": {{.Values.osm.outboundIPRangeExclusionList | mustToJson}},

charts/osm/values.schema.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@
175175
"caBundleSecretName",
176176
"enableDebugServer",
177177
"enablePermissiveTrafficPolicy",
178+
"http1PerRequestLoadBalancing",
179+
"http2PerRequestLoadBalancing",
178180
"trafficInterceptionMode",
179181
"enableEgress",
180182
"enableReconciler",
@@ -786,6 +788,24 @@
786788
false
787789
]
788790
},
791+
"http1PerRequestLoadBalancing": {
792+
"$id": "#/properties/osm/properties/http1PerRequestLoadBalancing",
793+
"type": "boolean",
794+
"title": "The http1PerRequestLoadBalancing schema",
795+
"description": "Indicating if load balancing based on request is enabled for http1.",
796+
"examples": [
797+
false
798+
]
799+
},
800+
"http2PerRequestLoadBalancing": {
801+
"$id": "#/properties/osm/properties/http2PerRequestLoadBalancing",
802+
"type": "boolean",
803+
"title": "The http2PerRequestLoadBalancing schema",
804+
"description": "Indicating if load balancing based on request is enabled for http2.",
805+
"examples": [
806+
true
807+
]
808+
},
789809
"trafficInterceptionMode": {
790810
"$id": "#/properties/osm/properties/trafficInterceptionMode",
791811
"type": "string",

charts/osm/values.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ osm:
1212
# -- Container image pull policy for control plane containers
1313
pullPolicy: IfNotPresent
1414
# -- Container image tag for control plane images
15-
tag: "1.3.8"
15+
tag: "1.3.9"
1616
# -- Image name defaults
1717
name:
1818
# -- osm-controller's image name
@@ -60,7 +60,7 @@ osm:
6060
sidecarDrivers:
6161
- sidecarName: pipy
6262
# -- Sidecar image for Linux workloads
63-
sidecarImage: flomesh/pipy:0.90.2-14
63+
sidecarImage: flomesh/pipy:0.90.3-38
6464
# -- Remote destination port on which the Discovery Service listens for new connections from Sidecars.
6565
proxyServerPort: 6060
6666
- sidecarName: envoy
@@ -76,7 +76,7 @@ osm:
7676
# -- Pipy RepoServer
7777
repoServer:
7878
# -- Image used for Pipy RepoServer
79-
image: flomesh/pipy-repo:0.90.2-14
79+
image: flomesh/pipy-repo:0.90.3-38
8080
# -- if false , Pipy RepoServer is installed within osmController pod.
8181
standalone: false
8282
# -- ipaddr of host/service where Pipy RepoServer is installed
@@ -385,6 +385,12 @@ osm:
385385
# -- Enable permissive traffic policy mode
386386
enablePermissiveTrafficPolicy: true
387387

388+
# -- Specifies a boolean indicating if load balancing based on request is enabled for http1.
389+
http1PerRequestLoadBalancing: false
390+
391+
# -- Specifies a boolean indicating if load balancing based on request is enabled for http2.
392+
http2PerRequestLoadBalancing: true
393+
388394
# -- Traffic interception mode in the mesh
389395
trafficInterceptionMode: iptables
390396

cmd/osm-bootstrap/crds/config_meshconfig.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,12 @@ spec:
249249
type: array
250250
items:
251251
type: string
252+
http1PerRequestLoadBalancing:
253+
description: True for load balancing based on request is enabled for http1.
254+
type: boolean
255+
http2PerRequestLoadBalancing:
256+
description: True for load balancing based on request is enabled for http1.
257+
type: boolean
252258
enablePermissiveTrafficPolicyMode:
253259
description: True for allowing traffic to flow between client and service pods within the mesh without SMI traffic policies, i.e. no traffic policy enforcement in the mesh. If set to false, enables deny-all traffic policy in mesh i.e. an SMI Traffic Target is necessary for services to communicate.
254260
type: boolean
@@ -622,6 +628,12 @@ spec:
622628
type: integer
623629
minimum: 1
624630
maximum: 65535
631+
http1PerRequestLoadBalancing:
632+
description: True for load balancing based on request is enabled for http1.
633+
type: boolean
634+
http2PerRequestLoadBalancing:
635+
description: True for load balancing based on request is enabled for http1.
636+
type: boolean
625637
enablePermissiveTrafficPolicyMode:
626638
description: True for allowing traffic to flow between client and service pods within the mesh without SMI traffic policies, i.e. no traffic policy enforcement in the mesh. If set to false, enables deny-all traffic policy in mesh i.e. an SMI Traffic Target is necessary for services to communicate.
627639
type: boolean

pkg/apis/config/v1alpha1/mesh_config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ type TrafficSpec struct {
108108
// InboundExternalAuthorization defines a ruleset that, if enabled, will configure a remote external authorization endpoint
109109
// for all inbound and ingress traffic in the mesh.
110110
InboundExternalAuthorization ExternalAuthzSpec `json:"inboundExternalAuthorization,omitempty"`
111+
112+
// HTTP1PerRequestLoadBalancing defines a boolean indicating if load balancing based on request is enabled for http1.
113+
HTTP1PerRequestLoadBalancing bool `json:"http1PerRequestLoadBalancing"`
114+
115+
// HTTP1PerRequestLoadBalancing defines a boolean indicating if load balancing based on request is enabled for http2.
116+
HTTP2PerRequestLoadBalancing bool `json:"http2PerRequestLoadBalancing"`
111117
}
112118

113119
// ObservabilitySpec is the type to represent OSM's observability configurations.

pkg/apis/config/v1alpha2/mesh_config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ type TrafficSpec struct {
157157
// names to exclude from inbound and outbound traffic interception by the
158158
// sidecar proxy.
159159
NetworkInterfaceExclusionList []string `json:"networkInterfaceExclusionList"`
160+
161+
// HTTP1PerRequestLoadBalancing defines a boolean indicating if load balancing based on request is enabled for http1.
162+
HTTP1PerRequestLoadBalancing bool `json:"http1PerRequestLoadBalancing"`
163+
164+
// HTTP1PerRequestLoadBalancing defines a boolean indicating if load balancing based on request is enabled for http2.
165+
HTTP2PerRequestLoadBalancing bool `json:"http2PerRequestLoadBalancing"`
160166
}
161167

162168
// ObservabilitySpec is the type to represent OSM's observability configurations.

pkg/messaging/broker.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ func getProxyUpdateEvent(msg events.PubSubMessage) *proxyUpdateEvent {
341341
// changes.
342342
if prevSpec.Traffic.EnableEgress != newSpec.Traffic.EnableEgress ||
343343
prevSpec.Traffic.EnablePermissiveTrafficPolicyMode != newSpec.Traffic.EnablePermissiveTrafficPolicyMode ||
344+
prevSpec.Traffic.HTTP1PerRequestLoadBalancing != newSpec.Traffic.HTTP1PerRequestLoadBalancing ||
345+
prevSpec.Traffic.HTTP2PerRequestLoadBalancing != newSpec.Traffic.HTTP2PerRequestLoadBalancing ||
344346
prevSpec.Observability.Tracing != newSpec.Observability.Tracing ||
345347
prevSpec.Observability.RemoteLogging != newSpec.Observability.RemoteLogging ||
346348
prevSpec.Sidecar.LogLevel != newSpec.Sidecar.LogLevel ||

pkg/sidecar/providers/pipy/repo/codebase/modules/outbound-http-load-balancing.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
((
22
config = pipy.solve('config.js'),
3+
http1PerRequestLoadBalancing = Boolean(config?.Spec?.Traffic?.HTTP1PerRequestLoadBalancing),
4+
http2PerRequestLoadBalancing = Boolean(config?.Spec?.Traffic?.HTTP2PerRequestLoadBalancing),
35
certChain = config?.Certificate?.CertChain,
46
privateKey = config?.Certificate?.PrivateKey,
57
isDebugEnabled = config?.Spec?.SidecarLogLevel === 'debug',
@@ -86,6 +88,7 @@
8688
_failoverObject: null,
8789
_targetObject: null,
8890
_muxHttpOptions: null,
91+
_session: null,
8992
})
9093

9194
.import({
@@ -103,6 +106,7 @@
103106
.pipeline()
104107
.onStart(
105108
() => void (
109+
_session = {},
106110
(_clusterConfig = clusterConfigs.get(__cluster)) && (
107111
_muxHttpOptions = _clusterConfig.muxHttpOptions,
108112
_clusterConfig.failoverBalancer && (
@@ -111,10 +115,23 @@
111115
)
112116
)
113117
)
118+
.onEnd(() => void ( _session = null))
114119
.handleMessageStart(
115120
msg => (
116121
_clusterConfig && (
117-
_targetObject = _clusterConfig.targetBalancer?.next?.({}),
122+
__isHTTP2 ? (
123+
http2PerRequestLoadBalancing ? (
124+
_targetObject = _clusterConfig.targetBalancer?.next?.({})
125+
) : (
126+
_targetObject = _clusterConfig.targetBalancer?.next?.()
127+
)
128+
) : (
129+
http1PerRequestLoadBalancing ? (
130+
_targetObject = _clusterConfig.targetBalancer?.next?.(_session)
131+
) : (
132+
_targetObject = _clusterConfig.targetBalancer?.next?.()
133+
)
134+
),
118135
__target = _targetObject?.id
119136
) && (
120137
(

pkg/sidecar/providers/pipy/repo/codebase/modules/outbound-http-routing.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@
4343
(path, headers) => matchPath(path) && headerRules.every(([k, v]) => v.test(headers[k] || '')) && (
4444
__route = config,
4545
__service = service,
46-
__cluster = clusterCache.get(balancer.next({})?.id),
46+
__cluster = clusterCache.get(balancer.next()?.id),
4747
failoverBalancer && (
48-
_failoverCluster = clusterCache.get(failoverBalancer.next({})?.id)
48+
_failoverCluster = clusterCache.get(failoverBalancer.next()?.id)
4949
),
5050
true
5151
)
5252
) : (
5353
(path) => matchPath(path) && (
5454
__route = config,
5555
__service = service,
56-
__cluster = clusterCache.get(balancer.next({})?.id),
56+
__cluster = clusterCache.get(balancer.next()?.id),
5757
failoverBalancer && (
58-
_failoverCluster = clusterCache.get(failoverBalancer.next({})?.id)
58+
_failoverCluster = clusterCache.get(failoverBalancer.next()?.id)
5959
),
6060
true
6161
)

pkg/sidecar/providers/pipy/repo/jobs.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ func features(s *Server, proxy *pipy.Proxy, pipyConf *PipyConf) {
287287
pipyConf.setRemoteLoggingLevel((*meshConf).GetMeshConfig().Spec.Observability.RemoteLogging.Level)
288288
pipyConf.setEnableSidecarActiveHealthChecks((*meshConf).GetFeatureFlags().EnableSidecarActiveHealthChecks)
289289
pipyConf.setEnableEgress((*meshConf).IsEgressEnabled())
290+
pipyConf.setHTTP1PerRequestLoadBalancing((*meshConf).GetMeshConfig().Spec.Traffic.HTTP1PerRequestLoadBalancing)
291+
pipyConf.setHTTP2PerRequestLoadBalancing((*meshConf).GetMeshConfig().Spec.Traffic.HTTP2PerRequestLoadBalancing)
290292
pipyConf.setEnablePermissiveTrafficPolicyMode((*meshConf).IsPermissiveTrafficPolicyMode())
291293
pipyConf.setLocalDNSProxy((*meshConf).IsLocalDNSProxyEnabled(), (*meshConf).GetLocalDNSProxyPrimaryUpstream(), (*meshConf).GetLocalDNSProxySecondaryUpstream())
292294
clusterProps := (*meshConf).GetMeshConfig().Spec.ClusterSet.Properties

pkg/sidecar/providers/pipy/repo/policy.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ func (p *PipyConf) setEnableEgress(enableEgress bool) (update bool) {
7878
return
7979
}
8080

81+
func (p *PipyConf) setHTTP1PerRequestLoadBalancing(http1PerRequestLoadBalancing bool) (update bool) {
82+
if update = p.Spec.Traffic.HTTP1PerRequestLoadBalancing != http1PerRequestLoadBalancing; update {
83+
p.Spec.Traffic.HTTP1PerRequestLoadBalancing = http1PerRequestLoadBalancing
84+
}
85+
return
86+
}
87+
88+
func (p *PipyConf) setHTTP2PerRequestLoadBalancing(http2PerRequestLoadBalancing bool) (update bool) {
89+
if update = p.Spec.Traffic.HTTP2PerRequestLoadBalancing != http2PerRequestLoadBalancing; update {
90+
p.Spec.Traffic.HTTP2PerRequestLoadBalancing = http2PerRequestLoadBalancing
91+
}
92+
return
93+
}
94+
8195
func (p *PipyConf) setEnablePermissiveTrafficPolicyMode(enablePermissiveTrafficPolicyMode bool) (update bool) {
8296
if update = p.Spec.Traffic.enablePermissiveTrafficPolicyMode != enablePermissiveTrafficPolicyMode; update {
8397
p.Spec.Traffic.enablePermissiveTrafficPolicyMode = enablePermissiveTrafficPolicyMode

pkg/sidecar/providers/pipy/repo/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ type FeatureFlags struct {
191191
type TrafficSpec struct {
192192
EnableEgress bool
193193
enablePermissiveTrafficPolicyMode bool
194+
HTTP1PerRequestLoadBalancing bool
195+
HTTP2PerRequestLoadBalancing bool
194196
}
195197

196198
// UpstreamDNSServers defines upstream DNS servers for local DNS Proxy.

0 commit comments

Comments
 (0)