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 20 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
35 changes: 21 additions & 14 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ import (
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/webhook"

_ "github.com/Percona-Lab/percona-version-service/api"
"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 @@ -84,19 +85,23 @@ func main() {
}

options := ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "08db1feb.percona.com",
Namespace: namespace,
Scheme: scheme,
WebhookServer: webhook.NewServer(webhook.Options{
Port: 9443,
}),
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "08db1feb.percona.com",
LeaderElectionNamespace: operatorNamespace,
}

// Add support for MultiNamespace set in WATCH_NAMESPACE
if len(namespace) > 0 {
options.Namespace = ""
options.NewCache = cache.MultiNamespacedCacheBuilder(append(strings.Split(namespace, ","), operatorNamespace))
namespaces := make(map[string]cache.Config)
for _, ns := range append(strings.Split(namespace, ","), operatorNamespace) {
namespaces[ns] = cache.Config{}
}
options.Cache.DefaultNamespaces = namespaces
}

// Get a config to talk to the apiserver
Expand Down Expand Up @@ -138,10 +143,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
76 changes: 39 additions & 37 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/percona/percona-xtradb-cluster-operator

go 1.18
go 1.20

require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0
Expand All @@ -9,14 +9,15 @@ require (
github.com/cert-manager/cert-manager v1.12.1
github.com/flosch/pongo2/v6 v6.0.0
github.com/go-ini/ini v1.67.0
github.com/go-logr/logr v1.2.4
github.com/go-logr/logr v1.3.0
github.com/go-logr/zapr v1.2.4
github.com/go-openapi/errors v0.20.4
github.com/go-openapi/runtime v0.26.0
github.com/go-openapi/strfmt v0.21.7
github.com/go-openapi/swag v0.22.4
github.com/go-openapi/validate v0.22.1
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.63
Expand All @@ -25,12 +26,12 @@ require (
github.com/pkg/errors v0.9.1
github.com/robfig/cron/v3 v3.0.1
go.uber.org/zap v1.26.0
golang.org/x/sync v0.3.0
k8s.io/api v0.28.3
k8s.io/apimachinery v0.28.3
k8s.io/client-go v0.28.3
k8s.io/klog/v2 v2.100.1
sigs.k8s.io/controller-runtime v0.15.0
golang.org/x/sync v0.5.0
k8s.io/api v0.28.4
k8s.io/apimachinery v0.28.4
k8s.io/client-go v0.28.4
k8s.io/klog/v2 v2.110.1
sigs.k8s.io/controller-runtime v0.16.2
)

require (
Expand All @@ -41,13 +42,13 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // 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.19.6 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/loads v0.21.2 // indirect
github.com/go-openapi/spec v0.20.8 // indirect
Expand All @@ -58,14 +59,14 @@ require (
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Expand All @@ -75,40 +76,41 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/prometheus/client_golang v1.15.1 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.mongodb.org/mongo-driver v1.11.3 // indirect
go.opentelemetry.io/otel v1.15.0 // indirect
go.opentelemetry.io/otel/trace v1.15.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.12.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/oauth2 v0.14.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.14.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.4.0 // indirect
golang.org/x/tools v0.15.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.27.2 // indirect
k8s.io/component-base v0.27.2 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect
k8s.io/apiextensions-apiserver v0.28.4 // indirect
k8s.io/component-base v0.28.4 // indirect
k8s.io/kube-openapi v0.0.0-20231113174909-778a5567bc1e // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/gateway-api v0.7.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace github.com/Azure/go-autorest => github.com/Azure/go-autorest v13.3.2+incompatible // Required by OLM
Expand Down
Loading
Loading