Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Add rhche minishift addon #620

Merged
merged 6 commits into from
Apr 23, 2018

Conversation

l0rd
Copy link
Contributor

@l0rd l0rd commented Apr 4, 2018

What does this PR do?

Change the default way to deploy rhche on minishift: using an addon. Deploying rhche will be just a matter of:

    minishift addons install openshift/minishift-addons/rhche-prerequisites
    minishift addons apply rhche-prerequisites
    minishift addons install openshift/minishift-addons/rhche
    minishift addons apply rhche --addon-env KEYCLOAK_DOCKER_IMAGE=eivantsov/keycloak

What issues does this PR fix or reference?

#489

How have you tested this PR?

I have run this on minishift 1.15. Note that fabric8 auth, api and f8proxy are not part of the deployment and therefore rhche fails to start (cannot retrieve Che token). That should be fixed introducing some stubs of these services in a second PR

Copy link

@garagatyi garagatyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I was not able to try it out. Addon points to a non-existing template file for Postgres. BTW looks like there are some copy-paste errors, please, take a look at inlined comments.

@@ -0,0 +1,38 @@
# Name: rhche
# Description: Setup and Configure Red Hat Che Template
# Url: https://www.eclipse.org/che/docs/setup/openshift/index.html

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this link supposed to point to rhche repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed thanks

# Description: Setup and Configure Red Hat Che Template
# Url: https://www.eclipse.org/che/docs/setup/openshift/index.html
# NAMESPACE, CHE_DOCKER_IMAGE, OPENSHIFT_TOKEN, GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET
# NAMESPACE=mini-che, CHE_DOCKER_IMAGE=eclipse/che-server:latest, OPENSHIFT_TOKEN=NULL, GITHUB_CLIENT_ID=changeme, GITHUB_CLIENT_SECRET=changeme

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we use upstream values here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed the 2 lines above. These were just comments that I forgot to remove.

# NAMESPACE, CHE_DOCKER_IMAGE, OPENSHIFT_TOKEN, GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET
# NAMESPACE=mini-che, CHE_DOCKER_IMAGE=eclipse/che-server:latest, OPENSHIFT_TOKEN=NULL, GITHUB_CLIENT_ID=changeme, GITHUB_CLIENT_SECRET=changeme
# Required-Vars: NAMESPACE, CHE_DOCKER_IMAGE, CHE_VERSION, KEYCLOAK_DOCKER_IMAGE
# Var-Defaults: NAMESPACE=rhche, CHE_DOCKER_IMAGE=registry.devshift.net/che/rh-che-server, CHE_VERSION=latest, KEYCLOAK_DOCKER_IMAGE=eclipse/che-keycloak

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this image repo/tag what is produced by build script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is what is produced by the official CI

echo [CHE] Deploying Postgres
oc new-app -f templates/multi/postgres-template.yaml -n #{NAMESPACE}

echo [CHE] Waiting 30s for Keycloak to be up and running

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Postgres, not Keycloak

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed thanks

oc new-app -f templates/multi/keycloak-template.yaml -p IMAGE_KEYCLOAK=#{KEYCLOAK_DOCKER_IMAGE} -p ROUTING_SUFFIX=#{routing-suffix} -n #{NAMESPACE}

echo [CHE] Waiting 60s for Keycloak to be up and running
sleep 60

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my experience with keycloak on OCP in upstream Che waiting some amount of time for keycloak is not very reliable. It fails from time to time because keycloak not yet fully started. But since we don't have an ability to run scripts here I see only one option is to merge all the apps into a single template and let services find each other. It is a kubernetes/openshift deployment way in any case I suppose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have taken in consideration your feedback and I have splitted the addon in 2 separate addons (I have not put all in one yaml because you may want to use an existing keycloak/postgre).

@@ -0,0 +1,17 @@
# Name: rhche
# Description: Remove add on
# Url: https://www.eclipse.org/che/docs/setup/openshift/index.html

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rh-che repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes fixed thanks

value: ${CHE_FABRIC8_AUTH_ENDPOINT}
- name: CHE_FABRIC8_MULTICLUSTER_OSO_PROXY_URL
value: ${CHE_FABRIC8_MULTICLUSTER_OSO_PROXY_URL}
- name: CHE_DOCKER_ENABLE__CONTAINER__STOP__DETECTOR

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that this docker var is needed in rhche?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you. It doesn't make much sense actually but we are using it in the "official" yaml https://github.com/redhat-developer/rh-che/blob/rh-che6/openshift/rh-che.app.yaml#L171.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unused in che6. So I would suggest to remove it from your PR and from the current deployment configuration eclipse-che/che#9344

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not really related to this PR but more to Uncle Bob boyscout rule :-). I have fixed that on both yaml files.

group: io.fabric8.online.packages
name: rhche
data:
che.jdbc.url: "amRiYzpwb3N0Z3Jlc3FsOi8vcG9zdGdyZXM6NTQzMi9kYmNoZQ=="

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not set jbbc values to NULL?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I set che.jdbc.url: "NULL" here I am afraid that Che will use that value as the URL and won't be able to connect.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't. Here is my PR that was intended to simplify our deployment configs eclipse-che/che#9047

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I have updated the PR

oc adm policy add-role-to-user admin developer -n #{NAMESPACE}

echo [CHE] Deploying Postgres
oc new-app -f templates/multi/postgres-template.yaml -n #{NAMESPACE}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no such a file in the branch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I have added the files

@garagatyi
Copy link

I understand that I would not be able to start it successfully because there are no mocked services but still looks like some parts are still missing.

@l0rd l0rd force-pushed the rhche-minishift-addon-part1 branch from e49876a to fd5ac50 Compare April 5, 2018 08:55
@l0rd
Copy link
Contributor Author

l0rd commented Apr 5, 2018

@garagatyi I have updated the PR. Note that I have splitted the addon in 2 separate addons and the keycloak image to use now is eivantsov/keycloak so to test the PR:

minishift addons install openshift/minishift-addons/rhche-prerequisites
minishift addons apply rhche-prerequisites
minishift addons install openshift/minishift-addons/rhche
minishift addons apply rhche --addon-env KEYCLOAK_DOCKER_IMAGE=eivantsov/keycloak

@@ -202,11 +202,6 @@ objects:
value: ${CHE_FABRIC8_AUTH_ENDPOINT}
- name: CHE_FABRIC8_MULTICLUSTER_OSO_PROXY_URL
value: ${CHE_FABRIC8_MULTICLUSTER_OSO_PROXY_URL}
- name: CHE_DOCKER_ENABLE__CONTAINER__STOP__DETECTOR
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that setting CHE_DOCKER_ENABLE__CONTAINER__STOP__DETECTOR to false isn't necessary anymore ? At some stage it was necessary to avoid some errors.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not used in upstream Che at all

@ScrewTSW
Copy link
Member

[test]

2 similar comments
@ScrewTSW
Copy link
Member

[test]

@ScrewTSW
Copy link
Member

[test]

Copy link

@garagatyi garagatyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Eager to see the state of minishift addon when we would be able to develop everything locally!

# Url: https://github.com/redhat-developer/rh-che
# Required-Vars: NAMESPACE, KEYCLOAK_DOCKER_IMAGE
# Var-Defaults: NAMESPACE=rhche, KEYCLOAK_DOCKER_IMAGE=eclipse/che-keycloak
# OpenShift-Version: >=3.5.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@l0rd I had issues with running Che deployments on oc 3.6 some time ago. Have you tried it with oc 3.5?

@@ -0,0 +1,5 @@
# Todo

- Split the addon in 2 addons: rhche-prereq and rhche

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line looks not actual anymore

@@ -168,11 +168,6 @@ objects:
configMapKeyRef:
key: che-fabric8-multicluster-oso-proxy-url
name: rhche
- name: CHE_DOCKER_ENABLE__CONTAINER__STOP__DETECTOR

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning this up

@ScrewTSW
Copy link
Member

ScrewTSW commented Apr 11, 2018

There is something that is unnerving to me.
The jenkins job fails with an unexpected token in jenkins-env.
Why would the env variables contain something different than all the other pull requests?
Could this possibly, after it's merged, cause all the sub-sequential builds to fail?

@ScrewTSW
Copy link
Member

@l0rd ^

@l0rd
Copy link
Contributor Author

l0rd commented Apr 11, 2018

@ScrewTSW maybe it's just because I need to rebase this PR on top of your new modifications? Let me try

@l0rd l0rd force-pushed the rhche-minishift-addon-part1 branch from 37d0044 to 856325b Compare April 11, 2018 08:50
@l0rd
Copy link
Contributor Author

l0rd commented Apr 11, 2018

@ScrewTSW are you 100% sure that the script works on other PRs after your last changes?

The problem looks to be here: this command creates a script (export_env_variables) that contains a ( (parenthesis).

@ScrewTSW
Copy link
Member

Yes, because I've run [test] on them after the fix

@ScrewTSW
Copy link
Member

ScrewTSW commented Apr 11, 2018

I have no idea how could a ( get into env variables

@rhopp
Copy link
Collaborator

rhopp commented Apr 11, 2018

I've run simple test of the line you suggested:

$ cat jenkins-env 
KEYCLOAK_TOKEN=testToken
BUILD_NUBMER=buildNubmer
JOB_NAME=jobName
RH_CHE_USERNAME=username
RH_CHE_PASS=pass

$ grep -E "(KEYCLOAK|BUILD_NUMBER|JOB_NAME|RH_CHE)" ./jenkins-env | sed 's/^/export /g' | sed 's/= /=/g' > ./export_env_variables

$ cat export_env_variables 
export KEYCLOAK_TOKEN=testToken
export JOB_NAME=jobName
export RH_CHE_USERNAME=username
export RH_CHE_PASS=pass

It seems, that the line works exactly as expected.

What I would suggest is not to block this PR on this (I cannot think a way how this particular PR could break the script) and (in another PR) edit the script to write the variable names(not values - could contain secret info), which are grepped from the jenkins-env. This way we will have knowledge what variables we are exporting and where to look for potencial issues when this happens next time.
WDYT?

@ScrewTSW
Copy link
Member

Will try to have a look and add the debug info into the script

@ScrewTSW
Copy link
Member

@l0rd I think you can merge for now.

@ibuziuk
Copy link
Member

ibuziuk commented Apr 12, 2018

[test]

@ibuziuk
Copy link
Member

ibuziuk commented Apr 12, 2018

@ScrewTSW is it still not clear why the build is failing with:
export_env_variables: line 8: syntax error near unexpected token (`
?

@ScrewTSW
Copy link
Member

@ibuziuk I really apologize for the delay. No, I wasn't able to find any reason.
I guess we can merge and see what happens.

@ScrewTSW
Copy link
Member

[test]

@ScrewTSW
Copy link
Member

ScrewTSW commented Apr 19, 2018

@l0rd @ibuziuk this is so strange :D I've rebased #645 onto mario's branch and there are no issues with the export. it's only this PR that is failing with the error...

Let's call it black magic and merge this PR.

@l0rd l0rd merged commit 0cdf78f into redhat-developer:rh-che6 Apr 23, 2018
@l0rd l0rd deleted the rhche-minishift-addon-part1 branch April 23, 2018 22:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants