affo commented on code in PR #2506:
URL: https://github.com/apache/fluss/pull/2506#discussion_r2792775212


##########
helm/tests/sasl_test.yaml:
##########
@@ -0,0 +1,203 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+suite: sasl-disabled-secret
+templates:
+  - templates/secret-jaas-config.yaml
+tests:
+  - it: does not render sasl secret when sasl is disabled
+    set:
+      listeners.internal.protocol: PLAINTEXT
+      listeners.client.protocol: PLAINTEXT
+    asserts:
+      - hasDocuments:
+          count: 0
+---
+
+suite: sasl-disabled-statefulset
+templates:
+  - templates/sts-coordinator.yaml
+tests:
+  - it: does not render sasl settings in pod spec when sasl is disabled
+    set:
+      listeners.internal.protocol: PLAINTEXT
+      listeners.client.protocol: PLAINTEXT
+    asserts:
+      - notMatchRegex:
+          path: spec.template.spec.containers[0].command[2]
+          pattern: 'security\.sasl\.enabled\.mechanisms:'
+      - notMatchRegex:
+          path: spec.template.spec.containers[0].command[2]
+          pattern: 'security\.sasl\.plain\.jaas\.config:'
+      - notMatchRegex:
+          path: spec.template.spec.containers[0].command[2]
+          pattern: 'client\.security\.sasl\.username:'
+      - notMatchRegex:
+          path: spec.template.spec.containers[0].command[2]
+          pattern: 'client\.security\.sasl\.password:'
+      - notContains:
+          path: spec.template.spec.volumes
+          content:
+            name: sasl-config
+---
+
+suite: sasl-enabled-generated-secret
+templates:
+  - templates/secret-jaas-config.yaml
+tests:
+  - it: renders generated sasl secret when sasl is enabled
+    set:
+      listeners.internal.protocol: SASL_PLAINTEXT
+      listeners.client.protocol: SASL_PLAINTEXT
+    asserts:
+      - hasDocuments:
+          count: 1
+      - matchRegex:
+          path: metadata.name
+          pattern: ^RELEASE-NAME-fluss-sasl-jaas-config$
+      - matchRegex:
+          path: stringData["jaas.conf"]
+          pattern: 'FlussServer\s*\{'
+      - matchRegex:
+          path: stringData["jaas.conf"]
+          pattern: 'FlussClient\s*\{'
+---
+
+suite: sasl-enabled-secret-with-plaintext-internal
+templates:
+  - templates/secret-jaas-config.yaml
+tests:
+  - it: does not include FlussClient section when internal listener is not SASL
+    set:
+      listeners.internal.protocol: PLAINTEXT
+      listeners.client.protocol: SASL_PLAINTEXT
+    asserts:
+      - hasDocuments:
+          count: 1
+      - matchRegex:
+          path: stringData["jaas.conf"]
+          pattern: 'FlussServer\s*\{'
+      - notMatchRegex:
+          path: stringData["jaas.conf"]
+          pattern: 'FlussClient\s*\{'
+---
+
+suite: sasl-enabled-statefulset-uses-generated-secret
+templates:
+  - templates/sts-coordinator.yaml
+tests:
+  - it: references generated secret and wires JVM JAAS config
+    set:
+      listeners.internal.protocol: SASL_PLAINTEXT
+      listeners.client.protocol: SASL_PLAINTEXT
+    asserts:
+      - contains:
+          path: spec.template.spec.volumes
+          content:
+            name: sasl-config
+            secret:
+              secretName: RELEASE-NAME-fluss-sasl-jaas-config
+      - matchRegex:
+          path: spec.template.spec.containers[0].command[2]
+          pattern: 
'FLUSS_ENV_JAVA_OPTS="-Djava\.security\.auth\.login\.config=/etc/fluss/conf/jaas\.conf
 \$\{FLUSS_ENV_JAVA_OPTS\}"'
+      - matchRegex:
+          path: spec.template.spec.containers[0].command[2]
+          pattern: 'client\.security\.protocol: SASL'
+---
+
+suite: sasl-enabled-statefulset-internal-plaintext
+templates:
+  - templates/sts-coordinator.yaml
+  - templates/sts-tablet.yaml
+tests:
+  - it: does not render internal client sasl config when internal listener is 
plaintext

Review Comment:
   ```suggestion
     - it: does not render internal client sasl config for coordinator when 
internal listener is plaintext
   ```



##########
website/docs/install-deploy/deploying-with-helm.md:
##########
@@ -225,6 +225,11 @@ The following table lists the configurable parameters of 
the Fluss chart and the
 | `resources.tabletServer.limits.cpu` | CPU limits for tablet servers | Not 
set |
 | `resources.tabletServer.limits.memory` | Memory limits for tablet servers | 
Not set |
 
+### SASL Parameters
+
+| Parameter | Description | Default |
+|-----------|-------------|---------|
+| `security.sasl_plain.users` | User list for PLAIN authentication | 
`[{username: admin, password: password}]` |

Review Comment:
   ```suggestion
   | `security.sasl_plain.users` | User list for SASL/PLAIN authentication | 
`[{username: admin, password: password}]` |
   ```



##########
helm/templates/sts-coordinator.yaml:
##########
@@ -77,6 +77,16 @@ spec:
               echo "" >> $FLUSS_HOME/conf/server.yaml && \
               echo "bind.listeners: ${BIND_LISTENERS}" >> 
$FLUSS_HOME/conf/server.yaml && \
               echo "advertised.listeners: ${ADVERTISED_LISTENERS}" >> 
$FLUSS_HOME/conf/server.yaml && \
+              echo "security.protocol.map: INTERNAL:{{ upper 
.Values.listeners.internal.protocol }},CLIENT:{{ upper 
.Values.listeners.client.protocol }}" >> $FLUSS_HOME/conf/server.yaml && \
+
+              {{- if (include "fluss.sasl.enabled" .) }}
+              echo "security.sasl.enabled.mechanisms: PLAIN" >> 
$FLUSS_HOME/conf/server.yaml && \
+              {{ if regexFind "SASL" (upper 
.Values.listeners.internal.protocol) }}

Review Comment:
   yeah, the configuration is not required to be here, but configuring SASL and 
its mechanism is, makes sense 🤝 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to