Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple input plugins exposed via Type LoadBalancer not working #639

Open
camrossi opened this issue Apr 30, 2024 · 0 comments
Open

Multiple input plugins exposed via Type LoadBalancer not working #639

camrossi opened this issue Apr 30, 2024 · 0 comments

Comments

@camrossi
Copy link

I have a config with 2 http_listener_v2 plugins listening on 2 different ports.
When I try to deploy this config with Helm it fails as the generated Services are having duplicate names:

apiVersion: v1
kind: Service
metadata:
  name: telegraf
  labels:
    helm.sh/chart: telegraf-1.8.45
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: telegraf
    app.kubernetes.io/instance: telegraf
spec:
  type: LoadBalancer
  ports:
  - port: 8080
    targetPort: 8080
    name: "http-listener-v2" <====
  - port: 8081
    targetPort: 8081
    name: "http-listener-v2" <====
  - port: 9273
    targetPort: 9273
    name: "prometheus-client"
  selector:
    app.kubernetes.io/name: telegraf
    app.kubernetes.io/instance: telegraf

This seems expected from what I can see in the Template: All the Services have the name hardcoded.

We should probably have some logic to detect if the same input plugin is used and then add the port in the name or use the alias

below my value config for the relevant part:

inputs:
    - http_listener_v2:
        alias: "fab1"
        service_address: ":8080"
        paths: ["/"]
        tags:
          fabric: "fab1"
        data_format: "json_v2"
        json_v2: &json_v2_config
       <SNIP>
    - http_listener_v2:
        alias: "fab2"
        service_address: ":8081"
        paths: ["/"]
        tags:
          fabric: "fab2"
        data_format: "json_v2"
        json_v2: *json_v2_config

For now I patched the service Template to include the port in the name, not sure if there is a supported way to do this that I am missing ?

    {{- if eq $key "http_listener_v2" }}
  - port: {{ trimPrefix ":" $value.service_address | int64 }}
    targetPort: {{ trimPrefix ":" $value.service_address | int64 }}
    name: {{ printf "http-listener-v2-%d" (trimPrefix ":" $value.service_address | int64 ) }} <===
    {{- end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant