Skip to content

Commit

Permalink
manager: fix dynamic config update of tiproxy (#4825)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhebox authored Jan 20, 2023
1 parent 744abb0 commit dc1508a
Show file tree
Hide file tree
Showing 19 changed files with 272 additions and 58 deletions.
68 changes: 67 additions & 1 deletion docs/api-references/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -22027,6 +22027,70 @@ github.com/pingcap/tidb-operator/pkg/apis/util/config.GenericConfig
</tr>
</tbody>
</table>
<h3 id="tiproxymember">TiProxyMember</h3>
<p>
(<em>Appears on:</em>
<a href="#tiproxystatus">TiProxyStatus</a>)
</p>
<p>
<p>TiProxyMember is TiProxy member</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>name</code></br>
<em>
string
</em>
</td>
<td>
</td>
</tr>
<tr>
<td>
<code>health</code></br>
<em>
bool
</em>
</td>
<td>
</td>
</tr>
<tr>
<td>
<code>info</code></br>
<em>
github.com/pingcap/TiProxy/lib/config.HealthInfo
</em>
</td>
<td>
<em>(Optional)</em>
<p>Additional healthinfo if it is healthy.</p>
</td>
</tr>
<tr>
<td>
<code>lastTransitionTime</code></br>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#time-v1-meta">
Kubernetes meta/v1.Time
</a>
</em>
</td>
<td>
<p>Last time the health transitioned from one to another.
TODO: remove nullable, <a href="https://github.com/kubernetes/kubernetes/issues/86811">https://github.com/kubernetes/kubernetes/issues/86811</a></p>
</td>
</tr>
</tbody>
</table>
<h3 id="tiproxyspec">TiProxySpec</h3>
<p>
(<em>Appears on:</em>
Expand Down Expand Up @@ -22205,7 +22269,9 @@ MemberPhase
<td>
<code>members</code></br>
<em>
map[string]bool
<a href="#tiproxymember">
map[string]github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiProxyMember
</a>
</em>
</td>
<td>
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ require (
github.com/openshift/generic-admission-server v1.14.1-0.20210422140326-da96454c926d
github.com/opentracing/opentracing-go v1.1.0 // indirect
github.com/pierrec/lz4 v2.0.5+incompatible // indirect
github.com/pingcap/TiProxy/lib v0.0.0-20230103134416-da56a2cf1ed9
github.com/pingcap/TiProxy/lib v0.0.0-20230119083121-a15dd3e8f104
github.com/pingcap/advanced-statefulset/client v1.17.1-0.20210831081013-d54ef54b2938
github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8 // indirect
github.com/pingcap/errors v0.11.4
Expand All @@ -66,7 +66,7 @@ require (
github.com/sirupsen/logrus v1.6.0
github.com/spf13/cobra v1.5.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.0
github.com/stretchr/testify v1.8.1
github.com/tikv/pd v2.1.17+incompatible
github.com/uber-go/atomic v0.0.0-00010101000000-000000000000 // indirect
github.com/uber/jaeger-client-go v2.19.0+incompatible // indirect
Expand Down
21 changes: 12 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,8 @@ github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+v
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pingcap/TiProxy/lib v0.0.0-20230103134416-da56a2cf1ed9 h1:GYT3IH1RFbg1B7mR1UVT8Hmbgu5x1y46RhQZE6lRglA=
github.com/pingcap/TiProxy/lib v0.0.0-20230103134416-da56a2cf1ed9/go.mod h1:0vthA3rLPfn1tdT0i/Y1jBb51dLmA+UEgGKkL9Fwd4I=
github.com/pingcap/TiProxy/lib v0.0.0-20230119083121-a15dd3e8f104 h1:G+VPB2nuXNGzU0LtigISBPqzRF1qUsu8YP1r2fu+p/I=
github.com/pingcap/TiProxy/lib v0.0.0-20230119083121-a15dd3e8f104/go.mod h1:AR0IJ6SdStz1dkxG0gi47RxzQWxbPKACQ7JG1VY6Dnc=
github.com/pingcap/advanced-statefulset/client v1.17.1-0.20210831081013-d54ef54b2938 h1:VnViTohM8PPnacFPPYjzLSUKVmKcmtiF7VUMSScm8vM=
github.com/pingcap/advanced-statefulset/client v1.17.1-0.20210831081013-d54ef54b2938/go.mod h1:pPv7hNjiBHrhnaept9u1Hd2G6fN0TOn+3uDi0/PdOk4=
github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8 h1:USx2/E1bX46VG32FIw034Au6seQ2fY9NEILmNh/UlQg=
Expand Down Expand Up @@ -724,16 +724,18 @@ github.com/storageos/go-api v0.0.0-20180912212459-343b3eff91fc/go.mod h1:ZrLn+e0
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/thecodeteam/goscaleio v0.1.0/go.mod h1:68sdkZAsK8bvEwBlbQnlLS+xU+hvLYM/iQ8KXej1AwM=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
Expand Down Expand Up @@ -778,8 +780,8 @@ go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/etcd v0.5.0-alpha.5.0.20200819165624-17cef6e3e9d5 h1:Gqga3zA9tdAcfqobUGjSoCob5L3f8Dt5EuOp3ihNZko=
go.etcd.io/etcd v0.5.0-alpha.5.0.20200819165624-17cef6e3e9d5/go.mod h1:skWido08r9w6Lq/w70DO5XYIKMu4QFu1+4VsqLQuJy8=
go.etcd.io/etcd/client/pkg/v3 v3.5.4 h1:lrneYvz923dvC14R54XcA7FXoZ3mlGZAgmwhfm7HqOg=
go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
go.etcd.io/etcd/client/pkg/v3 v3.5.5 h1:9S0JUVvmrVl7wCF39iTQthdaaNIiAaQbmK75ogO6GU8=
go.etcd.io/etcd/client/pkg/v3 v3.5.5/go.mod h1:ggrwbk069qxpKPq8/FKkQ3Xq9y39kbFR4LnKszpRXeQ=
go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
Expand All @@ -802,8 +804,8 @@ go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec=
go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.8.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
Expand Down Expand Up @@ -950,8 +952,9 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210925032602-92d5a993a665/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956 h1:XeJjHH1KiLpKGb6lvMiksZ9l0fVUh+AmGcm0nOMEBOY=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210916214954-140adaaadfaf/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
6 changes: 5 additions & 1 deletion hack/localtest/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ spec:
config: {}
tiproxy:
baseImage: xhebox/tiproxy
version: test
version: latest
imagePullPolicy: Always
replicas: 1
config: |
[proxy]
require-backend-tls = false
max-connections = 30
2 changes: 1 addition & 1 deletion hack/localtest/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ if [ -n "$ENABLE_SSL" ]; then
kubectl create secret generic ${cluster}-cluster-client-secret --namespace=${namespace} --from-file=tls.crt=client.pem --from-file=tls.key=client-key.pem --from-file=ca.crt=ca.pem
fi

helm install operator $BASE/../../charts/tidb-operator/ --namespace testing --set "operatorImage=xx/tidb-operator:latest,imagePullPolicy=Always"
helm install operator $BASE/../../charts/tidb-operator/ --namespace testing --set "operatorImage=xx/tidb-operator:latest"
kubectl apply -f $BASE/cluster.yaml --namespace testing
22 changes: 21 additions & 1 deletion manifests/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34226,7 +34226,27 @@ spec:
type: array
members:
additionalProperties:
type: boolean
properties:
health:
type: boolean
info:
properties:
config_version:
format: int32
type: integer
required:
- config_version
type: object
lastTransitionTime:
format: date-time
nullable: true
type: string
name:
type: string
required:
- health
- name
type: object
type: object
phase:
type: string
Expand Down
22 changes: 21 additions & 1 deletion manifests/crd/v1/pingcap.com_tidbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20971,7 +20971,27 @@ spec:
type: array
members:
additionalProperties:
type: boolean
properties:
health:
type: boolean
info:
properties:
config_version:
format: int32
type: integer
required:
- config_version
type: object
lastTransitionTime:
format: date-time
nullable: true
type: string
name:
type: string
required:
- health
- name
type: object
type: object
phase:
type: string
Expand Down
22 changes: 21 additions & 1 deletion manifests/crd/v1beta1/pingcap.com_tidbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20941,7 +20941,27 @@ spec:
type: array
members:
additionalProperties:
type: boolean
properties:
health:
type: boolean
info:
properties:
config_version:
format: int32
type: integer
required:
- config_version
type: object
lastTransitionTime:
format: date-time
nullable: true
type: string
name:
type: string
required:
- health
- name
type: object
type: object
phase:
type: string
Expand Down
22 changes: 21 additions & 1 deletion manifests/crd_v1beta1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34191,7 +34191,27 @@ spec:
type: array
members:
additionalProperties:
type: boolean
properties:
health:
type: boolean
info:
properties:
config_version:
format: int32
type: integer
required:
- config_version
type: object
lastTransitionTime:
format: date-time
nullable: true
type: string
name:
type: string
required:
- health
- name
type: object
type: object
phase:
type: string
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/google/gofuzz v1.1.0
github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb
github.com/onsi/gomega v1.10.2
github.com/pingcap/TiProxy/lib v0.0.0-20230103134416-da56a2cf1ed9
github.com/pingcap/TiProxy/lib v0.0.0-20230119083121-a15dd3e8f104
github.com/pingcap/errors v0.11.4
github.com/prometheus/common v0.26.0
github.com/prometheus/prometheus v1.8.2
Expand Down
Loading

0 comments on commit dc1508a

Please sign in to comment.