-
Notifications
You must be signed in to change notification settings - Fork 295
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
CloudSqlEnvironmentPostProcessor not compatible with Spring Cloud Bootstrap PropertySourceLocator mechanism #433
Comments
Thanks for the report. Unfortunately we migrated from the old way of doing things due to some issues that emerged in the ilford releases (context here). I don't think we can switch back. Do you know if the We had a bootstrap issue here before which sounds like it might have solved a similar problem? Perhaps we can add your property source to that
|
Thanks for the background information. It will be a hard one to fix then. A possibly ugly solution would be to create a Regarding your other question. The |
I see. Yeah we can do something to update the docs. I would still be interested to see if it's possible to reproduce the issue -- Is the overall idea to set the |
Notice that |
@meltsufin Changing the order of the I will create a todo for me to see if I can create a simple reproduction somewhere next week. |
@snicoll Do you have any insight into this kind of issue? |
I thought we already discussed this, didn't we? See #215 (comment) |
This problem indeed occurs due to limitations in the deprecated bootstrap mechanism. I am not sure if you should try to fix this issue. Adding a warning to the documentation regarding which properties should not be configured via property sources that require the legacy bootstrap methods, should suffice in my opinion. |
I'm confused on this because we specifically skip the |
That's a different problem with the same cause. Even if your BPP runs in the right "context" it runs before Spring Cloud Config Server has loaded the remote config, see spring-cloud/spring-cloud-commons#608 (comment) |
Indeed, but in this case it is not the Spring Cloud Config Server but a Spring Cloud Kubernetes ConfigMap PropertySource, but the mechanism is the same. |
Right. Same design issue yeah. |
Any change? I've the same issue when we trying to disable gcp sql module in local environment. I've configured # Disable Spring Cloud Kubernetes
spring:
cloud:
kubernetes:
enabled: false
gcp:
sql:
enabled: false Ouput log:
|
@limkinZero Are you able to use the setting in |
I couldn't. I tried configue the property in the application.properties
with the same error.
El vie., 29 de octubre de 2021 20:51, Mike Eltsufin <
***@***.***> escribió:
… @limkinZero <https://github.com/limkinZero> Are you able to use the
setting in application.yaml? CloudSqlEnvironmentPostProcessor is not part
of the bootstrap phase.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#433 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLQJD7LWDTWDWH6ATMYTWDUJLULLANCNFSM42Q6JW5A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
@limkinZero That's interesting. You might have something else going on in your application configuration. Would you be able to provide a reproducible example of this issue? |
Mmm, you can check this branch:
https://gitlab.com/aweframework/awe/-/tree/380-configure-cloud-sql-for-awe-boot-project-on-the-cloud
but you have to add the dependency to pom.xml file in awe-boot project
(awe-test module)and configure the bootstrap.yaml to disable gpc.
El sáb., 30 de octubre de 2021 5:07, Mike Eltsufin ***@***.***>
escribió:
… @limkinZero <https://github.com/limkinZero> That's interesting. You might
have something else going on in your application configuration. Would you
be able to provide a reproducible example of this issue?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#433 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLQJD2RUPB7BEMXAUUHEDDUJNONPANCNFSM42Q6JW5A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
@limkinZero Would you be able to make the necessary changes in a fork and provide exact instructions on how to reproduce the issue? |
I wonder if we should try implementing the Cloud SQL configuration as a custom This would not help with refreshing credentials and such because of GoogleCloudPlatform/cloud-sql-jdbc-socket-factory#776 / #1204, but it may be an improvement. @mzeijen What are you doing as a workaround in the meantime -- maven profiles? |
@mzeijen @limkinZero @elefeint I created a demo project in here. It can be treated as a workaround of this issue. |
Close this issue as no response, please reopen the issue if needed. |
Bumps [checkstyle](https://github.com/checkstyle/checkstyle) from 8.45.1 to 9.0. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](checkstyle/checkstyle@checkstyle-8.45.1...checkstyle-9.0) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
I discovered that the new
CloudSqlEnvironmentPostProcessor
within Spring Cloud GCP 2.x causes issues when you combine it with properties that are being loaded via aPropertySource
that is created via the Spring Cloud BootstrapPropertySourceLocator
. The reason is that the properties loaded via aPropertySource
that is created by aPropertySourceLocator
are loaded after theCloudSqlEnvironmentPostProcessor
is executed.The case in which we discovered this is as follows:
application.yml
, on the classpath, the propertyspring.cloud.gcp.sql.enabled
is set tofalse
spring.cloud.gcp.sql.enabled
property but it set totrue
spring.cloud.gcp.sql.enabled=true
is never picked up by theCloudSqlEnvironmentPostProcessor
and thus it doesn't do its thing to setup the required correctDatasource
for CloudSQL. The application fails to startup.PropertySourceLocator
mechanism to create aPropertySource
for the ConfigMap but this happens when theApplicationContextInitializers
are executed, which is after theEnvironmentPostProcessor
have been executed in the normal application context startup phase (so thePropertySourceLocator
is only created in the bootstrap contact startup phase and executed in the application context startup phase). Because of that theCloudSqlEnvironmentPostProcessor
never sees the properties from the ConfigMap PropertySource.To figure out what was going on took some time. In the end, there are plenty workaround like simply mounting the ConfigMap and loading via one of the ways that Spring Boot has to load configuration, but it would be best if the CloudSQL support mechanism in Spring Cloud GCP would simply be compatible with Spring Cloud Bootstrap and it all works as expected.
I am not sure what a good solution is. Maybe go back to the mechanism from Spring Cloud GCP 1.x?
Sample
I have not provided a code sample, as this is requires fairly complicated setup to demonstrate the issue. I hope that the explanation above suffices to make the issue clear.
The text was updated successfully, but these errors were encountered: