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

feat(builder): remove deprecated strategies and default to Jib #5062

Merged
merged 3 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
strategy:
fail-fast: false
matrix:
publisher: ["Spectrum", "Jib"]
publisher: ["Jib", "Spectrum"]

steps:
- name: Checkout code
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/camel.apache.org_builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ spec:
properties:
buildah:
description: 'a BuildahTask, for Buildah strategy Deprecated:
use spectrum, jib or s2i instead'
use spectrum, jib, s2i or a custom publishing strategy instead'
properties:
baseImage:
description: base image layer
Expand Down Expand Up @@ -914,7 +914,7 @@ spec:
type: object
kaniko:
description: 'a KanikoTask, for Kaniko strategy Deprecated:
use spectrum, jib or s2i instead'
use spectrum, jib, s2i or a custom publishing strategy instead'
properties:
baseImage:
description: base image layer
Expand Down
3 changes: 2 additions & 1 deletion config/crd/bases/camel.apache.org_integrationkits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ spec:
type: array
verbose:
description: Enable verbose logging on build components that
support it (e.g. Kaniko build pod).
support it (e.g. Kaniko build pod). Deprecated no longer
in use
type: boolean
type: object
camel:
Expand Down
6 changes: 4 additions & 2 deletions config/crd/bases/camel.apache.org_integrationplatforms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ spec:
type: array
verbose:
description: Enable verbose logging on build components that
support it (e.g. Kaniko build pod).
support it (e.g. Kaniko build pod). Deprecated no longer
in use
type: boolean
type: object
camel:
Expand Down Expand Up @@ -2512,7 +2513,8 @@ spec:
type: array
verbose:
description: Enable verbose logging on build components that
support it (e.g. Kaniko build pod).
support it (e.g. Kaniko build pod). Deprecated no longer
in use
type: boolean
type: object
camel:
Expand Down
3 changes: 2 additions & 1 deletion config/crd/bases/camel.apache.org_integrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6535,7 +6535,8 @@ spec:
type: array
verbose:
description: Enable verbose logging on build components that
support it (e.g. Kaniko build pod).
support it (e.g. Kaniko build pod). Deprecated no longer
in use
type: boolean
type: object
camel:
Expand Down
3 changes: 2 additions & 1 deletion config/crd/bases/camel.apache.org_kameletbindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6820,7 +6820,8 @@ spec:
type: array
verbose:
description: Enable verbose logging on build components
that support it (e.g. Kaniko build pod).
that support it (e.g. Kaniko build pod). Deprecated
no longer in use
type: boolean
type: object
camel:
Expand Down
3 changes: 2 additions & 1 deletion config/crd/bases/camel.apache.org_pipes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6818,7 +6818,8 @@ spec:
type: array
verbose:
description: Enable verbose logging on build components
that support it (e.g. Kaniko build pod).
that support it (e.g. Kaniko build pod). Deprecated
no longer in use
type: boolean
type: object
camel:
Expand Down
2 changes: 0 additions & 2 deletions docs/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ asciidoc:
camel-quarkus-version: 3.2.3
camel-quarkus-docs-version: 3.2.x
quarkus-version: 3.2.9.Final
buildah-version: 1.30.0
kaniko-version: 1.9.1
kustomize-version: 4.5.4
kubernetes-api-version: 0.27.7
operator-fwk-api-version: 0.20.0
Expand Down
1 change: 0 additions & 1 deletion docs/modules/ROOT/pages/contributing/developers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ When configuring the IDE task, make sure to add all required environment variabl
After you set up the IDE task, with Java 11+ to be used by default, you can run and debug the operator process.

NOTE: The operator can be fully debugged in CRC, because it uses OpenShift S2I binary builds under the hood.
The build phase cannot be (currently) debugged in Minikube because the Kaniko builder requires that the operator and the publisher pod share a common persistent volume.

[[publishing]]
== Building Metadata for Publishing the Operator in Operator Hub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ The `routine` strategy (default) is in general faster as it does not require Kub

The `pod` strategy is **always** used when running a Quarkus native build (as it requires certain tools not available in the operator container). You can also use this strategy when you want to have a higher level of concurrency. Although a bit slower (it requires Kubernetes to spin off a new Pod), this strategy will guarantee the execution of each parallel build in a timely manner.

NOTE: the `pod` strategy was also required when using the now deprecated Buildah or Kaniko publishing strategy.

Beside the build strategy, there are other configuration you can fine tune for each single build (via builder trait) or in the `.spec.build.buildConfiguration` of the IntegrationPlatform if you want to apply such configuration to all your builds. See the Builder trait page for more information.

The most relevant are the `resource` and `limit` parameters which can be used to control how much resources to give to builder Pods. Then you can configure the `orderStrategy`, setting a `sequential` (single build), `fifo` (parallel build started in FIFO order) or `dependencies` (parallel build holding those applications which may depends on other because of xref:architecture/incremental-image.adoc[incremental image]). Finally you can include any `mavenProfile` to the build in order to influence the behavior of the build (ie, adding any plugin or configuration you can use when xref:pipeline/pipeline.adoc[running a pipeline]).
Expand Down
8 changes: 0 additions & 8 deletions docs/modules/ROOT/pages/installation/advanced/offline.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ We cannot provide any specific guideline on how to preload images in the cluster

The last one is the image used in the Camel K Runtime 2.16.0 version (the default one at the time of writing). Make sure to identify in the catalog (`.spec.runtime.metadata.quarkus.native-builder-image`) the one required in your installation.

If you also plan to use Buildah or Kaniko strategy, you need to provide those images as well:

* `quay.io/buildah/stable`
* `gcr.io/kaniko-project/executor`
* `gcr.io/kaniko-project/warmer`

Same thing if you are planning to use any xref:pipeline/pipeline.adoc[custom pipeline]. You need to upload the expected image ahead of time.

If all the above is set, then, you should be ready to pull and push from the container registry in Camel K as well.

[[maven]]
Expand Down
15 changes: 0 additions & 15 deletions docs/modules/ROOT/pages/installation/registry/gcr.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@ The best way to obtain a valid key is from the Google web console:

A `.json` file with the key will be downloaded to your machine. You need to store that key in a Kubernetes secret.

It's **important** to rename the file you've just downloaded to `kaniko-secret.json` (make sure you write it correctly).
After the renaming, execute the following command to create the secret:

```
kubectl create secret generic kaniko-secret --from-file=kaniko-secret.json
```

Ensure you have the https://github.com/apache/camel-k/releases[*kamel* CLI] on your system path.

You should now execute the following command to install cluster resources and the operator (in the current namespace):

```
kamel install --build-publish-strategy=Kaniko --registry gcr.io --organization <<your-project-id>> --registry-secret kaniko-secret
```

Use the project id of your project on GKE. Usually this can be obtained from the connection string.

NOTE: the project id is **NOT** the cluster id!
5 changes: 3 additions & 2 deletions docs/modules/ROOT/partials/apis/camel-k-crds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5206,15 +5206,15 @@ a PackageTask, used to package the project


a BuildahTask, for Buildah strategy
Deprecated: use spectrum, jib or s2i instead
Deprecated: use spectrum, jib, s2i or a custom publishing strategy instead

|`kaniko` +
*xref:#_camel_apache_org_v1_KanikoTask[KanikoTask]*
|


a KanikoTask, for Kaniko strategy
Deprecated: use spectrum, jib or s2i instead
Deprecated: use spectrum, jib, s2i or a custom publishing strategy instead

|`spectrum` +
*xref:#_camel_apache_org_v1_SpectrumTask[SpectrumTask]*
Expand Down Expand Up @@ -5817,6 +5817,7 @@ bool


Enable verbose logging on build components that support it (e.g. Kaniko build pod).
Deprecated no longer in use

|`properties` +
[]string
Expand Down
3 changes: 3 additions & 0 deletions e2e/commonwithcustominstall/platform_traits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ func TestTraitOnIntegrationPlatform(t *testing.T) {
Expect(KamelInstallWithID(operatorID, ns).Execute()).To(Succeed())

containerTestName := "testname"

Eventually(PlatformPhase(ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
ip := Platform(ns)()
ip.Spec.Traits = v1.Traits{Logging: &trait.LoggingTrait{Level: "DEBUG"}, Container: &trait.ContainerTrait{Name: containerTestName}}

if err := TestClient().Update(TestContext, ip); err != nil {
t.Fatal("Can't create IntegrationPlatform", err)
}
Eventually(PlatformPhase(ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))

name := RandomizedSuffixName("java")
t.Run("Run integration with platform traits", func(t *testing.T) {
Expand Down
15 changes: 0 additions & 15 deletions e2e/install/cli/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,3 @@ func TestInstallDebugLogging(t *testing.T) {
Eventually(OperatorEnvVarValue(ns, "LOG_LEVEL"), TestTimeoutLong).Should(Equal("debug"))
})
}

func TestInstallWithPublishStrategyOptions(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
operatorID := fmt.Sprintf("camel-k-%s", ns)
Expect(KamelInstallWithID(operatorID, ns, "--build-publish-strategy", "Kaniko", "--build-publish-strategy-option", "KanikoExecutorImage=foo", "--build-publish-strategy-option", "KanikoWarmerImage=bar").Execute()).To(Succeed())
Eventually(OperatorPod(ns)).ShouldNot(BeNil())
Eventually(Platform(ns)).ShouldNot(BeNil())
Eventually(func() map[string]string {
return Platform(ns)().Spec.Build.PublishStrategyOptions
}).Should(HaveKeyWithValue("KanikoExecutorImage", "foo"))
Eventually(func() map[string]string {
return Platform(ns)().Spec.Build.PublishStrategyOptions
}).Should(HaveKeyWithValue("KanikoWarmerImage", "bar"))
})
}
4 changes: 2 additions & 2 deletions helm/camel-k/crds/crd-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ spec:
properties:
buildah:
description: 'a BuildahTask, for Buildah strategy Deprecated:
use spectrum, jib or s2i instead'
use spectrum, jib, s2i or a custom publishing strategy instead'
properties:
baseImage:
description: base image layer
Expand Down Expand Up @@ -914,7 +914,7 @@ spec:
type: object
kaniko:
description: 'a KanikoTask, for Kaniko strategy Deprecated:
use spectrum, jib or s2i instead'
use spectrum, jib, s2i or a custom publishing strategy instead'
properties:
baseImage:
description: base image layer
Expand Down
3 changes: 2 additions & 1 deletion helm/camel-k/crds/crd-integration-kit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ spec:
type: array
verbose:
description: Enable verbose logging on build components that
support it (e.g. Kaniko build pod).
support it (e.g. Kaniko build pod). Deprecated no longer
in use
type: boolean
type: object
camel:
Expand Down
6 changes: 4 additions & 2 deletions helm/camel-k/crds/crd-integration-platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ spec:
type: array
verbose:
description: Enable verbose logging on build components that
support it (e.g. Kaniko build pod).
support it (e.g. Kaniko build pod). Deprecated no longer
in use
type: boolean
type: object
camel:
Expand Down Expand Up @@ -2512,7 +2513,8 @@ spec:
type: array
verbose:
description: Enable verbose logging on build components that
support it (e.g. Kaniko build pod).
support it (e.g. Kaniko build pod). Deprecated no longer
in use
type: boolean
type: object
camel:
Expand Down
3 changes: 2 additions & 1 deletion helm/camel-k/crds/crd-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6535,7 +6535,8 @@ spec:
type: array
verbose:
description: Enable verbose logging on build components that
support it (e.g. Kaniko build pod).
support it (e.g. Kaniko build pod). Deprecated no longer
in use
type: boolean
type: object
camel:
Expand Down
3 changes: 2 additions & 1 deletion helm/camel-k/crds/crd-kamelet-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6820,7 +6820,8 @@ spec:
type: array
verbose:
description: Enable verbose logging on build components
that support it (e.g. Kaniko build pod).
that support it (e.g. Kaniko build pod). Deprecated
no longer in use
type: boolean
type: object
camel:
Expand Down
3 changes: 2 additions & 1 deletion helm/camel-k/crds/crd-pipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6818,7 +6818,8 @@ spec:
type: array
verbose:
description: Enable verbose logging on build components
that support it (e.g. Kaniko build pod).
that support it (e.g. Kaniko build pod). Deprecated
no longer in use
type: boolean
type: object
camel:
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/camel/v1/build_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ type Task struct {
// Application Publishing

// a BuildahTask, for Buildah strategy
// Deprecated: use spectrum, jib or s2i instead
// Deprecated: use spectrum, jib, s2i or a custom publishing strategy instead
Buildah *BuildahTask `json:"buildah,omitempty"`
// a KanikoTask, for Kaniko strategy
// Deprecated: use spectrum, jib or s2i instead
// Deprecated: use spectrum, jib, s2i or a custom publishing strategy instead
Kaniko *KanikoTask `json:"kaniko,omitempty"`
// a SpectrumTask, for Spectrum strategy
Spectrum *SpectrumTask `json:"spectrum,omitempty"`
Expand Down
6 changes: 0 additions & 6 deletions pkg/apis/camel/v1/build_types_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ func ConfigurationTasksByName(tasks []Task, name string) *BuildConfiguration {
if t.Jib != nil && t.Jib.Name == name {
return &t.Jib.Configuration
}
if t.Buildah != nil && t.Buildah.Name == name {
return &t.Buildah.Configuration
}
if t.Kaniko != nil && t.Kaniko.Name == name {
return &t.Kaniko.Configuration
}
}
return &BuildConfiguration{}
}
Expand Down
11 changes: 1 addition & 10 deletions pkg/apis/camel/v1/integrationplatform_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,6 @@ type IntegrationPlatformKameletRepositorySpec struct {
type IntegrationPlatformBuildPublishStrategy string

const (
// IntegrationPlatformBuildPublishStrategyBuildah uses Buildah project (https://buildah.io/)
// in order to push the incremental images to the image repository. It can be used with `pod` BuildStrategy.
// Deprecated: use Spectrum, Jib or S2I instead.
IntegrationPlatformBuildPublishStrategyBuildah IntegrationPlatformBuildPublishStrategy = "Buildah"
// IntegrationPlatformBuildPublishStrategyKaniko uses Kaniko project (https://github.com/GoogleContainerTools/kaniko)
// in order to push the incremental images to the image repository. It can be used with `pod` BuildStrategy.
// Deprecated: use Spectrum, Jib or S2I instead.
IntegrationPlatformBuildPublishStrategyKaniko IntegrationPlatformBuildPublishStrategy = "Kaniko"
// IntegrationPlatformBuildPublishStrategyS2I uses the Source to Images (S2I) feature
// (https://docs.openshift.com/container-platform/4.9/openshift_images/create-images.html#images-create-s2i_create-images)
// provided by an OpenShift cluster in order to create and push the images to the registry. It is the default choice on OpenShift cluster.
Expand All @@ -175,8 +167,6 @@ const (

// IntegrationPlatformBuildPublishStrategies the list of all available publish strategies.
var IntegrationPlatformBuildPublishStrategies = []IntegrationPlatformBuildPublishStrategy{
IntegrationPlatformBuildPublishStrategyBuildah,
IntegrationPlatformBuildPublishStrategyKaniko,
IntegrationPlatformBuildPublishStrategyS2I,
IntegrationPlatformBuildPublishStrategySpectrum,
IntegrationPlatformBuildPublishStrategyJib,
Expand All @@ -197,6 +187,7 @@ const (
// IntegrationPlatformPhaseCreating when the IntegrationPlatform is under creation process.
IntegrationPlatformPhaseCreating IntegrationPlatformPhase = "Creating"
// IntegrationPlatformPhaseWarming when the IntegrationPlatform is warming (ie, creating Kaniko cache).
// Deprecated no longer in use.
IntegrationPlatformPhaseWarming IntegrationPlatformPhase = "Warming"
// IntegrationPlatformPhaseReady when the IntegrationPlatform is ready.
IntegrationPlatformPhaseReady IntegrationPlatformPhase = "Ready"
Expand Down
15 changes: 0 additions & 15 deletions pkg/apis/camel/v1/integrationplatform_types_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ limitations under the License.
package v1

import (
"strconv"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -173,19 +171,6 @@ func (in *IntegrationPlatformStatus) RemoveCondition(condType IntegrationPlatfor
in.Conditions = newConditions
}

// IsOptionEnabled tells if provided option key is present in PublishStrategyOptions and enabled.
func (b IntegrationPlatformBuildSpec) IsOptionEnabled(option string) bool {
// Key defined in builder/kaniko.go
if enabled, ok := b.PublishStrategyOptions[option]; ok {
res, err := strconv.ParseBool(enabled)
if err != nil {
return false
}
return res
}
return false
}

// AddOption add a publish strategy option.
func (b *IntegrationPlatformBuildSpec) AddOption(option string, value string) {
options := b.PublishStrategyOptions
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/camel/v1/trait/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package trait
type BuilderTrait struct {
PlatformBaseTrait `property:",squash" json:",inline"`
// Enable verbose logging on build components that support it (e.g. Kaniko build pod).
// Deprecated no longer in use
Verbose *bool `property:"verbose" json:"verbose,omitempty"`
// A list of properties to be provided to the build task
Properties []string `property:"properties" json:"properties,omitempty"`
Expand Down
Loading
Loading