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

Can't change tiproxy service type #5664

Open
ztelliot opened this issue Jun 16, 2024 · 7 comments
Open

Can't change tiproxy service type #5664

ztelliot opened this issue Jun 16, 2024 · 7 comments

Comments

@ztelliot
Copy link

ztelliot commented Jun 16, 2024

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: {}
@csuzhangxc
Copy link
Member

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

@tradergt
Copy link

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

@csuzhangxc
Copy link
Member

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?

@tradergt
Copy link

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.

@ztelliot
Copy link
Author

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.

@tradergt
Copy link

tradergt commented Aug 20, 2024

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

@csuzhangxc
Copy link
Member

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

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

3 participants