Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Templates in OpenShift recipes #12583

Merged
merged 1 commit into from
Feb 5, 2019

Conversation

amisevsk
Copy link
Contributor

@amisevsk amisevsk commented Feb 1, 2019

What does this PR do?

Add support for Templates as OpenShift recipes, with parameters

This commit does not add dashboard validation (separate PR: #12582), so starting a workspace based off a template requires manually editing an existing workspace config rather than creating a new stack.

The actual change is quite simple: the actual code difference amounts to

clientFactory.create().load(new ByteArrayInputStream(content.getBytes())).get()

instead of

clientFactory.create().lists().load(new ByteArrayInputStream(content.getBytes())).get()

Sample recipe:

kind: Template
apiVersion: v1
metadata:
  name: template-test
objects:
- 
  apiVersion: v1
  kind: Pod
  metadata:
    name: ws
    labels:
      parameter: ${TEST}
  spec:
    containers:
    - 
      image: 'eclipse/che-dev:nightly'
      name: dev
      resources:
        limits:
        memory: 512Mi
parameters:
- name: TEST
  value: test

Above recipe formatted for pasting into existing config:

kind: Template\napiVersion: v1\nmetadata:\n  name: template-test\nobjects:\n- \n  apiVersion: v1\n  kind: Pod\n  metadata:\n    name: ws\n    labels:\n      parameter: ${TEST}\n  spec:\n    containers:\n    - \n      image: 'eclipse/che-dev:nightly'\n      name: dev\n      resources:\n        limits:\n        memory: 512Mi\nparameters:\n- name: TEST\n  value: test

What issues does this PR fix or reference?

#11504

Release Notes

Support OpenShift templates in workspace stack recipes.

Docs PR

Still TODO: docs need to be updated with routes/secrets/templates/etc. notes.

@amisevsk amisevsk added kind/enhancement A feature request - must adhere to the feature request template. status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. labels Feb 1, 2019
@amisevsk amisevsk requested a review from garagatyi as a code owner February 1, 2019 16:26
Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

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

LGTM. Nice to see templates supported by Kubernetes/OpenShfit infrastructure 👍

A small remark to the recipe for testing: indentation is missing before memory field. Resources should be

      resources:
        limits:
          memory: 512Mi

@sleshchenko
Copy link
Member

@amisevsk Note that Kubernetes/OpenShfit recipe is also parsed as the list here https://github.com/eclipse/che/blob/master/wsmaster/che-core-api-devfile/src/main/java/org/eclipse/che/api/devfile/server/DevfileEnvironmentFactory.java#L122
Please check if it can be easily handled there and fix/create a separate issue.

@amisevsk
Copy link
Contributor Author

amisevsk commented Feb 4, 2019

@sleshchenko I'm not terribly familiar with the devfile codepaths, but it looks like the task would be more complicated there, since it specifically outputs Kubernetes List yaml -- even if we could unmarshal lists/templates, it's not clear how to preserve this when converting back to yaml. I'll create an issue.

@amisevsk
Copy link
Contributor Author

amisevsk commented Feb 4, 2019

ci-test

@amisevsk
Copy link
Contributor Author

amisevsk commented Feb 4, 2019

Issue here: #12592

@che-bot
Copy link
Contributor

che-bot commented Feb 5, 2019

Results of automated E2E tests of Eclipse Che Multiuser on OCP:
Build details
Test report
docker image: eclipseche/che-server:12583
https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

@ibuziuk
Copy link
Member

ibuziuk commented Feb 5, 2019

@vkuznyetsov @rhopp could we please get QA approval before merging to master ?

@ibuziuk ibuziuk requested review from vkuznyetsov and rhopp February 5, 2019 11:43
@slemeur slemeur mentioned this pull request Feb 5, 2019
69 tasks
@artaleks9
Copy link
Contributor

Selenium tests execution on Eclipse Che Multiuser on OCP (https://ci.codenvycorp.com/job/che-pullrequests-test-ocp/1511/) doesn't show any regression against this Pull Request.

@@ -137,12 +130,12 @@ public void shouldCreateOpenShiftEnvironmentWithServicesFromRecipe() throws Exce

@Test
public void shouldCreateOpenShiftEnvironmentWithPVCsFromRecipe() throws Exception {
// given
// givewhen(loadedRecipe.get()).thenReturn(n
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like a typo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Accidental paste -- thanks!

Add support for Templates as OpenShift recipes, with parameters
- If the parameter does not have a default value, it is substituted with
  an empty string
- If the parameter has a default value, it is substituted when launching
  the workspace
- Generated parameter values are not supported

This commit does not add dashboard validation, so starting a workspace
based off a template requires manually editing the workspace config
rather than creating a new stack.

Signed-off-by: Angel Misevski <[email protected]>
@dmytro-ndp
Copy link
Contributor

ci-test

@riuvshin
Copy link
Contributor

riuvshin commented Feb 5, 2019

@dmytro-ndp do you think that comment fix in the unit test requires whole e2e cycle rerun?

@riuvshin
Copy link
Contributor

riuvshin commented Feb 5, 2019

@amisevsk feel free to merge this right away, do not wait for e2e tests report after comment change...

@che-bot
Copy link
Contributor

che-bot commented Feb 5, 2019

Results of automated E2E tests of Eclipse Che Multiuser on OCP:
Build details
Test report
docker image: eclipseche/che-server:12583
https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

@dmytro-ndp
Copy link
Contributor

dmytro-ndp commented Feb 5, 2019

@riuvshin:

@dmytro-ndp do you think that comment fix in the unit test requires whole e2e cycle rerun?

No, I don't think so.
I had run e2e tests again because there initial commit was rewritten with new one.

@amisevsk amisevsk merged commit a337920 into eclipse-che:master Feb 5, 2019
@che-bot che-bot removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Feb 5, 2019
@che-bot che-bot added this to the 6.18.0 milestone Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants