Skip to content

App Framework: How to specify NodePort for service like indexcluster? #1148

Open
@srt180

Description

@srt180

Please select the type of request

Bug

Tell us more

Describe the request

  • A clear and concise description of the request.

I follow the instructions for deploy distributed splunk in k8s, and everything works out. But when I'm trying to edit the service for NodePort serviceTemplate, it failed and got error log in splunk-operator.

operator error message:

"Service "splunk-idxc-example-indexer-service" is invalid: [spec.ports[4].name: Duplicate value: "http-splunkweb", spec.ports[5].name: Duplicate value: "http-hec", spec.ports[6].name: Duplicate value: "https-splunkd", spec.ports[7].name: Duplicate value: "tcp-s2s", spec.ports[4].nodePort: Duplicate value: 32649, spec.ports[5].nodePort: Duplicate value: 31623, spec.ports[6].nodePort: Duplicate value: 31848, spec.ports[7].nodePort: Duplicate value: 31430, spec.ports[4]: Duplicate value: core.ServicePort{Name:"", Protocol:"TCP", AppProtocol:(*string)(nil), Port:8000, TargetPort:intstr.IntOrString{Type:0, IntVal:0, StrVal:""}, NodePort:0}, spec.ports[5]: Duplicate value: core.ServicePort{Name:"", Protocol:"TCP", AppProtocol:(*string)(nil), Port:8088, TargetPort:intstr.IntOrString{Type:0, IntVal:0, StrVal:""}, NodePort:0}, spec.ports[6]: Duplicate value: core.ServicePort{Name:"", Protocol:"TCP", AppProtocol:(*string)(nil), Port:8089, TargetPort:intstr.IntOrString{Type:0, IntVal:0, StrVal:""}, NodePort:0}, spec.ports[7]: Duplicate value: core.ServicePort{Name:"", Protocol:"TCP", AppProtocol:(*string)(nil), Port:9997, TargetPort:intstr.IntOrString{Type:0, IntVal:0, StrVal:""}, NodePort:0}]"

Expected behavior

  • A clear and concise description of what you expected to happen.

set service to NodePort as expected

Splunk setup on K8S

  • Details of the Splunk setup on the K8s cluster.
apiVersion: enterprise.splunk.com/v4
kind: IndexerCluster
metadata:
  name: idxc-example
  finalizers:
  - enterprise.splunk.com/delete-pvc
spec:
  monitoringConsoleRef:
    name: mc-example
  replicas: 5
  clusterManagerRef:
    name: cm-example
  licenseManagerRef:
    name: lm-example
  etcVolumeStorageConfig:
    storageClassName: worker1
    storageCapacity: 15Gi
  varVolumeStorageConfig:
    storageClassName: worker1
    storageCapacity: 1024Gi
  startupProbe:
    initialDelaySeconds: 300
    timeoutSeconds: 30
    periodSeconds: 60
    failureThreshold: 30
  serviceTemplate:
    spec:
      type: NodePort
      ports:
        - name: http-splunkweb
          nodePort: 32649
          port: 8000
          protocol: TCP
          targetPort: 8000
        - name: http-hec
          nodePort: 31623
          port: 8088
          protocol: TCP
          targetPort: 8088
        - name: https-splunkd
          nodePort: 31848
          port: 8089
          protocol: TCP
          targetPort: 8089
        - name: tcp-s2s
          nodePort: 31430
          port: 9997
          protocol: TCP
          targetPort: 9997

Reproduction/Testing steps

  • Steps to reproduce the bug. For an enhancement or feature request, please provide steps to test.

K8s environment

  • Useful information about the K8S environment being used. Eg. version of K8s, kind of K8s cluster etc..

k8s: v1.26.1
splunk/splunk:9.0.3-a2
splunk/splunk-operator:2.2.1

Proposed changes(optional)

  • Proposed change, if any.

K8s collector data(optional)

Additional context(optional)

  • Add any other context about the problem here.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions