diff --git a/addons/master/master_test.go b/addons/master/master_test.go index 6e0e028d35..cce4c38f9b 100644 --- a/addons/master/master_test.go +++ b/addons/master/master_test.go @@ -70,7 +70,7 @@ func TestMasterOn(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -161,7 +161,7 @@ func TestMasterOff(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -223,7 +223,7 @@ func TestMasterAuto(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, diff --git a/docs/modules/ROOT/pages/contributing/developers.adoc b/docs/modules/ROOT/pages/contributing/developers.adoc index e968e5d50b..1b9856cb5c 100644 --- a/docs/modules/ROOT/pages/contributing/developers.adoc +++ b/docs/modules/ROOT/pages/contributing/developers.adoc @@ -227,8 +227,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. - [[publishing]] == Building Metadata for Publishing the Operator in Operator Hub diff --git a/docs/modules/ROOT/pages/contributing/local-development.adoc b/docs/modules/ROOT/pages/contributing/local-development.adoc index a908f9f7a4..732a9936a7 100644 --- a/docs/modules/ROOT/pages/contributing/local-development.adoc +++ b/docs/modules/ROOT/pages/contributing/local-development.adoc @@ -30,8 +30,6 @@ This command will build and publish your actual Camel K development version to t ---- make install-k8s-global (default in camel-k namespace) make install-k8s-ns (default in default namespace) -make install-openshift-global (default in camel-k namespace) -make install-openshift-ns (default in default namespace) ---- Those targets may use two variables, `NAMESPACE` and `REGISTRY` in order to let you specify the namespace where to install the operator and the container registry to use. For instance: @@ -45,6 +43,25 @@ Will install a global operator in the `test` namespace with the registry located In order to uninstall the local operator you can also run `make uninstall` (will keep CRDs) and `make uninstall-all` (will remove CRDs and consequently any running Integration). You can use variable `NAMESPACE` as well if the operator was installed in a namespace different than default. +=== CRC special requirement + +You may need to test the operator on CRC. In such case you can login to the Openshift registry accessing its local interface: + +``` +docker login -u kubeadmin -p $(oc whoami -t) default-route-openshift-image-registry.apps-crc.testing +``` + +At this stage you will need to hack a little bit in order to be able to push the operator image to the registry: +``` +CUSTOM_IMAGE=default-route-openshift-image-registry.apps-crc.testing/camel-k/camel-k make bundle +NOTEST=true CUSTOM_IMAGE=default-route-openshift-image-registry.apps-crc.testing/camel-k/camel-k make images +docker push default-route-openshift-image-registry.apps-crc.testing/camel-k/camel-k:2.6.0-SNAPSHOT +``` + +With the steps above you should have available a local operator into CRC and proceed normally with the `make install-k8s-global` procedure. + +NOTE: you will need to configure the IntegrationPlatform and the registry as required for Openshift and the operator Deployment may fail due to high amount of resources limit (which you can remove to let the operator start). + [[local-camel-k-runtime]] === Local Camel K runtime diff --git a/docs/modules/ROOT/pages/installation/advanced/build-config.adoc b/docs/modules/ROOT/pages/installation/advanced/build-config.adoc index 3b83a1f1e8..8e38926ce1 100644 --- a/docs/modules/ROOT/pages/installation/advanced/build-config.adoc +++ b/docs/modules/ROOT/pages/installation/advanced/build-config.adoc @@ -20,10 +20,8 @@ The most relevant are the `resource` and `limit` parameters which can be used to The publish strategy is used to control the behavior of the creation of the container after a build. Basically it create a container image from the application built in the previous step and store as a container in the xref:installation/registry/registry.adoc[registry] configured. -The operator has 2 different strategy which you can adopt: Jib (default in plain Kubernetes profile) and S2I (default in Openshift profile). +The operator has one unique strategy which you can adopt: Jib. Alternatively you can provide your own publishing strategy (although this is not recommended). https://cloud.google.com/java/getting-started/jib[Jib] is a technology that transform a Java project into a container image and is configurable directly in Maven. -https://access.redhat.com/documentation/es-es/openshift_container_platform/4.2/html/builds/understanding-image-builds#build-strategy-s2i_understanding-image-builds[S2I] is an efficient technology integrated in Openshift, reason why it is enabled by default in such a profile. - NOTE: you may define your own publishing technology by using xref:pipeline/pipeline.adoc[pipelines]. \ No newline at end of file diff --git a/docs/modules/ROOT/pages/installation/registry/registry-secret.adoc b/docs/modules/ROOT/pages/installation/registry/registry-secret.adoc index da5f232aa1..fee6374164 100644 --- a/docs/modules/ROOT/pages/installation/registry/registry-secret.adoc +++ b/docs/modules/ROOT/pages/installation/registry/registry-secret.adoc @@ -9,7 +9,7 @@ In some cases, you might already have a push/pull secret for your container regi [source,bash] ---- -kubectl create secret docker-registry your-secret-name --docker-username your-user --docker-password your-pass +kubectl create secret docker-registry registry --docker-server --docker-username --docker-password ---- Another possibility is to upload to the cluster your entire list of push/pull secrets: @@ -34,8 +34,8 @@ spec: build: registry: address: - organization: + organization: (optional) secret: ---- -NOTE: make sure any credential contains the valid authentication servers: `docker.io` is used by **Jib**. Other publishing strategies may instead require to use a different endpoint, ie, `https://index.docker.io/v1/`. \ No newline at end of file +NOTE: make sure any credential contains the valid authentication servers: for instance, `docker.io` is used by **Jib**. \ No newline at end of file diff --git a/docs/modules/ROOT/pages/installation/registry/registry.adoc b/docs/modules/ROOT/pages/installation/registry/registry.adoc index 0b0b2ed26f..14d4b5744b 100644 --- a/docs/modules/ROOT/pages/installation/registry/registry.adoc +++ b/docs/modules/ROOT/pages/installation/registry/registry.adoc @@ -8,14 +8,26 @@ The Camel K operator is in charge to build a Camel application and to "container For the reason above it's important that you provide a container registry which is accessible from both the operator Pod and the cluster internal mechanisms. However, a **default registry** is present in certain platforms such as _Minikube_, _Openshift_ or _Docker Desktop_. -For any other platform that do not provide a default container registry, then, a registry must be provided accordingly. +For any other platform that do not provide a default container registry, then, a container registry must be provided accordingly. [[how-to-configure]] == How to configure Camel K container registry When running a production grade installation, you'll be probably using a private container registry which is accessible via authenticated method. The secret is something that will be https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-pod-that-uses-your-secret[included at deployment time] as `imagePullSecret` configuration. -As each registry may have a slightly different way of securing the access you can use the generic guidelines provided in xref:installation/registry/registry-secret.adoc[Secret registry configuration] and adjust accordingly. We expect that at the end of the process you have a public address (1) an _organization_ (2) and a _secret_ (3) values that will be used to configure the registry. +[[kubernetes-secret]] +=== Create a secret for your registry + +The easiest way to create a Secret is to leverage the `kubectl` CLI: + +[source,bash] +---- +kubectl create secret docker-registry registry --docker-server --docker-username --docker-password +---- + +NOTE: you must include `--docker-server docker.io` value also if you're using Docker Hub. The default value provided by `kubectl` won't. + +As each registry may have a slightly different way of securing the access you can use the generic guidelines provided in and adjust accordingly (more information in the xref:installation/registry/registry-secret.adoc[Secret registry configuration] guide). We expect that at the end of the process you have a public address (1) an _organization_ (2) (optional, see details below) and a _secret_ (3) values that will be used to configure the registry. You will need to create or edit any existing `IntegrationPlatform` custom resource with the values as expected in the `.spec.build.registry`. @@ -31,13 +43,18 @@ spec: build: registry: address: - organization: + organization: (optional) secret: ---- The changes will be immediately reconciled and the operator will be able to push and pull resources in a secure manner. -[[configuring-registry]] +[[organization]] +=== Role of the organization parameter + +The `organization` parameter is optional. When it's missing, the operator will use the namespace name to create an image within such organization name. When you're using an container registry you may be limited to store image in a given organization only. In this case, you must provide the name of such `organization` with this option. + +[[requirements]] == Container registry requirements Each platform may have its default registry of choice. And each container registry may have a slight different configuration. Please, be aware that we won't be able to support all the available solutions. @@ -57,6 +74,7 @@ We have some hints that can help you configuring on the most common platforms: - xref:installation/registry/special/icr.adoc[IBM Container Registry] - xref:installation/registry/special/kind.adoc[Kind] - xref:installation/registry/special/minikube.adoc[Minikube] +- xref:installation/registry/special/openshift.adoc[Openshift] [[configuring-registry-run-it-yours]] == Run your own container registry diff --git a/docs/modules/ROOT/pages/installation/registry/special/openshift.adoc b/docs/modules/ROOT/pages/installation/registry/special/openshift.adoc new file mode 100644 index 0000000000..2ebd55fafa --- /dev/null +++ b/docs/modules/ROOT/pages/installation/registry/special/openshift.adoc @@ -0,0 +1,54 @@ += Configuring Openshift registry + +Openshift has an embedded container registry you can use to store the images produced by Camel K build process. The full details required to provide access to the registry are available in the https://docs.openshift.com/container-platform/4.17/registry/accessing-the-registry.html[Openshift registry documentation]. + +NOTE: before version 2.6, Camel K used S2I as a default publishing strategy against the embedded registry. Any upgrade from S2I to Jib should work out of the box. + +== Service Account secret credentials + +The first thing you need to do is to create an access token for the service account you want to use to pull/push images from the registry. We suggest to use the `camel-k-builder` Service Account which was created during the installation procedure and is normally used to perform "building" operations. + +```bash +oc serviceaccounts new-token camel-k-builder -n camel-k +eyJhb[...]Uhz0 +``` + +WARNING: treat the token with the due level of confidentiality. + +You will need to use this token to create a secret: +```bash +oc create secret docker-registry ocp-registry --docker-server image-registry.openshift-image-registry.svc:5000 --docker-username camel-k-builder --docker-password eyJhb[...]Uhz0 -n camel-k +``` + +NOTE: `image-registry.openshift-image-registry.svc:5000` is the default internal route exposed by Openshift. You may need to use an alternative route according to the configuration of your cluster. + +== Service account pull and push permissions + +Before being able to pull and push containers images to the registry, you need to provide the proper privileges to access: + +```bash +oc policy add-role-to-user registry-viewer -z camel-k-builder -n camel-k +oc policy add-role-to-user registry-editor -z camel-k-builder -n camel-k +``` + +NOTE: `-z` identifies a Service Account. + +== Configure the IntegrationPlatform + +Now you should have all the authorizations required to pull and push containers to the image registry. In order to do that you will need to provide the Secret created above into your IntegrationPlatform configuration: + +[source,yaml] +---- +apiVersion: camel.apache.org/v1 +kind: IntegrationPlatform +metadata: + name: camel-k + namespace: camel-k +spec: + build: + registry: + address: image-registry.openshift-image-registry.svc:5000 + secret: ocp-registry +---- + +NOTE: make sure to use the same address provided in the secret above. \ No newline at end of file diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc index 1178e6f763..c92a62aec0 100644 --- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc +++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc @@ -5696,7 +5696,7 @@ a PackageTask, used to package the project a BuildahTask, for Buildah strategy -Deprecated: use jib, s2i or a custom publishing strategy instead +Deprecated: use jib or a custom publishing strategy instead |`kaniko` + *xref:#_camel_apache_org_v1_KanikoTask[KanikoTask]* @@ -5704,7 +5704,7 @@ Deprecated: use jib, s2i or a custom publishing strategy instead a KanikoTask, for Kaniko strategy -Deprecated: use jib, s2i or a custom publishing strategy instead +Deprecated: use jib or a custom publishing strategy instead |`spectrum` + *xref:#_camel_apache_org_v1_SpectrumTask[SpectrumTask]* @@ -5712,7 +5712,7 @@ Deprecated: use jib, s2i or a custom publishing strategy instead a SpectrumTask, for Spectrum strategy -Deprecated: use jib, s2i or a custom publishing strategy instead +Deprecated: use jib or a custom publishing strategy instead |`s2i` + *xref:#_camel_apache_org_v1_S2iTask[S2iTask]* @@ -5720,6 +5720,7 @@ Deprecated: use jib, s2i or a custom publishing strategy instead a S2iTask, for S2I strategy +Deprecated: use jib or a custom publishing strategy instead |`jib` + *xref:#_camel_apache_org_v1_JibTask[JibTask]* @@ -8525,6 +8526,8 @@ as a Maven repository. * <<#_camel_apache_org_v1_Traits, Traits>> +WARNING: The Route trait is **deprecated** and will removed in future release versions: use Ingress trait istead. + The Route trait can be used to configure the creation of OpenShift routes for the integration. The certificate and key contents may be sourced either from the local filesystem or in a OpenShift `secret` object. diff --git a/docs/modules/traits/pages/route.adoc b/docs/modules/traits/pages/route.adoc index 49f3b32aa3..7cff47a7de 100755 --- a/docs/modules/traits/pages/route.adoc +++ b/docs/modules/traits/pages/route.adoc @@ -1,8 +1,12 @@ = Route Trait // Start of autogenerated code - DO NOT EDIT! (badges) +[.badges] +[.badge-key]##Deprecated since##[.badge-unsupported]##2.6.0## // End of autogenerated code - DO NOT EDIT! (badges) // Start of autogenerated code - DO NOT EDIT! (description) +WARNING: The Route trait is **deprecated** and will removed in future release versions: use Ingress trait istead. + The Route trait can be used to configure the creation of OpenShift routes for the integration. The certificate and key contents may be sourced either from the local filesystem or in a OpenShift `secret` object. diff --git a/e2e/install/helm/setup_test.go b/e2e/install/helm/setup_test.go index f9c25b38b9..8fe4bb2bae 100644 --- a/e2e/install/helm/setup_test.go +++ b/e2e/install/helm/setup_test.go @@ -40,7 +40,7 @@ import ( func TestHelmInstallation(t *testing.T) { WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { containerRegistry, ok := os.LookupEnv("KAMEL_INSTALL_REGISTRY") - g.Expect(ok).To(BeTrue()) + g.Expect(ok).To(BeTrue(), "This test requires setting KAMEL_INSTALL_REGISTRY variable.") // Let's make sure no CRD is yet available in the cluster // as we must make the procedure to install them accordingly g.Eventually(CRDs(t)).Should(BeNil(), "No Camel K CRDs should be previously installed for this test") diff --git a/helm/camel-k/crds/camel-k-crds.yaml b/helm/camel-k/crds/camel-k-crds.yaml index 210c294ed2..f2dde79ccb 100644 --- a/helm/camel-k/crds/camel-k-crds.yaml +++ b/helm/camel-k/crds/camel-k-crds.yaml @@ -164,7 +164,7 @@ spec: buildah: description: |- a BuildahTask, for Buildah strategy - Deprecated: use jib, s2i or a custom publishing strategy instead + Deprecated: use jib or a custom publishing strategy instead properties: baseImage: description: base image layer @@ -1071,7 +1071,7 @@ spec: kaniko: description: |- a KanikoTask, for Kaniko strategy - Deprecated: use jib, s2i or a custom publishing strategy instead + Deprecated: use jib or a custom publishing strategy instead properties: baseImage: description: base image layer @@ -1798,7 +1798,9 @@ spec: type: array type: object s2i: - description: a S2iTask, for S2I strategy + description: |- + a S2iTask, for S2I strategy + Deprecated: use jib or a custom publishing strategy instead properties: baseImage: description: base image layer @@ -1901,7 +1903,7 @@ spec: spectrum: description: |- a SpectrumTask, for Spectrum strategy - Deprecated: use jib, s2i or a custom publishing strategy instead + Deprecated: use jib or a custom publishing strategy instead properties: baseImage: description: base image layer diff --git a/helm/camel-k/templates/NOTES.txt b/helm/camel-k/templates/NOTES.txt index 1708d369c6..74970d39ca 100644 --- a/helm/camel-k/templates/NOTES.txt +++ b/helm/camel-k/templates/NOTES.txt @@ -1,7 +1,7 @@ Thanks for installing Camel K version {{ .Chart.Version }}! {{- if .Values.platform }} -WARNING: you're setting some IntegrationPlatform values. This is deprecated and may remove in future releases. Make sure to install an IntegrationPlatform as a separate process. +WARNING: you're setting some IntegrationPlatform values. This is deprecated and may be removed in future releases. Make sure to install an IntegrationPlatform as a separate process. {{- end }} {{- if not (.Values.platform) }} diff --git a/helm/camel-k/templates/builder-service-account.yaml b/helm/camel-k/templates/builder-service-account.yaml new file mode 100644 index 0000000000..9952a77000 --- /dev/null +++ b/helm/camel-k/templates/builder-service-account.yaml @@ -0,0 +1,23 @@ +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +apiVersion: v1 +kind: ServiceAccount +metadata: + name: camel-k-builder + labels: + app: "camel-k" diff --git a/helm/camel-k/templates/operator-role-binding.yaml b/helm/camel-k/templates/operator-role-binding.yaml index c34445be17..5b072d711d 100644 --- a/helm/camel-k/templates/operator-role-binding.yaml +++ b/helm/camel-k/templates/operator-role-binding.yaml @@ -30,4 +30,21 @@ roleRef: kind: Role name: camel-k-operator apiGroup: rbac.authorization.k8s.io + +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: camel-k-builder-openshift + labels: + app: "camel-k" + {{- include "camel-k.labels" . | nindent 4 }} +subjects: +- kind: ServiceAccount + name: camel-k-builder +roleRef: + kind: Role + name: camel-k-builder-openshift + apiGroup: rbac.authorization.k8s.io + {{- end }} \ No newline at end of file diff --git a/pkg/apis/camel/v1/build_types.go b/pkg/apis/camel/v1/build_types.go index 463489691d..94f22e09ba 100644 --- a/pkg/apis/camel/v1/build_types.go +++ b/pkg/apis/camel/v1/build_types.go @@ -67,15 +67,16 @@ type Task struct { // Application Publishing // a BuildahTask, for Buildah strategy - // Deprecated: use jib, s2i or a custom publishing strategy instead + // Deprecated: use jib or a custom publishing strategy instead Buildah *BuildahTask `json:"buildah,omitempty"` // a KanikoTask, for Kaniko strategy - // Deprecated: use jib, s2i or a custom publishing strategy instead + // Deprecated: use jib or a custom publishing strategy instead Kaniko *KanikoTask `json:"kaniko,omitempty"` // a SpectrumTask, for Spectrum strategy - // Deprecated: use jib, s2i or a custom publishing strategy instead + // Deprecated: use jib or a custom publishing strategy instead Spectrum *SpectrumTask `json:"spectrum,omitempty"` // a S2iTask, for S2I strategy + // Deprecated: use jib or a custom publishing strategy instead S2i *S2iTask `json:"s2i,omitempty"` // a JibTask, for Jib strategy Jib *JibTask `json:"jib,omitempty"` diff --git a/pkg/apis/camel/v1/integrationplatform_types.go b/pkg/apis/camel/v1/integrationplatform_types.go index 6c211996b8..475ec0332c 100644 --- a/pkg/apis/camel/v1/integrationplatform_types.go +++ b/pkg/apis/camel/v1/integrationplatform_types.go @@ -150,13 +150,14 @@ type IntegrationPlatformKameletSpec struct { type IntegrationPlatformBuildPublishStrategy string const ( - // IntegrationPlatformBuildPublishStrategyS2I uses the Source to Images (S2I) feature + // IntegrationPlatformBuildPublishStrategyJib 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. + // Deprecated: use jib or a custom publishing strategy instead. IntegrationPlatformBuildPublishStrategyS2I IntegrationPlatformBuildPublishStrategy = "S2I" // IntegrationPlatformBuildPublishStrategySpectrum uses Spectrum project (https://github.com/container-tools/spectrum) // in order to push the incremental images to the image repository. It is the default choice on vanilla Kubernetes cluster. - // Deprecated: use jib, s2i or a custom publishing strategy instead. + // Deprecated: use jib or a custom publishing strategy instead. IntegrationPlatformBuildPublishStrategySpectrum IntegrationPlatformBuildPublishStrategy = "Spectrum" // IntegrationPlatformBuildPublishStrategyJib uses Jib maven plugin (https://github.com/GoogleContainerTools/jib) // in order to push the incremental images to the image repository. diff --git a/pkg/apis/camel/v1/trait/route.go b/pkg/apis/camel/v1/trait/route.go index d2bd0ce6c8..b2f27bec43 100644 --- a/pkg/apis/camel/v1/trait/route.go +++ b/pkg/apis/camel/v1/trait/route.go @@ -17,6 +17,8 @@ limitations under the License. package trait +// WARNING: The Route trait is **deprecated** and will removed in future release versions: use Ingress trait istead. +// // The Route trait can be used to configure the creation of OpenShift routes for the integration. // // The certificate and key contents may be sourced either from the local filesystem or in a OpenShift `secret` object. @@ -28,6 +30,7 @@ package trait // See the examples section at the end of this page to see the setup options. // // +camel-k:trait=route. +// +camel-k:deprecated=2.6.0. type RouteTrait struct { Trait `property:",squash" json:",inline"` // The annotations added to route. diff --git a/pkg/builder/s2i.go b/pkg/builder/s2i.go index 7d83fa62a7..f6de959d84 100644 --- a/pkg/builder/s2i.go +++ b/pkg/builder/s2i.go @@ -59,6 +59,7 @@ type s2iTask struct { var _ Task = &s2iTask{} func (t *s2iTask) Do(ctx context.Context) v1.BuildStatus { + log.Info("S2I publishing strategy is deprecated and may be removed in the future, use Jib strategy instead") status := initializeStatusFrom(t.build.Status, t.task.BaseImage) bc := &buildv1.BuildConfig{ diff --git a/pkg/controller/integrationplatform/monitor.go b/pkg/controller/integrationplatform/monitor.go index d615525d97..34ceff647b 100644 --- a/pkg/controller/integrationplatform/monitor.go +++ b/pkg/controller/integrationplatform/monitor.go @@ -82,12 +82,18 @@ func (action *monitorAction) Handle(ctx context.Context, platform *v1.Integratio if err != nil { return platform, err } - if isOpenshift { + if isOpenshift && platform.Status.Build.PublishStrategy == v1.IntegrationPlatformBuildPublishStrategyS2I { platform.Status.SetCondition( v1.IntegrationPlatformConditionTypeRegistryAvailable, corev1.ConditionFalse, v1.IntegrationPlatformConditionTypeRegistryAvailableReason, - "registry not available because provided by Openshift") + "registry not available because provided by Openshift S2I") + action.L.Infof("WARN: S2I publishing strategy is deprecated and may be removed in the future, use Jib strategy instead") + platform.Status.SetCondition( + "S2IPublishingStrategyDeprecated", + corev1.ConditionTrue, + "PublishingStrategyDeprecationNoticeReason", + "S2I publishing strategy is deprecated and may be removed in the future, use Jib strategy instead") } else { if platform.Status.Build.Registry.Address == "" { // error, we need a registry if we're not on Openshift diff --git a/pkg/platform/defaults.go b/pkg/platform/defaults.go index ebb09c3d7f..8006d8cfeb 100644 --- a/pkg/platform/defaults.go +++ b/pkg/platform/defaults.go @@ -81,11 +81,7 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl } if p.Status.Build.PublishStrategy == "" { - if p.Status.Cluster == v1.IntegrationPlatformClusterOpenShift { - p.Status.Build.PublishStrategy = v1.IntegrationPlatformBuildPublishStrategyS2I - } else { - p.Status.Build.PublishStrategy = v1.IntegrationPlatformBuildPublishStrategyJib - } + p.Status.Build.PublishStrategy = v1.IntegrationPlatformBuildPublishStrategyJib log.Debugf("Integration Platform %s [%s]: setting publishing strategy %s", p.Name, p.Namespace, p.Status.Build.PublishStrategy) } @@ -123,7 +119,7 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl func configureRegistry(ctx context.Context, c client.Client, p *v1.IntegrationPlatform, verbose bool) error { if p.Status.Cluster == v1.IntegrationPlatformClusterOpenShift && - p.Status.Build.PublishStrategy != v1.IntegrationPlatformBuildPublishStrategyS2I && + p.Status.Build.PublishStrategy == v1.IntegrationPlatformBuildPublishStrategyS2I && p.Status.Build.Registry.Address == "" { err := configureForOpenShiftS2i(ctx, c, p) diff --git a/pkg/resources/config/crd/bases/camel.apache.org_builds.yaml b/pkg/resources/config/crd/bases/camel.apache.org_builds.yaml index d5b2849999..bb7e345c0b 100644 --- a/pkg/resources/config/crd/bases/camel.apache.org_builds.yaml +++ b/pkg/resources/config/crd/bases/camel.apache.org_builds.yaml @@ -164,7 +164,7 @@ spec: buildah: description: |- a BuildahTask, for Buildah strategy - Deprecated: use jib, s2i or a custom publishing strategy instead + Deprecated: use jib or a custom publishing strategy instead properties: baseImage: description: base image layer @@ -1071,7 +1071,7 @@ spec: kaniko: description: |- a KanikoTask, for Kaniko strategy - Deprecated: use jib, s2i or a custom publishing strategy instead + Deprecated: use jib or a custom publishing strategy instead properties: baseImage: description: base image layer @@ -1798,7 +1798,9 @@ spec: type: array type: object s2i: - description: a S2iTask, for S2I strategy + description: |- + a S2iTask, for S2I strategy + Deprecated: use jib or a custom publishing strategy instead properties: baseImage: description: base image layer @@ -1901,7 +1903,7 @@ spec: spectrum: description: |- a SpectrumTask, for Spectrum strategy - Deprecated: use jib, s2i or a custom publishing strategy instead + Deprecated: use jib or a custom publishing strategy instead properties: baseImage: description: base image layer diff --git a/pkg/resources/config/manager/kustomization.yaml b/pkg/resources/config/manager/kustomization.yaml index 1ad4421c37..c14f195837 100644 --- a/pkg/resources/config/manager/kustomization.yaml +++ b/pkg/resources/config/manager/kustomization.yaml @@ -22,7 +22,3 @@ resources: - operator-deployment.yaml - operator-service-account.yaml - builder-service-account.yaml -- builder-role.yaml -- builder-role-openshift.yaml -- builder-role-binding.yaml -- builder-role-binding-openshift.yaml diff --git a/pkg/resources/config/manifests/kustomization.yaml b/pkg/resources/config/manifests/kustomization.yaml index e4c6d3ced6..1af136a8a1 100644 --- a/pkg/resources/config/manifests/kustomization.yaml +++ b/pkg/resources/config/manifests/kustomization.yaml @@ -30,8 +30,6 @@ resources: - ../scorecard - ../rbac - ../rbac/namespaced -- ../rbac/openshift -- ../rbac/openshift/namespaced patchesStrategicMerge: - patch-delete-user-cluster-role.yaml diff --git a/pkg/resources/config/manager/builder-role-binding-openshift.yaml b/pkg/resources/config/rbac/builder-role-binding-openshift.yaml similarity index 100% rename from pkg/resources/config/manager/builder-role-binding-openshift.yaml rename to pkg/resources/config/rbac/builder-role-binding-openshift.yaml diff --git a/pkg/resources/config/manager/builder-role-binding.yaml b/pkg/resources/config/rbac/builder-role-binding.yaml similarity index 85% rename from pkg/resources/config/manager/builder-role-binding.yaml rename to pkg/resources/config/rbac/builder-role-binding.yaml index abeb2784d2..4487f6f16e 100644 --- a/pkg/resources/config/manager/builder-role-binding.yaml +++ b/pkg/resources/config/rbac/builder-role-binding.yaml @@ -22,12 +22,8 @@ metadata: labels: app: "camel-k" subjects: - # TODO set the camel k builder SA with operator namespace - # - kind: ServiceAccount - # name: camel-k-builder -- apiGroup: rbac.authorization.k8s.io - kind: Group - name: system:authenticated +- kind: ServiceAccount + name: camel-k-builder roleRef: kind: Role name: camel-k-builder diff --git a/pkg/resources/config/manager/builder-role-openshift.yaml b/pkg/resources/config/rbac/builder-role-openshift.yaml similarity index 100% rename from pkg/resources/config/manager/builder-role-openshift.yaml rename to pkg/resources/config/rbac/builder-role-openshift.yaml diff --git a/pkg/resources/config/manager/builder-role.yaml b/pkg/resources/config/rbac/builder-role.yaml similarity index 100% rename from pkg/resources/config/manager/builder-role.yaml rename to pkg/resources/config/rbac/builder-role.yaml diff --git a/pkg/resources/config/rbac/kustomization.yaml b/pkg/resources/config/rbac/kustomization.yaml index 5b3e03f558..43700a966f 100644 --- a/pkg/resources/config/rbac/kustomization.yaml +++ b/pkg/resources/config/rbac/kustomization.yaml @@ -29,7 +29,10 @@ resources: - operator-cluster-role-binding-addressable-resolver.yaml - operator-cluster-role-local-registry.yaml - operator-role-binding-local-registry.yaml - +- builder-role.yaml +- builder-role-openshift.yaml +- builder-role-binding.yaml +- builder-role-binding-openshift.yaml transformers: - |- diff --git a/pkg/trait/builder_test.go b/pkg/trait/builder_test.go index c5c96265e0..6f85f17649 100644 --- a/pkg/trait/builder_test.go +++ b/pkg/trait/builder_test.go @@ -37,7 +37,7 @@ import ( func TestBuilderTraitNotAppliedBecauseOfNilKit(t *testing.T) { environments := []*Environment{ - createBuilderTestEnv(v1.IntegrationPlatformClusterOpenShift, v1.IntegrationPlatformBuildPublishStrategyS2I, v1.BuildStrategyRoutine), + createBuilderTestEnv(v1.IntegrationPlatformClusterOpenShift, v1.IntegrationPlatformBuildPublishStrategyJib, v1.BuildStrategyRoutine), } for _, e := range environments { @@ -59,7 +59,7 @@ func TestBuilderTraitNotAppliedBecauseOfNilKit(t *testing.T) { func TestBuilderTraitNotAppliedBecauseOfNilPhase(t *testing.T) { environments := []*Environment{ - createBuilderTestEnv(v1.IntegrationPlatformClusterOpenShift, v1.IntegrationPlatformBuildPublishStrategyS2I, v1.BuildStrategyRoutine), + createBuilderTestEnv(v1.IntegrationPlatformClusterOpenShift, v1.IntegrationPlatformBuildPublishStrategyJib, v1.BuildStrategyRoutine), } for _, e := range environments { @@ -79,24 +79,6 @@ func TestBuilderTraitNotAppliedBecauseOfNilPhase(t *testing.T) { } } -func TestS2IBuilderTrait(t *testing.T) { - env := createBuilderTestEnv(v1.IntegrationPlatformClusterOpenShift, v1.IntegrationPlatformBuildPublishStrategyS2I, v1.BuildStrategyRoutine) - conditions, traits, err := NewBuilderTestCatalog().apply(env) - - require.NoError(t, err) - assert.Empty(t, traits) - assert.NotEmpty(t, conditions) - assert.NotEmpty(t, env.ExecutedTraits) - assert.NotNil(t, env.GetTrait("builder")) - assert.NotEmpty(t, env.Pipeline) - assert.Len(t, env.Pipeline, 3) - assert.NotNil(t, env.Pipeline[0].Builder) - assert.NotNil(t, env.Pipeline[1].Package) - assert.NotNil(t, env.Pipeline[2].S2i) - assert.Equal(t, "root-jdk-image", env.Pipeline[2].S2i.BaseImage) - assert.Empty(t, env.Pipeline[2].S2i.Registry) -} - func TestJibBuilderTrait(t *testing.T) { env := createBuilderTestEnv(v1.IntegrationPlatformClusterOpenShift, v1.IntegrationPlatformBuildPublishStrategyJib, v1.BuildStrategyRoutine) conditions, traits, err := NewBuilderTestCatalog().apply(env) @@ -178,7 +160,7 @@ func NewBuilderTestCatalog() *Catalog { } func TestMavenPropertyBuilderTrait(t *testing.T) { - env := createBuilderTestEnv(v1.IntegrationPlatformClusterKubernetes, v1.IntegrationPlatformBuildPublishStrategyS2I, v1.BuildStrategyRoutine) + env := createBuilderTestEnv(v1.IntegrationPlatformClusterKubernetes, v1.IntegrationPlatformBuildPublishStrategyJib, v1.BuildStrategyRoutine) builderTrait := createNominalBuilderTraitTest() builderTrait.Properties = append(builderTrait.Properties, "build-time-prop1=build-time-value1") @@ -264,7 +246,7 @@ func TestCustomTaskBuilderTraitInvalidStrategyOverride(t *testing.T) { } func TestMavenProfilesBuilderTrait(t *testing.T) { - env := createBuilderTestEnv(v1.IntegrationPlatformClusterKubernetes, v1.IntegrationPlatformBuildPublishStrategyS2I, v1.BuildStrategyRoutine) + env := createBuilderTestEnv(v1.IntegrationPlatformClusterKubernetes, v1.IntegrationPlatformBuildPublishStrategyJib, v1.BuildStrategyRoutine) builderTrait := createNominalBuilderTraitTest() builderTrait.MavenProfiles = []string{"configmap:maven-profile/owasp-profile.xml", "secret:maven-profile-secret"} @@ -291,7 +273,7 @@ func TestMavenProfilesBuilderTrait(t *testing.T) { } func TestInvalidMavenProfilesBuilderTrait(t *testing.T) { - env := createBuilderTestEnv(v1.IntegrationPlatformClusterKubernetes, v1.IntegrationPlatformBuildPublishStrategyS2I, v1.BuildStrategyRoutine) + env := createBuilderTestEnv(v1.IntegrationPlatformClusterKubernetes, v1.IntegrationPlatformBuildPublishStrategyJib, v1.BuildStrategyRoutine) builderTrait := createNominalBuilderTraitTest() builderTrait.MavenProfiles = []string{"fakeprofile"} diff --git a/pkg/trait/container_test.go b/pkg/trait/container_test.go index 7673a9471b..dbc7975b35 100644 --- a/pkg/trait/container_test.go +++ b/pkg/trait/container_test.go @@ -71,7 +71,7 @@ func TestContainerWithDefaults(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -153,7 +153,7 @@ func TestContainerWithOpenshift(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -222,7 +222,7 @@ func TestContainerWithCustomName(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -289,7 +289,7 @@ func TestContainerWithCustomImage(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -359,7 +359,7 @@ func TestContainerWithCustomImageAndIntegrationKit(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, diff --git a/pkg/trait/cron_test.go b/pkg/trait/cron_test.go index d440f7386b..e537e22ffb 100644 --- a/pkg/trait/cron_test.go +++ b/pkg/trait/cron_test.go @@ -267,7 +267,7 @@ func TestCronDeps(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -350,7 +350,7 @@ func TestCronMultipleScheduleFallback(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -428,7 +428,7 @@ func TestCronDepsFallback(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, diff --git a/pkg/trait/health_test.go b/pkg/trait/health_test.go index a11d0662b9..e0a7da0079 100644 --- a/pkg/trait/health_test.go +++ b/pkg/trait/health_test.go @@ -76,7 +76,7 @@ func TestHealthTrait(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, diff --git a/pkg/trait/knative_service_test.go b/pkg/trait/knative_service_test.go index 51ba739ded..bb8cbc71a9 100644 --- a/pkg/trait/knative_service_test.go +++ b/pkg/trait/knative_service_test.go @@ -109,7 +109,7 @@ func TestKnativeService(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -246,7 +246,7 @@ func TestKnativeServiceWithCustomContainerName(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -331,7 +331,7 @@ func TestKnativeServiceWithRest(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -399,7 +399,7 @@ func TestKnativeServiceNotApplicable(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -474,7 +474,7 @@ func TestKnativeServiceNoServingAvailable(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -686,7 +686,7 @@ func TestKnativeServiceAuto(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, diff --git a/pkg/trait/knative_test.go b/pkg/trait/knative_test.go index fd7cc917e5..47d0aacc27 100644 --- a/pkg/trait/knative_test.go +++ b/pkg/trait/knative_test.go @@ -97,7 +97,7 @@ func TestKnativeEnvConfigurationFromTrait(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, }, Profile: v1.TraitProfileKnative, @@ -225,7 +225,7 @@ func TestKnativeEnvConfigurationFromSource(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, }, Profile: v1.TraitProfileKnative, @@ -338,7 +338,7 @@ func TestKnativeTriggerExplicitFilterConfig(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -438,7 +438,7 @@ func TestKnativeTriggerExplicitFilterConfigNoEventTypeFilter(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -535,7 +535,7 @@ func TestKnativeTriggerDefaultEventTypeFilter(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -632,7 +632,7 @@ func TestKnativeTriggerDefaultEventTypeFilterDisabled(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -732,7 +732,7 @@ func TestKnativeMultipleTrigger(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -870,7 +870,7 @@ func TestKnativeMultipleTriggerAdditionalFilterConfig(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -1005,7 +1005,7 @@ func TestKnativeTriggerNoEventType(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -1102,7 +1102,7 @@ func TestKnativeTriggerNoServingAvailable(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -1273,7 +1273,7 @@ func TestKnativeEnabled(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, }, Profile: v1.TraitProfileKnative, @@ -1344,7 +1344,7 @@ func TestKnativeNotEnabled(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, }, Profile: v1.TraitProfileKnative, @@ -1420,7 +1420,7 @@ func NewFakeEnvironment(t *testing.T, source v1.SourceSpec) Environment { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -1475,7 +1475,7 @@ func NewFakeEnvironmentForSyntheticKit(t *testing.T) Environment { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, }, Profile: v1.TraitProfileKnative, diff --git a/pkg/trait/mount_test.go b/pkg/trait/mount_test.go index aed0d73710..d1c624056c 100644 --- a/pkg/trait/mount_test.go +++ b/pkg/trait/mount_test.go @@ -290,7 +290,7 @@ func getNominalEnv(t *testing.T, traitCatalog *Catalog) *Environment { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, diff --git a/pkg/trait/route.go b/pkg/trait/route.go index 710bb3a368..42a6023d43 100644 --- a/pkg/trait/route.go +++ b/pkg/trait/route.go @@ -78,7 +78,15 @@ func (t *routeTrait) Configure(e *Environment) (bool, *TraitCondition, error) { return false, nil, nil } - return true, nil, nil + condition := NewIntegrationCondition( + "Route", + v1.IntegrationConditionTraitInfo, + corev1.ConditionTrue, + TraitConfigurationReason, + "Route trait is deprecated in favour of Ingress. It may be removed in future version.", + ) + + return true, condition, nil } func (t *routeTrait) Apply(e *Environment) error { diff --git a/pkg/trait/route_test.go b/pkg/trait/route_test.go index 5240690888..09273fe43e 100644 --- a/pkg/trait/route_test.go +++ b/pkg/trait/route_test.go @@ -164,7 +164,7 @@ func createTestRouteEnvironment(t *testing.T, name string) *Environment { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -353,9 +353,8 @@ func TestRoute_TLS_wrong_secret(t *testing.T) { TLSDestinationCACertificateSecret: "404", }, } - conditions, traits, err := traitsCatalog.apply(environment) + _, traits, err := traitsCatalog.apply(environment) assert.Empty(t, traits) - assert.Empty(t, conditions) // there must be errors as the trait has wrong configuration require.Error(t, err) assert.Nil(t, environment.GetTrait("route")) @@ -382,9 +381,8 @@ func TestRoute_TLS_secret_wrong_key(t *testing.T) { TLSCACertificateSecret: tlsMultipleSecretsName + "/foo", }, } - conditions, traits, err := traitsCatalog.apply(environment) + _, traits, err := traitsCatalog.apply(environment) assert.Empty(t, traits) - assert.Empty(t, conditions) // there must be errors as the trait has wrong configuration require.Error(t, err) assert.Nil(t, environment.GetTrait("route")) @@ -411,9 +409,8 @@ func TestRoute_TLS_secret_missing_key(t *testing.T) { TLSCACertificateSecret: tlsMultipleSecretsName, }, } - conditions, traits, err := traitsCatalog.apply(environment) + _, traits, err := traitsCatalog.apply(environment) assert.Empty(t, traits) - assert.Empty(t, conditions) // there must be errors as the trait has wrong configuration require.Error(t, err) assert.Nil(t, environment.GetTrait("route")) diff --git a/pkg/trait/service_test.go b/pkg/trait/service_test.go index 87c240f7b3..7202112f6d 100644 --- a/pkg/trait/service_test.go +++ b/pkg/trait/service_test.go @@ -94,7 +94,7 @@ func TestServiceWithDefaults(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -201,7 +201,7 @@ func TestService(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -288,7 +288,7 @@ func TestServiceWithCustomContainerName(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -379,7 +379,7 @@ func TestServiceWithNodePort(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -474,7 +474,7 @@ func TestServiceWithKnativeServiceEnabled(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -555,7 +555,7 @@ func TestServicesWithKnativeProfile(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -637,7 +637,7 @@ func TestServiceWithKnativeServiceDisabledInIntegrationPlatform(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -721,7 +721,7 @@ func TestServiceAutoConfiguration(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, }, @@ -799,7 +799,7 @@ func TestServiceAnnotationsAndLables(t *testing.T) { Spec: v1.IntegrationPlatformSpec{ Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ - PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, + PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib, Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: catalog.Runtime.Version, },