nutanix-cloud-native / nutanix-cloud-native/ndb-operator

The Kubernetes service automatically generated to point to the deployed DB instance does not allow specifying the port

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

Nobody has claimed this yet.

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

Description

When an NDB operator deploys a database solution, a Kubernetes service is automatically deployed, configuring the deployed database as the endpoint.

However, it is not currently possible to specify the port on which the service will listen, and port 80 is set by default.

It should be feasible, when setting up the resources of type 'Database', to specify the port on which the Kubernetes service would listen. The Custom Resource Definition (CRD) should provide the option to define something similar:

The actual result is

apiVersion: v1
kind: Service
metadata:
  name: demoappdb02-svc
spec:
  clusterIP: 172.19.94.227
  clusterIPs:
  - 172.19.94.227
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - port: 80
    protocol: TCP
    targetPort: 5432

We should be able to create resources like this

apiVersion: ndb.nutanix.com/v1alpha1
kind: Database
metadata:
  # This name that will be used within the kubernetes cluster
  name: demoappdb02
spec:
  # Name of the NDBServer resource created earlier
  ndbRef: gdb
  isClone: false
  servicePort : 5432
  exposedPort : 5432

Then we should get similar result:

apiVersion: v1
kind: Service
metadata:
  name: demoappdb02-svc
spec:
  clusterIP: 172.19.94.227
  clusterIPs:
  - 172.19.94.227
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - port: 5432
    protocol: TCP
    targetPort: 5432

Contributor guide

Open the contributing guide

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.

Research direction

Start by locating the Database CRD and the entry point that generates the Kubernetes Service for deployed database resources. Trace how the service port and target port are currently chosen, then verify that servicePort and exposedPort are accepted and produce the requested Service ports for the example resource.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
databases, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.