Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Using its own BuildConfig when using f-m-p #1070

Closed
zonArt opened this issue Oct 17, 2017 · 13 comments
Closed

Using its own BuildConfig when using f-m-p #1070

zonArt opened this issue Oct 17, 2017 · 13 comments
Labels
cat/discussion Topic of discussion status/stale Issue/PR considered to be stale

Comments

@zonArt
Copy link

zonArt commented Oct 17, 2017

Is it a way to define its own BuildConfig when using f-m-p (like adding a bc.yml file in src/main/fabric8) ?

Description

Got my BuildConfig always overridden by fabric8 plugin and would really like to tune it and use it

Info

  • f-m-p version : v3.5.31
  • Maven version (mvn -v) : 3.3.9
  • Kubernetes / OpenShift setup and version :
    openshift v1.5.1
    kubernetes v1.5.2+43a9be4
  • If it's a bug, how to reproduce :
    having this kind of file in src/main/fabric8:
apiVersion: v1
kind: BuildConfig
metadata:
  name: mybuildconfig
  namespace: projectname
spec:
  source:
    binary: {}
    type: Binary
  output:
    pushSecret:
      name: artifactory
    to:
      kind: ImageStream
      name: myimagestream
  strategy:
    dockerStrategy: {}
    type: Docker
  triggers:
  - generic:
      secret: dummysecret
    type: Generic
  nodeSelector:
    kubernetes.io/hostname: hostname

It gets overridden when executing mvn fabric8:build with especially annoying removal of pushSecret because of this:

BuildOutput buildOutput = new BuildOutputBuilder().withNewTo()
.withKind("ImageStreamTag")
.withName(outputImageStreamTag)
.endTo().build();

Thank you in advance for your kind help

@FlorianBois
Copy link

FlorianBois commented Oct 20, 2017

I'm asking myself if the plugin is really designed to have BuildConfig and ImageStream really overridable , my understanding of the lifecycle is : build > push > resource > apply > deploy > ... However, with custom yml for BuildConfig and ImageStream , we are force to do the resource > apply before the build, which somehow do unwanted deployment (deployment done before the build) unless we do tricky workaround in the deploymentConfig

Either, the plugin is able to deal with pushSecret and make its own BuildConfig and ImageStream before the build, forbidding the custom yaml for BuildConfig and ImageStream explicitely when parameter buildRecreate = none, or either , we can provide custom BuildConfig and ImageStream but we need specifc goals for build like build-resource build-apply dedicated to the preparation of the build that do not make anything else than things related to the build.

what is the best strategy with openshift here ? this is maybe a topic for story : Fill in the gaps and decouple (https://github.com/fabric8io/fabric8-maven-plugin/projects/1 ) where openshift has a different way to do the build.

@rhuss
Copy link
Contributor

rhuss commented Jul 24, 2018

Actually the build itself is considered to be an implementation detail as there are some constraints. I.e. the build has to use a binary source as this is the only mode that makes sense for an S2I build with f-m-p (where Maven runs outside s2i and the builder image just assembles the image).

Also share the concerns of @FlorianBois that it doesn't make sense to treat builds as regular resource objects.

So for now I'd recommend to extend the configuration for the plugin to tune the s2i build.

@stale
Copy link

stale bot commented Oct 23, 2018

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

@stale stale bot added the status/stale Issue/PR considered to be stale label Oct 23, 2018
@zonArt
Copy link
Author

zonArt commented Oct 23, 2018

@rhuss Any news for the implementation of s2i build configuration's extend ?

@stale stale bot removed the status/stale Issue/PR considered to be stale label Oct 23, 2018
@rhuss
Copy link
Contributor

rhuss commented Oct 23, 2018

@zonArt no, not yet. But we are currently reworking the whole build part to allow for a more flexible way of building images. This also affects the s2i build part, and when redoing this we should add the corresponding s2i config hooks.

What's your actual use case or better, what do you want to be configurable in the build config / imagestream ?

@stale
Copy link

stale bot commented Jan 21, 2019

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

@stale stale bot added the status/stale Issue/PR considered to be stale label Jan 21, 2019
@rohanKanojia rohanKanojia added cat/discussion Topic of discussion and removed status/stale Issue/PR considered to be stale labels Jan 24, 2019
@rohanKanojia
Copy link
Member

@zonArt : polite ping, Could you please elaborate your use case so that we can think about it's possible integration?

@zonArt
Copy link
Author

zonArt commented Jan 24, 2019

Hi,

I'm not anymore working on builds with fpm for now and thus my usecase is not anymore relevant. But as far as I remember from my previous job, the need was for us to be able to configure the pushSecret within the plugin to be able to push to a private registry. Also the possibility to override the output kind would probably be great addition too (being forced to use an ImageStream is a little limitation). I think @FlorianBois would probably be the best person to answer these concerns (even if I'll follow that closely as I might need it in a next future)

@schuch
Copy link
Contributor

schuch commented Mar 28, 2019

I am also interested in this.

My use case would be to push the image to an external registry:

spec:
  output:
    to:
      kind: DockerImage   
      name: docker.io/group/imagename:latest
    pushSecret:
      name: dockerhub

See https://blog.openshift.com/pushing-application-images-to-an-external-registry/ (Step 5)

@rohanKanojia
Copy link
Member

@schuch : Umm, you mean #1054 ??

@schuch
Copy link
Contributor

schuch commented Mar 28, 2019

Ah i overlooked that. Yes #1054 would be enough for me.

@hetzge
Copy link

hetzge commented May 23, 2019

I have a similar problem. I need to change the resource constraints:

spec:
  resources:
    limits:
      cpu: '1'
      memory: 1000Mi
    requests:
      cpu: 200m
      memory: 200Mi

@stale
Copy link

stale bot commented Aug 21, 2019

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

@stale stale bot added the status/stale Issue/PR considered to be stale label Aug 21, 2019
@stale stale bot closed this as completed Aug 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cat/discussion Topic of discussion status/stale Issue/PR considered to be stale
Projects
None yet
Development

No branches or pull requests

6 participants