You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
4
4
5
5
## As-Is Today
6
6
7
7
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).
8
8
9
9
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).
10
10
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:
12
12
- Git Repo Url
13
13
- Git Repo Ref
14
14
- Build Context Path
15
15
- Container Port
16
+
- Image Name
16
17
17
18
The console devfile import page has the Git Repo Url, Git Repo Ref & the Build Context Path
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.
26
23
27
24
### 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.
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.
33
32
34
33
Here is a proposed 2.0.0 spec devfile that can support build guidance for OpenShift Console:
35
34
@@ -39,21 +38,28 @@ metadata:
39
38
name: nodejs
40
39
version: 1.0.0
41
40
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
43
42
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
45
46
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
47
48
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
49
50
targetPort: 3000
50
51
env:
51
52
- name: FOO # set container env through the devfile.yaml for the container
52
53
value: "bar"
53
54
```
54
55
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.
56
59
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`
58
61
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