Skip to content

Commit

Permalink
Merge branch 'main' into K8SPXC-1341
Browse files Browse the repository at this point in the history
  • Loading branch information
hors authored Feb 5, 2024
2 parents c482ad9 + 45f14c7 commit 5c1f635
Show file tree
Hide file tree
Showing 98 changed files with 12,901 additions and 371 deletions.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/1-feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Feature request 🧭
description: Suggest an idea for this project
labels: "feature-request"
body:
- type: textarea
attributes:
label: Proposal
description: "What would you like to have as a feature"
placeholder: "A clear and concise description of what you want to happen."
validations:
required: true
- type: textarea
attributes:
label: Use-Case
description: "How would this help you?"
placeholder: "Tell us more what you'd like to achieve."
validations:
required: false
- type: dropdown
id: interested-in-implementing-the-feature
attributes:
label: Is this a feature you are interested in implementing yourself?
options:
- 'No'
- 'Maybe'
- 'Yes'
validations:
required: true
- type: textarea
id: anything-else
attributes:
label: Anything else?
description: "Let us know if you have anything else to share"
53 changes: 53 additions & 0 deletions .github/ISSUE_TEMPLATE/2-bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Report a bug 🐛
description: Create a report to help us improve
labels: "bug"
body:
- type: markdown
attributes:
value: |
## Self-help
Thank you for considering to open a bug report!
Before you do, however, make sure to check our existing resources to see if it has already been discussed/reported:
- [Reported bugs](https://github.com/percona/percona-xtradb-cluster-operator/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Abug)
- [JIRA bugs](https://perconadev.atlassian.net/issues/?jql=project%20%3D%20%22Percona%20Operator%20for%20MySQL%20based%20on%20Percona%20XtraDB%20Cluster%22%20and%20issuetype%20%3D%20Bug%20and%20resolution%20%3D%20unresolved%20order%20BY%20created%20DESC)
- [Percona Operator for MySQL forum](https://forums.percona.com/c/mysql-mariadb/percona-kubernetes-operator-for-mysql/28)
- type: textarea
attributes:
label: Report
description: "What bug have you encountered?"
placeholder: "A clear and concise description of what the bug is."
validations:
required: true
- type: textarea
attributes:
label: More about the problem
description: What do you see happening
placeholder: Logs, expected behavior, other
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
description: "Tell us how to reproduce the problem"
value: |
1.
2.
3.
validations:
required: true
- type: textarea
attributes:
label: Versions
description: "Tell us which versions do you use"
value: |
1. Kubernetes
2. Operator
3. Database
validations:
required: true
- type: textarea
id: anything-else
attributes:
label: Anything else?
description: "Let us know if you have anything else to share"
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: Ask a question about Percona Operator for MySQL or get support
url: https://forums.percona.com/c/mysql-mariadb/percona-kubernetes-operator-for-mysql/28
about: Ask a question or request support for using Percona Operator for MySQL
- name: Report vulnerability or security concern
url: https://www.percona.com/security
about: For any security issues or concerns
1 change: 0 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

**Config/Logging/Testability**
- [ ] Are all needed new/changed options added to default YAML files?
- [ ] Are the manifests (crd/bundle) regenerated if needed?
- [ ] Did we add proper logging messages for operator actions?
- [ ] Did we ensure compatibility with the previous version or cluster upgrade process?
- [ ] Does the change support oldest and newest supported PXC version?
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,12 @@ jobs:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: info

manifests:
name: runner / manifests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
make generate manifests VERSION=main
git diff --exit-code
4 changes: 2 additions & 2 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
./e2e-tests/build
- name: Run Trivy vulnerability scanner image (linux/arm64)
uses: aquasecurity/[email protected].0
uses: aquasecurity/[email protected].1
with:
image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-arm64'
format: 'table'
Expand All @@ -49,7 +49,7 @@ jobs:
./e2e-tests/build
- name: Run Trivy vulnerability scanner image (linux/amd64)
uses: aquasecurity/[email protected].0
uses: aquasecurity/[email protected].1
with:
image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-amd64'
format: 'table'
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ vet: ## Run go vet against code.
go vet ./...

test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) --arch=amd64 use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
DISABLE_TELEMETRY=true KUBEBUILDER_ASSETS="$(shell $(ENVTEST) --arch=amd64 use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out

##@ Build

Expand Down
46 changes: 21 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/percona/percona-xtradb-cluster-operator)
[![Go Report Card](https://goreportcard.com/badge/github.com/percona/percona-xtradb-cluster-operator)](https://goreportcard.com/report/github.com/percona/percona-xtradb-cluster-operator)

[Percona XtraDB Cluster](https://www.percona.com/software/mysql-database/percona-xtradb-cluster) (PXC) is an open-source enterprise MySQL solution that helps you to ensure data availability for your applications while improving security and simplifying the development of new applications in the most demanding public, private, and hybrid cloud environments.
[Percona Operator for MySQL based on Percona XtraDB Cluster](https://docs.percona.com/percona-operator-for-mysql/pxc/index.html) (PXC) automates the creation and management of highly available, enterprise-ready MySQL database clusters on Kubernetes.

Based on our best practices for deployment and configuration, [Percona Operator for MySQL based on Percona XtraDB Cluster](https://www.percona.com/doc/kubernetes-operator-for-pxc/index.html) contains everything you need to quickly and consistently deploy and scale Percona XtraDB Cluster instances in a Kubernetes-based environment on-premises or in the cloud. It provides the following capabilities:
Within the [Percona Operator for MySQL based on Percona XtraDB Cluster](https://www.percona.com/doc/kubernetes-operator-for-pxc/index.html) we have implemented our best practices for deployment and configuration Percona XtraDB Cluster instances in a Kubernetes-based environment on-premises or in the cloud. The OPerator provides the following capabilities to keep the cluster healthy:

* Easy deployment with no single point of failure
* Load balancing and proxy service with either HAProxy or ProxySQL
Expand All @@ -21,44 +21,34 @@ Based on our best practices for deployment and configuration, [Percona Operator
* Automated Password Rotation – use the standard Kubernetes API to enforce password rotation policies for system user
* Private container image registries

# Architecture
You interact with Percona Operator mostly via the command line tool. If you feel more comfortable with operating the Operator and database clusters via the web interface, there is [Percona Everest](https://docs.percona.com/everest/index.html) - an open-source web-based database provisioning tool available for you. It automates day-to-day database management operations for you, reducing the overall administrative overhead. [Get started with Percona Everest](https://docs.percona.com/everest/quickstart-guide/quick-install.html).

Percona Operators are based on the [Operator SDK](https://github.com/operator-framework/operator-sdk) and leverage Kubernetes primitives to follow best CNCF practices.

Please read more about architecture and design decisions [here](https://www.percona.com/doc/kubernetes-operator-for-pxc/architecture.html).
# Architecture

# Quickstart installation
Percona Operators are based on the [Operator SDK](https://github.com/operator-framework/operator-sdk) and leverage Kubernetes primitives to follow best CNCF practices.

## Helm
Please read more about [architecture and design decisions](https://www.percona.com/doc/kubernetes-operator-for-pxc/architecture.html).

Install the Operator:
## Documentation

```sh
helm install my-op percona/pxc-operator
```
To learn more about the Operator, check the [Percona Operator for MySQL based on Percona XtraDB Cluster documentation](https://docs.percona.com/percona-operator-for-mysql/pxc/index.html).

Install Percona XtraDB Cluster:
```sh
helm install my-db percona/pxc-db
```
# Quickstart installation

See more details in:
- [Helm installation documentation](https://www.percona.com/doc/kubernetes-operator-for-pxc/helm.html)
- [Operator helm chart parameter reference](https://github.com/percona/percona-helm-charts/tree/main/charts/pxc-operator)
- [Percona XtraDB Cluster helm chart parameters reference](https://github.com/percona/percona-helm-charts/tree/main/charts/pxc-db)
Ready to try out the Operator? Check the [Quickstart tutorial](https://docs.percona.com/percona-operator-for-mysql/pxc/quickstart.html) for easy-to follow steps.

Below is one of the ways to deploy the Operator using `kubectl`.

## kubectl

It usually takes two steps to deploy Percona XtraDB Cluster on Kubernetes.

Deploy the Operator from `deploy/bundle.yaml`:
1. Deploy the Operator from `deploy/bundle.yaml`:

```sh
kubectl apply -f https://raw.githubusercontent.com/percona/percona-xtradb-cluster-operator/main/deploy/bundle.yaml
```

Deploy the database cluster itself from `deploy/cr.yaml`:
2. Deploy the database cluster itself from `deploy/cr.yaml`:

```sh
kubectl apply -f https://raw.githubusercontent.com/percona/percona-xtradb-cluster-operator/main/deploy/cr.yaml
Expand All @@ -71,7 +61,11 @@ See full documentation with examples and various advanced cases on [percona.com]

Percona welcomes and encourages community contributions to help improve Percona Operator for MySQL.

See the [Contribution Guide](CONTRIBUTING.md) and [Building and Testing Guide](e2e-tests/README.md) for more information.
See the [Contribution Guide](CONTRIBUTING.md) and [Building and Testing Guide](e2e-tests/README.md) for more information on how you can contribute.

## Communication

We would love to hear from you! Reach out to us on [Forum](https://forums.percona.com/c/mysql-mariadb/percona-kubernetes-operator-for-mysql/28) with your questions, feedback and ideas

# Join Percona Kubernetes Squad!
```
Expand Down Expand Up @@ -99,5 +93,7 @@ We have an experimental public roadmap which can be found [here](https://github.

# Submitting Bug Reports

If you find a bug in Percona Docker Images or in one of the related projects, please submit a report to that project's [JIRA](https://jira.percona.com/browse/K8SPXC) issue tracker. Learn more about submitting bugs, new features ideas and improvements in the [Contribution Guide](CONTRIBUTING.md).
If you find a bug in Percona Docker Images or in one of the related projects, please submit a report to that project's [JIRA](https://jira.percona.com/browse/K8SPXC) issue tracker or [create a GitHub issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue#creating-an-issue-from-a-repository) in this repository.

Learn more about submitting bugs, new features ideas and improvements in the [Contribution Guide](CONTRIBUTING.md).

2 changes: 1 addition & 1 deletion build/pxc-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
fi
if [ -n "$PXC_SERVICE" ]; then
function get_primary() {
peer-list -on-start=/var/lib/mysql/get-pxc-state -service="$PXC_SERVICE" 2>&1 \
/var/lib/mysql/peer-list -on-start=/var/lib/mysql/get-pxc-state -service="$PXC_SERVICE" 2>&1 \
| grep wsrep_ready:ON:wsrep_connected:ON:wsrep_local_state_comment:Synced:wsrep_cluster_status:Primary \
| sort \
| tail -1 \
Expand Down
6 changes: 3 additions & 3 deletions cmd/pitr/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const (
timelinePath string = "/tmp/pitr-timeline" // path to file with timeline
)

func New(c Config) (*Collector, error) {
func New(ctx context.Context, c Config) (*Collector, error) {
var s storage.Storage
var err error
switch c.StorageType {
Expand All @@ -76,7 +76,7 @@ func New(c Config) (*Collector, error) {
if len(bucketArr) > 1 {
prefix = strings.TrimPrefix(c.BackupStorageS3.BucketURL, bucketArr[0]+"/") + "/"
}
s, err = storage.NewS3(c.BackupStorageS3.Endpoint, c.BackupStorageS3.AccessKeyID, c.BackupStorageS3.AccessKey, bucketArr[0], prefix, c.BackupStorageS3.Region, c.VerifyTLS)
s, err = storage.NewS3(ctx, c.BackupStorageS3.Endpoint, c.BackupStorageS3.AccessKeyID, c.BackupStorageS3.AccessKey, bucketArr[0], prefix, c.BackupStorageS3.Region, c.VerifyTLS)
if err != nil {
return nil, errors.Wrap(err, "new storage manager")
}
Expand Down Expand Up @@ -245,7 +245,7 @@ func createTimelineFile(firstTs string) error {
}

func updateTimelineFile(lastTs string) error {
f, err := os.OpenFile(timelinePath, os.O_RDWR, 0644)
f, err := os.OpenFile(timelinePath, os.O_RDWR, 0o644)
if err != nil {
return errors.Wrapf(err, "open %s", timelinePath)
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/pitr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func runCollector(ctx context.Context) {
if err != nil {
log.Fatalln("ERROR: get config:", err)
}
c, err := collector.New(config)
c, err := collector.New(ctx, config)
if err != nil {
log.Fatalln("ERROR: new controller:", err)
}
Expand Down Expand Up @@ -96,7 +96,6 @@ func getCollectorConfig() (collector.Config, error) {
}

return cfg, err

}

func getRecovererConfig() (recoverer.Config, error) {
Expand Down
8 changes: 4 additions & 4 deletions cmd/pitr/recoverer/recoverer.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ type Config struct {
BinlogStorageAzure BinlogAzure
}

func (c Config) storages() (storage.Storage, storage.Storage, error) {
func (c Config) storages(ctx context.Context) (storage.Storage, storage.Storage, error) {
var binlogStorage, defaultStorage storage.Storage
switch c.StorageType {
case "s3":
bucket, prefix, err := getBucketAndPrefix(c.BinlogStorageS3.BucketURL)
if err != nil {
return nil, nil, errors.Wrap(err, "get bucket and prefix")
}
binlogStorage, err = storage.NewS3(c.BinlogStorageS3.Endpoint, c.BinlogStorageS3.AccessKeyID, c.BinlogStorageS3.AccessKey, bucket, prefix, c.BinlogStorageS3.Region, c.VerifyTLS)
binlogStorage, err = storage.NewS3(ctx, c.BinlogStorageS3.Endpoint, c.BinlogStorageS3.AccessKeyID, c.BinlogStorageS3.AccessKey, bucket, prefix, c.BinlogStorageS3.Region, c.VerifyTLS)
if err != nil {
return nil, nil, errors.Wrap(err, "new s3 storage")
}
Expand All @@ -69,7 +69,7 @@ func (c Config) storages() (storage.Storage, storage.Storage, error) {
return nil, nil, errors.Wrap(err, "get bucket and prefix")
}
prefix = prefix[:len(prefix)-1]
defaultStorage, err = storage.NewS3(c.BackupStorageS3.Endpoint, c.BackupStorageS3.AccessKeyID, c.BackupStorageS3.AccessKey, bucket, prefix+".sst_info/", c.BackupStorageS3.Region, c.VerifyTLS)
defaultStorage, err = storage.NewS3(ctx, c.BackupStorageS3.Endpoint, c.BackupStorageS3.AccessKeyID, c.BackupStorageS3.AccessKey, bucket, prefix+".sst_info/", c.BackupStorageS3.Region, c.VerifyTLS)
if err != nil {
return nil, nil, errors.Wrap(err, "new storage manager")
}
Expand Down Expand Up @@ -137,7 +137,7 @@ type RecoverType string
func New(ctx context.Context, c Config) (*Recoverer, error) {
c.Verify()

binlogStorage, storage, err := c.storages()
binlogStorage, storage, err := c.storages(ctx)
if err != nil {
return nil, errors.Wrap(err, "new binlog storage manager")
}
Expand Down
3 changes: 3 additions & 0 deletions deploy/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ spec:
# timeout connect 100500
# timeout server 28800s
#
# resolvers kubernetes
# parse-resolv-conf
#
# frontend galera-in
# bind *:3309 accept-proxy
# bind *:3306
Expand Down
Loading

0 comments on commit 5c1f635

Please sign in to comment.