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

fix(#7712): S2i build no longer renames artifacts #7749

Merged
merged 5 commits into from Mar 12, 2020

Conversation

iocanel
Copy link
Contributor

@iocanel iocanel commented Mar 10, 2020

Fixes: #7712 #7766 #7740

This pull request changes the way that the artifact is handled during the s2i build process.

  • The artifact is no longer renamed.
  • The user is able to specify the target directory and or the target filename (if the s2i builder image changes the name).
  • The artifact name that is used in the manifests comes from JarBuildItem / NativeBuildItem unless the user specifies something else (see above).

@iocanel
Copy link
Contributor Author

iocanel commented Mar 10, 2020

CC @Ladicek @maxandersen

@iocanel iocanel changed the title fix(#7712): S2i build no longer renames artifacts [WIP] fix(#7712): S2i build no longer renames artifacts Mar 10, 2020
@iocanel
Copy link
Contributor Author

iocanel commented Mar 10, 2020

Found some issues with the PR related to native mode ...
I am on it.

It should be ok now.

@iocanel iocanel changed the title [WIP] fix(#7712): S2i build no longer renames artifacts fix(#7712): S2i build no longer renames artifacts Mar 10, 2020
@maxandersen
Copy link
Contributor

as this changes the behavior of kubernetes/openshift setup best to get this fixed before final.

@geoand
Copy link
Contributor

geoand commented Mar 11, 2020

I would like @Ladicek to test this if possible.

I agree with @maxandersen that we need this in for Final from a usability perspective. Moreover it changes the s2i configuration which we really want to do before the Final is out to avoid unnecessary breaking changes down the line

@Ladicek
Copy link
Contributor

Ladicek commented Mar 11, 2020

/me looking

Copy link
Contributor

@Ladicek Ladicek left a comment

Choose a reason for hiding this comment

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

This seems to work fine from my perspective. I don't test native binaries in OpenShift yet, but for the JVM mode, this is OK.

(I'm still not sure why we need the full java ... cmdline, but it can't hurt either, so I'm fine with that.)

@geoand
Copy link
Contributor

geoand commented Mar 11, 2020

Thanks for checking @Ladicek

Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

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

Added some minor comments about the config property javadoc (which should be fixed since they end up in the docs)

@iocanel
Copy link
Contributor Author

iocanel commented Mar 11, 2020

This seems to work fine from my perspective. I don't test native binaries in OpenShift yet, but for the JVM mode, this is OK.

It's the ubi quarkus native binary image that does rename the artifact. It doesn't affect JVM mode.

(I'm still not sure why we need the full java ... cmdline, but it can't hurt either, so I'm fine with that.)

Because there is no guarantee that the s2i builder image the user selects will support JAVA_APP_JAR etc.

@geoand
Copy link
Contributor

geoand commented Mar 11, 2020

Please squash the commits when you are done :)

@iocanel
Copy link
Contributor Author

iocanel commented Mar 11, 2020

Please squash the commits when you are done :)

Done!

Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

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

LGTM

@geoand geoand added this to the 1.3.0.Final milestone Mar 11, 2020
@Ladicek
Copy link
Contributor

Ladicek commented Mar 11, 2020

(I'm still not sure why we need the full java ... cmdline, but it can't hurt either, so I'm fine with that.)

Because there is no guarantee that the s2i builder image the user selects will support JAVA_APP_JAR etc.

I have actually noticed that it might hurt, or at least be suboptimal. I filed #7766 for that.

@gsmet gsmet modified the milestones: 1.3.0.Final, 1.4.0 Mar 11, 2020
@gsmet
Copy link
Member

gsmet commented Mar 11, 2020

@geoand please don't assign PRs to 1.3.0.Final. I do it when I backport things.

As long as they are not backported, they don't end up in 1.3.0.Final as we already have a branch.

Thanks!

@geoand
Copy link
Contributor

geoand commented Mar 11, 2020

So the milestone should be 1.4.0.Final?

@iocanel
Copy link
Contributor Author

iocanel commented Mar 11, 2020

Added a couple more commits that fixes: #7766 and #7740.
Also it changes the default s2i java base image to openjdk.

@iocanel
Copy link
Contributor Author

iocanel commented Mar 12, 2020

This case still causes duplicate entry in the YAML file:

As this is a non-blocker issue, I think that the fix for that particular uses case should be deferred post 1.3.0.Final.

@geoand
Copy link
Contributor

geoand commented Mar 12, 2020

This case still causes duplicate entry in the YAML file:

As this is a non-blocker issue, I think that the fix for that particular uses case should be deferred post 1.3.0.Final.

I agree

@Ladicek
Copy link
Contributor

Ladicek commented Mar 12, 2020

Yea, there's no way how to indicate priority in GitHub issues (except labels, but I can't assign those). If it were, I'd mark that particular issue as not a blocker -- but since you already tried to fix it, I wanted to report that the fix is incomplete :-)

@Ladicek
Copy link
Contributor

Ladicek commented Mar 12, 2020

Ah, one thing. This doesn't mean I didn't find any other issue. I'm still checking. This one was just too easy to find :-)

@geoand
Copy link
Contributor

geoand commented Mar 12, 2020

@Ladicek I propose we merge now and if you find any issues open them along with an indication of how serious they are for .Final

@Ladicek
Copy link
Contributor

Ladicek commented Mar 12, 2020

I agree with merging (as I didn't spot any other glaring issue yet), but would like to have these 2 questions answered first:

  1. Can we use the registry.access.redhat.com/openjdk/openjdk-11-rhel7 image by default?
  2. Can the fact that "known image" matching algorithm ignores the registry name have security consequences? Or any other consequences? I can only think of the possibility to abuse that by creating identically named image in an internal registry. But I'd like other folks to think about that too, at least a little.

@iocanel
Copy link
Contributor Author

iocanel commented Mar 12, 2020

I agree with merging (as I didn't spot any other glaring issue yet), but would like to have these 2 questions answered first:

  1. Can we use the registry.access.redhat.com/openjdk/openjdk-11-rhel7 image by default?

This is already the image we use. If your question is if we should, then maybe @maxandersen can answer that.

  1. Can the fact that "known image" matching algorithm ignores the registry name have security consequences? Or any other consequences? I can only think of the possibility to abuse that by creating identically named image in an internal registry. But I'd like other folks to think about that too, at least a little.

Let me start by saying that we can't take the registry into consideration, as this would break all private registries. Now, let's see what the implications might be:

Security wise, nothing changes. We don't grant any special privileges to known images, we just align our generated manifests (something anyone can do by hand anyway).

Other consequences?

Yeah, if someone creates an identically named image that doesn't respect the same environment variable conventions as the original one, publish that to a private, and use that instead, then the resulting container will probably fail to start. But I think we can live with that (at least for now).

@Ladicek
Copy link
Contributor

Ladicek commented Mar 12, 2020

I agree with merging (as I didn't spot any other glaring issue yet), but would like to have these 2 questions answered first:

  1. Can we use the registry.access.redhat.com/openjdk/openjdk-11-rhel7 image by default?

This is already the image we use.

No we don't. We currently use the Fabric8 image by default. This PR changes that to the Red Hat image. I'm not sure if that's right. Technically, the image is available for everyone. However, I think that "conditions apply". If you don't have a Red Hat subscription (even the $0 developer subscription), you shouldn't use it. Or something like that.

  1. Can the fact that "known image" matching algorithm ignores the registry name have security consequences? Or any other consequences? I can only think of the possibility to abuse that by creating identically named image in an internal registry. But I'd like other folks to think about that too, at least a little.

Let me start by saying that we can't take the registry into consideration, as this would break all private registries. Now, let's see what the implications might be:

Security wise, nothing changes. We don't grant any special privileges to known images, we just align our generated manifests (something anyone can do by hand anyway).

Other consequences?

Yeah, if someone creates an identically named image that doesn't respect the same environment variable conventions as the original one, publish that to a private, and use that instead, then the resulting container will probably fail to start. But I think we can live with that (at least for now).

OK, agree.

@iocanel
Copy link
Contributor Author

iocanel commented Mar 12, 2020

No we don't. We currently use the Fabric8 image by default. This PR changes that to the Red Hat image.

I stand corrected!

@geoand
Copy link
Contributor

geoand commented Mar 12, 2020

No we don't. We currently use the Fabric8 image by default. This PR changes that to the Red Hat image.

I stand corrected!

Which leaves us where with regards to @Ladicek 's comment?

@iocanel
Copy link
Contributor Author

iocanel commented Mar 12, 2020

No we don't. We currently use the Fabric8 image by default. This PR changes that to the Red Hat image.

I stand corrected!

Which leaves us where with regards to @Ladicek 's comment?

We need to check if we can use registry.access.redhat.com/openjdk/openjdk-11-rhel7 as a default image. It seems that @maxandersen is swarmed though. @tqvarnst since we discussed about this on Monday, are there any legal obstacles in proceeding with this change (adopting openjdk-11-rhel7 as the default s2i base image)?

@Ladicek
Copy link
Contributor

Ladicek commented Mar 12, 2020

I don't like us using the Fabric8 image, but I don't think there's a better image that we can use by default. When UBI image with Java comes out, we should switch to that for sure, but until then...

@gsmet
Copy link
Member

gsmet commented Mar 12, 2020

For the default Dockerfiles, we use ubi and install Java manually.

@geoand
Copy link
Contributor

geoand commented Mar 12, 2020

We can't do that for s2i however

@maxandersen
Copy link
Contributor

long thread and not sure what questions are left but just two things to state:

  • we are stuck with fabric8 image until ubi-java comes out - for customers they'll need to explicitly set whatever supported image is needed.
  • we are not going to use any image that require auth as default.

.map(d -> Paths.get(s2iConfig.jarPath).getParent().resolve("lib")
.resolve(d.getArtifact().getGroupId() + "." + d.getArtifact().getPath().getFileName()).toAbsolutePath()
.map(d -> String.valueOf(d.getArtifact().getGroupId() + "." + d.getArtifact().getPath().getFileName()))
.map(s -> Paths.get(s2iConfig.jarDirectory).resolve("lib").resolve(s).toAbsolutePath()
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder what happens on Windows, would this possibly generate Windows-style paths into the Kubernetes YAML? (Didn't check, just thinking aloud.)

Copy link
Contributor

@Ladicek Ladicek left a comment

Choose a reason for hiding this comment

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

This works fine for my usecase. There might be follow-up issues, but this is a good base IMHO.

@geoand
Copy link
Contributor

geoand commented Mar 12, 2020

Since we are practically out of time, I'm going to merge this to get the needed fixes into Final

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

presence of quarkus-container-image-s2i extension causes wrong java -jar argument in pod spec
5 participants