Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-18725

Chained s2i builder image with binary artifact is taking too much space

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 7.3.0.GA
    • 7.3.0.CD18
    • OpenShift
    • None
    • Hide
      oc login <openshift-instance>:6443
      oc new-project eap-demo
      oc create -f 1234567_myserviceaccount-secret.yaml # this secret can be created in https://access.redhat.com/terms-based-registry/
      oc secrets link default 1234567-myserviceaccount-pull-secret --for=pull
      oc secrets link builder 1234567-myserviceaccount-pull-secret --for=pull
      for resource in \
        eap-cd-amq-persistent-s2i.json \
        eap-cd-amq-s2i.json \
        eap-cd-basic-s2i.json \
        eap-cd-https-s2i.json \
        eap-cd-image-stream.json \
        eap-cd-sso-s2i.json \
        eap-cd-starter-s2i.json \
        eap-cd-third-party-db-s2i.json \
        eap-cd-tx-recovery-s2i.json
      do
        oc replace --force -f \
      https://raw.githubusercontent.com/jboss-container-images/jboss-eap-7-openshift-image/eap-cd/templates/${resource}
      done
      oc new-app --template=eap-cd-basic-s2i  -p IMAGE_STREAM_NAMESPACE=eap-demo  -p SOURCE_REPOSITORY_URL=https://github.com/jboss-developer/jboss-eap-quickstarts  -p SOURCE_REPOSITORY_REF=openshift  -p CONTEXT_DIR=kitchensink
      oc get images # find sha256 of newly created builder image
      oc describe image <sha256-builder-image>
      
      Show
      oc login <openshift-instance>:6443 oc new -project eap-demo oc create -f 1234567_myserviceaccount-secret.yaml # this secret can be created in https: //access.redhat.com/terms-based-registry/ oc secrets link default 1234567-myserviceaccount-pull-secret -- for =pull oc secrets link builder 1234567-myserviceaccount-pull-secret -- for =pull for resource in \ eap-cd-amq-persistent-s2i.json \ eap-cd-amq-s2i.json \ eap-cd-basic-s2i.json \ eap-cd-https-s2i.json \ eap-cd-image-stream.json \ eap-cd-sso-s2i.json \ eap-cd-starter-s2i.json \ eap-cd-third-party-db-s2i.json \ eap-cd-tx-recovery-s2i.json do oc replace --force -f \ https: //raw.githubusercontent.com/jboss-container-images/jboss-eap-7-openshift-image/eap-cd/templates/${resource} done oc new -app --template=eap-cd-basic-s2i -p IMAGE_STREAM_NAMESPACE=eap-demo -p SOURCE_REPOSITORY_URL=https: //github.com/jboss-developer/jboss-eap-quickstarts -p SOURCE_REPOSITORY_REF=openshift -p CONTEXT_DIR=kitchensink oc get images # find sha256 of newly created builder image oc describe image <sha256-builder-image>

      Customer Impact: Imagine production environment with 1000 microservices built by s2i. 820MB * 1000 = 820GB of disk space for registry will be needeed to keep one version of all microservices.

      The issue is not with builder image itself but the result of s2i build. This builder "image with binary artifacts" is stored to registry and later with runtime image to produce final image with compiled artefact.

      Problem is that new layer in builder "image with binary artifacts" has 800+MB. Note that this layer will not be shared with other images and each new build will consume 800+MB in registry which can leads to out of disk space issues really quickly (especially in Openshift internal registry)

      Looking at the image using dive command there are following changes:

      As only content of s2i-output is copied into runtime image. All other changes should be cleaned up after s2i build so they do not take space.

      For example there is /tmp directory with maven repo of built application. Directories /opt/eap and /opt/jboss are no longer necessary as well. Removing those 3 dirs will free ~500MB.

      Note:
      There is used naming convention from following diagram:

        1. chaining.png
          9 kB
          Miroslav Novak
        2. s2i-builder-image.png
          328 kB
          Miroslav Novak
        3. Screenshot from 2020-03-23 15-02-49.png
          313 kB
          Martin Choma

              jdenise@redhat.com Jean Francois Denise
              mnovak1@redhat.com Miroslav Novak
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: