pingcap/tidb-operator

Can't change tiproxy service type

ztelliot opened this issue · 7 comments

Bug Report

What version of Kubernetes are you using?
v1.26.6

What version of TiDB Operator are you using?
v1.6.0

What did you do?
add spec.tiproxy.service.type = LoadBalancer in TidbCluster

What did you expect to see?
service type change to LoadBalancer

What did you see instead?

The request is invalid: patch: Invalid value: "...": strict decoding error: unknown field "spec.tiproxy.service"

part of my TidbCluster file:

spec:
  ....
  tiproxy:
    baseImage: pingcap/tiproxy
    version: main
    imagePullPolicy: Always
    replicas: 3
    service:
        type: LoadBalancer
    config: {}

it does support changing the service type now, if you need to use LoadBalancer, you can create another service (with type: LoadBalancer) manually.
/cc @xhebox

I just tried it and it does not work? How are you doing it?

I just tried it and it does not work? How are you doing it?

Do you mean, an extra service manually added does not work?

Have you set the same lableSelector as the original one?

Is there an example some where? I am kind of lost on how to actually set this up, tbh. I would appreciate any help here.

Hello, here is my tiproxy service config:

Original service created by operator

apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/component: tiproxy
    app.kubernetes.io/instance: tidb
    app.kubernetes.io/managed-by: tidb-operator
    app.kubernetes.io/name: tidb-cluster
    app.kubernetes.io/used-by: end-user
  name: tidb-tiproxy
  namespace: tidb
spec:
  ipFamilyPolicy: PreferDualStack
  ports:
  - name: tiproxy-api
    nodePort: 21982
    port: 3080
    protocol: TCP
    targetPort: 3080
  - name: tiproxy-sql
    nodePort: 29742
    port: 6000
    protocol: TCP
    targetPort: 6000
  selector:
    app.kubernetes.io/component: tiproxy
    app.kubernetes.io/instance: tidb
    app.kubernetes.io/managed-by: tidb-operator
    app.kubernetes.io/name: tidb-cluster
  type: NodePort

And the LoadBalancer service created by myself

apiVersion: v1
kind: Service
metadata:
  name: tidb-tiproxy-lb
  namespace: tidb
spec:
  ipFamilyPolicy: PreferDualStack
  ports:
  - name: tiproxy-api
    port: 3080
    protocol: TCP
    targetPort: 3080
  - name: tiproxy-sql
    port: 6000
    protocol: TCP
    targetPort: 6000
  selector:
    app.kubernetes.io/component: tiproxy
    app.kubernetes.io/instance: tidb
    app.kubernetes.io/managed-by: tidb-operator
    app.kubernetes.io/name: tidb-cluster
  type: LoadBalancer

Just copy your original service yaml, delete the nodePort in ports and change the type to LoadBalancer.

ok, so here is the issue and where the confusion comes in. If you install via: https://docs.pingcap.com/tidb-in-kubernetes/stable/get-started
There is no way to change the above file. Which is why i was so confused..

I just used the above as i have a simplish install trying to play with tidb in my home lab

ok, so here is the issue and where the confusion comes in. If you install via: https://docs.pingcap.com/tidb-in-kubernetes/stable/get-started There is no way to change the above file. Which is why i was so confused..

I just used the above as i have a simplish install trying to play with tidb in my home lab

not CHANGE the original one, just copy to a new file and give the resource another name