-
Notifications
You must be signed in to change notification settings - Fork 272
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
feat(operator): add support for pod template #5369
Conversation
@andreaTP Please review, I'll take a look at your PR soon. |
operator/controller/src/main/java/io/apicurio/registry/operator/utils/Mapper.java
Outdated
Show resolved
Hide resolved
operator/controller/src/main/java/io/apicurio/registry/operator/utils/PodTemplateSpecUtils.java
Outdated
Show resolved
Hide resolved
operator/controller/src/main/java/io/apicurio/registry/operator/utils/PodTemplateSpecUtils.java
Outdated
Show resolved
Hide resolved
operator/controller/src/main/java/io/apicurio/registry/operator/utils/PodTemplateSpecUtils.java
Outdated
Show resolved
Hide resolved
operator/controller/src/main/java/io/apicurio/registry/operator/utils/PodTemplateSpecUtils.java
Outdated
Show resolved
Hide resolved
operator/controller/src/test/java/io/apicurio/registry/operator/unit/MergePTSTest.java
Outdated
Show resolved
Hide resolved
operator/controller/src/test/java/io/apicurio/registry/operator/unit/MergePTSTest.java
Outdated
Show resolved
Hide resolved
operator/controller/src/test/java/io/apicurio/registry/operator/unit/MergePTSTest.java
Outdated
Show resolved
Hide resolved
operator/controller/src/test/resources/podtemplatespec-test-cases.yaml
Outdated
Show resolved
Hide resolved
operator/controller/src/test/resources/podtemplatespec-test-cases.yaml
Outdated
Show resolved
Hide resolved
@andreaTP I've changed the approach to implementing the PTS support. Let me know what you think. |
4b143e1
to
b65a6b5
Compare
I can close and reopen the PR if you think this is too cluttered. |
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.
@jsenko I overall like where this is going, let's try to continue here if you are not too bothered by the comments.
I think we can improve by separating the "merge things" logic from the getDefaultXXXDeployment
.
i.e.:
getDefaultXXDeployment
-> constructs in code the default base without any check, from scratchmergeXYZ
-> contains all the logic for merging the default base with the user-defined values
The distinction will also make clear the intentions and semantic decisions over the merging strategies.
Please, remember that, before merging we should have some sort of documentation about the decisions we are taking when merging stuff.
operator/controller/src/main/java/io/apicurio/registry/operator/resource/ResourceFactory.java
Outdated
Show resolved
Hide resolved
operator/controller/src/main/java/io/apicurio/registry/operator/resource/ResourceFactory.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/io/apicurio/registry/operator/resource/app/AppDeploymentResource.java
Outdated
Show resolved
Hide resolved
operator/controller/src/main/java/io/apicurio/registry/operator/utils/Utils.java
Outdated
Show resolved
Hide resolved
* | ||
* @param target must not be null | ||
*/ | ||
public static <T, K> void mergeNotOverride(List<T> target, List<T> source, Function<T, K> extractKey) { |
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'm convinced this can be done in a simpler way, let me know if I should take a stab at 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.
Can you create a followup PR for this please? This PR does not have to be perfect, is should be correct. I'll be happy to review your PR.
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'm ok with this, agreed.
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.
Follow up PR created: jsenko#1055
operator/controller/src/test/java/io/apicurio/registry/operator/it/PTSITTest.java
Outdated
Show resolved
Hide resolved
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
||
public class PodTemplateSpecTest { |
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.
Nice job here! Clear and well organized!
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.
Thank you
Updated. |
We do not have docs ported yet. What kind of documentation do you have in mind? The merge logic is stupidly simple at the moment and can be documented later. |
Even a section in the Readme of the sub-module is fine by me.
It's "stupidly simple" to you that have written the code, knows where to look for finding information, knows how to use the IDE etc. etc. I think we can improve in inclusiveness here and allow anyone looking at this PR to access a description in plain English of what we are trying to achieve. All in all, it can be easy or complicated, but there is no documented decision about the tradeoffs we took:
I want to be able to read a spec, reason about it, and verify the implementation. Once we have proper documentation in place we can move the text around. |
operator/controller/src/main/java/io/apicurio/registry/operator/resource/ResourceFactory.java
Show resolved
Hide resolved
@andreaTP I've added information to the README. |
To allow the testing of Ingresses when using minikube, run: | ||
```shell | ||
minikube addons enable ingress | ||
minikube tunnel |
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.
side note: this mechanism seems to be not enough on my machine, but I have not narrowed it down.
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.
hmm it works for me. Maybe try with the latest version?
|
||
If your cluster does not have an accessible ingress host, you can skip them using `test.operator.ingress-skip=true` (**not recommended**). | ||
|
||
## PodTemplateSpec merging |
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.
Thanks 👍
} else { | ||
r.getSpec().setTemplate(new PodTemplateSpec()); | ||
} | ||
mergeDeploymentPodTemplateSpec( |
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 believe that the most idiomatic place to do this merging is in XXXDeploymentResource
so that we have a clear distinction:
- what comes as default -> comes from
RegistryFactory
- user defined customizations -> reconciled in the
DeploymentResource
(i.e. before setting the env var for the datasources)
But we can follow up in a separate PR.
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, good to go, thanks for bearing with me @jsenko
No description provided.