che icon indicating copy to clipboard operation
che copied to clipboard

How do I deploy Eclipse Che with a custom version of the Che Plugin Broker image?

Open AmitChameides opened this issue 7 years ago • 7 comments

Summary

Similar to this issue, I am setting up Eclipse Che for OpenShift in an enterprise environment which has a proxy which man-in-the-middles some SSL communications. This proxy's mechanism causes the issue described in this issue, which can be solved by adding custom certificates to the Che Plugin Broker pod's truststore.

Because it's impossible permission-wise to add the certificates to the pod after it has been created, a custom image of Che Plugin Broker needs to be created using a modified Dockerfile. That's fine. I believe I can do this without a problem. Likewise, putting this image on an online registry is not an issue, making it accessible for Eclipse Che.

However, I have no idea how to follow through. How do I get the Che pod to call my image instead of the default one when a new workspace is trying to set up and the Che Plugin Broker pod is created? I feel like I need to edit something in the Che pod calling that Plugin Broker, but I'm just not sure what.

Relevant information

As stated, I am using the latest versions of Eclipse Che Multiuser for OpenShift. The Che image I am using is a custom, slightly modified version of the official one. It is exactly the same with the exception that it also has some extra certificates in its truststore. Related to this issue.

Thanks in advance

AmitChameides avatar Aug 29 '19 07:08 AmitChameides

@AmitChameides There are configuration properties that have values for plugin broker images. https://github.com/eclipse/che/blob/master/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties#L600 Here are the corresponding environment variables to override these properties: CHE_WORKSPACE_PLUGIN__BROKER_INIT_IMAGE and CHE_WORKSPACE_PLUGIN__BROKER_UNIFIED_IMAGE

sleshchenko avatar Aug 29 '19 07:08 sleshchenko

Thank you! Where can I find these environment variables? Or should I create them in my Che pod?

It's just that I don't have a pod of Che Operator running in my basic Che scene at this stage - I only have three pods: The Che pod, the Keycloak pod, and the Postgres pod. When I attempt to create a new workspace, the Che Plugin Broker pod is created but is promptly deleted once the certificate error occurs.

AmitChameides avatar Aug 29 '19 08:08 AmitChameides

@AmitChameides You should add this environment variables to Che Deployment or Che Config map if there is such (custom if Che was deployed with che-operator, I think). Make sure that Che Server is rescaled after updating env vars.

sleshchenko avatar Aug 29 '19 08:08 sleshchenko

Such instructions need to be findable in the docs.

tsmaeder avatar Aug 30 '19 07:08 tsmaeder

Hello all, I created custom Che Plugin Broker images which contain my certificates by cloning the Che Plugin Broker project from GitHub, altering the Dockerfiles and building them according to the instructions on Github, and then putting the images on a public Docker registry of mine on DockerHub. Likewise, I added the specified environment variables to my Che pod's environment variables, which link to the custom images I uploaded to Docker.

However, when running the pod I am faced with the following error: Error: Failed to run the workspace: "Failure executing: POST at: https://172.30.0.1/api/v1/namespaces/revival-che/pods. Message: Pod "workspace9ayp1maalh18efrh.che-plugin-broker" is invalid: [spec.containers[0].name: Invalid value: "amitchameides-not-suspicious-name-unified_plugin_broker": a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?'), spec.initContainers[0].name: Invalid value: "amitchameides-not-suspicious-name-init_plugin_broker": a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')]. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.containers[0].name, message=Invalid value: "amitchameides-not-suspicious-name-unified_plugin_broker": a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?'), reason=FieldValueInvalid, additionalProperties={}), StatusCause(field=spec.initContainers[0].name, message=Invalid value: "amitchameides-not-suspicious-name-init_plugin_broker": a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?'), reason=FieldValueInvalid, additionalProperties={})], group=null, kind=Pod, name=workspace9ayp1maalh18efrh.che-plugin-broker, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=Pod "workspace9ayp1maalh18efrh.che-plugin-broker" is invalid: [spec.containers[0].name: Invalid value: "amitchameides-not-suspicious-name-unified_plugin_broker": a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?'), spec.initContainers[0].name: Invalid value: "amitchameides-not-suspicious-name-init_plugin_broker": a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')], metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={})."

This error probably indicates that my input for the environment variables you gave me is not in the correct format. I wrote there values in the format of amitchameides/not-suspicious-name:unified_plugin_broker. Does this field expect a URI or something like that? Please advise.

AmitChameides avatar Sep 02 '19 12:09 AmitChameides

The error message says you're not supposed to use the underscore character (as in "init_plugin_broker")

tsmaeder avatar Sep 02 '19 13:09 tsmaeder

Oh! Okay :) Indeed, changing it from _ to - both in my registry and my environment variables made everything work! Thank you both very much, @tsmaeder and @sleshchenko!

I'm closing this thread, so here's the summary of the solution:

  1. Create your own Che Plugin Init Broker and Che Plugin Unified Broker by cloning the projects from the che-plugin-broker GitHub page, building your own custom images using its Dockerfiles and uploading them to your own Docker registry.
  2. In your Che pod, create two new environment variables named CHE_WORKSPACE_PLUGIN__BROKER_INIT_IMAGE and CHE_WORKSPACE_PLUGIN__BROKER_UNIFIED_IMAGE and in their values put the repository+tag of your respective custom image. Make sure to not have underscores (_) in your repository/tag text!
  3. Re-deploy your Che pod and it should now call your custom images instead of the default Eclipse Che ones.

AmitChameides avatar Sep 02 '19 13:09 AmitChameides