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

openshift-maven-plugin: Support for S2I builds to be pushed to external registries #522

Closed
jauffrey opened this issue Dec 14, 2020 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@jauffrey
Copy link

jauffrey commented Dec 14, 2020

Description

Hello team,

One of my use case is being able to push to an external registry (https://www.openshift.com/blog/pushing-application-images-to-an-external-registry) using a oc:build

  • use case: being able to update the BuildConfig with external registry when running an oc:build
  • current issue: the generated buildConfig output always uses ImageStreamTag, publishing in Openshift's internal repository

The current implementation always creates an ImageStreamTag (org.eclipse.jkube.kit.config.service.openshift.OpenshiftBuildService, l. 216):

protected String updateOrCreateBuildConfig(BuildServiceConfig config, OpenShiftClient client, KubernetesListBuilder builder, ImageConfiguration imageConfig, String openshiftPullSecret) {
        ImageName imageName = new ImageName(imageConfig.getName());
        String buildName = getS2IBuildName(config, imageName);
        String imageStreamName = getImageStreamName(imageName);
        String outputImageStreamTag = imageStreamName + ":" + (imageName.getTag() != null ? imageName.getTag() : "latest");

        BuildStrategy buildStrategyResource = createBuildStrategy(imageConfig, config.getJKubeBuildStrategy(), openshiftPullSecret);
        BuildOutput buildOutput = new BuildOutputBuilder().withNewTo()
                .withKind("ImageStreamTag")
                .withName(outputImageStreamTag)
                .endTo().build();

        // Fetch existing build config
        BuildConfig buildConfig = client.buildConfigs().withName(buildName).get();
....

I didn't find a way to tune the output, even by updating the BuildConfig, oc:build replaces it.

Maybe I missed something in configuring the build config for oc:build, but I'm not able to change this with the current jKube version.

  • Current workaround: using either JIB build strategy or k8s:build to use local docker daemon to do the builds and push to the target external registry

Any help or other workaround appreciated.

Thanks

Info

  • Eclipse JKube version : 1.0.2
  • Maven version (mvn -v) : 3.5.3

  • Kubernetes / Red Hat OpenShift setup and version : Openshift 4.4

  • If it's a bug, how to reproduce :

  • If it's a feature request, what is your use case : (see description)

@manusa
Copy link
Member

manusa commented Dec 14, 2020

Hi Jauffry,

I don't think we've considered this scenario for the OpenShift Maven Plugin.
Even the oc:push shows a warning message Image is pushed to OpenShift's internal registry during oc:build goal. Skipping....

The approach we considered to push to external registries was what you suggested, use Kubernetes Maven Plugin to build and push locally. However, this of course won't work with S2I builds.

So I'm guessing that this feature request could be summarized as something like "Support for S2I builds to be pushed to external registries`.

We'll certainly look into this.

@manusa manusa added the enhancement New feature or request label Dec 14, 2020
@jauffrey jauffrey changed the title openshift-maven-plugin: Allow BuildConfig output to use external docker registry instead of ImageStreamTag openshift-maven-plugin: Support for S2I builds to be pushed to external registries Dec 14, 2020
@jauffrey
Copy link
Author

Thank you Marc. I'll use the workaround for now, but having this behaviour to be triggered by oc:push (or a combination of oc:build + oc:push) would be awesome.

@manusa manusa added this to the 1.2.0 milestone Jan 18, 2021
@manusa manusa modified the milestones: 1.2.0, 1.3.0 Mar 31, 2021
@manusa manusa modified the milestones: 1.3.0, 1.4.0 May 7, 2021
@manusa
Copy link
Member

manusa commented Jun 30, 2021

Hi @jauffrey

This functionality should be covered now by #710 (fabric8io/fabric8-maven-plugin#1054)

You can check how it works in this demo https://www.youtube.com/watch?v=zAIARZ-efxk

Could you confirm if this is what you were looking for?

@jauffrey
Copy link
Author

jauffrey commented Jul 1, 2021

Hi @manusa
Many thanks for your awesome work on this. I checked the demo and it will definitely solve the issue.
Can't wait to test it! 🚀 :shipit:

@manusa
Copy link
Member

manusa commented Jul 28, 2021

We just released v1.4.0, hopefully this issue should be covered. I'm closing it, in case there's something missing, don't hesitate to open a new issue so we can address it.

@manusa manusa closed this as completed Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants