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
Fix external resources updation when json input change #1286
Fix external resources updation when json input change #1286
Conversation
|
Hi @aruniiird. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/ok-to-test |
| r.Log.Info("Monitoring Information found. Monitoring will be enabled on the external cluster.", "StorageCluster", klog.KRef(instance.Namespace, instance.Name)) | ||
| r.monitoringIP = monitoringIP | ||
| // for any other CephCluster resource, developer has to handle | ||
| return fmt.Errorf("CephCluster Resource named: %q, is not taken care of", d.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really need this? IMO we can drop it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, don't do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| // nothing to be done here, | ||
| // as all the validation will be done in CephCluster creation | ||
| if d.Name == "monitoring-endpoint" { | ||
| continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not do the validations here?
Is there a benefit in moving it to CephCluster creation block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC this PR fixes a particular bug, so we should avoid making unrelated changes (in case we need to backport and maintain). Refactors should be kept separate from bug fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the most part I agree. Specifically, the main thing I wanna see when moving code around are two commits, one for the actual logic changes and one for moving it to its new location. These two can come in any order, as makes sense for the task.
That said, while this commit is very nice to have, it seems rather destabilizing for something that I don't think is a blocker for feature freeze. If possible, move these changes to a separate PR so we can evaluate what the minimum number of changes actually is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved the functionality to a different PR.
IMO we should not be doing the verification/validation at one function and use it entirely in a different function (expecting the first function to be called as the second function is not directly calling the first function).
Let me know we really want to put the verification/validation in the previous place.
There is always a question why not use it in TWO places. But our current testing workflow prevents it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will create a backport manually once it is merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| @@ -369,37 +386,51 @@ func (r *StorageClusterReconciler) createExternalStorageClusterResources(instanc | |||
| } | |||
|
|
|||
| // createExternalStorageClusterConfigMap creates configmap for external cluster | |||
| func (r *StorageClusterReconciler) createExternalStorageClusterConfigMap(cm *corev1.ConfigMap, found *corev1.ConfigMap, objectKey types.NamespacedName) error { | |||
| func (r *StorageClusterReconciler) createExternalStorageClusterConfigMap(cm, found *corev1.ConfigMap, objectKey types.NamespacedName) error { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the original signature as it is easier to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| return err | ||
| } | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| // createExternalStorageClusterSecret creates secret for external cluster | ||
| func (r *StorageClusterReconciler) createExternalStorageClusterSecret(sec *corev1.Secret, found *corev1.Secret, objectKey types.NamespacedName) error { | ||
| func (r *StorageClusterReconciler) createExternalStorageClusterSecret(sec, found *corev1.Secret, objectKey types.NamespacedName) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the original signature - it is easier to read and understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
Please provide more details in the commit message - it is not clear what problem the PR is fixing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed on all current change requests. The implementation itself seems fairly solid, but I want to exercise some discipline in avoiding unnecessary refactoring when resolving specific critical issues.
| r.Log.Info("Monitoring Information found. Monitoring will be enabled on the external cluster.", "StorageCluster", klog.KRef(instance.Namespace, instance.Name)) | ||
| r.monitoringIP = monitoringIP | ||
| // for any other CephCluster resource, developer has to handle | ||
| return fmt.Errorf("CephCluster Resource named: %q, is not taken care of", d.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, don't do this.
| @@ -369,37 +386,51 @@ func (r *StorageClusterReconciler) createExternalStorageClusterResources(instanc | |||
| } | |||
|
|
|||
| // createExternalStorageClusterConfigMap creates configmap for external cluster | |||
| func (r *StorageClusterReconciler) createExternalStorageClusterConfigMap(cm *corev1.ConfigMap, found *corev1.ConfigMap, objectKey types.NamespacedName) error { | |||
| func (r *StorageClusterReconciler) createExternalStorageClusterConfigMap(cm, found *corev1.ConfigMap, objectKey types.NamespacedName) error { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| return err | ||
| } | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| // createExternalStorageClusterSecret creates secret for external cluster | ||
| func (r *StorageClusterReconciler) createExternalStorageClusterSecret(sec *corev1.Secret, found *corev1.Secret, objectKey types.NamespacedName) error { | ||
| func (r *StorageClusterReconciler) createExternalStorageClusterSecret(sec, found *corev1.Secret, objectKey types.NamespacedName) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| // nothing to be done here, | ||
| // as all the validation will be done in CephCluster creation | ||
| if d.Name == "monitoring-endpoint" { | ||
| continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the most part I agree. Specifically, the main thing I wanna see when moving code around are two commits, one for the actual logic changes and one for moving it to its new location. These two can come in any order, as makes sense for the task.
That said, while this commit is very nice to have, it seems rather destabilizing for something that I don't think is a blocker for feature freeze. If possible, move these changes to a separate PR so we can evaluate what the minimum number of changes actually is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aruniiird
This PR does a bug fix and refactors.
I suggest we separate refactor into a different PR.
Keep this PR limited to the fix and include changes from #1285 as a separate commit if it makes sense.
a42cf4c
to
13087d5
Compare
13087d5
to
efc5181
Compare
…unction Signed-off-by: Arun Kumar Mohan <amohan@redhat.com>
efc5181
to
bc3d9bd
Compare
Previously external cluster's monitoring endpoints were attached to Reconcile object's variables and passed to other parts of the code. Now, we are retrieving the Monitoring endpoint details, directly from the external cluster secret, while creating the CephCluster and do all the verifications. Signed-off-by: Arun Kumar Mohan <amohan@redhat.com>
When the JSON input changes, OCS-Operator should update the external cluster resources. Signed-off-by: Arun Kumar Mohan <amohan@redhat.com>
bc3d9bd
to
d65b4a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
| // nothing to be done here, | ||
| // as all the validation will be done in CephCluster creation | ||
| if d.Name == "monitoring-endpoint" { | ||
| continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
/test ocs-operator-ci |
|
/retest |
|
/retest-required Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
|
/retest-required Please review the full test history for this PR and help us cut down flakes. |
|
/retest-required cancel |
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
|
The ocs-operator-ci was reliably failing on the KMS unit tests because of that one persistent flake with being unable to connect to localhost. I added some commits that hopefully resolve that once and for all. |
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
718ffc8
to
cc07d5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jarrpa The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
Created a release 4.8 backport PR: #1319 |
|
/test ocs-operator-ci |
|
/retest-required Please review the full test history for this PR and help us cut down flakes. |
|
e2e tests passed, but retest-required is messing things up.... overriding the results. /override ci/prow/ocs-operator-bundle-e2e-aws |
|
@jarrpa: Overrode contexts on behalf of jarrpa: ci/prow/ocs-operator-bundle-e2e-aws In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This PR make sure that when JSON input is changed, corresponding external cluster resources also get updated.
This is on top of PR:#1286 .