Skip to content

Commit 059dd3b

Browse files
committed
Update proposal
Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>
1 parent 52b8c9d commit 059dd3b

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed
Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
11
# Console Import from Devfile
22

3-
This document outlines how the console is going to use a devfile 2.0.0 spec for it's import feature targeted for Dec 4, 2020.
3+
This document outlines how the console is going to use a devfile 2.0.0 spec for it's import feature targeted for the upcoming release.
44

55
## As-Is Today
66

77
Currently the Devfile import feature is mocked with a POC [openshift/console PR](https://github.com/openshift/console/pull/6321). The POC PR, requires the build guidance devfile spec to be implemented. However, the build guidance spec is still an open discussion in the [devfile/api PR](https://github.com/devfile/api/pull/127).
88

99
With an initial target date for the Dec 04, 2020; the devfile import developer preview should look similar to this [demo video](https://drive.google.com/file/d/1uLzDibVZlkMqbjtKkho04e8k2-Ns5A2W/view).
1010

11-
The information for required to build a component from build guidances are:
11+
The information required to build a component from build guidance are:
1212
- Git Repo Url
1313
- Git Repo Ref
1414
- Build Context Path
1515
- Container Port
16+
- Image Name
1617

1718
The console devfile import page has the Git Repo Url, Git Repo Ref & the Build Context Path
1819

1920
<img src="https://user-images.githubusercontent.com/31771087/99319303-4ae89180-2837-11eb-8933-eaaf41160bcd.png">
2021

21-
The open devfile spec for Build Guidance allows for the Dockerfile Location to be specified
22-
23-
<img src="https://user-images.githubusercontent.com/31771087/99319306-4c19be80-2837-11eb-9639-a5c130deb4ba.png">
24-
25-
The Container Port in the POC was parsed from the Dockerfile's `EXPOSE` command but it should ideally be defined in the devfile.
22+
The Dockerfile is assumed to be present in the context directory. The Container Port is assumed to be 8080 and the Image Name is assumed to be the same as the application name.
2623

2724
### Note:
28-
The context path is present in both the Console import form and the devfile spec. It should ideally be present only at the Console form level, since it will help find the `devfile.yaml` and as well as the `Dockerfile`.
25+
The context path is present in both the Console import form and the open devfile spec(Refer to the OpenShift Console Devfile Import screenshot above and the open Build Guidance PR screenshot below). Do we require two context dir information? Is the context dir in the Console form for devfile.yaml and the context dir in the build guidance spec for Dockerfile relative to devfile.yaml? Or do we always assume both the devfile.yaml and Dockerfile are always at the same dir level.
26+
27+
<img src="https://user-images.githubusercontent.com/31771087/99319306-4c19be80-2837-11eb-9639-a5c130deb4ba.png">
2928

3029
## Proposed Changes
3130

32-
With the target deadline closing soon, we may need to provide an alternative path for the OpenShift Console to consume devfile. With the Build Guidance spec [devfile/api PR](https://github.com/devfile/api/pull/127) still an open discussion, this document proposes a solution within the boundaries of the devfile 2.0.0 spec to achieve this.
31+
With the target deadline approaching soon, we may need to provide an alternative path for the OpenShift Console to consume the devfile. With the Build Guidance spec [devfile/api PR](https://github.com/devfile/api/pull/127) still an open discussion, this document proposes a solution within the boundaries of the devfile 2.0.0 spec to achieve this.
3332

3433
Here is a proposed 2.0.0 spec devfile that can support build guidance for OpenShift Console:
3534

@@ -39,21 +38,28 @@ metadata:
3938
name: nodejs
4039
version: 1.0.0
4140
attributes:
42-
build.guidance-dockerfile: https://raw.githubusercontent.com/odo-devfiles/registry/master/devfiles/nodejs/build/Dockerfile # can also be a path relative to the context provided in the Console devfile import form
41+
alpha.build-dockerfile: https://raw.githubusercontent.com/odo-devfiles/registry/master/devfiles/nodejs/build/Dockerfile # can also be a path relative to the context
4342
components:
44-
- name: console
43+
- name: myapplication
44+
attributes:
45+
tool: console-import # key:value pair used to filter container type component that only the Console Devfile Import is interested in
4546
container:
46-
image: buildImage:latest # this is the image which will be used by the Console's buildConfig output
47+
image: buildContextImageOutput:latest # this is the image which will be used by the Console's buildConfig output
4748
endpoints:
48-
- name: http-3000 # define endpoints in devfile.yaml, rather than getting it from the Dockerfile
49+
- name: http-3000 # define endpoints in devfile.yaml, rather than hardcoding a default
4950
targetPort: 3000
5051
env:
5152
- name: FOO # set container env through the devfile.yaml for the container
5253
value: "bar"
5354
```
5455
55-
Console's devfile import POC is using a `BuildConfig` to build the Dockerfile from the dockerfile path location. The POC PR outputs it to an `ImageStream`. However, the above devfile proposal would require an exact image name and tag to build a container from the image. The POC PR could change the `BuiidConfig` output to a docker image. OpenShift [doc](https://docs.openshift.com/container-platform/4.6/builds/managing-build-output.html) outlines how this can be achieved via a `BuildConfig` and pushes the build to a private or dockerhub registry.
56+
Console's devfile import POC is using a `BuildConfig` to build the Dockerfile from the dockerfile path location, currently found from the context dir. The POC PR `BuildConfig` outputs it to an `ImageStreamTag`. However, the POC PR assumes the `ImageStream` and `ImageStreamTag` are all the same name as the application name. This is tightly coupled and dependant on the information entered in the Console Devfile Import form and thus does not allow us to mention a custom image name in the devfile.
57+
58+
If we want to decouple `ImageStream` and `ImageStreamTag` from the application name, so that a custom image name can be specified in the devfile's component container; then we would need to update 1. image stream name 2. build config output image stream tag 3. deployment's container image in `pkg/server/devfile-handler.go` and also the annotation mapping for the `ImageStreamTag` in `getTriggerAnnotation()` in `frontend/packages/dev-console/src/components/import/import-submit-utils.ts`. This allows us to use the image name from devfile.yaml rather than always using the application name.
5659

57-
The devfile container component can also mention endpoints instead of parsing it from the Dockerfile's `EXPOSE` cmd like the Console's POC currently does. Furthermore, more properties can be mentioned in the devfile container component as per the spec, to customize the pod container.
60+
The above proposed devfile container component can also mentions an endpoint instead of hardcoding a default 8080. This can be updated in `createOrUpdateResources()` in `frontend/packages/dev-console/src/components/import/import-submit-utils.ts`
5861

59-
These devfile information would be parsed and returned by the library and thus ensuring a consistent UX across all the consumners of the devfile.
62+
These devfile information would be parsed and returned by the library and thus ensuring a consistent UX.
63+
64+
### Note:
65+
The above devfile proposal and POC PR assumes the `BuildConfig` outputs the build to an `ImageStreamTag` which is used by the OpenShift internal registry. To push the image to a non-OpenShift Image Registry, the `BuiidConfig` output can pushed to a private registry. OpenShift [doc](https://docs.openshift.com/container-platform/4.6/builds/managing-build-output.html) outlines how this can be achieved via a `BuildConfig` and pushes the build to a private or dockerhub registry. Pushing to a private registry requires secret configuration from the Docker config, and this OpenShift [doc](https://docs.openshift.com/container-platform/3.11/dev_guide/builds/build_inputs.html#using-docker-credentials-for-private-registries) explains how to achieve it.

0 commit comments

Comments
 (0)