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

Support cron and timezone in manager task integration #1851

Merged
merged 6 commits into from
Apr 23, 2024

Conversation

rzetelskik
Copy link
Member

@rzetelskik rzetelskik commented Mar 19, 2024

Description of your changes: This PR adds missing cron and related fields, currently missing from out API, to manager task specs and extends the unit tests to cover them.

Which issue is resolved by this Pull Request:
Resolves #1739

/kind feature
/priority important-longterm
/cc

@scylla-operator-bot scylla-operator-bot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. labels Mar 19, 2024
Copy link
Contributor

@rzetelskik: GitHub didn't allow me to request PR reviews from the following users: rzetelskik.

Note that only scylladb members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

Description of your changes:

Which issue is resolved by this Pull Request:
Resolves #1739
Resolves #1796

/kind feature
/priority important-longterm
/cc

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@scylla-operator-bot scylla-operator-bot bot added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 19, 2024
@rzetelskik rzetelskik force-pushed the manager-api-sync branch 5 times, most recently from 777d05a to 0b41f8e Compare March 20, 2024 08:56
@rzetelskik
Copy link
Member Author

/priority critical-urgent
since the bug fixes are a prerequisite for #1752

@scylla-operator-bot scylla-operator-bot bot added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Mar 20, 2024
@rzetelskik rzetelskik removed the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Mar 20, 2024
@scylla-operator-bot scylla-operator-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 20, 2024
@rzetelskik
Copy link
Member Author

/cc @Michal-Leszczynski
would you be able to verify if there's anything missing from manager task specs in our API?

@rzetelskik rzetelskik changed the title [WIP] Support missing API fields in manager task spec and integration Support missing API fields in manager task spec and integration Mar 20, 2024
@scylla-operator-bot scylla-operator-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 20, 2024
Copy link
Member

@tnozicka tnozicka left a comment

Choose a reason for hiding this comment

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

please fix the API to use pointers where needed

pkg/api/scylla/v1/types_cluster.go Outdated Show resolved Hide resolved
@scylla-operator-bot scylla-operator-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 20, 2024
Copy link

@Michal-Leszczynski Michal-Leszczynski left a comment

Choose a reason for hiding this comment

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

        // startDate specifies the task start date expressed in the RFC3339 format or now[+duration],
	// e.g. now+3d2h10m, valid units are d, h, m, s.
	// +kubebuilder:default:="now"
	// +optional
	StartDate string `json:"startDate,omitempty"`

The now syntax can cause a lot of pain since it is parsed on the operator or sctool side. Maybe it's worth to discourage users from using via appropriate field description?

	// interval represents a task schedule interval e.g. 3d2h10m, valid units are d, h, m, s.
	// +optional
	// +kubebuilder:default:="0"
	Interval string `json:"interval,omitempty"`

The interval field is (or should be) deprecated by SM. Is it also deprecated here?

        // For Scylla clusters that are row-level repair enabled, setting intensity below 1 has the same effect as setting intensity 1.
	// +kubebuilder:default:="1"
	// +optional
	Intensity string `json:"intensity,omitempty" mapstructure:"intensity,omitempty"`

Why is it string? SM supports float64 for backward compatibility, but all floats are converted to ints anyway, because they don't make sense anymore from Scylla POV.

pkg/api/scylla/v1/types_cluster.go Outdated Show resolved Hide resolved
pkg/api/scylla/v1/types_cluster.go Show resolved Hide resolved
pkg/api/scylla/v1/types_cluster.go Outdated Show resolved Hide resolved
pkg/api/scylla/v1/types_cluster.go Outdated Show resolved Hide resolved
@scylla-operator-bot scylla-operator-bot bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Apr 18, 2024
@scylla-operator-bot scylla-operator-bot bot added the area/dependency Issues or PRs related to dependency changes label Apr 18, 2024
@rzetelskik
Copy link
Member Author

@tnozicka I added cron and timezone validation. TZ and CRON_TZ are not accepted as part of cron for now. I'll raise an issue with the manager team.

@rzetelskik
Copy link
Member Author

manager flake and upgrade flake - can't possibly be deteriorated by this PR
#1694 (comment)
#1233 (comment)

/test images
/retest

Copy link
Member

@tnozicka tnozicka left a comment

Choose a reason for hiding this comment

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

thanks, the api and overall logic looks sound to me, had some technical comments

@@ -34,6 +38,8 @@ var (
scyllav1.BroadcastAddressTypeServiceClusterIP,
scyllav1.BroadcastAddressTypeServiceLoadBalancerIngress,
}

schedulerTaskSpecCronParser = cron.NewParser(cron.SecondOptional | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor)
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure the parser should be a global var as it may be an issue with concurrent access. I'd globalize only the parsing options.

Copy link
Member Author

Choose a reason for hiding this comment

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

done


// We can only validate interval when cron is non-nil for backwards compatibility.
if schedulerTaskSpec.Interval != nil && schedulerTaskSpec.Cron != nil {
if intervalDuration, err := duration.ParseDuration(*schedulerTaskSpec.Interval); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

nit: please split the assignment to make it shorter

Copy link
Member Author

Choose a reason for hiding this comment

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

done

expectedErrorString: "",
},
{
name: "invalid timezone in manager backup task spec",
Copy link
Member

Choose a reason for hiding this comment

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

it's unclear whether the test should produce and error or not from it's name (in other places as well), especially given it says invalid and produces no error

Copy link
Member Author

Choose a reason for hiding this comment

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

my bad, it shouldn't say invalid here

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@rzetelskik
Copy link
Member Author

@rzetelskik: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gke-release-script-latest 415c60b link true /test e2e-gke-release-script-latest
ci/prow/e2e-gke-parallel-clusterip 7ea90ba link true /test e2e-gke-parallel-clusterip
ci/prow/e2e-gke-parallel 7ea90ba link true /test e2e-gke-parallel
Full PR test history. Your PR dashboard.

manager flake
/retest

@rzetelskik
Copy link
Member Author

same thing again
/retest

@rzetelskik
Copy link
Member Author

/test images
/retest

@rzetelskik
Copy link
Member Author

and again
/retest

Copy link
Member

@tnozicka tnozicka left a comment

Choose a reason for hiding this comment

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

thanks for the updates

/approve
high level lgtm but I only scanned the test
/assign @zimnx

@scylla-operator-bot scylla-operator-bot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 19, 2024
@rzetelskik
Copy link
Member Author

aaand again

/test images
/retest

Copy link
Contributor

scylla-operator-bot bot commented Apr 19, 2024

@rzetelskik: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gke-release-script-latest 415c60b link true /test e2e-gke-release-script-latest

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@rzetelskik
Copy link
Member Author

/retest

Copy link
Collaborator

@zimnx zimnx left a comment

Choose a reason for hiding this comment

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

thanks
/lgtm

@scylla-operator-bot scylla-operator-bot bot added the lgtm Indicates that a PR is ready to be merged. label Apr 23, 2024
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rzetelskik, tnozicka, zimnx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rzetelskik
Copy link
Member Author

/hold cancel

@scylla-operator-bot scylla-operator-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 23, 2024
@scylla-operator-bot scylla-operator-bot bot merged commit 962fd4c into scylladb:master Apr 23, 2024
13 checks passed
@rzetelskik rzetelskik deleted the manager-api-sync branch April 23, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/dependency Issues or PRs related to dependency changes kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support cron in ScyllaCluster API for Scylla Manager tasks
5 participants