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

Support of additional volumes in pod #10099

Merged
merged 69 commits into from
Aug 3, 2024

Conversation

cthtrifork
Copy link
Contributor

@cthtrifork cthtrifork commented May 13, 2024

Type of change

  • Enhancement / new feature

Description

This is a solution design for an upcoming proposal (strimzi/proposals#120) supporting #3693
It will need testcoverage and more. Right now it is blocked by an seemingly unrelated compile issue:
CrdGenerator: error: class io.fabric8.kubernetes.api.model.Quantity is missing @JsonInclude

Checklist

Please go through this checklist and make sure all applicable tasks have been done

  • Write tests
  • Make sure all tests pass
  • Update documentation
  • Check RBAC rights for Kubernetes / OpenShift roles
  • Try your changes from Pod inside your Kubernetes and OpenShift cluster, not just locally
  • Reference relevant issue(s) and close them after merging
  • Update CHANGELOG.md
  • Supply screenshots for visual changes, such as Grafana dashboards

@MichaelMorrisEst
Copy link
Contributor

I've pushed a commit that moves the implementation some way along to where I think we want to go based on the proposal. I haven't tested it yet, but hope to in next day or so

@cthtrifork
Copy link
Contributor Author

cthtrifork commented Jun 10, 2024

@MichaelMorrisEst Great work. So besides getting an approval on the proposal, what do you think is missing?

  • Unit tests
  • Integration tests?
  • Documentation
  • Validation

@MichaelMorrisEst
Copy link
Contributor

@MichaelMorrisEst Great work. So besides getting an approval on the proposal, what do you think is missing?

  • Unit tests
  • Integration tests?
  • Documentation
  • Validation

Thanks.
Yes, and in additional to those items you list, we are also missing in the implementation the impacts for the other components (only kafka and zookeeper pods there at the moment). I can continue with implementing those.
There is also an open question on using the Quantity class which is referenced from EmptyDirVolumeSource. I have added a comment in the proposal PR (strimzi/proposals#120 (comment)) to get peoples thoughts on how to resolve

cthtrifork and others added 4 commits June 12, 2024 15:02
Signed-off-by: Casper Thygesen <cth@trifork.com>
Signed-off-by: KastTrifork <kast@trifork.com>
Signed-off-by: KastTrifork <kast@trifork.com>
…nd added handling for zookeeper

Also fixed checkstyle issues and implemented workaround in CRD generator to allow compilation

Signed-off-by: MichaelMorris <michael.morris@est.tech>
Signed-off-by: KastTrifork <kast@trifork.com>
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Signed-off-by: KastTrifork <kast@trifork.com>
MichaelMorrisEst and others added 8 commits June 13, 2024 17:00
Existing tests now passing as well

Signed-off-by: MichaelMorris <michael.morris@est.tech>
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Signed-off-by: Casper Thygesen <cth@trifork.com>
Signed-off-by: Casper Thygesen <cth@trifork.com>
Signed-off-by: Casper Thygesen <cth@trifork.com>
…umes

Signed-off-by: Casper Thygesen <cth@trifork.com>
Signed-off-by: Casper Thygesen <cth@trifork.com>
Signed-off-by: Casper Thygesen <cth@trifork.com>
@@ -656,7 +656,7 @@ private void checkClass(Class<?> crdClass) {

private void checkJsonInclude(Class<?> crdClass) {
if (!crdClass.isAnnotationPresent(JsonInclude.class)) {
err(crdClass + " is missing @JsonInclude");
warn(crdClass + " is missing @JsonInclude"); // Changed temporarily to allow compilation of io.fabric8.kubernetes.api.model.Quantity
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MichaelMorrisEst Will you help fix this

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 gave it a go, please review 😄

@cthtrifork cthtrifork changed the title Initial design of additionalVolumes support Support of additional volumes in pod Jun 30, 2024
@cthtrifork
Copy link
Contributor Author

@tombentley @scholzj I think this PR is ready for feedback. We need to adjust a modified testcase change as discussed in the community call, and we need to validate the changes on our own cluster. The PR should be mature enough to get feedback.

@cthtrifork cthtrifork marked this pull request as ready for review July 1, 2024 19:20
Signed-off-by: KastTrifork <kast@trifork.com>
@cthtrifork
Copy link
Contributor Author

./.azure/scripts/release_files_check.sh
ERROR checksum of ./helm-charts does not match expected
expected f029e1dd81b5391a8684a6f555a48f7bef12033e  -
found e713b7265baf9c3108d5db3a0902bd64a0629dc7  -
if your changes are not related to a release please check your changes into
./packaging/helm-charts
instead of ./helm-charts

if this is part of a release instead update the checksum i.e.
HELM_CHART_CHECKSUM="f029e1dd81b5391a8684a6f555a48f7bef12033e  -"
->
HELM_CHART_CHECKSUM="e713b7265baf9c3108d5db3a0902bd64a0629dc7  -"
checksum of ./install/ matches expected checksum => OK
checksum of ./examples/ matches expected checksum => OK
make: *** [Makefile:138: release_files_check] Error 1

This needs to be solved.

Signed-off-by: Casper Thygesen <cth@trifork.com>
KastTrifork and others added 4 commits July 19, 2024 14:05
Signed-off-by: KastTrifork <kast@trifork.com>
Signed-off-by: pegtrifork <peg@trifork.com>
Signed-off-by: pegtrifork <peg@trifork.com>
Signed-off-by: pegtrifork <peg@trifork.com>
@scholzj
Copy link
Member

scholzj commented Jul 22, 2024

/azp run regression

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@scholzj scholzj left a comment

Choose a reason for hiding this comment

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

I think the code looks good. We just need get a bit more consistency to the actual code and its formatting.

CHANGELOG.md Outdated
* Additional OAuth configuration options have been added for 'oauth' authentication on the listener and the client.
On the listener `serverBearerTokenLocation` and `userNamePrefix` have been added.
On the client `accessTokenLocation`, `clientAssertion`, `clientAssertionLocation`, `clientAssertionType`, and `saslExtensions` have been added.


Copy link
Member

Choose a reason for hiding this comment

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

Nit, but I think this line is not needed.

@@ -195,6 +196,17 @@ public void setTmpDirSizeLimit(String tmpDirSizeLimit) {
this.tmpDirSizeLimit = tmpDirSizeLimit;
}

@Description("Additional volumes that can be mounted to the pod.")
@JsonProperty("volumes")
Copy link
Member

Choose a reason for hiding this comment

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

This should be removed? @JsonProperty("volumes")

@@ -545,6 +575,14 @@ public void testTemplate() {
assertThat(sa.getMetadata().getLabels().entrySet().containsAll(saLabels.entrySet()), is(true));
assertThat(sa.getMetadata().getAnnotations().entrySet().containsAll(saAnots.entrySet()), is(true));
}

private static Volume getVolume(Deployment dep, String volumeName) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with the utility method. But can we keep it up top with the other utility methods and not in the middle of the tests?

Comment on lines 476 to 482
private static Volume getVolume(PodSpec podSpec, String volumeName) {
return podSpec.getVolumes().stream().filter(volume -> volumeName.equals(volume.getName())).iterator().next();
}

private static VolumeMount getVolumeMount(Container container, String volumeName) {
return container.getVolumeMounts().stream().filter(volumeMount -> volumeName.equals(volumeMount.getName())).iterator().next();
}
Copy link
Member

Choose a reason for hiding this comment

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

Again, fine with the utility methods. But can we keep them up tom with the other ones and not in the middle of the tests?

Comment on lines 1058 to 1064
private static Volume getVolume(Pod pod, String volumeName) {
return pod.getSpec().getVolumes().stream().filter(volume -> volumeName.equals(volume.getName())).iterator().next();
}

private static VolumeMount getVolumeMount(Container container, String volumeName) {
return container.getVolumeMounts().stream().filter(volumeMount -> volumeName.equals(volumeMount.getName())).iterator().next();
}
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

@@ -1886,7 +1939,7 @@ public void testPodSetWithOAuthWithMissingClientSecret() {
.build();
KafkaMirrorMaker2 resource = new KafkaMirrorMaker2Builder(this.resource)
.editSpec()
.withClusters(targetClusterWithOAuthWithMissingClientSecret)
.withClusters(targetClusterWithOAuthWithMissingClientSecret)
Copy link
Member

Choose a reason for hiding this comment

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

Whit is intentionally indented for better readability.

pegtrifork and others added 2 commits July 23, 2024 09:24
Co-authored-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Peter Kiib Egede <100785536+pegtrifork@users.noreply.github.com>
Signed-off-by: pegtrifork <peg@trifork.com>
@scholzj
Copy link
Member

scholzj commented Jul 23, 2024

/azp run regression

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@scholzj scholzj left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

Copy link
Member

@tombentley tombentley left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@ppatierno ppatierno left a comment

Choose a reason for hiding this comment

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

LGTM.
Just a nit but no need to change if you want to stay with this. I would make calls to addAdditionalVolumeMounts and addAdditionalVolumes explicit with the TemplateUtils instead of importing them. So, i.e. using TemplateUtils.addAdditionalVolumeMounts. I think we do this way most of the code in the repository.

Signed-off-by: MichaelMorris <michael.morris@est.tech>
@MichaelMorrisEst
Copy link
Contributor

LGTM. Just a nit but no need to change if you want to stay with this. I would make calls to addAdditionalVolumeMounts and addAdditionalVolumes explicit with the TemplateUtils instead of importing them. So, i.e. using TemplateUtils.addAdditionalVolumeMounts. I think we do this way most of the code in the repository.

Done

@scholzj
Copy link
Member

scholzj commented Jul 26, 2024

/azp run build

Copy link

Pull request contains merge conflicts.

@scholzj
Copy link
Member

scholzj commented Jul 26, 2024

It seems that the branch has some conflicts. Can you try to look into it and rebase it if needed?

@scholzj
Copy link
Member

scholzj commented Aug 1, 2024

Any chance you can rebase this? So that we can get it merged and included in the next release?

Signed-off-by: Kasper Storgaard <116632810+KastTrifork@users.noreply.github.com>
@@ -321,6 +321,7 @@ public void testTemplate() {
assertThat(dep.getSpec().getTemplate().getSpec().getSchedulerName(), is("my-scheduler"));
assertThat(dep.getSpec().getTemplate().getSpec().getTopologySpreadConstraints(), containsInAnyOrder(tsc1, tsc2));
assertThat(dep.getSpec().getTemplate().getSpec().getEnableServiceLinks(), is(false));
assertThat(dep.getSpec().getTemplate().getSpec().getTolerations(), is(singletonList(toleration)));
Copy link
Member

Choose a reason for hiding this comment

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

I think this is wrong and is causing the test failure?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for pointing this out

The line mentioned is from the main branch. I noticed that there is another line using the variable assertToleration which was missing, and therefore test failure. I've added the assertToleration variable now, and the test should pass

Copy link
Member

Choose a reason for hiding this comment

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

I don't think you handled it well - or maybe I misled you. If you compare it with the main branch, this is the correct line:

assertThat(dep.getSpec().getTemplate().getSpec().getTolerations(), is(singletonList(toleration)));
... you are restoring the removed behavior, so it will likely fail when running the tests. (also, please just delete the wrong line, not comment it out)

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, my bad. I got confused by your comment and the error message in the pipeline. I will correct it to the right line, the one you are referring to, and remove the old behavior.

Thanks for your patience :-)

Signed-off-by: Kasper Storgaard <116632810+KastTrifork@users.noreply.github.com>
Signed-off-by: Kasper Storgaard <116632810+KastTrifork@users.noreply.github.com>
@scholzj
Copy link
Member

scholzj commented Aug 2, 2024

/azp run regression

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@scholzj scholzj merged commit 27db9cf into strimzi:main Aug 3, 2024
21 checks passed
@scholzj
Copy link
Member

scholzj commented Aug 3, 2024

Thanks for the PR!

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.

Support mounting a volume to the pod
7 participants