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 Role Helm charts into component #538

Merged
merged 4 commits into from
Apr 11, 2023

Conversation

seshachalam-yv
Copy link
Contributor

@seshachalam-yv seshachalam-yv commented Feb 27, 2023

How to categorize this PR?

/area robustness
/kind enhancement

What this PR does / why we need it:
This PR refactors the Etcd-druid Role helm charts in Golang component and adds unit tests.

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

Special notes for your reviewer:

Release note:

Eliminated `Role` helm charts and converted into Golang component with added unit tests.

@seshachalam-yv seshachalam-yv requested a review from a team as a code owner February 27, 2023 12:25
@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 Feb 27, 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 Feb 27, 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) 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 Feb 28, 2023
@@ -64,3 +71,17 @@ func GetDeltaSnapshotLeaseName(etcd *druidv1alpha1.Etcd) string {
func GetFullSnapshotLeaseName(etcd *druidv1alpha1.Etcd) string {
return fmt.Sprintf("%s-full-snap", etcd.Name)
}

// GenerateEtcdOwnerReference generates an OwnerReference for an etcd object that can be used to set it as the owner of other objects.
func GenerateEtcdOwnerReference(etcd *druidv1alpha1.Etcd) []metav1.OwnerReference {
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not belong here. Can you move it to miscellaneous.go for now?

@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 Feb 28, 2023
@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 Feb 28, 2023
@seshachalam-yv seshachalam-yv changed the title Add role component Refactor Role Helm charts into component Feb 28, 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) 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 1, 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 Mar 1, 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 Mar 13, 2023
@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 Mar 13, 2023
@aaronfern aaronfern linked an issue Mar 20, 2023 that may be closed by this pull request
8 tasks
@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 10, 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 addressing my comments. Please address the changes mentioned for introducing a BeforeEach() section in pkg/component/etcd/serviceaccount/values_helper_test.go in a separate PR as mentioned.
/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 Apr 10, 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 Apr 10, 2023
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.

Looks good, i have added some minor comments

api/v1alpha1/types_etcd.go Show resolved Hide resolved
pkg/component/etcd/role/values_helper_test.go Show resolved Hide resolved
@gardener-robot gardener-robot added needs/second-opinion Needs second review by someone else and removed reviewed/lgtm Has approval for merging labels Apr 11, 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 Apr 11, 2023
- Remove Role from template yaml from chart
- Add utils function `GetRoleName`
- Removed old `reconcileRole`
- Add unit tests for Role component
- `GetPeerServiceName`
- `GetClientServiceName`
- `GetServiceAccountName`
- `GetConfigmapName`
- `GetCompactionJobName`
- `GetOrdinalPodName`
- `GetDeltaSnapshotLeaseName`
- `GetFullSnapshotLeaseName`
- `GetDefaultLabels`
- `GetAsOwnerReference`
- `GetRoleName`
@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 Apr 11, 2023
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/second-opinion Needs second review by someone else labels Apr 11, 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 Apr 11, 2023
@seshachalam-yv seshachalam-yv merged commit ebc8311 into gardener:master Apr 11, 2023
@seshachalam-yv seshachalam-yv deleted the feat/role-component branch April 11, 2023 06:50
@gardener-robot gardener-robot added the status/closed Issue is closed (either delivered or triaged) label Apr 11, 2023
seshachalam-yv added a commit to seshachalam-yv/etcd-druid that referenced this pull request Apr 19, 2023
seshachalam-yv added a commit to seshachalam-yv/etcd-druid that referenced this pull request May 31, 2023
seshachalam-yv added a commit that referenced this pull request Jun 9, 2023
…etcd` (#559)

* Refactor: Update `configmap` component to use default labels and owner references from `etcd`.

This commit refactors the `configmap` component to use the default labels and owner references provided by etcd. Specifically, we removed the functions `getOwnerReferences` and `getObjectMeta`, and instead used the `GetEtcdAsOwnerReference` and `GetDefaultLabels` functions.

In addition, we improved the formulation of the configmap by adding a new function called `getEtcdConfigYaml`.

* Refactor: Update `lease` component to use default labels and owner references from `etcd`.

This commit refactors the `lease` component to use the default labels and owner references provided by etcd. Specifically, we removed the functions `getOwnerReferences`, and instead used the `GetEtcdAsOwnerReference` and `GetDefaultLabels` functions.

* Refactor: Update `poddisruptionbudget` component to use default labels and owner references from `etcd`.

This commit refactors the `poddisruptionbudget` component to use the default labels and owner references provided by etcd. Specifically, we removed the functions `getOwnerReferences`, and instead used the `GetEtcdAsOwnerReference` and `GetDefaultLabels` functions.

* Refactor: Update `service` component to use default labels and owner references from `etcd`.

This commit refactors the `service` component to use the default labels and owner references provided by etcd. Specifically, removed the functions `getOwnerReferences`, `getSelectors`, `getLabels` and instead used the `GetEtcdAsOwnerReference` and `GetDefaultLabels` functions.

* Refactor: Update `statefulset` component to use default labels and owner references from `etcd`.

This commit refactors the `statefulset` component to use the default labels and owner references provided by etcd. Specifically, removed the functions `getCommonLabels` and instead used the `GetAsOwnerReference` and `GetDefaultLabels` functions.

Fix intergration test

rebase with master

* Updated the E2E test suite to use the appropriate component names.

* Addressed review comment from Madhav about OwnerReferences.

This commit addresses the review comment #539 (comment)

* This commit addresses the review comment from Shreyas about improving the service account test in response to #538 (review)

* Refactor API version to use 'druidv1alpha1.GroupVersion.String()' instead of the static string 'druid.gardener.cloud/v1alpha1

* Addressed review comment

- Updated function `GetAsOwnerReference to return metav1.OwnerReference instead of *metav1.OwnerReference

* Renamed function name checkConfigmap to checkConfigMap

* Renamed ServerPort to PeerPort

* Removed arguments of emptyPodDisruptionBudget and reused name, namespace from component's value

* Constructing a etcdconfig YAML using strut instead of string string concatenation

* Used default labels for lease component

* Update log message with OwnerReference <name>:<uid>

* make revendor

* fix failing test

* Removed checkPDBMetadata function

* minor refactoring to configmap component

* Removed JSON tags

* Rebase with master

* Fix integration test

* Fix failing test

* Apply suggestions from code review

Co-authored-by: Aaron Francis Fernandes <79958509+aaronfern@users.noreply.github.com>

* Addressed review feedback

* Apply suggestions from code review

Co-authored-by: Shreyas Rao <42259948+shreyas-s-rao@users.noreply.github.com>

* Addressed review comment
- Renamed field `PodAdditionalLabels` to `AdditionalPodLabels`.

* Update pkg/component/etcd/configmap/values.go

Co-authored-by: Shreyas Rao <42259948+shreyas-s-rao@users.noreply.github.com>

* Fixed typo

---------

Co-authored-by: Madhav Bhargava <madhav.bhargava@sap.com>
Co-authored-by: Aaron Francis Fernandes <79958509+aaronfern@users.noreply.github.com>
Co-authored-by: Shreyas Rao <42259948+shreyas-s-rao@users.noreply.github.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.

None yet

7 participants