Skip to content

Commit bc7c2dd

Browse files
committed
feat: deprecate Openshift specific features
* S2I, use Jib instead * Route, use Ingress instead Likely to be supported until a new major release. Closes #5771
1 parent f96f01a commit bc7c2dd

38 files changed

+250
-126
lines changed

addons/master/master_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func TestMasterOn(t *testing.T) {
7070
Spec: v1.IntegrationPlatformSpec{
7171
Cluster: v1.IntegrationPlatformClusterOpenShift,
7272
Build: v1.IntegrationPlatformBuildSpec{
73-
PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I,
73+
PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib,
7474
Registry: v1.RegistrySpec{Address: "registry"},
7575
RuntimeVersion: catalog.Runtime.Version,
7676
},
@@ -161,7 +161,7 @@ func TestMasterOff(t *testing.T) {
161161
Spec: v1.IntegrationPlatformSpec{
162162
Cluster: v1.IntegrationPlatformClusterOpenShift,
163163
Build: v1.IntegrationPlatformBuildSpec{
164-
PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I,
164+
PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib,
165165
Registry: v1.RegistrySpec{Address: "registry"},
166166
RuntimeVersion: catalog.Runtime.Version,
167167
},
@@ -223,7 +223,7 @@ func TestMasterAuto(t *testing.T) {
223223
Spec: v1.IntegrationPlatformSpec{
224224
Cluster: v1.IntegrationPlatformClusterOpenShift,
225225
Build: v1.IntegrationPlatformBuildSpec{
226-
PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I,
226+
PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyJib,
227227
Registry: v1.RegistrySpec{Address: "registry"},
228228
RuntimeVersion: catalog.Runtime.Version,
229229
},

docs/modules/ROOT/pages/contributing/developers.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,6 @@ When configuring the IDE task, make sure to add all required environment variabl
227227

228228
After you set up the IDE task, with Java 11+ to be used by default, you can run and debug the operator process.
229229

230-
NOTE: The operator can be fully debugged in CRC, because it uses OpenShift S2I binary builds under the hood.
231-
232230
[[publishing]]
233231
== Building Metadata for Publishing the Operator in Operator Hub
234232

docs/modules/ROOT/pages/contributing/local-development.adoc

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ This command will build and publish your actual Camel K development version to t
3030
----
3131
make install-k8s-global (default in camel-k namespace)
3232
make install-k8s-ns (default in default namespace)
33-
make install-openshift-global (default in camel-k namespace)
34-
make install-openshift-ns (default in default namespace)
3533
----
3634

3735
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
4543

4644
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.
4745

46+
=== CRC special requirement
47+
48+
You may need to test the operator on CRC. In such case you can login to the Openshift registry accessing its local interface:
49+
50+
```
51+
docker login -u kubeadmin -p $(oc whoami -t) default-route-openshift-image-registry.apps-crc.testing
52+
```
53+
54+
At this stage you will need to hack a little bit in order to be able to push the operator image to the registry:
55+
```
56+
CUSTOM_IMAGE=default-route-openshift-image-registry.apps-crc.testing/camel-k/camel-k make bundle
57+
NOTEST=true CUSTOM_IMAGE=default-route-openshift-image-registry.apps-crc.testing/camel-k/camel-k make images
58+
docker push default-route-openshift-image-registry.apps-crc.testing/camel-k/camel-k:2.6.0-SNAPSHOT
59+
```
60+
61+
With the steps above you should have available a local operator into CRC and proceed normally with the `make install-k8s-global` procedure.
62+
63+
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).
64+
4865
[[local-camel-k-runtime]]
4966
=== Local Camel K runtime
5067

docs/modules/ROOT/pages/installation/advanced/build-config.adoc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ The most relevant are the `resource` and `limit` parameters which can be used to
2020

2121
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.
2222

23-
The operator has 2 different strategy which you can adopt: Jib (default in plain Kubernetes profile) and S2I (default in Openshift profile).
23+
The operator has one unique strategy which you can adopt: Jib. Alternatively you can provide your own publishing strategy (although this is not recommended).
2424

2525
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.
2626

27-
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.
28-
2927
NOTE: you may define your own publishing technology by using xref:pipeline/pipeline.adoc[pipelines].

docs/modules/ROOT/pages/installation/registry/registry-secret.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ In some cases, you might already have a push/pull secret for your container regi
99

1010
[source,bash]
1111
----
12-
kubectl create secret docker-registry your-secret-name --docker-username your-user --docker-password your-pass
12+
kubectl create secret docker-registry registry --docker-server <my-server> --docker-username <my-user> --docker-password <my-password>
1313
----
1414

1515
Another possibility is to upload to the cluster your entire list of push/pull secrets:
@@ -34,8 +34,8 @@ spec:
3434
build:
3535
registry:
3636
address: <my-registry-address>
37-
organization: <my-organization>
37+
organization: <my-organization> (optional)
3838
secret: <my-secret-credentials>
3939
----
4040

41-
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/`.
41+
NOTE: make sure any credential contains the valid authentication servers: for instance, `docker.io` is used by **Jib**.

docs/modules/ROOT/pages/installation/registry/registry.adoc

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,26 @@ The Camel K operator is in charge to build a Camel application and to "container
88

99
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_.
1010

11-
For any other platform that do not provide a default container registry, then, a registry must be provided accordingly.
11+
For any other platform that do not provide a default container registry, then, a container registry must be provided accordingly.
1212

1313
[[how-to-configure]]
1414
== How to configure Camel K container registry
1515

1616
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.
1717

18-
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.
18+
[[kubernetes-secret]]
19+
=== Create a secret for your registry
20+
21+
The easiest way to create a Secret is to leverage the `kubectl` CLI:
22+
23+
[source,bash]
24+
----
25+
kubectl create secret docker-registry registry --docker-server <my-registry-address> --docker-username <my-user> --docker-password <my-password>
26+
----
27+
28+
NOTE: you must include `--docker-server docker.io` value also if you're using Docker Hub. The default value provided by `kubectl` won't.
29+
30+
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.
1931

2032
You will need to create or edit any existing `IntegrationPlatform` custom resource with the values as expected in the `.spec.build.registry`.
2133

@@ -31,13 +43,18 @@ spec:
3143
build:
3244
registry:
3345
address: <my-registry-address>
34-
organization: <my-organization>
46+
organization: <my-organization> (optional)
3547
secret: <my-secret-credentials>
3648
----
3749

3850
The changes will be immediately reconciled and the operator will be able to push and pull resources in a secure manner.
3951

40-
[[configuring-registry]]
52+
[[organization]]
53+
=== Role of the organization parameter
54+
55+
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.
56+
57+
[[requirements]]
4158
== Container registry requirements
4259
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.
4360

@@ -57,6 +74,7 @@ We have some hints that can help you configuring on the most common platforms:
5774
- xref:installation/registry/special/icr.adoc[IBM Container Registry]
5875
- xref:installation/registry/special/kind.adoc[Kind]
5976
- xref:installation/registry/special/minikube.adoc[Minikube]
77+
- xref:installation/registry/special/openshift.adoc[Openshift]
6078

6179
[[configuring-registry-run-it-yours]]
6280
== Run your own container registry
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
= Configuring Openshift registry
2+
3+
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].
4+
5+
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.
6+
7+
== Service Account secret credentials
8+
9+
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.
10+
11+
```bash
12+
oc serviceaccounts new-token camel-k-builder -n camel-k
13+
eyJhb[...]Uhz0
14+
```
15+
16+
WARNING: treat the token with the due level of confidentiality.
17+
18+
You will need to use this token to create a secret:
19+
```bash
20+
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
21+
```
22+
23+
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.
24+
25+
== Service account pull and push permissions
26+
27+
Before being able to pull and push containers images to the registry, you need to provide the proper privileges to access:
28+
29+
```bash
30+
oc policy add-role-to-user registry-viewer -z camel-k-builder -n camel-k
31+
oc policy add-role-to-user registry-editor -z camel-k-builder -n camel-k
32+
```
33+
34+
NOTE: `-z` identifies a Service Account.
35+
36+
== Configure the IntegrationPlatform
37+
38+
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:
39+
40+
[source,yaml]
41+
----
42+
apiVersion: camel.apache.org/v1
43+
kind: IntegrationPlatform
44+
metadata:
45+
name: camel-k
46+
namespace: camel-k
47+
spec:
48+
build:
49+
registry:
50+
address: image-registry.openshift-image-registry.svc:5000
51+
secret: ocp-registry
52+
----
53+
54+
NOTE: make sure to use the same address provided in the secret above.

docs/modules/ROOT/partials/apis/camel-k-crds.adoc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5696,30 +5696,31 @@ a PackageTask, used to package the project
56965696
56975697
56985698
a BuildahTask, for Buildah strategy
5699-
Deprecated: use jib, s2i or a custom publishing strategy instead
5699+
Deprecated: use jib or a custom publishing strategy instead
57005700
57015701
|`kaniko` +
57025702
*xref:#_camel_apache_org_v1_KanikoTask[KanikoTask]*
57035703
|
57045704
57055705
57065706
a KanikoTask, for Kaniko strategy
5707-
Deprecated: use jib, s2i or a custom publishing strategy instead
5707+
Deprecated: use jib or a custom publishing strategy instead
57085708
57095709
|`spectrum` +
57105710
*xref:#_camel_apache_org_v1_SpectrumTask[SpectrumTask]*
57115711
|
57125712
57135713
57145714
a SpectrumTask, for Spectrum strategy
5715-
Deprecated: use jib, s2i or a custom publishing strategy instead
5715+
Deprecated: use jib or a custom publishing strategy instead
57165716
57175717
|`s2i` +
57185718
*xref:#_camel_apache_org_v1_S2iTask[S2iTask]*
57195719
|
57205720
57215721
57225722
a S2iTask, for S2I strategy
5723+
Deprecated: use jib or a custom publishing strategy instead
57235724
57245725
|`jib` +
57255726
*xref:#_camel_apache_org_v1_JibTask[JibTask]*
@@ -8525,6 +8526,8 @@ as a Maven repository.
85258526
85268527
* <<#_camel_apache_org_v1_Traits, Traits>>
85278528
8529+
WARNING: The Route trait is **deprecated** and will removed in future release versions: use Ingress trait istead.
8530+
85288531
The Route trait can be used to configure the creation of OpenShift routes for the integration.
85298532
85308533
The certificate and key contents may be sourced either from the local filesystem or in a OpenShift `secret` object.

docs/modules/traits/pages/route.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
= Route Trait
22

33
// Start of autogenerated code - DO NOT EDIT! (badges)
4+
[.badges]
5+
[.badge-key]##Deprecated since##[.badge-unsupported]##2.6.0##
46
// End of autogenerated code - DO NOT EDIT! (badges)
57
// Start of autogenerated code - DO NOT EDIT! (description)
8+
WARNING: The Route trait is **deprecated** and will removed in future release versions: use Ingress trait istead.
9+
610
The Route trait can be used to configure the creation of OpenShift routes for the integration.
711

812
The certificate and key contents may be sourced either from the local filesystem or in a OpenShift `secret` object.

e2e/install/helm/setup_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import (
4040
func TestHelmInstallation(t *testing.T) {
4141
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
4242
containerRegistry, ok := os.LookupEnv("KAMEL_INSTALL_REGISTRY")
43-
g.Expect(ok).To(BeTrue())
43+
g.Expect(ok).To(BeTrue(), "This test requires setting KAMEL_INSTALL_REGISTRY variable.")
4444
// Let's make sure no CRD is yet available in the cluster
4545
// as we must make the procedure to install them accordingly
4646
g.Eventually(CRDs(t)).Should(BeNil(), "No Camel K CRDs should be previously installed for this test")

0 commit comments

Comments
 (0)