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

Refactor components to use default labels and owner references from etcd #559

Merged

Conversation

seshachalam-yv
Copy link
Contributor

@seshachalam-yv seshachalam-yv commented Mar 18, 2023

How to categorize this PR?

/area robustness
/kind enhancement

What this PR does / why we need it:

This PR refactors below components to use default labels and owner references from etcd.

  • statefulset
  • service
  • poddisruptionbudget
  • lease
  • configmap

To get default labels and ownerreferences for etcd, introduced two functions

  • GetDefaultLabels returns the default labels for etcd.
  • GetEtcdAsOwnerReference returns an OwnerReference object that represents the etcd

In addition, the configmap component has been further improved with the addition of a new function called getEtcdConfigYaml. This function helps to formulate the configmap in a more efficient way.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:
cc: @unmarshall

Release note:

Refactored `statefulset`, `service`, `poddisruptionbudget`, `lease`, and `configmap` components to use default labels and owner references from `etcd`.

@seshachalam-yv seshachalam-yv requested a review from a team as a code owner March 18, 2023 08:17
@gardener-robot gardener-robot added area/robustness Robustness, reliability, resilience related kind/enhancement Enhancement, improvement, extension 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 Mar 18, 2023
@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) 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 Mar 18, 2023
api/v1alpha1/types_etcd.go Outdated Show resolved Hide resolved
pkg/component/etcd/configmap/configmap.go Outdated Show resolved Hide resolved
)

// GenerateValues generates `lease.Values` for the lease component with the given parameters.
// GenerateValues generates `lease.Values` for the lease component
func GenerateValues(etcd *druidv1alpha1.Etcd) Values {
return Values{
BackupEnabled: etcd.Spec.Backup.Store != nil,
EtcdName: etcd.Name,
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that in the other components, this is changed to Name. Can you do this here too?

@gardener-robot gardener-robot added the needs/changes Needs (more) changes label Mar 18, 2023
@gardener-robot gardener-robot added the needs/rebase Needs git rebase label Apr 5, 2023
@gardener-robot
Copy link

@seshachalam-yv You need rebase this pull request with latest master branch. Please check.

@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 Apr 5, 2023
@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 Apr 5, 2023
@seshachalam-yv
Copy link
Contributor Author

/invite @abdasgupta

@gardener-robot
Copy link

@abdasgupta You have pull request review open invite, please check

@seshachalam-yv
Copy link
Contributor Author

seshachalam-yv commented Apr 17, 2023

/hold Until I address this review comment #539 (comment)

@gardener-robot gardener-robot added the reviewed/do-not-merge Has no approval for merging as it may break things, be of poor quality or have (ext.) dependencies label Apr 17, 2023
@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) 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 Apr 19, 2023
@seshachalam-yv
Copy link
Contributor Author

seshachalam-yv commented Apr 19, 2023

/unhold PR is ready for review @unmarshall @shreyas-s-rao @aaronfern @abdasgupta

@gardener-robot gardener-robot removed the reviewed/do-not-merge Has no approval for merging as it may break things, be of poor quality or have (ext.) dependencies label Apr 19, 2023
Copy link
Contributor

@shreyas-s-rao shreyas-s-rao left a comment

Choose a reason for hiding this comment

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

@seshachalam-yv thanks a lot for the well-written PR, and apologies for the late review. I have a few nits to be addressed, but overall LGTM 👍

pkg/utils/statefulset.go Show resolved Hide resolved
pkg/component/etcd/service/values.go Outdated Show resolved Hide resolved
pkg/component/etcd/statefulset/values_helper.go Outdated Show resolved Hide resolved
pkg/component/etcd/statefulset/values.go Outdated Show resolved Hide resolved
pkg/component/etcd/lease/values.go Show resolved Hide resolved
pkg/component/etcd/lease/lease.go Show resolved Hide resolved
pkg/component/etcd/configmap/values.go Outdated Show resolved Hide resolved
pkg/component/etcd/configmap/configmap.go Show resolved Hide resolved
pkg/component/etcd/configmap/configmap.go Show resolved Hide resolved
Co-authored-by: Shreyas Rao <42259948+shreyas-s-rao@users.noreply.github.com>
@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 Jun 9, 2023
seshachalam-yv and others added 2 commits June 9, 2023 14:47
- Renamed field `PodAdditionalLabels` to `AdditionalPodLabels`.
Co-authored-by: Shreyas Rao <42259948+shreyas-s-rao@users.noreply.github.com>
@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 Jun 9, 2023
@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 Jun 9, 2023
@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 Jun 9, 2023
Copy link
Contributor

@shreyas-s-rao shreyas-s-rao left a comment

Choose a reason for hiding this comment

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

@seshachalam-yv Thanks for making all the requested changes!
/lgtm

@gardener-robot gardener-robot added reviewed/lgtm Has approval for merging and removed needs/second-opinion Needs second review by someone else labels Jun 9, 2023
@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 Jun 9, 2023
@seshachalam-yv seshachalam-yv merged commit 11f5ddd into gardener:master Jun 9, 2023
@seshachalam-yv seshachalam-yv deleted the refactor/pkg/components branch June 9, 2023 12:03
@gardener-robot gardener-robot added the status/closed Issue is closed (either delivered or triaged) label Jun 9, 2023
istvanballok added a commit to istvanballok/gardener that referenced this pull request Aug 18, 2023
The labels on the etcd service changed with
gardener/etcd-druid#559 that was introduced in
gardener#8299.

The `app` and `role` labels are no longer present on the service, but they are
still available on the pods.

So by using the pod's labels for the service discovery, we can restore the
previous behavior.

https://prometheus.io/docs/prometheus/latest/configuration/configuration/#endpoints
istvanballok added a commit to istvanballok/gardener that referenced this pull request Aug 18, 2023
The labels on the etcd service changed with
gardener/etcd-druid#559 that was introduced in
gardener#8299.

The `app` and `role` labels are no longer present on the service, but they are
still available on the pods.

So by using the pod's labels for the service discovery, we can restore the
previous behavior.

https://prometheus.io/docs/prometheus/latest/configuration/configuration/#endpoints

Co-authored-by: Istvan Zoltan Ballok <istvan.zoltan.ballok@sap.com>
Co-authored-by: Jeremy Rickards <jeremy.rickards@sap.com>
gardener-prow bot pushed a commit to gardener/gardener that referenced this pull request Aug 18, 2023
The labels on the etcd service changed with
gardener/etcd-druid#559 that was introduced in
#8299.

The `app` and `role` labels are no longer present on the service, but they are
still available on the pods.

So by using the pod's labels for the service discovery, we can restore the
previous behavior.

https://prometheus.io/docs/prometheus/latest/configuration/configuration/#endpoints

Co-authored-by: Jeremy Rickards <jeremy.rickards@sap.com>
gardener-ci-robot pushed a commit to gardener-ci-robot/gardener that referenced this pull request Aug 18, 2023
The labels on the etcd service changed with
gardener/etcd-druid#559 that was introduced in
gardener#8299.

The `app` and `role` labels are no longer present on the service, but they are
still available on the pods.

So by using the pod's labels for the service discovery, we can restore the
previous behavior.

https://prometheus.io/docs/prometheus/latest/configuration/configuration/#endpoints

Co-authored-by: Istvan Zoltan Ballok <istvan.zoltan.ballok@sap.com>
Co-authored-by: Jeremy Rickards <jeremy.rickards@sap.com>
gardener-prow bot pushed a commit to gardener/gardener that referenced this pull request Aug 18, 2023
The labels on the etcd service changed with
gardener/etcd-druid#559 that was introduced in
#8299.

The `app` and `role` labels are no longer present on the service, but they are
still available on the pods.

So by using the pod's labels for the service discovery, we can restore the
previous behavior.

https://prometheus.io/docs/prometheus/latest/configuration/configuration/#endpoints

Co-authored-by: Istvan Zoltan Ballok <istvan.zoltan.ballok@sap.com>
Co-authored-by: Jeremy Rickards <jeremy.rickards@sap.com>
briantopping pushed a commit to briantopping/gardener that referenced this pull request Aug 22, 2023
)

The labels on the etcd service changed with
gardener/etcd-druid#559 that was introduced in
gardener#8299.

The `app` and `role` labels are no longer present on the service, but they are
still available on the pods.

So by using the pod's labels for the service discovery, we can restore the
previous behavior.

https://prometheus.io/docs/prometheus/latest/configuration/configuration/#endpoints

Co-authored-by: Jeremy Rickards <jeremy.rickards@sap.com>
nickytd pushed a commit to nickytd/gardener that referenced this pull request Sep 11, 2023
)

The labels on the etcd service changed with
gardener/etcd-druid#559 that was introduced in
gardener#8299.

The `app` and `role` labels are no longer present on the service, but they are
still available on the pods.

So by using the pod's labels for the service discovery, we can restore the
previous behavior.

https://prometheus.io/docs/prometheus/latest/configuration/configuration/#endpoints

Co-authored-by: Jeremy Rickards <jeremy.rickards@sap.com>
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 reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) 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.

9 participants