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-1366: Add suspendedDeadlineSeconds #1970

Merged
merged 3 commits into from
Feb 11, 2025
Merged

K8SPXC-1366: Add suspendedDeadlineSeconds #1970

merged 3 commits into from
Feb 11, 2025

Conversation

egegunes
Copy link
Contributor

@egegunes egegunes commented Feb 7, 2025

K8SPXC-1366 Powered by Pull Request Badge

suspendedDeadlineSeconds allows user to configure maximum duration that
backup job can wait in suspended state. This field is optional and can
be configured in two separate places:

  1. PerconaXtraDBClusterBackup.spec.suspendedDeadlineSeconds: Always used if defined.
  2. PerconaXtraDBCluster.spec.backup.suspendedDeadlineSeconds: Used only if not defined in PerconaXtraDBClusterBackup.

Suspended deadlines seconds are checked against the last transition time
of job status condidition with type JobSuspended and status true.

Commit 5a07740 introduced startingDeadlineSeconds to fail backup it
doesn't start before configured deadline. This commit also allows user
to configure it globally, just like suspendedDeadlineSeconds.

startingDeadlineSeconds is an optinal field and can be configured in two
separate places:

  1. PerconaXtraDBClusterBackup.spec.startedDeadlineSeconds: Always used if defined.
  2. PerconaXtraDBCluster.spec.backup.startedDeadlineSeconds: Used only if not defined in PerconaXtraDBClusterBackup.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?
  • Are OpenShift compare files changed for E2E tests (compare/*-oc.yml)?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • 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?
  • Does the change support oldest and newest supported Kubernetes version?

@pull-request-size pull-request-size bot added the size/L 100-499 lines label Feb 7, 2025
suspendedDeadlineSeconds allows user to configure maximum duration that
backup job can wait in suspended state. This field is optional and can
be configured in two separate places:

1. PerconaXtraDBClusterBackup.spec.suspendedDeadlineSeconds: Always used if defined.
2. PerconaXtraDBCluster.spec.backup.suspendedDeadlineSeconds: Used only if not defined in PerconaXtraDBClusterBackup.

Suspended deadlines seconds are checked against the last transition time
of job status condidition with type JobSuspended and status true.

Commit 5a07740 introduced startingDeadlineSeconds to fail backup it
doesn't start before configured deadline. This commit also allows user
to configure it globally, just like suspendedDeadlineSeconds.

startingDeadlineSeconds is an optinal field and can be configured in two
separate places:

1. PerconaXtraDBClusterBackup.spec.startedDeadlineSeconds: Always used if defined.
2. PerconaXtraDBCluster.spec.backup.startedDeadlineSeconds: Used only if not defined in PerconaXtraDBClusterBackup.
@pull-request-size pull-request-size bot added size/XL 500-999 lines and removed size/L 100-499 lines labels Feb 10, 2025
@egegunes egegunes marked this pull request as ready for review February 10, 2025 11:28

var deadlineSeconds *int64
if cr.Spec.StartingDeadlineSeconds != nil {
deadlineSeconds = cr.Spec.StartingDeadlineSeconds
Copy link
Contributor

@nmarukovich nmarukovich Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it will be a bit nicer to use switch here?
And does it make sense to separate this function to 2 functions? Get deadlineSeconds and check the value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think switch will be much different, why do you think that it might be better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var deadlineSeconds *int64

switch {
case cr.Spec.StartingDeadlineSeconds != nil:
    deadlineSeconds = cr.Spec.StartingDeadlineSeconds
case cluster.Spec.Backup.StartingDeadlineSeconds != nil:
    deadlineSeconds = cluster.Spec.Backup.StartingDeadlineSeconds
default:
    return nil
}

For me it looks more readable, but it's not critical for sure, just want to understand when what is better to use.

@JNKPercona
Copy link
Collaborator

Test name Status
affinity-8-0 passed
auto-tuning-8-0 passed
cross-site-8-0 passed
custom-users-8-0 passed
demand-backup-cloud-8-0 passed
demand-backup-encrypted-with-tls-8-0 passed
demand-backup-8-0 passed
demand-backup-parallel-8-0 passed
haproxy-5-7 passed
haproxy-8-0 passed
init-deploy-5-7 passed
init-deploy-8-0 passed
limits-8-0 passed
monitoring-2-0-8-0 passed
one-pod-5-7 passed
one-pod-8-0 passed
pitr-8-0 passed
pitr-gap-errors-8-0 passed
proxy-protocol-8-0 passed
proxysql-sidecar-res-limits-8-0 passed
pvc-resize-5-7 passed
pvc-resize-8-0 passed
recreate-8-0 passed
restore-to-encrypted-cluster-8-0 passed
scaling-proxysql-8-0 passed
scaling-8-0 passed
scheduled-backup-5-7 passed
scheduled-backup-8-0 passed
security-context-8-0 passed
smart-update1-8-0 passed
smart-update2-8-0 passed
storage-8-0 passed
tls-issue-cert-manager-ref-8-0 passed
tls-issue-cert-manager-8-0 passed
tls-issue-self-8-0 passed
upgrade-consistency-8-0 passed
upgrade-haproxy-5-7 passed
upgrade-haproxy-8-0 passed
upgrade-proxysql-5-7 passed
upgrade-proxysql-8-0 passed
users-5-7 passed
users-8-0 passed
validation-hook-8-0 passed
We run 43 out of 43

commit: 8202127
image: perconalab/percona-xtradb-cluster-operator:PR-1970-8202127f

@hors hors merged commit 5872a54 into main Feb 11, 2025
12 checks passed
@hors hors deleted the K8SPXC-1366 branch February 11, 2025 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XL 500-999 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants