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

disable replicas reconciliation when annotation is present #736

Merged
merged 7 commits into from
Jun 1, 2022

Conversation

MStokluska
Copy link
Contributor

@MStokluska MStokluska commented Apr 14, 2022

This resolves the https://issues.redhat.com/browse/THREESCALE-8374

Verification

  • deploy 3scale
  • add annotation to the apiManager
  1. "apps.3scale.net/disable-apicast-production-replica-reconciler": "true"

  2. confirm that the apicast production replicas aren't synced anymore then set the above annotation to false and confirm that syncing is back on.

  3. "apps.3scale.net/disable-apicast-staging-replica-reconciler": "true"

  4. confirm that the apicast staging isn't synced anymore then set the above annotation to false and confirm that syncing is back on.

  5. "apps.3scale.net/disable-backend-listener-replica-reconciler": "true"

  6. confirm that the backend listeners aren't synced anymore then set the above annotation to false and confirm that syncing is back on.

  7. "apps.3scale.net/disable-backend-worker-replica-reconciler": "true"

  8. confirm that the backend workers aren't synced anymore then set the above annotation to false and confirm that syncing is back on.

  9. "apps.3scale.net/disable-cron-replica-reconciler": "true"

  10. confirm that the backend cron aren't synced anymore then set the above annotation to false and confirm that syncing is back on.

Revert updates to APIManager annotations and confirm that replicas syncing is back working.

Copy link
Member

@eguzki eguzki left a comment

Choose a reason for hiding this comment

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

You have only changed the mutators, which only applies when the objects exist in the cluster.

If you create the APIManager withh replicas set to some number, the deploymentconfig replicas will be set to that number as well. Then changes in the replica fields will not be reconciled. I would also set initial replicas to 1 if the annotation exists.

It also makes me feel uneasy that only backend (listernet, worker) and apicast (prodcution) deployment mutators are being conditioned by the annotation. Why not all of them? I see two options to be consistent.

  • the annotation afffects to all replicas
  • we have component specific annotation, for instance: apps.3scale.net/apicast-replica-field: false
    wdyt?

pkg/3scale/amp/operator/apicast_reconciler.go Outdated Show resolved Hide resolved
pkg/3scale/amp/operator/apicast_reconciler.go Outdated Show resolved Hide resolved
@MStokluska
Copy link
Contributor Author

Hey @eguzki I think this is ready for a review again. I still have to test it locally but I think the general flow should make more sense now.

@thomasmaas thomasmaas changed the title disable replicas reconiliation when annotation is present disable replicas reconciliation when annotation is present May 18, 2022
@den-rgb
Copy link

den-rgb commented May 30, 2022

/lgtm

@den-rgb
Copy link

den-rgb commented May 30, 2022

Looks good and code works as expected, pod count did not change until set to false.

pkg/3scale/amp/operator/apicast_reconciler.go Outdated Show resolved Hide resolved
pkg/3scale/amp/operator/apicast_reconciler.go Outdated Show resolved Hide resolved
pkg/3scale/amp/operator/backend_reconciler.go Outdated Show resolved Hide resolved
pkg/3scale/amp/operator/system_reconciler.go Outdated Show resolved Hide resolved
pkg/3scale/amp/operator/zync_reconciler.go Outdated Show resolved Hide resolved
pkg/reconcilers/deploymentconfig.go Outdated Show resolved Hide resolved
pkg/reconcilers/deploymentconfig.go Outdated Show resolved Hide resolved
@eguzki
Copy link
Member

eguzki commented May 31, 2022

missing doc that should be here

@codeclimate
Copy link

codeclimate bot commented Jun 1, 2022

Code Climate has analyzed commit db431de and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.

Copy link
Member

@eguzki eguzki left a comment

Choose a reason for hiding this comment

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

looking good 👍

@@ -730,6 +731,9 @@ func TestApicastServicePortMutator(t *testing.T) {
if err := grafanav1alpha1.AddToScheme(s); err != nil {
t.Fatal(err)
}
if err := configv1.AddToScheme(s); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

is it really needed? I do not see why

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been added due to an error when it's not present:

FAIL: TestApicastServicePortMutator (0.00s)
    /home/mstokluska/dev/3scale-operator/pkg/3scale/amp/operator/apicast_reconciler_test.go:749: no kind is registered for the type v1.ClusterVersion in scheme "pkg/runtime/scheme.go:101"
    --- FAIL: TestApicastServicePortMutator/annotationTrue
    ```

@eguzki eguzki merged commit 1b2b6cf into 3scale:master Jun 1, 2022
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.

3 participants