go function failed to run with authentication enabled

Open
#362 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
go, kubernetes

Research direction

Start with the Function resource's pulsar.authSecret configuration and the Go function connection setup; trace how test-auth is passed to the function and how the broker authentication settings are consumed. Use the reported connection log as the failure point, and consider the issue done when the Go function connects successfully with AuthenticationToken enabled.

Written by the indexing model from the issue text.

Description

help wanted

Hi,
I have a pulsar cluster with auth enabled, using AuthenticationProviderToken.

authenticationEnabled: "true"
authenticationProviders: "org.apache.pulsar.broker.authentication.AuthenticationProviderToken"

However, the go function runs with this error.

go-function-sample-function-0 pulsar-function 2022/05/11 16:04:04.677 asm_amd64.s:1581: [info] [TCP connection established] remote_addr=pulsar://pulsar-broker.pulsar:6650 local_addr=172.20.11.22:51436
go-function-sample-function-0 pulsar-function 2022/05/11 16:04:04.682 connection.go:225: [warning] Failed to establish connection with broker: 'Unable to authenticate' remote_addr=pulsar://pulsar-broker.pulsar:6650 local_addr=172.20.11.22:51436

How does my go function use AuthenticationToken, provided in the test-auth secret, to connect the broker? Any examples?

Here's my config file:

apiVersion: compute.functionmesh.io/v1alpha1
kind: Function
metadata:
  name: go-function-sample
  namespace: default
spec:
  image: lichuan33/pulsar-go-function:t1
  forwardSourceMessageProperty: true
  maxPendingAsyncRequests: 1000
  replicas: 1
  maxReplicas: 1
  logTopic: persistent://public/default/go-function-logs
  input:
    topics:
      - persistent://public/default/go-function-input-topic
  output:
    topic: persistent://public/default/go-function-output-topic
  resources:
    requests:
      cpu: "0.1"
      memory: 1G
    limits:
      cpu: "0.2"
      memory: 1.1G
  pulsar:
    pulsarConfig: "test-go-pulsar"
    authSecret: "test-auth"
  golang:
    go: /pulsar/examples/go-function
    goLocation: ""
  clusterName: pulsar
  autoAck: true
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: test-go-pulsar
data:
  webServiceURL: http://pulsar-broker.pulsar:8080
  brokerServiceURL: pulsar://pulsar-broker.pulsar:6650
---
apiVersion: v1
kind: Secret
metadata:
  name: test-auth
stringData:
  clientAuthenticationPlugin: "org.apache.pulsar.client.impl.auth.AuthenticationToken"
  clientAuthenticationParameters: "token:xxx.yyy.zzz"

Thanks.

Dominant language
Go
Stars
228
Forks
30
Avg merge
2d 8h
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from streamnative/function-mesh

All issues in streamnative/function-mesh

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.