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

Enabled jobs instead of cronjobs to take care of running compaction. #235

Merged
merged 1 commit into from
Nov 15, 2021

Conversation

abdasgupta
Copy link
Contributor

@abdasgupta abdasgupta commented Sep 25, 2021

How to categorize this PR?

/area performance
/kind enhancement

What this PR does / why we need it:
Earlier cronjobs are scheduled through druid for backup compaction of ETCD. But that incurs huge cost as we have to predefine schedule and resources for compaction jobs. This PR enabled to run jobs instead of cronjobs to run the backup compaction. Jobs are triggered based on the number of events that accumulated as delta snapshot after last full snapshot.

cc @aaronfern
Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

CronJob is no more used to schedule compaction job at regular interval. Instead, we are using Job.
Therefore, `BackupCompactionSchedule` field is removed from ETCD backup spec, as it was only necessary for scheduling CronJob.
A new controller named lease controller has been introduced. Lease controller will be responsible for creating compaction job based on the delta event lease.
For this, two new `Lease`s are introduced: One to hold the value of the latest full snapshot revision and one for the last delta revision.

@abdasgupta abdasgupta requested a review from a team as a code owner September 25, 2021 10:38
@gardener-robot
Copy link

@abdasgupta Labels area/todo, kind/todo do not exist.

@gardener-robot gardener-robot added needs/review Needs review size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py) needs/second-opinion Needs second review by someone else labels Sep 25, 2021
@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 25, 2021
@gardener-robot-ci-2 gardener-robot-ci-2 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 25, 2021
Copy link
Member

@timuthy timuthy 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 PR. I have a few suggestions and questions which I added as a comment to the affected line(s).

controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
charts/etcd/templates/etcd-compaction-job.yaml Outdated Show resolved Hide resolved
controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
@gardener-robot gardener-robot added the needs/changes Needs (more) changes label Sep 28, 2021
controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
controllers/etcd_custodian_controller.go Outdated Show resolved Hide resolved
@timuthy timuthy mentioned this pull request Sep 30, 2021
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 6, 2021
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 6, 2021
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 6, 2021
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 6, 2021
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 6, 2021
@abdasgupta abdasgupta changed the title [WIP] Enabled jobs instead of cronjobs to take care of running compaction. Enabled jobs instead of cronjobs to take care of running compaction. Oct 6, 2021
Copy link
Contributor

@aaronfern aaronfern left a comment

Choose a reason for hiding this comment

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

Thanks @abdasgupta for the well written PR!
Just one query from me and some nitpicks
Thanks!

controllers/lease_controller.go Outdated Show resolved Hide resolved
controllers/lease_controller.go Outdated Show resolved Hide resolved
controllers/etcd_controller.go Outdated Show resolved Hide resolved
controllers/etcd_controller.go Outdated Show resolved Hide resolved
controllers/controller_ref_manager.go Outdated Show resolved Hide resolved
Copy link
Contributor

@aaronfern aaronfern left a comment

Choose a reason for hiding this comment

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

Hey @abdasgupta
Just adding below some changes to the job that needs to be made before this PR is merged
This is to ensure it correctly works with the etcdbr version

controllers/lease_controller.go Outdated Show resolved Hide resolved
controllers/lease_controller.go Outdated Show resolved Hide resolved
controllers/lease_controller.go Outdated Show resolved Hide resolved
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 7, 2021
controllers/lease_controller.go Outdated Show resolved Hide resolved
controllers/lease_controller.go Outdated Show resolved Hide resolved
controllers/controller_ref_manager.go Outdated Show resolved Hide resolved
Copy link
Member

@timuthy timuthy left a comment

Choose a reason for hiding this comment

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

Just some last comments. Thanks for your effort 👍

main.go Outdated Show resolved Hide resolved
pkg/predicate/predicate_test.go Outdated Show resolved Hide resolved
@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 11, 2021
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 11, 2021
Copy link
Member

@timuthy timuthy left a comment

Choose a reason for hiding this comment

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

/lgtm
I tested and played around with it w/o facing any issues 👍

@gardener-robot gardener-robot added reviewed/lgtm Has approval for merging and removed needs/changes Needs (more) changes needs/rebase Needs git rebase needs/review Needs review needs/second-opinion Needs second review by someone else labels Nov 12, 2021
Copy link
Contributor

@stoyanr stoyanr left a comment

Choose a reason for hiding this comment

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

/lgtm

There are a few comments that still use the old name LeaseController that you may want to fix.

config controllersconfig.CompactionLeaseConfig
}

// NewCompactionLeaseController creates a new LeaseController object
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// NewCompactionLeaseController creates a new LeaseController object
// NewCompactionLeaseController creates a new CompactionLeaseController object

}
}

// NewCompactionLeaseControllerWithImageVector creates a new LeaseController object
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// NewCompactionLeaseControllerWithImageVector creates a new LeaseController object
// NewCompactionLeaseControllerWithImageVector creates a new CompactionLeaseController object

return lc.InitializeControllerWithImageVector()
}

// InitializeControllerWithImageVector will use LeaseController client to initialize image vector for etcd
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// InitializeControllerWithImageVector will use LeaseController client to initialize image vector for etcd
// InitializeControllerWithImageVector will use CompactionLeaseController client to initialize image vector for etcd

Copy link
Contributor

@aaronfern aaronfern left a comment

Choose a reason for hiding this comment

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

/lgtm

Added test case for lease controller in separate test file.
@gardener-robot gardener-robot added needs/second-opinion Needs second review by someone else and removed reviewed/lgtm Has approval for merging labels Nov 15, 2021
@gardener-robot-ci-2 gardener-robot-ci-2 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 15, 2021
@gardener-robot-ci-1 gardener-robot-ci-1 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 15, 2021
@gardener-robot gardener-robot added area/performance Performance (across all domains, such as control plane, networking, storage, etc.) related kind/enhancement Enhancement, improvement, extension labels Nov 15, 2021
Copy link
Member

@timuthy timuthy left a comment

Choose a reason for hiding this comment

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

/lgtm

@gardener-robot gardener-robot added reviewed/lgtm Has approval for merging and removed needs/second-opinion Needs second review by someone else labels Nov 15, 2021
@timuthy timuthy dismissed shreyas-s-rao’s stale review November 15, 2021 10:47

Comments have been addressed. Reviewer is absent.

@timuthy timuthy merged commit 1c2d8ab into gardener:master Nov 15, 2021
@abdasgupta abdasgupta deleted the job branch November 15, 2021 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/performance Performance (across all domains, such as control plane, networking, storage, etc.) related kind/enhancement Enhancement, improvement, extension needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) reviewed/lgtm Has approval for merging size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants