-
Notifications
You must be signed in to change notification settings - Fork 1k
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 1592 empty source on error #1792
Merged
ryanjbaxter
merged 15 commits into
spring-cloud:3.1.x
from
wind57:fix-1592-empty-source-on-error
Nov 22, 2024
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1bdd51a
refactor tests
wind57 5430511
Merge branch '3.1.x' into fix-1592-empty-source-on-error
wind57 804458f
started work
wind57 4c3df93
add k8s client tests
wind57 c7c97fa
dirty
wind57 c681f0a
dirty
wind57 dca7b19
add fabric8 it tests
wind57 0c00b75
dirty
wind57 691c2ac
dirty
wind57 e21af59
dirty
wind57 7094146
dirty
wind57 372e228
Merge branch '3.1.x' into fix-1592-empty-source-on-error
wind57 cd715b9
review comments
wind57 1560bb5
fix fabric8 tests
wind57 d05ce2d
fix tests
wind57 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
378 changes: 378 additions & 0 deletions
378
...rk/cloud/kubernetes/client/config/KubernetesClientConfigMapErrorOnReadingSourceTests.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,28 +80,54 @@ class KubernetesClientSecretsPropertySourceTests { | |
|
||
private static final String LIST_API_WITH_LABEL = "/api/v1/namespaces/default/secrets"; | ||
|
||
private static final String LIST_BODY = "{\n" + "\t\"kind\": \"SecretList\",\n" + "\t\"apiVersion\": \"v1\",\n" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. formatting only |
||
+ "\t\"metadata\": {\n" + "\t\t\"selfLink\": \"/api/v1/secrets\",\n" | ||
+ "\t\t\"resourceVersion\": \"163035\"\n" + "\t},\n" + "\t\"items\": [{\n" + "\t\t\t\"metadata\": {\n" | ||
+ "\t\t\t\t\"name\": \"db-secret\",\n" + "\t\t\t\t\"namespace\": \"default\",\n" | ||
+ "\t\t\t\t\"selfLink\": \"/api/v1/namespaces/default/secrets/db-secret\",\n" | ||
+ "\t\t\t\t\"uid\": \"59ba8e6a-a2d4-416c-b016-22597c193f23\",\n" | ||
+ "\t\t\t\t\"resourceVersion\": \"1462\",\n" + "\t\t\t\t\"creationTimestamp\": \"2020-10-28T14:45:02Z\",\n" | ||
+ "\t\t\t\t\"labels\": {\n" + "\t\t\t\t\t\"spring.cloud.kubernetes.secret\": \"true\"\n" + "\t\t\t\t}\n" | ||
+ "\t\t\t},\n" + "\t\t\t\"data\": {\n" + "\t\t\t\t\"password\": \"cDQ1NXcwcmQ=\",\n" | ||
+ "\t\t\t\t\"username\": \"dXNlcg==\"\n" + "\t\t\t},\n" + "\t\t\t\"type\": \"Opaque\"\n" + "\t\t},\n" | ||
+ "\t\t{\n" + "\t\t\t\"metadata\": {\n" + "\t\t\t\t\"name\": \"rabbit-password\",\n" | ||
+ "\t\t\t\t\"namespace\": \"default\",\n" | ||
+ "\t\t\t\t\"selfLink\": \"/api/v1/namespaces/default/secrets/rabbit-password\",\n" | ||
+ "\t\t\t\t\"uid\": \"bc211cb4-e7ff-4556-b26e-c54911301740\",\n" | ||
+ "\t\t\t\t\"resourceVersion\": \"162708\",\n" | ||
+ "\t\t\t\t\"creationTimestamp\": \"2020-10-29T19:47:36Z\",\n" + "\t\t\t\t\"labels\": {\n" | ||
+ "\t\t\t\t\t\"spring.cloud.kubernetes.secret\": \"true\"\n" + "\t\t\t\t},\n" | ||
+ "\t\t\t\t\"annotations\": {\n" | ||
+ "\t\t\t\t\t\"kubectl.kubernetes.io/last-applied-configuration\": \"{\\\"apiVersion\\\":\\\"v1\\\",\\\"data\\\":{\\\"spring.rabbitmq.password\\\":\\\"password\\\"},\\\"kind\\\":\\\"Secret\\\",\\\"metadata\\\":{\\\"annotations\\\":{},\\\"labels\\\":{\\\"spring.cloud.kubernetes.secret\\\":\\\"true\\\"},\\\"name\\\":\\\"rabbit-password\\\",\\\"namespace\\\":\\\"default\\\"},\\\"type\\\":\\\"Opaque\\\"}\\n\"\n" | ||
+ "\t\t\t\t}\n" + "\t\t\t},\n" + "\t\t\t\"data\": {\n" | ||
+ "\t\t\t\t\"spring.rabbitmq.password\": \"cGFzc3dvcmQ=\"\n" + "\t\t\t},\n" + "\t\t\t\"type\": \"Opaque\"\n" | ||
+ "\t\t}\n" + "\t]\n" + "}"; | ||
private static final String LIST_BODY = """ | ||
{ | ||
\t"kind": "SecretList", | ||
\t"apiVersion": "v1", | ||
\t"metadata": { | ||
\t\t"selfLink": "/api/v1/secrets", | ||
\t\t"resourceVersion": "163035" | ||
\t}, | ||
\t"items": [{ | ||
\t\t\t"metadata": { | ||
\t\t\t\t"name": "db-secret", | ||
\t\t\t\t"namespace": "default", | ||
\t\t\t\t"selfLink": "/api/v1/namespaces/default/secrets/db-secret", | ||
\t\t\t\t"uid": "59ba8e6a-a2d4-416c-b016-22597c193f23", | ||
\t\t\t\t"resourceVersion": "1462", | ||
\t\t\t\t"creationTimestamp": "2020-10-28T14:45:02Z", | ||
\t\t\t\t"labels": { | ||
\t\t\t\t\t"spring.cloud.kubernetes.secret": "true" | ||
\t\t\t\t} | ||
\t\t\t}, | ||
\t\t\t"data": { | ||
\t\t\t\t"password": "cDQ1NXcwcmQ=", | ||
\t\t\t\t"username": "dXNlcg==" | ||
\t\t\t}, | ||
\t\t\t"type": "Opaque" | ||
\t\t}, | ||
\t\t{ | ||
\t\t\t"metadata": { | ||
\t\t\t\t"name": "rabbit-password", | ||
\t\t\t\t"namespace": "default", | ||
\t\t\t\t"selfLink": "/api/v1/namespaces/default/secrets/rabbit-password", | ||
\t\t\t\t"uid": "bc211cb4-e7ff-4556-b26e-c54911301740", | ||
\t\t\t\t"resourceVersion": "162708", | ||
\t\t\t\t"creationTimestamp": "2020-10-29T19:47:36Z", | ||
\t\t\t\t"labels": { | ||
\t\t\t\t\t"spring.cloud.kubernetes.secret": "true" | ||
\t\t\t\t}, | ||
\t\t\t\t"annotations": { | ||
\t\t\t\t\t"kubectl.kubernetes.io/last-applied-configuration": "{\\"apiVersion\\":\\"v1\\",\\"data\\":{\\"spring.rabbitmq.password\\":\\"password\\"},\\"kind\\":\\"Secret\\",\\"metadata\\":{\\"annotations\\":{},\\"labels\\":{\\"spring.cloud.kubernetes.secret\\":\\"true\\"},\\"name\\":\\"rabbit-password\\",\\"namespace\\":\\"default\\"},\\"type\\":\\"Opaque\\"}\\n" | ||
\t\t\t\t} | ||
\t\t\t}, | ||
\t\t\t"data": { | ||
\t\t\t\t"spring.rabbitmq.password": "cGFzc3dvcmQ=" | ||
\t\t\t}, | ||
\t\t\t"type": "Opaque" | ||
\t\t} | ||
\t] | ||
}"""; | ||
|
||
private static WireMockServer wireMockServer; | ||
|
||
|
45 changes: 45 additions & 0 deletions
45
...ud/kubernetes/client/config/VisibleKubernetesClientEventBasedConfigMapChangeDetector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2013-2022 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.cloud.kubernetes.client.config; | ||
|
||
import io.kubernetes.client.common.KubernetesObject; | ||
import io.kubernetes.client.openapi.apis.CoreV1Api; | ||
|
||
import org.springframework.cloud.kubernetes.client.config.reload.KubernetesClientEventBasedConfigMapChangeDetector; | ||
import org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider; | ||
import org.springframework.cloud.kubernetes.commons.config.reload.ConfigReloadProperties; | ||
import org.springframework.cloud.kubernetes.commons.config.reload.ConfigurationUpdateStrategy; | ||
import org.springframework.core.env.ConfigurableEnvironment; | ||
|
||
/** | ||
* @author wind57 | ||
*/ | ||
public class VisibleKubernetesClientEventBasedConfigMapChangeDetector | ||
extends KubernetesClientEventBasedConfigMapChangeDetector { | ||
|
||
public VisibleKubernetesClientEventBasedConfigMapChangeDetector(CoreV1Api coreV1Api, | ||
ConfigurableEnvironment environment, ConfigReloadProperties properties, | ||
ConfigurationUpdateStrategy strategy, KubernetesClientConfigMapPropertySourceLocator propertySourceLocator, | ||
KubernetesNamespaceProvider kubernetesNamespaceProvider) { | ||
super(coreV1Api, environment, properties, strategy, propertySourceLocator, kubernetesNamespaceProvider); | ||
} | ||
|
||
public void onEvent(KubernetesObject kubernetesObject) { | ||
super.onEvent(kubernetesObject); | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
...loud/kubernetes/client/config/VisibleKubernetesClientEventBasedSecretsChangeDetector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2013-2022 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.cloud.kubernetes.client.config; | ||
|
||
import io.kubernetes.client.common.KubernetesObject; | ||
import io.kubernetes.client.openapi.apis.CoreV1Api; | ||
|
||
import org.springframework.cloud.kubernetes.client.config.reload.KubernetesClientEventBasedSecretsChangeDetector; | ||
import org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider; | ||
import org.springframework.cloud.kubernetes.commons.config.reload.ConfigReloadProperties; | ||
import org.springframework.cloud.kubernetes.commons.config.reload.ConfigurationUpdateStrategy; | ||
import org.springframework.core.env.ConfigurableEnvironment; | ||
|
||
/** | ||
* @author wind57 | ||
*/ | ||
public class VisibleKubernetesClientEventBasedSecretsChangeDetector | ||
extends KubernetesClientEventBasedSecretsChangeDetector { | ||
|
||
public VisibleKubernetesClientEventBasedSecretsChangeDetector(CoreV1Api coreV1Api, | ||
ConfigurableEnvironment environment, ConfigReloadProperties properties, | ||
ConfigurationUpdateStrategy strategy, KubernetesClientSecretsPropertySourceLocator propertySourceLocator, | ||
KubernetesNamespaceProvider kubernetesNamespaceProvider) { | ||
super(coreV1Api, environment, properties, strategy, propertySourceLocator, kubernetesNamespaceProvider); | ||
} | ||
|
||
@Override | ||
public void onEvent(KubernetesObject kubernetesObject) { | ||
super.onEvent(kubernetesObject); | ||
} | ||
|
||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
just formatting, nothing else changed here