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

Add retry for opensearch client creation in ISM Policy reconciler #805

Merged
merged 2 commits into from
May 13, 2024

Conversation

nilushancosta
Copy link
Contributor

Description

Add retry for opensearch client creation in ISM policy reconciler to fix panic
Minor change - Remove extra whitespace in developing.md file

Issues Resolved

Resolves #801

Check List

  • Commits are signed per the DCO using --signoff
  • Unittest added for the new/changed functionality and all unit tests are successful
  • Customer-visible features documented
  • No linter warnings (make lint)

If CRDs are changed:

  • CRD YAMLs updated (make manifests) and also copied into the helm chart
  • Changes to CRDs documented

Please refer to the PR guidelines before submitting this pull request.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

2. Remove extra whitespace in copy command in developing.md

Signed-off-by: Nilushan Costa <[email protected]>
@nilushancosta nilushancosta force-pushed the ismpolicy-panic-fix branch from 854e1dd to 1eefddd Compare May 7, 2024 08:23
@nilushancosta
Copy link
Contributor Author

As part of this fix, I modified 2 files; opensearch-operator/pkg/reconcilers/ismpolicy.go and docs/developing.md. However when I executed make build manifests, other files also got modified automatically. Since these modifications included changes to the CRD YAMLs, I copied them to the Helm chart as per the instructions in the developer guide. Please let me know if what I did is correct

Copy link
Collaborator

@swoehrl-mw swoehrl-mw left a comment

Choose a reason for hiding this comment

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

Hi @nilushancosta. Thanks for contributing this fix.

Not sure why there were changes in the CRD yamls, these should have already been done in the PR where the corresponding code change was introduced. No idea how that slipped through.
In the end, not your fault or problem, you did the copying correctly.

@@ -146,6 +146,7 @@ func (r *IsmPolicyReconciler) Reconcile() (retResult ctrl.Result, retErr error)
if err != nil {
reason := "error creating opensearch client"
r.recorder.Event(r.instance, "Warning", opensearchError, reason)
return ctrl.Result{Requeue: true, RequeueAfter: 30 * time.Second}, err
Copy link
Collaborator

Choose a reason for hiding this comment

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

The correct way here is to set retResult and retErr as the defer logic will use that to set a corresponding status in kubernetes. Similar to how the blocks above do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback. I updated the PR

@swoehrl-mw
Copy link
Collaborator

@nilushancosta On second thought, please remove all the crd yaml changes from the PR (from the chart and the config/crd/bases folder), we'll deal with that separately since the wrong field name (timestamp_field vs timestampField) in the YAMLs is already part of the 2.6.0 release so cannot be changed without causing inconsistencies.

cc @prudhvigodithi @salyh

@nilushancosta nilushancosta force-pushed the ismpolicy-panic-fix branch from d2da79d to 283eb68 Compare May 11, 2024 17:49
@nilushancosta
Copy link
Contributor Author

@nilushancosta On second thought, please remove all the crd yaml changes from the PR (from the chart and the config/crd/bases folder), we'll deal with that separately since the wrong field name (timestamp_field vs timestampField) in the YAMLs is already part of the 2.6.0 release so cannot be changed without causing inconsistencies.

cc @prudhvigodithi @salyh

Updated the PR by removing them

@nilushancosta nilushancosta requested a review from swoehrl-mw May 11, 2024 17:50
@swoehrl-mw swoehrl-mw merged commit ea46394 into opensearch-project:main May 13, 2024
8 checks passed
swoehrl-mw added a commit that referenced this pull request May 14, 2024
### Description
Due to some oversight the timestampField from
https://github.com/opensearch-project/opensearch-k8s-operator/blob/main/opensearch-operator/api/v1/opensearch_index_types.go#L14
was released as `timestamp_field` in the helm chart
(https://github.com/opensearch-project/opensearch-k8s-operator/blob/v2.6.0/charts/opensearch-operator/files/opensearch.opster.io_opensearchindextemplates.yaml#L57).
To prevent an incompatible renaming in the released CRDs this PR renames
the field in the code to be consistent.

### Issues Resolved
Originally discovered in #805 

### Check List
- [x] Commits are signed per the DCO using --signoff 
- [x] Unittest added for the new/changed functionality and all unit
tests are successful
- [x] Customer-visible features documented
- [x] No linter warnings (`make lint`)

If CRDs are changed:
- [-] CRD YAMLs updated (`make manifests`) and also copied into the helm
chart
- [-] Changes to CRDs documented

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

Signed-off-by: Sebastian Woehrl <[email protected]>
swoehrl-mw added a commit to swoehrl-mw/opensearch-k8s-operator that referenced this pull request May 16, 2024
…#810)

### Description
Due to some oversight the timestampField from
https://github.com/opensearch-project/opensearch-k8s-operator/blob/main/opensearch-operator/api/v1/opensearch_index_types.go#L14
was released as `timestamp_field` in the helm chart
(https://github.com/opensearch-project/opensearch-k8s-operator/blob/v2.6.0/charts/opensearch-operator/files/opensearch.opster.io_opensearchindextemplates.yaml#L57).
To prevent an incompatible renaming in the released CRDs this PR renames
the field in the code to be consistent.

### Issues Resolved
Originally discovered in opensearch-project#805

### Check List
- [x] Commits are signed per the DCO using --signoff
- [x] Unittest added for the new/changed functionality and all unit
tests are successful
- [x] Customer-visible features documented
- [x] No linter warnings (`make lint`)

If CRDs are changed:
- [-] CRD YAMLs updated (`make manifests`) and also copied into the helm
chart
- [-] Changes to CRDs documented

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

Signed-off-by: Sebastian Woehrl <[email protected]>
(cherry picked from commit f3455f9)
swoehrl-mw pushed a commit to swoehrl-mw/opensearch-k8s-operator that referenced this pull request May 16, 2024
…ensearch-project#805)

### Description
Add retry for opensearch client creation in ISM policy reconciler to fix
panic
Minor change - Remove extra whitespace in developing.md file

### Issues Resolved
Resolves
opensearch-project#801

### Check List
- [x] Commits are signed per the DCO using --signoff
- [ ] Unittest added for the new/changed functionality and all unit
tests are successful
- [ ] Customer-visible features documented
- [x] No linter warnings (`make lint`)

If CRDs are changed:
- [ ] CRD YAMLs updated (`make manifests`) and also copied into the helm
chart
- [ ] Changes to CRDs documented

Please refer to the [PR
guidelines](https://github.com/opensearch-project/opensearch-k8s-operator/blob/main/docs/developing.md#submitting-a-pr)
before submitting this pull request.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

---------

Signed-off-by: Nilushan Costa <[email protected]>
(cherry picked from commit ea46394)
swoehrl-mw pushed a commit that referenced this pull request Jun 18, 2024
### Description
Add retry for opensearch client creation in ISM policy reconciler to fix
panic
Minor change - Remove extra whitespace in developing.md file

### Issues Resolved
Resolves
#801

### Check List
- [x] Commits are signed per the DCO using --signoff
- [ ] Unittest added for the new/changed functionality and all unit
tests are successful
- [ ] Customer-visible features documented
- [x] No linter warnings (`make lint`)

If CRDs are changed:
- [ ] CRD YAMLs updated (`make manifests`) and also copied into the helm
chart
- [ ] Changes to CRDs documented

Please refer to the [PR
guidelines](https://github.com/opensearch-project/opensearch-k8s-operator/blob/main/docs/developing.md#submitting-a-pr)
before submitting this pull request.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

---------

Signed-off-by: Nilushan Costa <[email protected]>
(cherry picked from commit ea46394)
swoehrl-mw added a commit that referenced this pull request Jun 18, 2024
### Description
Due to some oversight the timestampField from
https://github.com/opensearch-project/opensearch-k8s-operator/blob/main/opensearch-operator/api/v1/opensearch_index_types.go#L14
was released as `timestamp_field` in the helm chart
(https://github.com/opensearch-project/opensearch-k8s-operator/blob/v2.6.0/charts/opensearch-operator/files/opensearch.opster.io_opensearchindextemplates.yaml#L57).
To prevent an incompatible renaming in the released CRDs this PR renames
the field in the code to be consistent.

### Issues Resolved
Originally discovered in #805

### Check List
- [x] Commits are signed per the DCO using --signoff
- [x] Unittest added for the new/changed functionality and all unit
tests are successful
- [x] Customer-visible features documented
- [x] No linter warnings (`make lint`)

If CRDs are changed:
- [-] CRD YAMLs updated (`make manifests`) and also copied into the helm
chart
- [-] Changes to CRDs documented

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

Signed-off-by: Sebastian Woehrl <[email protected]>
(cherry picked from commit f3455f9)
swoehrl-mw pushed a commit to MaibornWolff/opensearch-operator that referenced this pull request Jul 2, 2024
…ensearch-project#805)

### Description
Add retry for opensearch client creation in ISM policy reconciler to fix
panic
Minor change - Remove extra whitespace in developing.md file

### Issues Resolved
Resolves
opensearch-project#801

### Check List
- [x] Commits are signed per the DCO using --signoff
- [ ] Unittest added for the new/changed functionality and all unit
tests are successful
- [ ] Customer-visible features documented
- [x] No linter warnings (`make lint`)

If CRDs are changed:
- [ ] CRD YAMLs updated (`make manifests`) and also copied into the helm
chart
- [ ] Changes to CRDs documented

Please refer to the [PR
guidelines](https://github.com/opensearch-project/opensearch-k8s-operator/blob/main/docs/developing.md#submitting-a-pr)
before submitting this pull request.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

---------

Signed-off-by: Nilushan Costa <[email protected]>
(cherry picked from commit ea46394)
swoehrl-mw added a commit to MaibornWolff/opensearch-operator that referenced this pull request Jul 2, 2024
…#810)

### Description
Due to some oversight the timestampField from
https://github.com/opensearch-project/opensearch-k8s-operator/blob/main/opensearch-operator/api/v1/opensearch_index_types.go#L14
was released as `timestamp_field` in the helm chart
(https://github.com/opensearch-project/opensearch-k8s-operator/blob/v2.6.0/charts/opensearch-operator/files/opensearch.opster.io_opensearchindextemplates.yaml#L57).
To prevent an incompatible renaming in the released CRDs this PR renames
the field in the code to be consistent.

### Issues Resolved
Originally discovered in opensearch-project#805

### Check List
- [x] Commits are signed per the DCO using --signoff
- [x] Unittest added for the new/changed functionality and all unit
tests are successful
- [x] Customer-visible features documented
- [x] No linter warnings (`make lint`)

If CRDs are changed:
- [-] CRD YAMLs updated (`make manifests`) and also copied into the helm
chart
- [-] Changes to CRDs documented

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

Signed-off-by: Sebastian Woehrl <[email protected]>
(cherry picked from commit f3455f9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] OpenSearch operator panics and crashes when adding an OpenSearchISMPolicy
2 participants