Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/k8s.io/client-go-0.28.4
Browse files Browse the repository at this point in the history
  • Loading branch information
hors authored Dec 1, 2023
2 parents 4998cd8 + 6a3f339 commit 3120f10
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
export DOCKER_SQUASH=0
./e2e-tests/build
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.13.1
uses: aquasecurity/trivy-action@0.14.0
with:
image-ref: 'docker.io/perconalab/percona-xtradb-cluster-operator:${{ github.sha }}'
format: 'table'
Expand Down
1 change: 1 addition & 0 deletions cmd/pitr/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type Config struct {
BufferSize int64 `env:"BUFFER_SIZE"`
CollectSpanSec float64 `env:"COLLECT_SPAN_SEC" envDefault:"60"`
VerifyTLS bool `env:"VERIFY_TLS" envDefault:"true"`
TimeoutSeconds float64 `env:"TIMEOUT_SECONDS" envDefault:"60"`
}

type BackupS3 struct {
Expand Down
7 changes: 5 additions & 2 deletions cmd/pitr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ func runCollector(ctx context.Context) {
}
log.Println("run binlog collector")
for {
err := c.Run(ctx)
timeout, cancel := context.WithTimeout(ctx, time.Duration(config.CollectSpanSec)*time.Second)
defer cancel()

err := c.Run(timeout)
if err != nil {
log.Println("ERROR:", err)
log.Fatalln("ERROR:", err)
}

t := time.NewTimer(time.Duration(config.CollectSpanSec) * time.Second)
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/pxc.percona.com_perconaxtradbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ spec:
type: string
timeBetweenUploads:
type: number
timeoutSeconds:
type: number
type: object
schedule:
items:
Expand Down
2 changes: 2 additions & 0 deletions deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,8 @@ spec:
type: string
timeBetweenUploads:
type: number
timeoutSeconds:
type: number
type: object
schedule:
items:
Expand Down
1 change: 1 addition & 0 deletions deploy/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ spec:
enabled: false
storageName: STORAGE-NAME-HERE
timeBetweenUploads: 60
timeoutSeconds: 60
# resources:
# requests:
# memory: 0.1G
Expand Down
2 changes: 2 additions & 0 deletions deploy/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,8 @@ spec:
type: string
timeBetweenUploads:
type: number
timeoutSeconds:
type: number
type: object
schedule:
items:
Expand Down
2 changes: 2 additions & 0 deletions deploy/cw-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,8 @@ spec:
type: string
timeBetweenUploads:
type: number
timeoutSeconds:
type: number
type: object
schedule:
items:
Expand Down
16 changes: 10 additions & 6 deletions e2e-tests/functions
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ deploy_operator() {

deploy_helm() {
helm repo add hashicorp https://helm.releases.hashicorp.com
helm repo add minio https://helm.min.io/
helm repo add minio https://charts.min.io/
helm repo update
}

Expand Down Expand Up @@ -1245,15 +1245,19 @@ start_minio() {

local endpoint="http://minio-service:9000"
local minio_args=(
--version 8.0.5
--set accessKey=some-access-key
--set secretKey=some-secret-key
--version 5.0.14
--set replicas=1
--set mode=standalone
--set resources.requests.memory=256Mi
--set rootUser=rootuser
--set rootPassword=rootpass123
--set "users[0].accessKey=some-access-key"
--set "users[0].secretKey=some-secret-key"
--set "users[0].policy=consoleAdmin"
--set service.type=ClusterIP
--set configPathmc=/tmp/.minio/
--set securityContext.enabled=false
--set persistence.size=2G
--set environment.MINIO_REGION=us-east-1
--set environment.MINIO_HTTP_TRACE=/tmp/trace.log
)
if [[ -n $cert_secret ]]; then
endpoint="https://minio-service:9000"
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/pxc/v1/pxc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ type PITRSpec struct {
StorageName string `json:"storageName"`
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
TimeBetweenUploads float64 `json:"timeBetweenUploads,omitempty"`
TimeoutSeconds float64 `json:"timeoutSeconds,omitempty"`
}

type PXCScheduledBackupSchedule struct {
Expand Down Expand Up @@ -876,6 +877,10 @@ func (cr *PerconaXtraDBCluster) CheckNSetDefaults(serverVersion *version.ServerV
if cr.Spec.Backup.PITR.TimeBetweenUploads == 0 {
cr.Spec.Backup.PITR.TimeBetweenUploads = 60
}

if cr.Spec.Backup.PITR.TimeoutSeconds == 0 {
cr.Spec.Backup.PITR.TimeoutSeconds = 3600
}
}

for _, sch := range c.Backup.Schedule {
Expand Down
10 changes: 10 additions & 0 deletions pkg/pxc/app/deployment/binlog-collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ func GetBinlogCollectorDeployment(cr *api.PerconaXtraDBCluster) (appsv1.Deployme
Value: strconv.FormatInt(bufferSize, 10),
},
}...)

if cr.CompareVersionWith("1.14.0") >= 0 {
timeout := fmt.Sprintf("%.2f", cr.Spec.Backup.PITR.TimeoutSeconds)

envs = append(envs, corev1.EnvVar{
Name: "TIMEOUT_SECONDS",
Value: timeout,
})
}

container := corev1.Container{
Name: "pitr",
Image: cr.Spec.Backup.Image,
Expand Down

0 comments on commit 3120f10

Please sign in to comment.