Skip to content

Commit c0a71d6

Browse files
ericsyhfreeznet
andcommitted
feat: support ConnectorCatalog for builtinConnector (#1211)
<!-- ### Contribution Checklist - Name the pull request in the form "[charts/<chart-name>] Title of the pull request". Skip *[charts/<chart-name>]* if the PR doesn't change a specific chart. E.g. `[docs] Fix typo in README`. - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review. - Each pull request should address only one issue, not mix up code from multiple issues. - Each commit in the pull request has a meaningful commit message - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below. **(The sections below can be removed for hotfixes of typos)** --> *(If this PR fixes a github issue, please add `Fixes #<xyz>`.)* Fixes #<xyz> *(or if this PR is one task of a github issue, please add `Master Issue: #<xyz>` to link to the master issue.)* Master Issue: #<xyz> ### Motivation *Explain here the context, and why you're making that change. What is the problem you're trying to solve.* ### Modifications *Describe the modifications you've done.* ### Verifying this change - [x] Make sure that the change passes the CI checks. *(Please pick either of the following options)* This change is a trivial rework / code cleanup without any test coverage. *(or)* This change is already covered by existing tests, such as *(please describe tests)*. *(or)* This change added tests and can be verified as follows: *(example:)* - *Added integration tests for end-to-end deployment with large payloads (10MB)* - *Extended integration test for recovery after broker failure* ### Documentation Check the box below. Need to update docs? - [ ] `doc-required` (If you need help on updating docs, create a doc issue) - [x] `no-need-doc` (Please explain why) - [ ] `doc` (If this PR contains doc changes) --------- Signed-off-by: ericsyh <[email protected]> Co-authored-by: Rui Fu <[email protected]> (cherry picked from commit 102aa0a)
1 parent 003bed2 commit c0a71d6

File tree

10 files changed

+8086
-4
lines changed

10 files changed

+8086
-4
lines changed

charts/sn-platform-slim/templates/broker/_functions.tpl

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,28 @@ The pulsar root directory of functions image
1818
{{- else }}
1919
{{- template "pulsar.home" . }}
2020
{{- end }}
21-
{{- end }}
21+
{{- end }}
22+
23+
{{/*
24+
The customWorkerConfig tpl
25+
*/}}
26+
{{- define "pulsar.functions.config.customWorkerConfig" -}}
27+
functionsWorkerServiceCustomConfigs:
28+
{{- if and .Values.broker.functionmesh.enabled (eq .Values.broker.functionmesh.builtinConnectorType "ConnectorCatalog") }}
29+
connectorCatalogNamespace: "{{ template "pulsar.namespace" . }}"
30+
{{- end }}
31+
{{- end }}
32+
33+
{{/*
34+
Merge customWorkerConfig tpl
35+
*/}}
36+
{{- define "pulsar.functions.config.mergedCustomWorkerConfig" -}}
37+
{{- $baseCustomWorkerConfig := include "pulsar.functions.config.customWorkerConfig" . | fromYaml -}}
38+
{{- if .Values.broker.functionmesh.customWorkerConfig }}
39+
{{- $dictCustomWorkerConfig := .Values.broker.functionmesh.customWorkerConfig | fromYaml -}}
40+
{{- $mergedConfig := mustMergeOverwrite (dict) $dictCustomWorkerConfig $baseCustomWorkerConfig -}}
41+
{{ toYaml $dictCustomWorkerConfig | quote }}
42+
{{- else -}}
43+
{{ $baseCustomWorkerConfig | toYaml | quote }}
44+
{{- end }}
45+
{{- end }}

charts/sn-platform-slim/templates/broker/broker-builtin-connectors.yaml

Lines changed: 4007 additions & 0 deletions
Large diffs are not rendered by default.

charts/sn-platform-slim/templates/broker/broker-cluster.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,21 @@ spec:
212212
function:
213213
enabled: true
214214
mesh:
215+
{{- if eq .Values.broker.functionmesh.builtinConnectorType "ConfigMap" }}
215216
builtinConnectorsRef:
216217
name: {{ include "pulsar.builtinConnectorsConfigMapName" . }}
218+
{{- end }}
217219
functionEnabled: {{ .Values.broker.functionmesh.mesh.functionEnabled }}
218220
sinkEnabled: {{ .Values.broker.functionmesh.mesh.sinkEnabled }}
219221
sourceEnabled: {{ .Values.broker.functionmesh.mesh.sourceEnabled }}
220222
uploadEnabled: {{ .Values.broker.functionmesh.mesh.uploadEnabled }}
223+
{{- if and .Values.broker.functionmesh.enabled (eq .Values.broker.functionmesh.builtinConnectorType "ConnectorCatalog") }}
224+
customWorkerConfig: {{ template "pulsar.functions.config.mergedCustomWorkerConfig" . }}
225+
{{- else }}
221226
{{- if .Values.broker.functionmesh.customWorkerConfig }}
222227
customWorkerConfig: {{ .Values.broker.functionmesh.customWorkerConfig | quote }}
223228
{{- end }}
229+
{{- end }}
224230
{{- if .Values.broker.functionmesh.custom }}
225231
custom:
226232
{{ toYaml .Values.broker.functionmesh.custom | indent 8 }}

charts/sn-platform-slim/templates/broker/broker-configmap-functionmesh.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818
#
19-
{{- if and .Values.components.broker .Values.broker.functionmesh.enabled}}
19+
{{- if and .Values.components.broker .Values.broker.functionmesh.enabled (eq .Values.broker.functionmesh.builtinConnectorType "ConfigMap")}}
2020
---
2121
apiVersion: v1
2222
kind: ConfigMap

charts/sn-platform-slim/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,10 @@ broker:
11561156
sourceEnabled: true
11571157
sinkEnabled: true
11581158
builtinConnectorRepository:
1159+
# The resource type for builtinConnector. Supported values: ConfigMap and ConnectorCatalog
1160+
# For ConnectorCatalog builtinConnectorType, make sure you are running with the sn-operator: https://github.com/streamnative/private-cloud
1161+
# And has ConnectorCatalog CRD
1162+
builtinConnectorType: ConfigMap
11591163
customWorkerConfig:
11601164
runnerImages:
11611165
labels:

charts/sn-platform/templates/broker/_functions.tpl

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,28 @@ The pulsar root directory of functions image
1818
{{- else }}
1919
{{- template "pulsar.home" . }}
2020
{{- end }}
21-
{{- end }}
21+
{{- end }}
22+
23+
{{/*
24+
The customWorkerConfig tpl
25+
*/}}
26+
{{- define "pulsar.functions.config.customWorkerConfig" -}}
27+
functionsWorkerServiceCustomConfigs:
28+
{{- if and .Values.broker.functionmesh.enabled (eq .Values.broker.functionmesh.builtinConnectorType "ConnectorCatalog") }}
29+
connectorCatalogNamespace: "{{ template "pulsar.namespace" . }}"
30+
{{- end }}
31+
{{- end }}
32+
33+
{{/*
34+
Merge customWorkerConfig tpl
35+
*/}}
36+
{{- define "pulsar.functions.config.mergedCustomWorkerConfig" -}}
37+
{{- $baseCustomWorkerConfig := include "pulsar.functions.config.customWorkerConfig" . | fromYaml -}}
38+
{{- if .Values.broker.functionmesh.customWorkerConfig }}
39+
{{- $dictCustomWorkerConfig := .Values.broker.functionmesh.customWorkerConfig | fromYaml -}}
40+
{{- $mergedConfig := mustMergeOverwrite (dict) $dictCustomWorkerConfig $baseCustomWorkerConfig -}}
41+
{{ toYaml $dictCustomWorkerConfig | quote }}
42+
{{- else -}}
43+
{{ $baseCustomWorkerConfig | toYaml | quote }}
44+
{{- end }}
45+
{{- end }}

0 commit comments

Comments
 (0)