[KOGITO-8298] Improve the Kaniko build time using a pre-warmed cache and desired resources (#51)
Signed-off-by: Davide Salerno <dsalerno@redhat.com>
diff --git a/builder/builder.go b/builder/builder.go
index 23129c6..7359f52 100644
--- a/builder/builder.go
+++ b/builder/builder.go
@@ -54,6 +54,21 @@
return ib
}
+func (b *Builder) getImageBuilderForKaniko(workflowID string, imageTag string, workflowDefinition []byte, task *api.KanikoTask) ImageBuilder {
+ containerFile := b.commonConfig.Data[b.commonConfig.Data[constants.DEFAULT_BUILDER_RESOURCE_NAME_KEY]]
+ ib := NewImageBuilder(workflowID, workflowDefinition, []byte(containerFile))
+ ib.OnNamespace(b.customConfig[constants.CUSTOM_NS_KEY])
+ ib.WithPodMiddleName(workflowID)
+ ib.WithInsecureRegistry(false)
+ ib.WithImageName(workflowID + imageTag)
+ ib.WithSecret(b.customConfig[constants.CUSTOM_REG_CRED_KEY])
+ ib.WithRegistryAddress(b.customConfig[constants.CUSTOM_REG_ADDRESS_KEY])
+ ib.WithCache(task.Cache)
+ ib.WithResources(task.Resources)
+ ib.WithAdditionalFlags(task.AdditionalFlags)
+ return ib
+}
+
func (b *Builder) ScheduleNewBuildWithTimeout(workflowName string, imageTag string, workflowDefinition []byte, timeout time.Duration) (*api.Build, error) {
ib := b.getImageBuilder(workflowName, imageTag, workflowDefinition)
ib.WithTimeout(timeout)
@@ -72,6 +87,12 @@
return b.BuildImage(ib.Build())
}
+func (b *Builder) ScheduleNewKanikoBuildWithContainerFile(workflowName string, imageTag string, workflowDefinition []byte, build api.BuildSpec) (*api.Build, error) {
+ ib := b.getImageBuilderForKaniko(workflowName, imageTag, workflowDefinition, build.Tasks[0].Kaniko)
+ ib.WithTimeout(5 * time.Minute)
+ return b.BuildImage(ib.Build())
+}
+
func (b *Builder) ReconcileBuild(build *api.Build, cli client.Client) (*api.Build, error) {
result, err := builder.FromBuild(build).WithClient(cli).Reconcile()
return result, err
@@ -100,6 +121,9 @@
}
build, err := builder.NewBuild(platform, kb.ImageName, kb.PodMiddleName).
+ WithKanikoCache(kb.Cache).
+ WithKanikoResources(kb.Resources).
+ WithKanikoAdditionalArgs(kb.AdditionalFlags).
WithResource(constants.BUILDER_RESOURCE_NAME_DEFAULT, kb.ContainerFile).
WithResource(kb.WorkflowID+b.commonConfig.Data[constants.DEFAULT_WORKFLOW_EXTENSION_KEY], kb.WorkflowDefinition).
WithClient(cli).
@@ -134,6 +158,9 @@
}
build, err := builder.NewBuild(platform, kb.ImageName, kb.PodMiddleName).
+ WithKanikoCache(kb.Cache).
+ WithKanikoResources(kb.Resources).
+ WithKanikoAdditionalArgs(kb.AdditionalFlags).
WithResource(constants.BUILDER_RESOURCE_NAME_DEFAULT, kb.ContainerFile).
WithResource(kb.WorkflowID+b.commonConfig.Data[constants.DEFAULT_WORKFLOW_EXTENSION_KEY], kb.WorkflowDefinition).
WithClient(cli).
@@ -158,6 +185,9 @@
RegistryAddress string
RegistryOrganization string
Secret string
+ Cache api.KanikoTaskCache
+ Resources corev1.ResourceRequirements
+ AdditionalFlags []string
}
type ImageBuilder struct {
@@ -203,6 +233,20 @@
return ib
}
+func (ib *ImageBuilder) WithCache(cache api.KanikoTaskCache) *ImageBuilder {
+ ib.KogitoBuilder.Cache = cache
+ return ib
+}
+func (ib *ImageBuilder) WithResources(resources corev1.ResourceRequirements) *ImageBuilder {
+ ib.KogitoBuilder.Resources = resources
+ return ib
+}
+
+func (ib *ImageBuilder) WithAdditionalFlags(flags []string) *ImageBuilder {
+ ib.KogitoBuilder.AdditionalFlags = flags
+ return ib
+}
+
func (ib *ImageBuilder) Build() KogitoBuilder {
return *ib.KogitoBuilder
}
diff --git a/bundle/manifests/sw.kogito.kie.org_kogitoserverlessbuilds.yaml b/bundle/manifests/sw.kogito.kie.org_kogitoserverlessbuilds.yaml
index 56a0652..2ef1e67 100644
--- a/bundle/manifests/sw.kogito.kie.org_kogitoserverlessbuilds.yaml
+++ b/bundle/manifests/sw.kogito.kie.org_kogitoserverlessbuilds.yaml
@@ -91,6 +91,12 @@
kaniko:
description: a KanikoTask, for Kaniko strategy
properties:
+ additionalFlags:
+ description: AdditionalFlags -- List of additional
+ flags for the Kaniko process (see https://github.com/GoogleContainerTools/kaniko/blob/main/README.md#additional-flags)
+ items:
+ type: string
+ type: array
baseImage:
description: base image layer
type: string
@@ -136,6 +142,35 @@
stored
type: string
type: object
+ resources:
+ description: Resources -- optional compute resource
+ requirements for the Kaniko container
+ properties:
+ limits:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Limits describes the maximum amount
+ of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ requests:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Requests describes the minimum
+ amount of compute resources required. If Requests
+ is omitted for a container, it defaults to
+ Limits if that is explicitly specified, otherwise
+ to an implementation-defined value. More info:
+ https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ type: object
verbose:
description: log more information
type: boolean
diff --git a/bundle/manifests/sw.kogito.kie.org_kogitoserverlessplatforms.yaml b/bundle/manifests/sw.kogito.kie.org_kogitoserverlessplatforms.yaml
index 85244ae..ea2ddc5 100644
--- a/bundle/manifests/sw.kogito.kie.org_kogitoserverlessplatforms.yaml
+++ b/bundle/manifests/sw.kogito.kie.org_kogitoserverlessplatforms.yaml
@@ -56,6 +56,12 @@
kaniko:
description: a KanikoTask, for Kaniko strategy
properties:
+ additionalFlags:
+ description: AdditionalFlags -- List of additional flags
+ for the Kaniko process (see https://github.com/GoogleContainerTools/kaniko/blob/main/README.md#additional-flags)
+ items:
+ type: string
+ type: array
baseImage:
description: base image layer
type: string
@@ -100,6 +106,34 @@
description: the secret where credentials are stored
type: string
type: object
+ resources:
+ description: Resources -- optional compute resource
+ requirements for the Kaniko container
+ properties:
+ limits:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Limits describes the maximum amount
+ of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ requests:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Requests describes the minimum amount
+ of compute resources required. If Requests is
+ omitted for a container, it defaults to Limits
+ if that is explicitly specified, otherwise to
+ an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ type: object
verbose:
description: log more information
type: boolean
@@ -241,6 +275,12 @@
kaniko:
description: a KanikoTask, for Kaniko strategy
properties:
+ additionalFlags:
+ description: AdditionalFlags -- List of additional flags
+ for the Kaniko process (see https://github.com/GoogleContainerTools/kaniko/blob/main/README.md#additional-flags)
+ items:
+ type: string
+ type: array
baseImage:
description: base image layer
type: string
@@ -285,6 +325,34 @@
description: the secret where credentials are stored
type: string
type: object
+ resources:
+ description: Resources -- optional compute resource
+ requirements for the Kaniko container
+ properties:
+ limits:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Limits describes the maximum amount
+ of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ requests:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Requests describes the minimum amount
+ of compute resources required. If Requests is
+ omitted for a container, it defaults to Limits
+ if that is explicitly specified, otherwise to
+ an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ type: object
verbose:
description: log more information
type: boolean
diff --git a/config/crd/bases/sw.kogito.kie.org_kogitoserverlessbuilds.yaml b/config/crd/bases/sw.kogito.kie.org_kogitoserverlessbuilds.yaml
index a6aceb4..44e6bd6 100644
--- a/config/crd/bases/sw.kogito.kie.org_kogitoserverlessbuilds.yaml
+++ b/config/crd/bases/sw.kogito.kie.org_kogitoserverlessbuilds.yaml
@@ -92,6 +92,12 @@
kaniko:
description: a KanikoTask, for Kaniko strategy
properties:
+ additionalFlags:
+ description: AdditionalFlags -- List of additional
+ flags for the Kaniko process (see https://github.com/GoogleContainerTools/kaniko/blob/main/README.md#additional-flags)
+ items:
+ type: string
+ type: array
baseImage:
description: base image layer
type: string
@@ -137,6 +143,35 @@
stored
type: string
type: object
+ resources:
+ description: Resources -- optional compute resource
+ requirements for the Kaniko container
+ properties:
+ limits:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Limits describes the maximum amount
+ of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ requests:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Requests describes the minimum
+ amount of compute resources required. If Requests
+ is omitted for a container, it defaults to
+ Limits if that is explicitly specified, otherwise
+ to an implementation-defined value. More info:
+ https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ type: object
verbose:
description: log more information
type: boolean
diff --git a/config/crd/bases/sw.kogito.kie.org_kogitoserverlessplatforms.yaml b/config/crd/bases/sw.kogito.kie.org_kogitoserverlessplatforms.yaml
index 51e9443..f7c0c5c 100644
--- a/config/crd/bases/sw.kogito.kie.org_kogitoserverlessplatforms.yaml
+++ b/config/crd/bases/sw.kogito.kie.org_kogitoserverlessplatforms.yaml
@@ -57,6 +57,12 @@
kaniko:
description: a KanikoTask, for Kaniko strategy
properties:
+ additionalFlags:
+ description: AdditionalFlags -- List of additional flags
+ for the Kaniko process (see https://github.com/GoogleContainerTools/kaniko/blob/main/README.md#additional-flags)
+ items:
+ type: string
+ type: array
baseImage:
description: base image layer
type: string
@@ -101,6 +107,34 @@
description: the secret where credentials are stored
type: string
type: object
+ resources:
+ description: Resources -- optional compute resource
+ requirements for the Kaniko container
+ properties:
+ limits:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Limits describes the maximum amount
+ of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ requests:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Requests describes the minimum amount
+ of compute resources required. If Requests is
+ omitted for a container, it defaults to Limits
+ if that is explicitly specified, otherwise to
+ an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ type: object
verbose:
description: log more information
type: boolean
@@ -242,6 +276,12 @@
kaniko:
description: a KanikoTask, for Kaniko strategy
properties:
+ additionalFlags:
+ description: AdditionalFlags -- List of additional flags
+ for the Kaniko process (see https://github.com/GoogleContainerTools/kaniko/blob/main/README.md#additional-flags)
+ items:
+ type: string
+ type: array
baseImage:
description: base image layer
type: string
@@ -286,6 +326,34 @@
description: the secret where credentials are stored
type: string
type: object
+ resources:
+ description: Resources -- optional compute resource
+ requirements for the Kaniko container
+ properties:
+ limits:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Limits describes the maximum amount
+ of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ requests:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Requests describes the minimum amount
+ of compute resources required. If Requests is
+ omitted for a container, it defaults to Limits
+ if that is explicitly specified, otherwise to
+ an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ type: object
verbose:
description: log more information
type: boolean
diff --git a/config/samples/sw.kogito_v1alpha08_kogitoserverlessplatform_withCache.yaml b/config/samples/sw.kogito_v1alpha08_kogitoserverlessplatform_withCache.yaml
new file mode 100644
index 0000000..f001fea
--- /dev/null
+++ b/config/samples/sw.kogito_v1alpha08_kogitoserverlessplatform_withCache.yaml
@@ -0,0 +1,15 @@
+apiVersion: sw.kogito.kie.org/v1alpha08
+kind: KogitoServerlessPlatform
+metadata:
+ name: kogito-workflow-platform
+spec:
+ cluster: kubernetes
+ platform:
+ publishStrategy: "Kaniko"
+ baseImage: quay.io/kiegroup/kogito-swf-builder-nightly:latest
+ registry:
+ address: quay.io/kiegroup
+ secret: regcred
+ PublishStrategyOptions:
+ KanikoBuildCacheEnabled: "true"
+
diff --git a/config/samples/sw.kogito_v1alpha08_kogitoserverlessplatform_withCacheAndCustomization.yaml b/config/samples/sw.kogito_v1alpha08_kogitoserverlessplatform_withCacheAndCustomization.yaml
new file mode 100644
index 0000000..d4a1313
--- /dev/null
+++ b/config/samples/sw.kogito_v1alpha08_kogitoserverlessplatform_withCacheAndCustomization.yaml
@@ -0,0 +1,29 @@
+apiVersion: sw.kogito.kie.org/v1alpha08
+kind: KogitoServerlessPlatform
+metadata:
+ name: kogito-workflow-platform
+spec:
+ cluster: kubernetes
+ build:
+ tasks:
+ - kaniko:
+ resources:
+ requests:
+ memory: "1Gi"
+ cpu: "1"
+ limits:
+ memory: "2Gi"
+ cpu: "2"
+ additionalFlags:
+ - "--use-new-run=true"
+ - "--cache=true"
+ - "--cache-dir=/kaniko/cache"
+ platform:
+ publishStrategy: "Kaniko"
+ baseImage: quay.io/kiegroup/kogito-swf-builder-nightly:latest
+ registry:
+ address: quay.io/kiegroup
+ secret: regcred
+ PublishStrategyOptions:
+ KanikoBuildCacheEnabled: "true"
+
diff --git a/controllers/kogitoserverlessbuild_controller.go b/controllers/kogitoserverlessbuild_controller.go
index 6bf9fa0..9a61523 100644
--- a/controllers/kogitoserverlessbuild_controller.go
+++ b/controllers/kogitoserverlessbuild_controller.go
@@ -104,7 +104,7 @@
if phase == api.BuildPhaseNone {
workflow, imageTag, err := r.retrieveWorkflowFromCR(build.Spec.WorkflowId, ctx, req)
if err == nil {
- buildStatus, err := builder.ScheduleNewBuildWithContainerFile(build.Spec.WorkflowId, imageTag, workflow)
+ buildStatus, err := builder.ScheduleNewKanikoBuildWithContainerFile(build.Spec.WorkflowId, imageTag, workflow, pl.Spec.Build)
if err == nil {
manageStatusUpdate(ctx, buildStatus, build, r, log)
return ctrl.Result{RequeueAfter: 5 * time.Second}, nil
diff --git a/go.mod b/go.mod
index cc7f11f..7c90f99 100644
--- a/go.mod
+++ b/go.mod
@@ -6,7 +6,7 @@
github.com/go-logr/logr v1.2.3
github.com/jpillora/backoff v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
- github.com/onsi/gomega v1.20.1
+ github.com/onsi/gomega v1.22.1
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/stretchr/testify v1.8.0
@@ -24,7 +24,7 @@
require (
github.com/RHsyseng/operator-utils v1.4.11
- github.com/kiegroup/container-builder v0.0.0-20221028160425-7921fe1891f1
+ github.com/kiegroup/container-builder v0.0.0-20221215132240-f70d743ccd41
github.com/onsi/ginkgo v1.16.5
github.com/openshift/api v0.0.0-20211209135129-c58d9f695577
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.55.1
diff --git a/go.sum b/go.sum
index f3307db..fb2b324 100644
--- a/go.sum
+++ b/go.sum
@@ -258,8 +258,8 @@
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
-github.com/kiegroup/container-builder v0.0.0-20221028160425-7921fe1891f1 h1:fA02lX9yziMCx3zPwIwZDXGp+Sb1YnN25fLfkqLFB1M=
-github.com/kiegroup/container-builder v0.0.0-20221028160425-7921fe1891f1/go.mod h1:XbhwGkhblYMFsXmRTgJk5KtTtLnMokCfztpJMZe7qYc=
+github.com/kiegroup/container-builder v0.0.0-20221215132240-f70d743ccd41 h1:JeGbUVj9wmqFdvDxeLOFyZh2VuxDHs/hQwimtsETPDY=
+github.com/kiegroup/container-builder v0.0.0-20221215132240-f70d743ccd41/go.mod h1:s1naiMt/mvRWXR4FNARNOsuB9LdDpQFhtrEAq9uArCM=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
@@ -312,12 +312,12 @@
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
-github.com/onsi/ginkgo/v2 v2.1.6 h1:Fx2POJZfKRQcM1pH49qSZiYeu319wji004qX+GDovrU=
+github.com/onsi/ginkgo/v2 v2.3.0 h1:kUMoxMoQG3ogk/QWyKh3zibV7BKZ+xBpWil1cTylVqc=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
-github.com/onsi/gomega v1.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q=
-github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo=
+github.com/onsi/gomega v1.22.1 h1:pY8O4lBfsHKZHM/6nrxkhVPUznOlIu3quZcKP/M20KI=
+github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM=
github.com/openshift/api v0.0.0-20211209135129-c58d9f695577 h1:NUe82M8wMYXbd5s+WBAJ2QAZZivs+nhZ3zYgZFwKfqw=
github.com/openshift/api v0.0.0-20211209135129-c58d9f695577/go.mod h1:DoslCwtqUpr3d/gsbq4ZlkaMEdYqKxuypsDjorcHhME=
github.com/openshift/build-machinery-go v0.0.0-20210712174854-1bb7fd1518d3/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
diff --git a/operator.yaml b/operator.yaml
index 2ff3433..ee68992 100644
--- a/operator.yaml
+++ b/operator.yaml
@@ -98,6 +98,12 @@
kaniko:
description: a KanikoTask, for Kaniko strategy
properties:
+ additionalFlags:
+ description: AdditionalFlags -- List of additional
+ flags for the Kaniko process (see https://github.com/GoogleContainerTools/kaniko/blob/main/README.md#additional-flags)
+ items:
+ type: string
+ type: array
baseImage:
description: base image layer
type: string
@@ -143,6 +149,35 @@
stored
type: string
type: object
+ resources:
+ description: Resources -- optional compute resource
+ requirements for the Kaniko container
+ properties:
+ limits:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Limits describes the maximum amount
+ of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ requests:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Requests describes the minimum
+ amount of compute resources required. If Requests
+ is omitted for a container, it defaults to
+ Limits if that is explicitly specified, otherwise
+ to an implementation-defined value. More info:
+ https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ type: object
verbose:
description: log more information
type: boolean
@@ -339,6 +374,12 @@
kaniko:
description: a KanikoTask, for Kaniko strategy
properties:
+ additionalFlags:
+ description: AdditionalFlags -- List of additional flags
+ for the Kaniko process (see https://github.com/GoogleContainerTools/kaniko/blob/main/README.md#additional-flags)
+ items:
+ type: string
+ type: array
baseImage:
description: base image layer
type: string
@@ -383,6 +424,34 @@
description: the secret where credentials are stored
type: string
type: object
+ resources:
+ description: Resources -- optional compute resource
+ requirements for the Kaniko container
+ properties:
+ limits:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Limits describes the maximum amount
+ of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ requests:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Requests describes the minimum amount
+ of compute resources required. If Requests is
+ omitted for a container, it defaults to Limits
+ if that is explicitly specified, otherwise to
+ an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ type: object
verbose:
description: log more information
type: boolean
@@ -524,6 +593,12 @@
kaniko:
description: a KanikoTask, for Kaniko strategy
properties:
+ additionalFlags:
+ description: AdditionalFlags -- List of additional flags
+ for the Kaniko process (see https://github.com/GoogleContainerTools/kaniko/blob/main/README.md#additional-flags)
+ items:
+ type: string
+ type: array
baseImage:
description: base image layer
type: string
@@ -568,6 +643,34 @@
description: the secret where credentials are stored
type: string
type: object
+ resources:
+ description: Resources -- optional compute resource
+ requirements for the Kaniko container
+ properties:
+ limits:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Limits describes the maximum amount
+ of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ requests:
+ additionalProperties:
+ anyOf:
+ - type: integer
+ - type: string
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ description: 'Requests describes the minimum amount
+ of compute resources required. If Requests is
+ omitted for a container, it defaults to Limits
+ if that is explicitly specified, otherwise to
+ an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ type: object
verbose:
description: log more information
type: boolean
diff --git a/platform/initialize.go b/platform/initialize.go
index ac2ace3..eaaac27 100644
--- a/platform/initialize.go
+++ b/platform/initialize.go
@@ -67,9 +67,9 @@
return nil, err
}
// nolint: staticcheck
- if platform.Status.BuildPlatform.PublishStrategy == api.PlatformBuildPublishStrategyKaniko {
+ if platform.Status.KogitoServerlessPlatformSpec.BuildPlatform.PublishStrategy == api.PlatformBuildPublishStrategyKaniko {
//If KanikoCache is enabled
- if platform.Status.BuildPlatform.IsOptionEnabled(builder.KanikoBuildCacheEnabled) {
+ if platform.Status.KogitoServerlessPlatformSpec.BuildPlatform.IsOptionEnabled(builder.KanikoBuildCacheEnabled) {
// Create the persistent volume claim used by the Kaniko cache
action.Logger.Info("Create persistent volume claim")
err := createPersistentVolumeClaim(ctx, action.client, platform)
diff --git a/platform/kaniko_cache.go b/platform/kaniko_cache.go
index 19ac1d9..3f299e0 100644
--- a/platform/kaniko_cache.go
+++ b/platform/kaniko_cache.go
@@ -67,6 +67,7 @@
Name: "warm-kaniko-cache",
Image: warmerImage,
Args: []string{
+ "--force",
"--cache-dir=" + builder.KanikoCacheDir,
"--image=" + platform.Status.BuildPlatform.BaseImage,
},