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

K8SPXC-1301: Run operator locally #1522

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
cecd676
Implement queries_exec.
inelpandzic Nov 4, 2023
3752d48
Add OPERATOR_IMAGE env var.
inelpandzic Nov 7, 2023
b340168
Merge branch 'main' into k8spxc-1301-run-operator-locally
inelpandzic Nov 8, 2023
2d4e454
Fix controller-runtime issues.
inelpandzic Nov 8, 2023
3f91473
Use queries.DatabaseExec
inelpandzic Nov 8, 2023
d31e269
Implement user exec manger.
inelpandzic Nov 9, 2023
58f9af3
Fix sql result parsing and set proper container.
inelpandzic Nov 11, 2023
33316f4
Temp improve getting primary pod.
inelpandzic Nov 14, 2023
3985c01
Implement ReplicationStatusExec.
inelpandzic Nov 14, 2023
fe1b906
Merge branch 'main' into k8spxc-1301-run-operator-locally
inelpandzic Nov 14, 2023
0aae3e3
Comments cleanup
inelpandzic Nov 14, 2023
fb40c51
Cleanup contexts.
inelpandzic Nov 14, 2023
e227a37
Remove file.
inelpandzic Nov 14, 2023
2c59190
Bump go version to 1.21.
inelpandzic Nov 16, 2023
b4a671e
Set go version to 1.20.
inelpandzic Nov 16, 2023
3732a1d
Updte controller-runtime.
inelpandzic Nov 16, 2023
fedfe55
Set controller-runtime to v0.16.2.
inelpandzic Nov 16, 2023
6d1abf3
Fix checking if old password is discarded.
inelpandzic Nov 20, 2023
a3b4546
Merge branch 'main' into k8spxc-1301-run-operator-locally
inelpandzic Nov 20, 2023
f348557
Properly update monitor and proxyadmin user within ProxySQL.
inelpandzic Nov 21, 2023
30d7c20
Fix Update160MonitorUserGrantExec with correct SQL query.
inelpandzic Nov 22, 2023
090b5bd
Fix syntax sql error.
inelpandzic Nov 22, 2023
9273b2a
Improve getting primary pod.
inelpandzic Nov 22, 2023
65e676c
Cleanup
inelpandzic Nov 23, 2023
df3dccb
Fix import.
inelpandzic Nov 23, 2023
eace940
Get Dabatabase connected through proxy.
inelpandzic Nov 24, 2023
1c2c1f5
Refactor
inelpandzic Nov 24, 2023
79740c7
Set propper database for user manager.
inelpandzic Nov 24, 2023
23961c9
Refactor user.Manager.
inelpandzic Nov 24, 2023
0c90841
Lint fix.
inelpandzic Nov 24, 2023
88c7aff
Fix getting replication status query.
inelpandzic Nov 29, 2023
6170d68
Fix pass leak.
inelpandzic Nov 29, 2023
7e998ca
Fix checking replication status.
inelpandzic Nov 29, 2023
b153930
Merge branch 'main' into k8spxc-1301-run-operator-locally
inelpandzic Dec 3, 2023
87a8712
Merge branch 'main' into k8spxc-1301-run-operator-locally
inelpandzic Dec 29, 2023
fb40ef7
Implement database.ShowReplicaStatus.
inelpandzic Dec 29, 2023
1ed4605
Revert cr.yaml file.
inelpandzic Dec 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/percona/percona-xtradb-cluster-operator/pkg/apis"
"github.com/percona/percona-xtradb-cluster-operator/pkg/controller"
"github.com/percona/percona-xtradb-cluster-operator/pkg/k8s"
"github.com/percona/percona-xtradb-cluster-operator/pkg/webhook"
hook "github.com/percona/percona-xtradb-cluster-operator/pkg/webhook"
"github.com/percona/percona-xtradb-cluster-operator/version"
)

Expand Down Expand Up @@ -146,10 +146,12 @@ func main() {
os.Exit(1)
}

err = webhook.SetupWebhook(mgr)
if err != nil {
setupLog.Error(err, "set up validation webhook")
os.Exit(1)
if _, found := os.LookupEnv("DISABLE_WEBHOOK"); !found {
err = hook.SetupWebhook(mgr)
if err != nil {
setupLog.Error(err, "set up validation webhook")
os.Exit(1)
}
}

if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21

require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0
github.com/Percona-Lab/percona-version-service/api v0.0.0-20201216104127-a39f2dded3cc
github.com/Percona-Lab/percona-version-service/api v0.0.0-20231221101643-f081411cf925
github.com/caarlos0/env v3.5.0+incompatible
github.com/cert-manager/cert-manager v1.13.3
github.com/flosch/pongo2/v6 v6.0.0
Expand All @@ -17,6 +17,7 @@ require (
github.com/go-openapi/swag v0.22.4
github.com/go-openapi/validate v0.22.3
github.com/go-sql-driver/mysql v1.7.1
github.com/gocarina/gocsv v0.0.0-20230616125104-99d496ca653d
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-version v1.6.0
github.com/minio/minio-go/v7 v7.0.65
Expand All @@ -43,8 +44,8 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/evanphx/json-patch/v5 v5.7.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/analysis v0.21.4 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
Expand Down
17 changes: 8 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0 h1:gggzg0SUMs6SQbEw+
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0/go.mod h1:+6KLcKIVgxoBDMqMO/Nvy7bZ9a0nbU3I1DtFQK3YvB4=
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY=
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o=
github.com/Percona-Lab/percona-version-service/api v0.0.0-20201216104127-a39f2dded3cc h1:Teed8lKNzSXdHZCd8HhOJVNptRyShOdsul5w6656IVE=
github.com/Percona-Lab/percona-version-service/api v0.0.0-20201216104127-a39f2dded3cc/go.mod h1:QDbZ+DHh0CkTHN6LRkMQd1pEl3b30EaNZ9FA97Mb3TA=
github.com/Percona-Lab/percona-version-service/api v0.0.0-20231221101643-f081411cf925 h1:QIJDMCpOhFbb5HF/wr5FEhJP41zTJzUeUArT3Qs88mo=
github.com/Percona-Lab/percona-version-service/api v0.0.0-20231221101643-f081411cf925/go.mod h1:QDbZ+DHh0CkTHN6LRkMQd1pEl3b30EaNZ9FA97Mb3TA=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
Expand Down Expand Up @@ -42,12 +42,12 @@ github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxER
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U=
github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww=
github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4=
github.com/evanphx/json-patch/v5 v5.7.0 h1:nJqP7uwL84RJInrohHfW0Fx3awjbm8qZeFv0nW9SYGc=
github.com/evanphx/json-patch/v5 v5.7.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
github.com/flosch/pongo2/v6 v6.0.0 h1:lsGru8IAzHgIAw6H2m4PCyleO58I40ow6apih0WprMU=
github.com/flosch/pongo2/v6 v6.0.0/go.mod h1:CuDpFm47R0uGGE7z13/tTlt1Y6zdxvr2RLT5LJhsHEU=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
Expand Down Expand Up @@ -92,6 +92,8 @@ github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrt
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/gocarina/gocsv v0.0.0-20230616125104-99d496ca653d h1:KbPOUXFUDJxwZ04vbmDOc3yuruGvVO+LOa7cVER3yWw=
github.com/gocarina/gocsv v0.0.0-20230616125104-99d496ca653d/go.mod h1:5YoVOkjYAQumqlV356Hj3xeYh4BdZuLE0/nRkf2NKkI=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
Expand Down Expand Up @@ -125,7 +127,6 @@ github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand Down Expand Up @@ -186,7 +187,6 @@ github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down Expand Up @@ -292,7 +292,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/pxc/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,12 @@ func (r *ReconcilePerconaXtraDBCluster) Reconcile(ctx context.Context, request r
}

if o.Spec.PXC.Expose.Enabled {
err = r.ensurePxcPodServices(o)
err = r.ensurePxcPodServices(ctx, o)
if err != nil {
return rr, errors.Wrap(err, "create replication services")
}
} else {
err = r.removePxcPodServices(o)
err = r.removePxcPodServices(ctx, o)
if err != nil {
return rr, errors.Wrap(err, "remove pxc pod services")
}
Expand Down
Loading
Loading