mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Use image selector feature in "Deploying application" guides (#7013)
* Update introduction message in Deploy guide * Fix syntax highlighting for Shell commands * Bump PrismJS to 1.29.0 to have syntax highlighting for things like Dockerfiles * Enable syntax highlighting for Dockerfile content in the Deploy guides * Update instructions on how to login to the container registry * Add instructions on how to register the image registry in odo This is to be able to use image selectors. * Use a relative image name in the Devfile * Add comment about the ingress domain name variable * Update the deploy guide for .NET * Highlight items that need to be changed in the Devfile * Register the image registry first and make it clear that permissions might need to be updated To make things simple, use a public registry like ttl.sh that does not require authentication. * Add more details on how to access the application
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
title: Deploying an Application
|
||||
---
|
||||
|
||||
In this guide, we will be using `odo` to deploy to production a "Hello World" application.
|
||||
In this guide, we will be using `odo` to run a "Hello World" application into a production-like mode.
|
||||
|
||||
You are expected to complete the [quickstart](../../quickstart) guide first with the respective example.
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import CodeBlock from '@theme/CodeBlock';
|
||||
|
||||
You can now determine how to access the application by running `odo describe component`:
|
||||
|
||||
@@ -20,3 +21,41 @@ Check for _Kubernetes Ingresses_ if you are on a Kubernetes cluster or _OpenShif
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</details>
|
||||
|
||||
|
||||
<Tabs groupId="quickstart">
|
||||
<TabItem value="kubernetes" label="Kubernetes">
|
||||
|
||||
Since we are using Ingress, we can check if an IP address has been set.
|
||||
|
||||
<div>
|
||||
<CodeBlock language="console">
|
||||
{`
|
||||
$ kubectl get ingress my-`}{props.name}{`-app
|
||||
NAME CLASS HOSTS ADDRESS PORTS AGE
|
||||
my-`}{props.name}{`-app traefik `}{props.name}{`.example.com 172.19.0.2 80 2m2s
|
||||
`}
|
||||
</CodeBlock>
|
||||
</div>
|
||||
|
||||
Once the IP address appears, you can now access the application, like so:
|
||||
|
||||
<div>
|
||||
<CodeBlock language="console">
|
||||
{`curl --resolve "`}{props.name}{`.example.com:80:172.19.0.2" -i http://`}{props.name}{`.example.com/`}
|
||||
</CodeBlock>
|
||||
</div>
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="openshift" label="OpenShift">
|
||||
|
||||
We can directly access the application by using the OpenShift Route displayed in the `odo describe component` output above:
|
||||
|
||||
<div>
|
||||
<CodeBlock language="console">
|
||||
{`curl -i http://my-`}{props.name}{`-app-user-crt-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com/`}
|
||||
</CodeBlock>
|
||||
</div>
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
```dockerfile
|
||||
```docker
|
||||
FROM registry.access.redhat.com/ubi8/dotnet-60:6.0 as builder
|
||||
WORKDIR /opt/app-root/src
|
||||
COPY --chown=1001 . .
|
||||
RUN dotnet publish -c Release
|
||||
|
||||
|
||||
FROM registry.access.redhat.com/ubi8/dotnet-60:6.0
|
||||
EXPOSE 8080
|
||||
COPY --from=builder /opt/app-root/src/bin /opt/app-root/src/bin
|
||||
|
||||
@@ -6,12 +6,12 @@ $ odo deploy
|
||||
/ \__/ odo version: v3.13.0
|
||||
\__/
|
||||
|
||||
↪ Building & Pushing Container: quay.io/MYUSERNAME/dotnet-odo-example
|
||||
↪ Building & Pushing Container: ttl.sh/my-dotnet-app-my-dotnet-app:411242
|
||||
• Building image locally ...
|
||||
build -t quay.io/MYUSERNAME/dotnet-odo-example -f /home/user/quickstart-demo/dotnet-demo/Dockerfile /home/user/quickstart-demo/dotnet-demo
|
||||
build -t ttl.sh/my-dotnet-app-my-dotnet-app -f /home/user/quickstart-demo/dotnet-demo/Dockerfile /home/user/quickstart-demo/dotnet-demo
|
||||
✓ Building image locally
|
||||
• Pushing image to container registry ...
|
||||
push quay.io/MYUSERNAME/dotnet-odo-example
|
||||
push ttl.sh/my-dotnet-app-my-dotnet-app
|
||||
✓ Pushing image to container registry
|
||||
|
||||
↪ Deploying Kubernetes Component: my-dotnet-app
|
||||
|
||||
@@ -22,8 +22,10 @@ Kubernetes components:
|
||||
• outerloop-service
|
||||
• outerloop-url
|
||||
|
||||
# highlight-start
|
||||
Kubernetes Ingresses:
|
||||
• my-dotnet-app: dotnet.example.com/
|
||||
# highlight-end
|
||||
|
||||
|
||||
```
|
||||
@@ -22,8 +22,10 @@ Kubernetes components:
|
||||
• outerloop-service
|
||||
• outerloop-url
|
||||
|
||||
# highlight-start
|
||||
OpenShift Routes:
|
||||
• my-dotnet-app: my-dotnet-app-pvala-crt-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com/
|
||||
• my-dotnet-app: my-dotnet-app-user-crt-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com/
|
||||
# highlight-end
|
||||
|
||||
|
||||
```
|
||||
@@ -18,6 +18,8 @@ commands:
|
||||
kind: run
|
||||
workingDir: ${PROJECT_SOURCE}
|
||||
id: run
|
||||
|
||||
# highlight-start
|
||||
# This is the main "composite" command that will run all below commands
|
||||
- id: deploy
|
||||
composite:
|
||||
@@ -42,6 +44,7 @@ commands:
|
||||
- id: k8s-url
|
||||
apply:
|
||||
component: outerloop-url
|
||||
# highlight-end
|
||||
components:
|
||||
- container:
|
||||
args:
|
||||
@@ -63,6 +66,8 @@ components:
|
||||
image: registry.access.redhat.com/ubi8/dotnet-60:6.0
|
||||
mountSources: true
|
||||
name: dotnet
|
||||
|
||||
# highlight-start
|
||||
# This will build the container image before deployment
|
||||
- name: outerloop-build
|
||||
image:
|
||||
@@ -70,7 +75,7 @@ components:
|
||||
buildContext: ${PROJECT_SOURCE}
|
||||
rootRequired: false
|
||||
uri: ./Dockerfile
|
||||
imageName: "{{CONTAINER_IMAGE}}"
|
||||
imageName: "{{APP_NAME}}"
|
||||
# This will create a Deployment in order to run your container image across
|
||||
# the cluster.
|
||||
- name: outerloop-deployment
|
||||
@@ -79,20 +84,20 @@ components:
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{RESOURCE_NAME}}
|
||||
image: {{CONTAINER_IMAGE}}
|
||||
- name: {{APP_NAME}}
|
||||
image: {{APP_NAME}}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{CONTAINER_PORT}}
|
||||
@@ -111,7 +116,7 @@ components:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
ports:
|
||||
- name: "{{CONTAINER_PORT}}"
|
||||
@@ -119,7 +124,7 @@ components:
|
||||
protocol: TCP
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
selector:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
type: NodePort
|
||||
- name: outerloop-url
|
||||
kubernetes:
|
||||
@@ -127,7 +132,7 @@ components:
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
rules:
|
||||
- host: "{{DOMAIN_NAME}}"
|
||||
@@ -137,9 +142,10 @@ components:
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
port:
|
||||
number: {{CONTAINER_PORT}}
|
||||
# highlight-end
|
||||
metadata:
|
||||
description: Stack with .NET 6.0
|
||||
displayName: .NET 6.0
|
||||
@@ -150,6 +156,7 @@ metadata:
|
||||
tags:
|
||||
- .NET
|
||||
version: 1.0.2
|
||||
# highlight-next-line
|
||||
schemaVersion: 2.2.0
|
||||
starterProjects:
|
||||
- git:
|
||||
@@ -160,11 +167,10 @@ starterProjects:
|
||||
origin: https://github.com/redhat-developer/s2i-dotnetcore-ex
|
||||
name: dotnet60-example
|
||||
subDir: app
|
||||
# Add the following variables code anywhere in devfile.yaml
|
||||
# This MUST be a container registry you are able to access
|
||||
# highlight-start
|
||||
variables:
|
||||
CONTAINER_IMAGE: quay.io/MYUSERNAME/dotnet-odo-example
|
||||
RESOURCE_NAME: my-dotnet-app
|
||||
APP_NAME: my-dotnet-app
|
||||
CONTAINER_PORT: "8080"
|
||||
DOMAIN_NAME: dotnet.example.com
|
||||
# highlight-end
|
||||
```
|
||||
@@ -18,6 +18,7 @@ commands:
|
||||
kind: run
|
||||
workingDir: ${PROJECT_SOURCE}
|
||||
id: run
|
||||
# highlight-start
|
||||
# This is the main "composite" command that will run all below commands
|
||||
- id: deploy
|
||||
composite:
|
||||
@@ -42,6 +43,7 @@ commands:
|
||||
- id: k8s-url
|
||||
apply:
|
||||
component: outerloop-url
|
||||
# highlight-end
|
||||
components:
|
||||
- container:
|
||||
args:
|
||||
@@ -63,6 +65,7 @@ components:
|
||||
image: registry.access.redhat.com/ubi8/dotnet-60:6.0
|
||||
mountSources: true
|
||||
name: dotnet
|
||||
# highlight-start
|
||||
# This will build the container image before deployment
|
||||
- name: outerloop-build
|
||||
image:
|
||||
@@ -70,7 +73,7 @@ components:
|
||||
buildContext: ${PROJECT_SOURCE}
|
||||
rootRequired: false
|
||||
uri: ./Dockerfile
|
||||
imageName: "{{CONTAINER_IMAGE}}"
|
||||
imageName: "{{APP_NAME}}"
|
||||
# This will create a Deployment in order to run your container image across
|
||||
# the cluster.
|
||||
- name: outerloop-deployment
|
||||
@@ -79,20 +82,20 @@ components:
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{RESOURCE_NAME}}
|
||||
image: {{CONTAINER_IMAGE}}
|
||||
- name: {{APP_NAME}}
|
||||
image: {{APP_NAME}}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{CONTAINER_PORT}}
|
||||
@@ -111,7 +114,7 @@ components:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
ports:
|
||||
- name: "{{CONTAINER_PORT}}"
|
||||
@@ -119,7 +122,7 @@ components:
|
||||
protocol: TCP
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
selector:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
type: NodePort
|
||||
- name: outerloop-url
|
||||
kubernetes:
|
||||
@@ -127,14 +130,16 @@ components:
|
||||
apiVersion: route.openshift.io/v1
|
||||
kind: Route
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
path: /
|
||||
to:
|
||||
kind: Service
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
port:
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
|
||||
# highlight-end
|
||||
metadata:
|
||||
description: Stack with .NET 6.0
|
||||
displayName: .NET 6.0
|
||||
@@ -145,6 +150,7 @@ metadata:
|
||||
tags:
|
||||
- .NET
|
||||
version: 1.0.2
|
||||
# highlight-next-line
|
||||
schemaVersion: 2.2.0
|
||||
starterProjects:
|
||||
- git:
|
||||
@@ -155,10 +161,10 @@ starterProjects:
|
||||
origin: https://github.com/redhat-developer/s2i-dotnetcore-ex
|
||||
name: dotnet60-example
|
||||
subDir: app
|
||||
# Add the following variables code anywhere in devfile.yaml
|
||||
# This MUST be a container registry you are able to access
|
||||
|
||||
# highlight-start
|
||||
variables:
|
||||
CONTAINER_IMAGE: quay.io/MYUSERNAME/dotnet-odo-example
|
||||
RESOURCE_NAME: my-dotnet-app
|
||||
APP_NAME: my-dotnet-app
|
||||
CONTAINER_PORT: "8080"
|
||||
# highlight-end
|
||||
```
|
||||
@@ -20,12 +20,12 @@ Add the `variables` and change them appropriately:
|
||||
<div>
|
||||
<CodeBlock language="yaml">
|
||||
{`
|
||||
# Add the following variables code anywhere in devfile.yaml
|
||||
# This MUST be a container registry you are able to access
|
||||
# Add the following variables section anywhere in devfile.yaml
|
||||
variables:
|
||||
CONTAINER_IMAGE: quay.io/MYUSERNAME/`}{props.name}{`-odo-example
|
||||
RESOURCE_NAME: my-`}{props.name}{`-app
|
||||
APP_NAME: my-`}{props.name}{`-app
|
||||
CONTAINER_PORT: "`}{props.port}{`"
|
||||
# The ingress domain name is not necessary when deploying to an OpenShift Cluster.
|
||||
# OpenShift will provide us with a dynamic URL to access the application.
|
||||
DOMAIN_NAME: `}{props.name}{`.example.com
|
||||
`}
|
||||
</CodeBlock>
|
||||
@@ -36,6 +36,7 @@ Add the commands used to deploy:
|
||||
```yaml
|
||||
# This is the main "composite" command that will run all below commands
|
||||
commands:
|
||||
# highlight-start
|
||||
- id: deploy
|
||||
composite:
|
||||
commands:
|
||||
@@ -60,12 +61,14 @@ commands:
|
||||
- id: k8s-url
|
||||
apply:
|
||||
component: outerloop-url
|
||||
# highlight-end
|
||||
```
|
||||
|
||||
Add the Docker image location as well as Kubernetes Deployment and Service resources to `components`:
|
||||
```yaml
|
||||
components:
|
||||
|
||||
# highlight-start
|
||||
# This will build the container image before deployment
|
||||
- name: outerloop-build
|
||||
image:
|
||||
@@ -73,7 +76,7 @@ components:
|
||||
buildContext: ${PROJECT_SOURCE}
|
||||
rootRequired: false
|
||||
uri: ./Dockerfile
|
||||
imageName: "{{CONTAINER_IMAGE}}"
|
||||
imageName: "{{APP_NAME}}"
|
||||
|
||||
# This will create a Deployment in order to run your container image across
|
||||
# the cluster.
|
||||
@@ -83,20 +86,20 @@ components:
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{RESOURCE_NAME}}
|
||||
image: {{CONTAINER_IMAGE}}
|
||||
- name: {{APP_NAME}}
|
||||
image: {{APP_NAME}}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{CONTAINER_PORT}}
|
||||
@@ -115,7 +118,7 @@ components:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
ports:
|
||||
- name: "{{CONTAINER_PORT}}"
|
||||
@@ -123,8 +126,10 @@ components:
|
||||
protocol: TCP
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
selector:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
type: NodePort
|
||||
|
||||
# highlight-end
|
||||
```
|
||||
|
||||
To be able to access our application we need to add one more `component` to the Devfile.
|
||||
@@ -140,7 +145,7 @@ For OpenShift cluster we add Route. For Kubernetes cluster we add Ingress.
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
rules:
|
||||
- host: "{{DOMAIN_NAME}}"
|
||||
@@ -150,7 +155,7 @@ For OpenShift cluster we add Route. For Kubernetes cluster we add Ingress.
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
port:
|
||||
number: {{CONTAINER_PORT}}
|
||||
```
|
||||
@@ -164,12 +169,12 @@ For OpenShift cluster we add Route. For Kubernetes cluster we add Ingress.
|
||||
apiVersion: route.openshift.io/v1
|
||||
kind: Route
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
path: /
|
||||
to:
|
||||
kind: Service
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
port:
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
```dockerfile
|
||||
```docker
|
||||
# This Dockerfile is referenced from:
|
||||
# https://github.com/GoogleCloudPlatform/golang-samples/blob/main/run/helloworld/Dockerfile
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ $ odo deploy
|
||||
/ \__/ odo version: v3.13.0
|
||||
\__/
|
||||
|
||||
↪ Building & Pushing Container: quay.io/MYUSERNAME/go-odo-example
|
||||
↪ Building & Pushing Container: ttl.sh/my-go-app-my-go-app:511242
|
||||
• Building image locally ...
|
||||
build -t quay.io/MYUSERNAME/go-odo-example -f /home/user/quickstart-demo/go-demo/Dockerfile /home/user/quickstart-demo/go-demo
|
||||
build -t ttl.sh/my-go-app-my-go-app -f /home/user/quickstart-demo/go-demo/Dockerfile /home/user/quickstart-demo/go-demo
|
||||
✓ Building image locally
|
||||
• Pushing image to container registry ...
|
||||
push quay.io/MYUSERNAME/go-odo-example
|
||||
push ttl.sh/my-go-app-my-go-app
|
||||
✓ Pushing image to container registry
|
||||
|
||||
↪ Deploying Kubernetes Component: my-go-app
|
||||
|
||||
@@ -22,8 +22,10 @@ Kubernetes components:
|
||||
• outerloop-service
|
||||
• outerloop-url
|
||||
|
||||
# highlight-start
|
||||
Kubernetes Ingresses:
|
||||
• my-go-app: go.example.com/
|
||||
# highlight-end
|
||||
|
||||
|
||||
```
|
||||
@@ -22,8 +22,10 @@ Kubernetes components:
|
||||
• outerloop-service
|
||||
• outerloop-url
|
||||
|
||||
# highlight-start
|
||||
OpenShift Routes:
|
||||
• my-go-app: my-go-app-pvala-crt-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com/
|
||||
• my-go-app: my-go-app-user-crt-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com/
|
||||
# highlight-end
|
||||
|
||||
|
||||
```
|
||||
@@ -21,6 +21,7 @@ commands:
|
||||
kind: run
|
||||
workingDir: ${PROJECT_SOURCE}
|
||||
id: run
|
||||
# highlight-start
|
||||
# This is the main "composite" command that will run all below commands
|
||||
- id: deploy
|
||||
composite:
|
||||
@@ -45,6 +46,7 @@ commands:
|
||||
- id: k8s-url
|
||||
apply:
|
||||
component: outerloop-url
|
||||
# highlight-end
|
||||
components:
|
||||
- container:
|
||||
args:
|
||||
@@ -58,6 +60,7 @@ components:
|
||||
memoryLimit: 1024Mi
|
||||
mountSources: true
|
||||
name: runtime
|
||||
# highlight-start
|
||||
# This will build the container image before deployment
|
||||
- name: outerloop-build
|
||||
image:
|
||||
@@ -65,7 +68,7 @@ components:
|
||||
buildContext: ${PROJECT_SOURCE}
|
||||
rootRequired: false
|
||||
uri: ./Dockerfile
|
||||
imageName: "{{CONTAINER_IMAGE}}"
|
||||
imageName: "{{APP_NAME}}"
|
||||
# This will create a Deployment in order to run your container image across
|
||||
# the cluster.
|
||||
- name: outerloop-deployment
|
||||
@@ -74,20 +77,20 @@ components:
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{RESOURCE_NAME}}
|
||||
image: {{CONTAINER_IMAGE}}
|
||||
- name: {{APP_NAME}}
|
||||
image: {{APP_NAME}}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{CONTAINER_PORT}}
|
||||
@@ -105,7 +108,7 @@ components:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
ports:
|
||||
- name: "{{CONTAINER_PORT}}"
|
||||
@@ -113,7 +116,7 @@ components:
|
||||
protocol: TCP
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
selector:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
type: NodePort
|
||||
- name: outerloop-url
|
||||
kubernetes:
|
||||
@@ -121,7 +124,7 @@ components:
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
rules:
|
||||
- host: "{{DOMAIN_NAME}}"
|
||||
@@ -131,9 +134,10 @@ components:
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
port:
|
||||
number: {{CONTAINER_PORT}}
|
||||
# highlight-end
|
||||
metadata:
|
||||
description: Go is an open source programming language that makes it easy to build
|
||||
simple, reliable, and efficient software.
|
||||
@@ -146,7 +150,7 @@ metadata:
|
||||
tags:
|
||||
- Go
|
||||
version: 1.0.2
|
||||
# Deploy "kind" ID's use schema 2.2.0+
|
||||
# highlight-next-line
|
||||
schemaVersion: 2.2.0
|
||||
starterProjects:
|
||||
- description: A Go project with a simple HTTP server
|
||||
@@ -156,11 +160,10 @@ starterProjects:
|
||||
remotes:
|
||||
origin: https://github.com/devfile-samples/devfile-stack-go.git
|
||||
name: go-starter
|
||||
# Add the following variables code anywhere in devfile.yaml
|
||||
# This MUST be a container registry you are able to access
|
||||
# highlight-start
|
||||
variables:
|
||||
CONTAINER_IMAGE: quay.io/MYUSERNAME/go-odo-example
|
||||
RESOURCE_NAME: my-go-app
|
||||
APP_NAME: my-go-app
|
||||
CONTAINER_PORT: "8080"
|
||||
DOMAIN_NAME: go.example.com
|
||||
# highlight-end
|
||||
```
|
||||
@@ -21,6 +21,7 @@ commands:
|
||||
kind: run
|
||||
workingDir: ${PROJECT_SOURCE}
|
||||
id: run
|
||||
# highlight-start
|
||||
# This is the main "composite" command that will run all below commands
|
||||
- id: deploy
|
||||
composite:
|
||||
@@ -45,6 +46,7 @@ commands:
|
||||
- id: k8s-url
|
||||
apply:
|
||||
component: outerloop-url
|
||||
# highlight-end
|
||||
components:
|
||||
- container:
|
||||
args:
|
||||
@@ -58,6 +60,7 @@ components:
|
||||
memoryLimit: 1024Mi
|
||||
mountSources: true
|
||||
name: runtime
|
||||
# highlight-start
|
||||
# This will build the container image before deployment
|
||||
- name: outerloop-build
|
||||
image:
|
||||
@@ -65,7 +68,7 @@ components:
|
||||
buildContext: ${PROJECT_SOURCE}
|
||||
rootRequired: false
|
||||
uri: ./Dockerfile
|
||||
imageName: "{{CONTAINER_IMAGE}}"
|
||||
imageName: "{{APP_NAME}}"
|
||||
# This will create a Deployment in order to run your container image across
|
||||
# the cluster.
|
||||
- name: outerloop-deployment
|
||||
@@ -74,20 +77,20 @@ components:
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{RESOURCE_NAME}}
|
||||
image: {{CONTAINER_IMAGE}}
|
||||
- name: {{APP_NAME}}
|
||||
image: {{APP_NAME}}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{CONTAINER_PORT}}
|
||||
@@ -105,7 +108,7 @@ components:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
ports:
|
||||
- name: "{{CONTAINER_PORT}}"
|
||||
@@ -113,7 +116,7 @@ components:
|
||||
protocol: TCP
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
selector:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
type: NodePort
|
||||
- name: outerloop-url
|
||||
kubernetes:
|
||||
@@ -121,14 +124,15 @@ components:
|
||||
apiVersion: route.openshift.io/v1
|
||||
kind: Route
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
path: /
|
||||
to:
|
||||
kind: Service
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
port:
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
# highlight-end
|
||||
metadata:
|
||||
description: Go is an open source programming language that makes it easy to build
|
||||
simple, reliable, and efficient software.
|
||||
@@ -141,7 +145,7 @@ metadata:
|
||||
tags:
|
||||
- Go
|
||||
version: 1.0.2
|
||||
# Deploy "kind" ID's use schema 2.2.0+
|
||||
# highlight-next-line
|
||||
schemaVersion: 2.2.0
|
||||
starterProjects:
|
||||
- description: A Go project with a simple HTTP server
|
||||
@@ -151,10 +155,9 @@ starterProjects:
|
||||
remotes:
|
||||
origin: https://github.com/devfile-samples/devfile-stack-go.git
|
||||
name: go-starter
|
||||
# Add the following variables code anywhere in devfile.yaml
|
||||
# This MUST be a container registry you are able to access
|
||||
# highlight-start
|
||||
variables:
|
||||
CONTAINER_IMAGE: quay.io/MYUSERNAME/go-odo-example
|
||||
RESOURCE_NAME: my-go-app
|
||||
APP_NAME: my-go-app
|
||||
CONTAINER_PORT: "8080"
|
||||
# highlight-end
|
||||
```
|
||||
@@ -1,4 +1,4 @@
|
||||
```dockerfile
|
||||
```docker
|
||||
FROM registry.access.redhat.com/ubi8/openjdk-11 as builder
|
||||
|
||||
USER jboss
|
||||
|
||||
@@ -6,12 +6,12 @@ $ odo deploy
|
||||
/ \__/ odo version: v3.13.0
|
||||
\__/
|
||||
|
||||
↪ Building & Pushing Container: quay.io/MYUSERNAME/java-odo-example
|
||||
↪ Building & Pushing Container: ttl.sh/my-java-app-my-java-app:611242
|
||||
• Building image locally ...
|
||||
build -t quay.io/MYUSERNAME/java-odo-example -f /home/user/quickstart-demo/java-demo/Dockerfile /home/user/quickstart-demo/java-demo
|
||||
build -t ttl.sh/my-java-app-my-java-app -f /home/user/quickstart-demo/java-demo/Dockerfile /home/user/quickstart-demo/java-demo
|
||||
✓ Building image locally [5ms]
|
||||
• Pushing image to container registry ...
|
||||
push quay.io/MYUSERNAME/java-odo-example
|
||||
push ttl.sh/my-java-app-my-java-app
|
||||
✓ Pushing image to container registry
|
||||
|
||||
↪ Deploying Kubernetes Component: my-java-app
|
||||
|
||||
@@ -23,8 +23,10 @@ Kubernetes components:
|
||||
• outerloop-service
|
||||
• outerloop-url
|
||||
|
||||
# highlight-start
|
||||
Kubernetes Ingresses:
|
||||
• my-java-app: java.example.com/
|
||||
# highlight-end
|
||||
|
||||
|
||||
```
|
||||
@@ -23,8 +23,10 @@ Kubernetes components:
|
||||
• outerloop-service
|
||||
• outerloop-url
|
||||
|
||||
# highlight-start
|
||||
OpenShift Routes:
|
||||
• my-java-app: my-java-app-pvala-crt-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com/
|
||||
• my-java-app: my-java-app-user-crt-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com/
|
||||
# highlight-end
|
||||
|
||||
|
||||
```
|
||||
@@ -84,7 +84,7 @@ components:
|
||||
buildContext: ${PROJECT_SOURCE}
|
||||
rootRequired: false
|
||||
uri: ./Dockerfile
|
||||
imageName: "{{CONTAINER_IMAGE}}"
|
||||
imageName: "{{APP_NAME}}"
|
||||
# This will create a Deployment in order to run your container image across
|
||||
# the cluster.
|
||||
- name: outerloop-deployment
|
||||
@@ -93,20 +93,20 @@ components:
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{RESOURCE_NAME}}
|
||||
image: {{CONTAINER_IMAGE}}
|
||||
- name: {{APP_NAME}}
|
||||
image: {{APP_NAME}}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{CONTAINER_PORT}}
|
||||
@@ -125,7 +125,7 @@ components:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
ports:
|
||||
- name: "{{CONTAINER_PORT}}"
|
||||
@@ -133,7 +133,7 @@ components:
|
||||
protocol: TCP
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
selector:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
type: NodePort
|
||||
- name: outerloop-url
|
||||
kubernetes:
|
||||
@@ -141,7 +141,7 @@ components:
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
rules:
|
||||
- host: "{{DOMAIN_NAME}}"
|
||||
@@ -151,7 +151,7 @@ components:
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
port:
|
||||
number: {{CONTAINER_PORT}}
|
||||
# highlight-end
|
||||
@@ -175,11 +175,8 @@ starterProjects:
|
||||
origin: https://github.com/odo-devfiles/springboot-ex.git
|
||||
name: springbootproject
|
||||
# highlight-start
|
||||
# Add the following variables code anywhere in devfile.yaml
|
||||
# This MUST be a container registry you are able to access
|
||||
variables:
|
||||
CONTAINER_IMAGE: quay.io/MYUSERNAME/java-odo-example
|
||||
RESOURCE_NAME: my-java-app
|
||||
APP_NAME: my-java-app
|
||||
CONTAINER_PORT: "8080"
|
||||
DOMAIN_NAME: java.example.com
|
||||
# highlight-end
|
||||
|
||||
@@ -84,7 +84,7 @@ components:
|
||||
buildContext: ${PROJECT_SOURCE}
|
||||
rootRequired: false
|
||||
uri: ./Dockerfile
|
||||
imageName: "{{CONTAINER_IMAGE}}"
|
||||
imageName: "{{APP_NAME}}"
|
||||
# This will create a Deployment in order to run your container image across
|
||||
# the cluster.
|
||||
- name: outerloop-deployment
|
||||
@@ -93,20 +93,20 @@ components:
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{RESOURCE_NAME}}
|
||||
image: {{CONTAINER_IMAGE}}
|
||||
- name: {{APP_NAME}}
|
||||
image: {{APP_NAME}}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{CONTAINER_PORT}}
|
||||
@@ -125,7 +125,7 @@ components:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
ports:
|
||||
- name: "{{CONTAINER_PORT}}"
|
||||
@@ -133,7 +133,7 @@ components:
|
||||
protocol: TCP
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
selector:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
type: NodePort
|
||||
- name: outerloop-url
|
||||
kubernetes:
|
||||
@@ -141,12 +141,12 @@ components:
|
||||
apiVersion: route.openshift.io/v1
|
||||
kind: Route
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
path: /
|
||||
to:
|
||||
kind: Service
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
port:
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
# highlight-end
|
||||
@@ -171,10 +171,8 @@ starterProjects:
|
||||
name: springbootproject
|
||||
# highlight-start
|
||||
# Add the following variables code anywhere in devfile.yaml
|
||||
# This MUST be a container registry you are able to access
|
||||
variables:
|
||||
CONTAINER_IMAGE: quay.io/MYUSERNAME/java-odo-example
|
||||
RESOURCE_NAME: my-java-app
|
||||
APP_NAME: my-java-app
|
||||
CONTAINER_PORT: "8080"
|
||||
# highlight-end
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
```dockerfile
|
||||
```docker
|
||||
# Sample copied from https://github.com/nodeshift-starters/devfile-sample/blob/main/Dockerfile
|
||||
|
||||
# Install the app dependencies in a full Node docker image
|
||||
|
||||
@@ -6,12 +6,12 @@ $ odo deploy
|
||||
/ \__/ odo version: v3.13.0
|
||||
\__/
|
||||
|
||||
↪ Building & Pushing Container: quay.io/MYUSERNAME/nodejs-odo-example
|
||||
↪ Building & Pushing Container: ttl.sh/my-nodejs-app-my-nodejs-app:611242
|
||||
• Building image locally ...
|
||||
build -t quay.io/MYUSERNAME/nodejs-odo-example -f /home/user/quickstart-demo/nodejs-demo/Dockerfile /home/user/quickstart-demo/nodejs-demo
|
||||
build -t ttl.sh/my-nodejs-app-my-nodejs-app -f /home/user/quickstart-demo/nodejs-demo/Dockerfile /home/user/quickstart-demo/nodejs-demo
|
||||
✓ Building image locally
|
||||
• Pushing image to container registry ...
|
||||
push quay.io/MYUSERNAME/nodejs-odo-example
|
||||
push ttl.sh/my-nodejs-app-my-nodejs-app
|
||||
✓ Pushing image to container registry
|
||||
|
||||
↪ Deploying Kubernetes Component: my-nodejs-app
|
||||
|
||||
@@ -22,8 +22,10 @@ Kubernetes components:
|
||||
• outerloop-service
|
||||
• outerloop-url
|
||||
|
||||
# highlight-start
|
||||
Kubernetes Ingresses:
|
||||
• my-go-app: go.example.com/
|
||||
# highlight-end
|
||||
|
||||
|
||||
```
|
||||
@@ -22,8 +22,10 @@ Kubernetes components:
|
||||
• outerloop-service
|
||||
• outerloop-url
|
||||
|
||||
# highlight-start
|
||||
OpenShift Routes:
|
||||
• my-nodejs-app: my-nodejs-app-pvala-crt-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com/
|
||||
• my-nodejs-app: my-nodejs-app-user-crt-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com/
|
||||
# highlight-end
|
||||
|
||||
|
||||
```
|
||||
@@ -32,6 +32,7 @@ commands:
|
||||
kind: test
|
||||
workingDir: ${PROJECT_SOURCE}
|
||||
id: test
|
||||
# highlight-start
|
||||
# This is the main "composite" command that will run all below commands
|
||||
- id: deploy
|
||||
composite:
|
||||
@@ -56,6 +57,7 @@ commands:
|
||||
- id: k8s-url
|
||||
apply:
|
||||
component: outerloop-url
|
||||
# highlight-end
|
||||
components:
|
||||
- container:
|
||||
args:
|
||||
@@ -75,6 +77,7 @@ components:
|
||||
memoryLimit: 1024Mi
|
||||
mountSources: true
|
||||
name: runtime
|
||||
# highlight-start
|
||||
# This will build the container image before deployment
|
||||
- name: outerloop-build
|
||||
image:
|
||||
@@ -82,7 +85,7 @@ components:
|
||||
buildContext: ${PROJECT_SOURCE}
|
||||
rootRequired: false
|
||||
uri: ./Dockerfile
|
||||
imageName: "{{CONTAINER_IMAGE}}"
|
||||
imageName: "{{APP_NAME}}"
|
||||
# This will create a Deployment in order to run your container image across
|
||||
# the cluster.
|
||||
- name: outerloop-deployment
|
||||
@@ -91,20 +94,20 @@ components:
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{RESOURCE_NAME}}
|
||||
image: {{CONTAINER_IMAGE}}
|
||||
- name: {{APP_NAME}}
|
||||
image: {{APP_NAME}}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{CONTAINER_PORT}}
|
||||
@@ -123,7 +126,7 @@ components:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
ports:
|
||||
- name: "{{CONTAINER_PORT}}"
|
||||
@@ -131,7 +134,7 @@ components:
|
||||
protocol: TCP
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
selector:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
type: NodePort
|
||||
- name: outerloop-url
|
||||
kubernetes:
|
||||
@@ -139,7 +142,7 @@ components:
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
rules:
|
||||
- host: "{{DOMAIN_NAME}}"
|
||||
@@ -149,9 +152,10 @@ components:
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
port:
|
||||
number: {{CONTAINER_PORT}}
|
||||
# highlight-end
|
||||
metadata:
|
||||
description: Stack with Node.js 16
|
||||
displayName: Node.js Runtime
|
||||
@@ -164,17 +168,17 @@ metadata:
|
||||
- Express
|
||||
- ubi8
|
||||
version: 2.1.1
|
||||
# highlight-next-line
|
||||
schemaVersion: 2.2.0
|
||||
starterProjects:
|
||||
- git:
|
||||
remotes:
|
||||
origin: https://github.com/odo-devfiles/nodejs-ex.git
|
||||
name: nodejs-starter
|
||||
# Add the following variables code anywhere in devfile.yaml
|
||||
# This MUST be a container registry you are able to access
|
||||
# highlight-start
|
||||
variables:
|
||||
CONTAINER_IMAGE: quay.io/MYUSERNAME/node-odo-example
|
||||
RESOURCE_NAME: my-node-app
|
||||
APP_NAME: my-node-app
|
||||
CONTAINER_PORT: "3000"
|
||||
DOMAIN_NAME: node.example.com
|
||||
# highlight-end
|
||||
```
|
||||
@@ -32,6 +32,7 @@ commands:
|
||||
kind: test
|
||||
workingDir: ${PROJECT_SOURCE}
|
||||
id: test
|
||||
# highlight-start
|
||||
# This is the main "composite" command that will run all below commands
|
||||
- id: deploy
|
||||
composite:
|
||||
@@ -56,6 +57,7 @@ commands:
|
||||
- id: k8s-url
|
||||
apply:
|
||||
component: outerloop-url
|
||||
# highlight-end
|
||||
components:
|
||||
- container:
|
||||
args:
|
||||
@@ -75,6 +77,7 @@ components:
|
||||
memoryLimit: 1024Mi
|
||||
mountSources: true
|
||||
name: runtime
|
||||
# highlight-start
|
||||
# This will build the container image before deployment
|
||||
- name: outerloop-build
|
||||
image:
|
||||
@@ -82,7 +85,7 @@ components:
|
||||
buildContext: ${PROJECT_SOURCE}
|
||||
rootRequired: false
|
||||
uri: ./Dockerfile
|
||||
imageName: "{{CONTAINER_IMAGE}}"
|
||||
imageName: "{{APP_NAME}}"
|
||||
# This will create a Deployment in order to run your container image across
|
||||
# the cluster.
|
||||
- name: outerloop-deployment
|
||||
@@ -91,20 +94,20 @@ components:
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{RESOURCE_NAME}}
|
||||
image: {{CONTAINER_IMAGE}}
|
||||
- name: {{APP_NAME}}
|
||||
image: {{APP_NAME}}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{CONTAINER_PORT}}
|
||||
@@ -123,7 +126,7 @@ components:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
ports:
|
||||
- name: "{{CONTAINER_PORT}}"
|
||||
@@ -131,7 +134,7 @@ components:
|
||||
protocol: TCP
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
selector:
|
||||
app: {{RESOURCE_NAME}}
|
||||
app: {{APP_NAME}}
|
||||
type: NodePort
|
||||
- name: outerloop-url
|
||||
kubernetes:
|
||||
@@ -139,14 +142,15 @@ components:
|
||||
apiVersion: route.openshift.io/v1
|
||||
kind: Route
|
||||
metadata:
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
spec:
|
||||
path: /
|
||||
to:
|
||||
kind: Service
|
||||
name: {{RESOURCE_NAME}}
|
||||
name: {{APP_NAME}}
|
||||
port:
|
||||
targetPort: {{CONTAINER_PORT}}
|
||||
# highlight-end
|
||||
metadata:
|
||||
description: Stack with Node.js 16
|
||||
displayName: Node.js Runtime
|
||||
@@ -159,17 +163,17 @@ metadata:
|
||||
- Express
|
||||
- ubi8
|
||||
version: 2.1.1
|
||||
# highlight-next-line
|
||||
schemaVersion: 2.2.0
|
||||
starterProjects:
|
||||
- git:
|
||||
remotes:
|
||||
origin: https://github.com/odo-devfiles/nodejs-ex.git
|
||||
name: nodejs-starter
|
||||
# Add the following variables code anywhere in devfile.yaml
|
||||
# This MUST be a container registry you are able to access
|
||||
# highlight-start
|
||||
variables:
|
||||
CONTAINER_IMAGE: quay.io/MYUSERNAME/node-odo-example
|
||||
RESOURCE_NAME: my-node-app
|
||||
APP_NAME: my-node-app
|
||||
CONTAINER_PORT: "3000"
|
||||
DOMAIN_NAME: node.example.com
|
||||
# highlight-end
|
||||
```
|
||||
@@ -1,13 +1,33 @@
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
**Prerequisites:**
|
||||
In order to use `odo deploy`, you must be able to build an image as well as push to a registry.
|
||||
|
||||
In order to use `odo deploy` you must be able to build an image as well as push to a registry.
|
||||
#### Step 1. Let `odo` know where to push container images
|
||||
|
||||
#### Step 1. Login to your container registry
|
||||
`odo` needs to know where to push non-absolute container images declared in the `devfile.yaml` file.
|
||||
|
||||
Login to a container registry that you will be pushing your application to:
|
||||
You can configure `odo` with the `odo preference set` command, like so:
|
||||
|
||||
```shell
|
||||
odo preference set ImageRegistry $registry
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Example Output</summary>
|
||||
|
||||
```console
|
||||
$ odo preference set ImageRegistry ttl.sh
|
||||
✓ Value of 'imageregistry' preference was set to 'ttl.sh'
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
#### Step 2 (Optional). Login to your container registry
|
||||
|
||||
If the container registry you registered requires some form of authentication, you will need to login to it.
|
||||
|
||||
Note that the cluster you are deploying to also needs to be able to pull images from this registry in order for the application container to be started properly.
|
||||
|
||||
<Tabs
|
||||
defaultValue="podman"
|
||||
@@ -18,10 +38,13 @@ values={[
|
||||
|
||||
<TabItem value="podman">
|
||||
|
||||
```console
|
||||
podman login
|
||||
```shell
|
||||
podman login $registry
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Example Output</summary>
|
||||
|
||||
```console
|
||||
$ podman login quay.io
|
||||
Username:
|
||||
@@ -29,14 +52,19 @@ Password:
|
||||
Login Succeeded!
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="docker">
|
||||
|
||||
```console
|
||||
docker login
|
||||
```shell
|
||||
docker login $registry
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Example Output</summary>
|
||||
|
||||
```console
|
||||
$ docker login docker.io
|
||||
Username:
|
||||
@@ -44,11 +72,13 @@ Password:
|
||||
Login Succeeded!
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
#### Step 2. Set the appropriate container build platform
|
||||
#### Step 3. Set the appropriate container build platform
|
||||
|
||||
Your container image build must match the same architecture as the cluster you are deploying to.
|
||||
|
||||
@@ -69,7 +99,7 @@ values={[
|
||||
|
||||
<TabItem value="linuxamd64">
|
||||
|
||||
```console
|
||||
```shell
|
||||
export ODO_IMAGE_BUILD_ARGS="--platform=linux/amd64"
|
||||
```
|
||||
|
||||
@@ -77,7 +107,7 @@ export ODO_IMAGE_BUILD_ARGS="--platform=linux/amd64"
|
||||
|
||||
<TabItem value="linuxarm64">
|
||||
|
||||
```console
|
||||
```shell
|
||||
export ODO_IMAGE_BUILD_ARGS="--platform=linux/arm64"
|
||||
```
|
||||
|
||||
@@ -85,7 +115,7 @@ export ODO_IMAGE_BUILD_ARGS="--platform=linux/arm64"
|
||||
|
||||
<TabItem value="windowsamd64">
|
||||
|
||||
```console
|
||||
```shell
|
||||
export ODO_IMAGE_BUILD_ARGS="--platform=windows/amd64"
|
||||
```
|
||||
|
||||
|
||||
@@ -7,4 +7,10 @@ odo deploy
|
||||
<details>
|
||||
<summary>Sample Output</summary>
|
||||
{props.deployout}
|
||||
</details>
|
||||
</details>
|
||||
|
||||
|
||||
:::note
|
||||
If you are using the [quay.io](https://quay.io/repository/) registry, you might have to change the permissions of the newly pushed image to Public to continue.
|
||||
Otherwise, you might see failures related to pulling the image.
|
||||
:::
|
||||
|
||||
@@ -17,11 +17,12 @@ import PreReq from './docs-mdx/prerequisites.mdx';
|
||||
|
||||
## Step 1. Create the initial development application
|
||||
|
||||
Complete the [Developing with .Net](/docs/user-guides/quickstart/dotnet) guide before continuing.
|
||||
Complete the [Developing with .NET](/docs/user-guides/quickstart/dotnet) guide before continuing.
|
||||
|
||||
## Step 2. Containerize the application
|
||||
|
||||
In order to deploy our application, we must containerize it in order to build and push to a registry. Create the following `Dockerfile` in the same directory:
|
||||
|
||||
import Dockerfile from './docs-mdx/dotnet/dotnet_Dockerfile.mdx';
|
||||
|
||||
<Dockerfile />
|
||||
@@ -54,7 +55,7 @@ import AccessingApplicationDescription from './docs-mdx/accessing_application.md
|
||||
import KubernetesDescribeOutput from './docs-mdx/dotnet/dotnet_describe_component_kubernetes_output.mdx';
|
||||
import OpenShiftDescribeOutput from './docs-mdx/dotnet/dotnet_describe_component_openshift_output.mdx';
|
||||
|
||||
<AccessingApplicationDescription k8sdata=<KubernetesDescribeOutput /> ocdata=<OpenShiftDescribeOutput />/>
|
||||
<AccessingApplicationDescription name="dotnet" k8sdata=<KubernetesDescribeOutput /> ocdata=<OpenShiftDescribeOutput />/>
|
||||
|
||||
## Step 6. Delete the resources
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ import AccessingApplicationDescription from './docs-mdx/accessing_application.md
|
||||
import KubernetesDescribeOutput from './docs-mdx/go/go_describe_component_kubernetes_output.mdx';
|
||||
import OpenShiftDescribeOutput from './docs-mdx/go/go_describe_component_openshift_output.mdx';
|
||||
|
||||
<AccessingApplicationDescription k8sdata=<KubernetesDescribeOutput /> ocdata=<OpenShiftDescribeOutput />/>
|
||||
<AccessingApplicationDescription name="go" k8sdata=<KubernetesDescribeOutput /> ocdata=<OpenShiftDescribeOutput />/>
|
||||
|
||||
## Step 6. Delete the resources
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ import AccessingApplicationDescription from './docs-mdx/accessing_application.md
|
||||
import KubernetesDescribeOutput from './docs-mdx/java/java_describe_component_kubernetes_output.mdx';
|
||||
import OpenShiftDescribeOutput from './docs-mdx/java/java_describe_component_openshift_output.mdx';
|
||||
|
||||
<AccessingApplicationDescription k8sdata=<KubernetesDescribeOutput /> ocdata=<OpenShiftDescribeOutput />/>
|
||||
<AccessingApplicationDescription name="java" k8sdata=<KubernetesDescribeOutput /> ocdata=<OpenShiftDescribeOutput />/>
|
||||
|
||||
## Step 6. Delete the resources
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ import AccessingApplicationDescription from './docs-mdx/accessing_application.md
|
||||
import KubernetesDescribeOutput from './docs-mdx/nodejs/nodejs_describe_component_kubernetes_output.mdx';
|
||||
import OpenShiftDescribeOutput from './docs-mdx/nodejs/nodejs_describe_component_openshift_output.mdx';
|
||||
|
||||
<AccessingApplicationDescription k8sdata=<KubernetesDescribeOutput /> ocdata=<OpenShiftDescribeOutput />/>
|
||||
<AccessingApplicationDescription name="nodejs" k8sdata=<KubernetesDescribeOutput /> ocdata=<OpenShiftDescribeOutput />/>
|
||||
|
||||
## Step 6. Delete the resources
|
||||
|
||||
|
||||
@@ -117,6 +117,7 @@ module.exports = {
|
||||
prism: {
|
||||
theme: prismReactRenderer.themes.github,
|
||||
darkTheme: prismReactRenderer.themes.oceanicNext,
|
||||
additionalLanguages: ['docker'],
|
||||
},
|
||||
algolia: {
|
||||
appId: '7RBQSTPIA4',
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"glob-parent": "^6.0.2",
|
||||
"node-forge": "^1.3.1",
|
||||
"prism-react-renderer": "^2.0.6",
|
||||
"prismjs": "^1.27.0",
|
||||
"prismjs": "^1.29.0",
|
||||
"react": "^17.0.1",
|
||||
"react-dom": "^17.0.1",
|
||||
"react-loadable": "^5.5.0",
|
||||
|
||||
@@ -6186,7 +6186,7 @@ prism-react-renderer@^2.0.6:
|
||||
"@types/prismjs" "^1.26.0"
|
||||
clsx "^1.2.1"
|
||||
|
||||
prismjs@^1.27.0, prismjs@^1.28.0:
|
||||
prismjs@^1.28.0, prismjs@^1.29.0:
|
||||
version "1.29.0"
|
||||
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.29.0.tgz#f113555a8fa9b57c35e637bba27509dcf802dd12"
|
||||
integrity sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==
|
||||
|
||||
Reference in New Issue
Block a user