Hi team :wave: I want to keep the realtime table c...
# troubleshooting
b
Hi team 👋 I want to keep the realtime table configuration in a git repo but dont want to expose the kafka login credentials, is it possible to pass these on a jaas like configuration file?
k
You can use environment variables in table config..
👍 1
b
thanks Kishore the table is a configmap, do you know if somehow I can override them? I tried but no success
@Kishore G is kubernetes configmap and job a good way to create tables or there is another way best recommended?
k
@Xiang Fu might be able to help you on that..
x
how do you want to use this table conf file? Table creation? If so, just write your own script for table creation, which takes the table template and apply secrets as environment variables.
You can import secrets to env variables and mount table request template using configmap
b
@Xiang Fu yes, I want to use for table creation.. If so, just write your own script for table creation, which takes the table template and apply secrets as environment variables. Do you have an example on how to set this?
I was trying to create a
jaas.conf
as secret mount and set the
-Djava.security.auth.login.config=/etc/kafka/secrets/jaas.conf
environment variable so Pinot could read the file... was something like:
Copy code
apiVersion: v1
kind: ConfigMap
metadata:
  name: cfmp
  namespace: pinot
data:
  realtime.json: |-
    {   
        ...
        # REALTIME table
    }
        

  schema.json: |-
    {
        # schema
    }
---
apiVersion: batch/v1
kind: Job
metadata:
  name: job
  namespace: pinot
spec:
  template:
    spec:
      containers:
        - name: pinot-job
          image: apachepinot/pinot:latest
          args: [ "AddTable", "-schemaFile", "/var/pinot/cfmp/schema.json", "-tableConfigFile", "/var/pinot/cfmp/realtime.json", "-controllerHost", "pinot-controller", "-controllerPort", "9000", "-exec" ]
          env:
            - name: JAVA_OPTS
              value: "-Xms4G -Xmx4G -Dpinot.admin.system.exit=true -Djava.security.auth.login.config=/etc/kafka/secrets/jaas.conf"  
          volumeMounts:
            - name: cfmp
              mountPath: /var/pinot/examples              
            - name: kafka-secret
              mountPath: /etc/kafka/secrets
              subPath: rest_jaas.conf
      restartPolicy: Never
      volumes:
        - name: cfmp
          configMap:
            name: cfmp
        - name: kafka-secret
          secret:
            secretName: kafka-secret          
  backoffLimit: 0
x
there is no out-of-box solution right now. What I mean is that you can have some place-holder string in your template file, and have a separated init-container step to assemble your secret.
Copy code
sed 's/JAAS_CONFIG_PATH/${JAAS_CONFIG_PATH}/g' /var/pinot/cfmp/realtime.json
👍 1
Note that
-Djava.security.auth.login.config=/etc/kafka/secrets/jaas.conf"
this kind of JVM opts has to be set at startup time
👍 1
which is not the right way, cause you may want to connect to multiple kafka
b
thanks @Xiang Fu
@Xiang Fu Hi there, even with it's drawback I wanna try to auth hiddin the username and password. I've tried the following: • created a jaas.conf:
Copy code
KafkaClient {
    org.apache.kafka.common.security.plain.PlainLoginModule required
    username="foo"
    password="bar";
};
• on the controller, passed the path of the file:
"-Djava.security.auth.login.config=/etc/kafka/secrets/jaas.conf"
• set table conf as following:
Copy code
[...]
    "tableIndexConfig": {
        "loadMode": "MMAP",
        "streamConfigs": {
            "streamType": "kafka",
            "stream.kafka.topic.name": "test",
            "stream.kafka.consumer.type": "lowlevel",
            "stream.kafka.consumer.prop.auto.offset.reset": "7d",
            "stream.kafka.consumer.factory.class.name": "org.apache.pinot.plugin.stream.kafka20.KafkaConsumerFactory",
            "stream.kafka.broker.list": "my-confluent-address:9092",
            "stream.kafka.decoder.class.name": "org.apache.pinot.plugin.stream.kafka.KafkaJSONMessageDecoder",
            "stream.kafka.decoder.prop.basic.auth.credentials.source": "USER_INFO",
            "sasl.mechanism": "PLAIN",
            "security.protocol": "SASL_PLAINTEXT",
            "sasl.enabled.mechanisms": "PLAIN",
            "realtime.segment.flush.threshold.rows": "50000",
            "realtime.segment.flush.threshold.time": "3h",
            "realtime.segment.flush.threshold.segment.size": "150M"                   
        }
    }
[...]
Now when when I add the table I receive the timeout error:
Copy code
{
  "code": 500,
  "error": "org.apache.pinot.spi.stream.TransientConsumerException: org.apache.pinot.shaded.org.apache.kafka.common.errors.TimeoutException: Timeout expired while fetching topic metadata"
}
Do you have any clue what am I messing?
x
per: https://docs.pinot.apache.org/basics/data-import/pinot-stream-ingestion/import-from-apache-kafka#use-kafka-partition-low-[…]l-consumer-with-sasl_ssl Can you try to see if explicitly adding
"sasl.jaas.config":"org.apache.kafka.common.security.scram.ScramLoginModule required username=\"foo\" password=\"bar\";",
into table config works for you? I don’t think pinot honors
"-Djava.security.auth.login.config=/etc/kafka/secrets/jaas.conf"
as it may have many kafka connections.
Another try is to load this jaas content as an environment variable, then use table config override: https://docs.pinot.apache.org/configuration-reference/table#environment-variables-override
note, you need this for all pinot controller/servers to ensure the connectivity
b
Oh thank you a lot @Xiang Fu Actually I’m trying to use the file to not let available the topic credentials at the UI. So I was trying to put the auth info out of the table conf…
@Xiang Fu do you know other way I can achieve this? Not showing creds on ui after the table is created?
x
use the ENV Var?
b
Env displays it's string after the table is uploaded.
Actually I used the config "*queryConsoleOnlyView*" to achieve what I was looking for
thanks
x
Ah, I see.
b
@Xiang Fu hi, im trying to use env vars and concatenate them but facing some issues, I've posted on #C011C9JHN7R... https://apache-pinot.slack.com/archives/C011C9JHN7R/p1695698071820449 do you have any guess? tkss