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

Display a deprecated message when Service uses plugin deployment #1391

Merged
merged 4 commits into from
Dec 13, 2019

Conversation

duduribeiro
Copy link
Contributor

@duduribeiro duduribeiro commented Oct 31, 2019

THREESCALE-2395

Our plugin deployment option is deprecated. To avoid needing some data migration in database, this commit sets the deployment option as hosted if the current option is set to plugins and also displays a message to the user to update their configuration.

Screenshot 2019-11-04 21 12 35

@duduribeiro duduribeiro force-pushed the add_warning_for_plugin_deployment branch 2 times, most recently from 9d47b95 to 0a41e06 Compare October 31, 2019 19:06
@codecov
Copy link

codecov bot commented Oct 31, 2019

Codecov Report

Merging #1391 into master will increase coverage by 2.28%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1391      +/-   ##
==========================================
+ Coverage   89.77%   92.05%   +2.28%     
==========================================
  Files        2185     2392     +207     
  Lines       67076    76259    +9183     
==========================================
+ Hits        60215    70203    +9988     
+ Misses       6861     6056     -805
Impacted Files Coverage Δ
test/unit/helpers/services_helper_test.rb 100% <ø> (ø) ⬆️
app/models/service.rb 93.63% <100%> (+0.11%) ⬆️
test/unit/service_test.rb 100% <100%> (ø) ⬆️
...developer_portal/admin/account/ogone_controller.rb 93.75% <0%> (-6.25%) ⬇️
app/models/forum.rb 88.88% <0%> (-0.4%) ⬇️
...user-management-api/services/mapping_rules_test.rb 100% <0%> (ø) ⬆️
app/lib/backend_api_logic/routing_policy.rb 100% <0%> (ø) ⬆️
...loper_portal/buyer/account_contracts_controller.rb 91.66% <0%> (ø) ⬆️
...ration/buyers/service_contracts_controller_test.rb 100% <0%> (ø) ⬆️
...developer_portal/admin/accounts_controller_test.rb 100% <0%> (ø) ⬆️
... and 997 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14c3334...9f6d191. Read the comment docs.

@duduribeiro duduribeiro changed the title [wip] Display a deprecated message when Service uses plugin deployment Oct 31, 2019
@duduribeiro duduribeiro force-pushed the add_warning_for_plugin_deployment branch from 0a41e06 to f6c5bef Compare October 31, 2019 19:09
@duduribeiro duduribeiro requested review from thomasmaas and a team October 31, 2019 19:10
@duduribeiro duduribeiro self-assigned this Oct 31, 2019
@duduribeiro duduribeiro marked this pull request as ready for review October 31, 2019 19:11
@duduribeiro duduribeiro force-pushed the add_warning_for_plugin_deployment branch from f6c5bef to a8a2f91 Compare November 1, 2019 14:06
@duduribeiro duduribeiro changed the title Display a deprecated message when Service uses plugin deployment [wip] Display a deprecated message when Service uses plugin deployment Nov 4, 2019
@thomasmaas thomasmaas force-pushed the add_warning_for_plugin_deployment branch from c1d0fb8 to 9c3db75 Compare November 4, 2019 20:14

# TODO: Remove this when no one use plugins
def deployment_option
return 'hosted' if plugin_deployment?
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be self_managed
People using plugin do not really have any apicast in front. It would enforce them to have one hosted
Also zync will create a route automatically in OpenShift if it is hosted

Copy link
Member

Choose a reason for hiding this comment

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

I’d say the logical setting is what you get out of the box when you install 3scale. That would be 3scale managed. Other question is if it would work.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK but anyway there are many references to deployment_option in the code
I'd prefer just updating the database and remove the plugins from the code.

For example, I do not know if we will show the policies or the mapping rules because of this change.

Copy link
Member

Choose a reason for hiding this comment

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

This is an effort to have something for 2.7.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, everything is shown as if 3scale managed APIcast was being used. And when the customer clicks ok, setting will actually be updated in db. I agree this is not the final solution but it is kind of a nice in between with heads up to customer. Next step is remove all of it.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove the code later but a data migration (DML) should be done IMO
Anyway plugins are not shown anymore right?

Copy link
Contributor

Choose a reason for hiding this comment

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

They are still shown (I just verified), deprecation notice was already issued long time ago. This is adding more work and has really unknown behaviours

Also this undesirable behaviour is worse than leaving it there: Zync will just create routes if it is hosted unlike before while it was still plugin.

If we just display the message and not touch the deployment_option method I would merge the PR.

Copy link
Member

Choose a reason for hiding this comment

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

Why is it wrong that zync creates the routes? If they change to apicast because they want to that would also happen, no?

Copy link
Contributor

@hallelujah hallelujah Nov 6, 2019

Choose a reason for hiding this comment

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

It is a change of behaviour without notice zync will create tons of routes ...
Not to mention that some users reported that already 3scale/zync#236

If they want to use the hosted gateway yes, but they might also want to use the self managed gateway or the service mesh.

Agree that it makes sense to have default to hosted but I'd say the timing is pretty bad to take this decision ...

EDIT: in fact I would make it self_managed instead of hosted because plugins are in a sense self managed by the customer.

@@ -0,0 +1,7 @@
- if @service&.plugin_deployment?
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not get why the nil check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There were some controllers Api::MetricsController that used this layout but didn't loaded the service in the variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

This smells then :)

# TODO: Remove this when no one use plugins
def plugin_deployment?
deployment = self[:deployment_option]
DeploymentOption.plugins.include?(deployment)
Copy link
Contributor

Choose a reason for hiding this comment

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

And here I thought Rubysts were allergic to parenthesis!

Suggested change
DeploymentOption.plugins.include?(deployment)
DeploymentOption.plugins.include? deployment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😂 .. I hate to omit the parenthesis

app/views/layouts/api/_service.html.slim Show resolved Hide resolved
@thomasmaas thomasmaas changed the title [wip] Display a deprecated message when Service uses plugin deployment Display a deprecated message when Service uses plugin deployment Nov 5, 2019
guicassolato
guicassolato previously approved these changes Nov 5, 2019
Copy link
Contributor

@guicassolato guicassolato left a comment

Choose a reason for hiding this comment

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

Let's make this PR about updating the deprecation message only and send another one for the actual removal of the code, which may not fit 2.7 release.

macejmic
macejmic previously approved these changes Nov 6, 2019
Copy link
Contributor

@hallelujah hallelujah left a comment

Choose a reason for hiding this comment

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

Please just show the message and do not touch the deployment_option method.

@Martouta
Copy link
Contributor

Martouta commented Nov 6, 2019

Quoted from Hery:

OK for me we would need to:

  1. Merge you PR with only the notice Display a deprecated message when Service uses plugin deployment #1391
  2. Merge my PR removing the plugins in the api and UI [Rolling Updates] Plugin deployment option are deprecated #1249
  3. Fix https://github.com/3scale/porta/blob/master/app/models/proxy.rb#L121 by migrating all deployment_option from service to Proxy
  4. Remove the column from Service with the code first then with a real migration
  5. make a DML task to put all plugins to hosted or self_managed TBD
  6. Remove plugin code

duduribeiro and others added 4 commits December 4, 2019 17:20
THREESCALE-2395
Our plugin deployment option is deprecated. To avoid needing some data
migration in database, this commit sets the deployment option as hosted
if the current option is set to plugins and also displays a message to
the user to update their configuration.
THREESCALE-2395
Our plugin deployment option is deprecated. To avoid needing some data
migration in database, this commit sets the deployment option as hosted
if the current option is set to plugins and also displays a message to
the user to update their configuration.
@duduribeiro duduribeiro force-pushed the add_warning_for_plugin_deployment branch from 136fb60 to 9f6d191 Compare December 4, 2019 20:27
@duduribeiro duduribeiro merged commit 6302212 into master Dec 13, 2019
@duduribeiro duduribeiro deleted the add_warning_for_plugin_deployment branch December 13, 2019 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants