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
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.
Any help or other workaround appreciated.
Thanks
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)
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.
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.
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?
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:
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.
Most helpful comment
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: