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

Deploy statefulset as component. #365

Merged
merged 15 commits into from
Aug 3, 2022
Merged

Conversation

abdasgupta
Copy link
Contributor

@abdasgupta abdasgupta commented Jul 4, 2022

How to categorize this PR?

/area robustness
/kind enhancement

What this PR does / why we need it:
This PR converts the statefulset yaml to client-go code to create ETCD statefulset programmatically. Earlier an example yaml was decoded and merged with correct values to create statefulset yaml. But this PR removes the use of yaml. Instead, it fetches values from ETCD spec and directly creates statefulset using client-go for kubernetes API.

This PR also removes the logic for claiming statefulset based on label selector.

Which issue(s) this PR fixes:
Fixes part of #278

Special notes for your reviewer:

Release note:

Deploying the etcd StatefulSet through a Helm chart has been abandoned. A codified version (component concept) is now used for this purpose.
`etcd` Statefulsets are not claimed anymore based on labels. Instead, the statefulsets are fetched using Name and Namespace combination. Thus, `etcd.spec.selector` does not have an effect on statefulsets anymore.

@abdasgupta abdasgupta requested a review from a team as a code owner July 4, 2022 06:19
@gardener-robot
Copy link

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

@gardener-robot gardener-robot added the needs/review Needs review label Jul 4, 2022
@abdasgupta abdasgupta marked this pull request as draft July 4, 2022 06:20
@gardener-robot gardener-robot added 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 Jul 4, 2022
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) 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 Jul 4, 2022
@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 Jul 5, 2022
@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 Jul 7, 2022
@gardener-robot-ci-3 gardener-robot-ci-3 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 Jul 7, 2022
@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 Jul 7, 2022
@gardener-robot-ci-3 gardener-robot-ci-3 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 Jul 7, 2022
@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 Jul 11, 2022
@gardener-robot-ci-3 gardener-robot-ci-3 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 Jul 11, 2022
@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 Jul 13, 2022
@abdasgupta abdasgupta marked this pull request as ready for review July 13, 2022 06:32
@gardener-robot-ci-3 gardener-robot-ci-3 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 Jul 13, 2022
controllers/etcd_controller.go Outdated Show resolved Hide resolved
controllers/etcd_controller.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.

Please remove this function as it is not used anymore

@gardener-robot gardener-robot added the needs/changes Needs (more) changes label Jul 15, 2022
@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 Jul 15, 2022
@gardener-robot-ci-3 gardener-robot-ci-3 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 Jul 27, 2022
@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 Jul 27, 2022
@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 Jul 27, 2022
@timuthy
Copy link
Member

timuthy commented Jul 27, 2022

@gardener/etcd-druid-maintainers the PR is ready for review.

@gardener-robot-ci-3 gardener-robot-ci-3 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 Jul 28, 2022
pkg/component/etcd/statefulset/values.go Outdated Show resolved Hide resolved
pkg/component/etcd/statefulset/statefulset.go Outdated Show resolved Hide resolved
pkg/component/etcd/statefulset/statefulset.go Show resolved Hide resolved
pkg/component/etcd/statefulset/statefulset.go Show resolved Hide resolved
pkg/component/etcd/statefulset/statefulset.go Outdated Show resolved Hide resolved
pkg/utils/miscellaneous.go Show resolved Hide resolved
controllers/controller_ref_manager.go Show resolved Hide resolved
controllers/etcd_controller.go Show resolved Hide resolved
leaseDeployer := componentlease.New(r.Client, etcd.Namespace, val.Lease)
if etcd.Spec.Etcd.Image == nil {
if etcdImage == "" {
return nil, nil, fmt.Errorf("either etcd resource or image vector should have %s image while deploying statefulset", common.Etcd)
Copy link
Contributor

Choose a reason for hiding this comment

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

This will result in re-queueing of request and since the image is now nil this will keep getting re-queued right?

Copy link
Member

Choose a reason for hiding this comment

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

Actually it'll only be re-queued if the images are nil and etcd or etcd-backup-restore images cannot be found in charts/images.yaml, see

images, err = imagevector.FindImages(im, imageNames)

Copy link
Contributor

Choose a reason for hiding this comment

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

So if the images cannot be found, re-queue will also never help, so continuously re-queueing will block on worker all the time with no real advantage. Is there any alert raised?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, you are right. I added a TODO that this is supposed to be part of a validating webhook. No, there is no alert but the error message is put to etcd.status.lastError.


if etcd.Spec.Backup.Image == nil {
if etcdBackupImage == "" {
return nil, nil, fmt.Errorf("either etcd resource or image vector should have %s image while deploying statefulset", common.BackupRestore)
Copy link
Contributor

Choose a reason for hiding this comment

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

This will result in re-queueing of request and since the image is now nil this will keep getting re-queued right?

@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 Jul 29, 2022
@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 Jul 29, 2022
@timuthy
Copy link
Member

timuthy commented Jul 29, 2022

Thanks for your valuable feedback @unmarshall. I addressed most of the points in 9d31a98 and replied to the rest of the comments.

Copy link
Contributor

@unmarshall unmarshall 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/changes Needs (more) changes needs/review Needs review needs/second-opinion Needs second review by someone else labels Aug 1, 2022
@timuthy timuthy dismissed stale reviews from shreyas-s-rao and aaronfern August 3, 2022 09:00

Comments resolved.

@timuthy timuthy merged commit de66db1 into gardener:master Aug 3, 2022
@gardener-robot gardener-robot added the status/closed Issue is closed (either delivered or triaged) label Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/robustness Robustness, reliability, resilience 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) status/closed Issue is closed (either delivered or triaged)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants