From f66b84441ba86aa4b05c34327b75decddb3cc48a Mon Sep 17 00:00:00 2001 From: Stephanie Date: Wed, 3 Nov 2021 15:22:07 -0400 Subject: [PATCH 1/4] update to devfile 2.2.0 with image component Signed-off-by: Stephanie --- devfile.yaml | 51 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/devfile.yaml b/devfile.yaml index 5e2650251..85856aef7 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -1,25 +1,54 @@ -schemaVersion: 2.0.0 +schemaVersion: 2.2.0 metadata: name: python version: 1.0.0 - attributes: - alpha.build-context: . - alpha.build-dockerfile: docker/Dockerfile starterProjects: - name: python-example git: remotes: origin: https://github.com/odo-devfiles/python-ex +variables: + CONTAINER_IMAGE: python-image:latest + COMPONENT_NAME: my-python + PORT: "8081" components: - - name: buildguidance + - name: outerloop-build attributes: tool: console-import - container: - image: buildguidanceimage-placeholder - memoryLimit: 1024Mi - endpoints: - - name: http-8081 - targetPort: 8081 + image: + imageName: "{{CONTAINER_IMAGE}}" + dockerfile: + uri: docker/Dockerfile + buildContext: . + rootRequired: false + - name: outerloop-deploy + kubernetes: + inlined: | + kind: Deployment + apiVersion: apps/v1 + metadata: + name: {{COMPONENT_NAME}} + spec: + replicas: 1 + selector: + matchLabels: + app: node-app + template: + metadata: + labels: + app: node-app + spec: + containers: + - name: {{COMPONENT_NAME}} + image: {{CONTAINER_IMAGE}} + ports: + - name: http + containerPort: {{PORT}} + protocol: TCP + resources: + limits: + memory: "128Mi" + cpu: "500m" - name: py-web container: image: quay.io/eclipse/che-python-3.7:nightly From eaa075fdf45e2cdfa7db3935a74d05125ca8dbca Mon Sep 17 00:00:00 2001 From: Stephanie Date: Wed, 3 Nov 2021 16:17:21 -0400 Subject: [PATCH 2/4] specify port in attribute Signed-off-by: Stephanie --- devfile.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/devfile.yaml b/devfile.yaml index 85856aef7..cd628c9d7 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -2,6 +2,8 @@ schemaVersion: 2.2.0 metadata: name: python version: 1.0.0 +attributes: + alpha.dockerimage-port: 8081 starterProjects: - name: python-example git: @@ -32,11 +34,11 @@ components: replicas: 1 selector: matchLabels: - app: node-app + app: python-app template: metadata: labels: - app: node-app + app: python-app spec: containers: - name: {{COMPONENT_NAME}} From f6c61314bab917e378e2ea091e4a139e1d133bdd Mon Sep 17 00:00:00 2001 From: Stephanie Date: Thu, 4 Nov 2021 12:03:33 -0400 Subject: [PATCH 3/4] use kubernetes.uri instead of inline Signed-off-by: Stephanie --- devfile.yaml | 37 ++++--------------------------------- outerloop-deploy.yaml | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 33 deletions(-) create mode 100644 outerloop-deploy.yaml diff --git a/devfile.yaml b/devfile.yaml index cd628c9d7..2b82b2711 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -2,6 +2,8 @@ schemaVersion: 2.2.0 metadata: name: python version: 1.0.0 + provider: Red Hat + supportUrl: https://github.com/devfile-samples/devfile-support#support-information attributes: alpha.dockerimage-port: 8081 starterProjects: @@ -9,48 +11,17 @@ starterProjects: git: remotes: origin: https://github.com/odo-devfiles/python-ex -variables: - CONTAINER_IMAGE: python-image:latest - COMPONENT_NAME: my-python - PORT: "8081" components: - name: outerloop-build - attributes: - tool: console-import image: - imageName: "{{CONTAINER_IMAGE}}" + imageName: python-image:latest dockerfile: uri: docker/Dockerfile buildContext: . rootRequired: false - name: outerloop-deploy kubernetes: - inlined: | - kind: Deployment - apiVersion: apps/v1 - metadata: - name: {{COMPONENT_NAME}} - spec: - replicas: 1 - selector: - matchLabels: - app: python-app - template: - metadata: - labels: - app: python-app - spec: - containers: - - name: {{COMPONENT_NAME}} - image: {{CONTAINER_IMAGE}} - ports: - - name: http - containerPort: {{PORT}} - protocol: TCP - resources: - limits: - memory: "128Mi" - cpu: "500m" + uri: outerloop-deploy.yaml - name: py-web container: image: quay.io/eclipse/che-python-3.7:nightly diff --git a/outerloop-deploy.yaml b/outerloop-deploy.yaml new file mode 100644 index 000000000..e32700d03 --- /dev/null +++ b/outerloop-deploy.yaml @@ -0,0 +1,25 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: my-python +spec: + replicas: 1 + selector: + matchLabels: + app: python-app + template: + metadata: + labels: + app: python-app + spec: + containers: + - name: my-python + image: python-image:latest + ports: + - name: http + containerPort: 8081 + protocol: TCP + resources: + limits: + memory: "128Mi" + cpu: "500m" From 17a00b0beec4661ec515ad80937d85f31f9fabbb Mon Sep 17 00:00:00 2001 From: Stephanie Date: Fri, 5 Nov 2021 11:22:34 -0400 Subject: [PATCH 4/4] add deploy cmd Signed-off-by: Stephanie --- devfile.yaml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/devfile.yaml b/devfile.yaml index 2b82b2711..f7742eecb 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -4,7 +4,7 @@ metadata: version: 1.0.0 provider: Red Hat supportUrl: https://github.com/devfile-samples/devfile-support#support-information -attributes: + attributes: alpha.dockerimage-port: 8081 starterProjects: - name: python-example @@ -52,3 +52,17 @@ commands: component: py-web group: kind: debug + - id: build-image + apply: + component: outerloop-build + - id: deployk8s + apply: + component: outerloop-deploy + - id: deploy + composite: + commands: + - build-image + - deployk8s + group: + kind: deploy + isDefault: true