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

update quickstart #5992

Merged
merged 17 commits into from
Aug 1, 2022
Merged
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
224 changes: 199 additions & 25 deletions docs/website/docs/user-guides/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,54 @@ $ go mod init my.example.go.project

Your source code has now been generated and created in the directory.

## Step 1. Creating your application (`odo init`)

## Step 1. Connect to your cluster and create a new namespace or project

Before starting you should make sure that odo is connected to your cluster and that you have created a new namespace (or project if you are using OpenShift).




<Tabs groupId="quickstart">
<TabItem value="kubernetes" label="Kubernetes">

### Creating a new namespace

If you are using Kubernetes, you can create a new namespace with the `odo create namespace` command.

```console
$ odo create namespace odo-dev
✓ Namespace "odo-dev" is ready for use
✓ New namespace created and now using namespace: odo-dev
```

</TabItem>
<TabItem value="openshift" label="OpenShift">

### Login to OpenShift Cluster
Copy link
Member

Choose a reason for hiding this comment

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

maybe put this in a different tab and show kubernetes 1st? we want to try to remain Kubernetes #1 and show that first, especially with CNCF presentations / advertising / etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure I understand this. The Kubernetes is always the first tab, and the OpenShift is the second. Or did I miss it somewhere?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I missed that part. I shouldn't be doing reviews on my day off, woops! When I went to preview it I hadn't seen it


The easiest way to connect `odo` to an OpenShift cluster is use copy "Copy login command" function in OpenShift Web Console.

1. Login to OpenShift Web Console.
2. At the top right corner click on your username and then on "Copy login command".
3. You will be prompted to enter your login credentials again.
4. After login, open "Display Token" link.
5. Copy whole `oc login --token ...` command and paste it into the terminal, **before executing the command replace `oc` with `odo`.**

### Create a new project

If you are using OpenShift, you can create a new namespace with the `odo create project` command.

```console
$ odo create project odo-dev
✓ Project "odo-dev" is ready for use
✓ New project created and now using namespace: odo-dev
```

</TabItem>
</Tabs>

## Step 2. Creating your application (`odo init`)

Now we'll initialize your application by creating a `devfile.yaml` to be deployed.

Expand Down Expand Up @@ -307,7 +354,7 @@ Changes will be directly reflected on the cluster.

</Tabs>

## Step 2. Developing your application continuously (`odo dev`)
## Step 3. Developing your application continuously (`odo dev`)

Now that we've generated our code as well as our Devfile, let's start on development.

Expand Down Expand Up @@ -425,7 +472,7 @@ Press Ctrl+c to exit `odo dev` and delete resources from the cluster
You can now access the application at [127.0.0.1:40001](http://127.0.0.1:40001) in your local browser and start your development loop. `odo` will watch for changes and push the code for real-time updates.


## Step 3. Deploying your application to the world (`odo deploy`)
## Step 4. Deploying your application to the world (`odo deploy`)

**Prerequisites:**

Expand Down Expand Up @@ -494,6 +541,10 @@ CMD ["npm", "start"]

Let's modify the `devfile.yaml` and add the respective deployment code.

:::caution
When copy/pasting to `devfile.yaml`, make sure the lines you inserted are correctly indented.
:::

`odo deploy` uses Devfile schema **2.2.0**. Change the schema to reflect the change:

```yaml
Expand Down Expand Up @@ -524,7 +575,7 @@ commands:
- build-image
- k8s-deployment
- k8s-service
- k8s-ingress
- k8s-url
group:
isDefault: true
kind: deploy
Expand All @@ -539,9 +590,9 @@ commands:
- id: k8s-service
apply:
component: outerloop-service
- id: k8s-ingress
- id: k8s-url
apply:
component: outerloop-ingress
component: outerloop-url
```

Add the Docker image location and Kubernetes Deployment, Service, and Ingress resources to `components`:
Expand Down Expand Up @@ -607,9 +658,16 @@ components:
selector:
app: {{RESOURCE_NAME}}
type: ClusterIP
```

To be able to access our application let's add one more `component` to the Devfile.
For OpenShift cluster we add Route. For Kubernetes cluster we add Ingress.

# Let's create an Ingress so we can access the application via a domain name
- name: outerloop-ingress
<Tabs groupId="quickstart">
<TabItem value="kubernetes" label="Kubernetes">

```yaml
- name: outerloop-url
kubernetes:
inlined: |
apiVersion: networking.k8s.io/v1
Expand All @@ -629,7 +687,27 @@ components:
port:
number: {{CONTAINER_PORT}}
```
</TabItem>
<TabItem value="openshift" label="OpenShift">

```yaml
- name: outerloop-url
kubernetes:
inlined: |
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: {{RESOURCE_NAME}}
spec:
path: /
to:
kind: Service
name: {{RESOURCE_NAME}}
port:
targetPort: {{CONTAINER_PORT}}
```
</TabItem>
</Tabs>

#### 3. Run the `odo deploy` command

Expand Down Expand Up @@ -693,6 +771,10 @@ CMD ["dotnet", "app.dll"]

Let's modify the `devfile.yaml` and add the respective deployment code.

:::caution
When copy/pasting to `devfile.yaml`, make sure the lines you inserted are correctly indented.
:::

`odo deploy` uses Devfile schema **2.2.0**. Change the schema to reflect the change:

```yaml
Expand Down Expand Up @@ -723,7 +805,7 @@ commands:
- build-image
- k8s-deployment
- k8s-service
- k8s-ingress
- k8s-url
group:
isDefault: true
kind: deploy
Expand All @@ -738,12 +820,12 @@ commands:
- id: k8s-service
apply:
component: outerloop-service
- id: k8s-ingress
- id: k8s-url
apply:
component: outerloop-ingress
component: outerloop-url
```

Add the Docker image location and Kubernetes Deployment, Service, and Ingress resources to `components`:
Add the Docker image location as well as Kubernetes Deployment and Service resources to `components`:
```yaml
components:

Expand Down Expand Up @@ -806,9 +888,16 @@ components:
selector:
app: {{RESOURCE_NAME}}
type: ClusterIP
```

To be able to access our application we need to add one more `component` to the Devfile.
For OpenShift cluster we add Route. For Kubernetes cluster we add Ingress.

# Let's create an Ingress so we can access the application via a domain name
- name: outerloop-ingress
<Tabs groupId="quickstart">
<TabItem value="kubernetes" label="Kubernetes">

```yaml
- name: outerloop-url
kubernetes:
inlined: |
apiVersion: networking.k8s.io/v1
Expand All @@ -828,6 +917,27 @@ components:
port:
number: {{CONTAINER_PORT}}
```
</TabItem>
<TabItem value="openshift" label="OpenShift">

```yaml
- name: outerloop-url
kubernetes:
inlined: |
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: {{RESOURCE_NAME}}
spec:
path: /
to:
kind: Service
name: {{RESOURCE_NAME}}
port:
targetPort: {{CONTAINER_PORT}}
```
</TabItem>
</Tabs>


#### 3. Run the `odo deploy` command
Expand Down Expand Up @@ -890,6 +1000,10 @@ COPY --from=builder /tmp/src/target/*.jar /deployments/app.jar

Let's modify the `devfile.yaml` and add the respective deployment code.

:::caution
When copy/pasting to `devfile.yaml`, make sure the lines you inserted are correctly indented.
:::

`odo deploy` uses Devfile schema **2.2.0**. Change the schema to reflect the change:

```yaml
Expand Down Expand Up @@ -920,7 +1034,7 @@ commands:
- build-image
- k8s-deployment
- k8s-service
- k8s-ingress
- k8s-url
group:
isDefault: true
kind: deploy
Expand All @@ -935,12 +1049,12 @@ commands:
- id: k8s-service
apply:
component: outerloop-service
- id: k8s-ingress
- id: k8s-url
apply:
component: outerloop-ingress
component: outerloop-url
```

Add the Docker image location and Kubernetes Deployment, Service, and Ingress resources to `components`:
Add the Docker image location as well as Kubernetes Deployment and Service resources to `components`:
```yaml
components:

Expand Down Expand Up @@ -1003,9 +1117,16 @@ components:
selector:
app: {{RESOURCE_NAME}}
type: ClusterIP
```

To be able to access our application we need to add one more `component` to the Devfile.
For OpenShift cluster we add Route. For Kubernetes cluster we add Ingress.

# Let's create an Ingress so we can access the application via a domain name
- name: outerloop-ingress
<Tabs groupId="quickstart">
<TabItem value="kubernetes" label="Kubernetes">

```yaml
- name: outerloop-url
kubernetes:
inlined: |
apiVersion: networking.k8s.io/v1
Expand All @@ -1025,6 +1146,27 @@ components:
port:
number: {{CONTAINER_PORT}}
```
</TabItem>
<TabItem value="openshift" label="OpenShift">

```yaml
- name: outerloop-url
kubernetes:
inlined: |
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: {{RESOURCE_NAME}}
spec:
path: /
to:
kind: Service
name: {{RESOURCE_NAME}}
port:
targetPort: {{CONTAINER_PORT}}
```
</TabItem>
</Tabs>


#### 3. Run the `odo deploy` command
Expand Down Expand Up @@ -1098,6 +1240,10 @@ CMD ["/app/server"]

Let's modify the `devfile.yaml` and add the respective deployment code.

:::caution
When copy/pasting to `devfile.yaml`, make sure the lines you inserted are correctly indented.
:::

`odo deploy` uses Devfile schema **2.2.0**. Change the schema to reflect the change:

```yaml
Expand Down Expand Up @@ -1128,7 +1274,7 @@ commands:
- build-image
- k8s-deployment
- k8s-service
- k8s-ingress
- k8s-url
group:
isDefault: true
kind: deploy
Expand All @@ -1143,9 +1289,9 @@ commands:
- id: k8s-service
apply:
component: outerloop-service
- id: k8s-ingress
- id: k8s-url
apply:
component: outerloop-ingress
component: outerloop-url
```

Add the Docker image location and Kubernetes Deployment, Service, and Ingress resources to `components`:
Expand Down Expand Up @@ -1212,8 +1358,16 @@ components:
app: {{RESOURCE_NAME}}
type: ClusterIP

# Let's create an Ingress so we can access the application via a domain name
- name: outerloop-ingress
```

To be able to access our application let's add one more `component` to the Devfile.
For OpenShift cluster we add Route. For Kubernetes cluster we add Ingress.

<Tabs groupId="quickstart">
<TabItem value="kubernetes" label="Kubernetes">

```yaml
- name: outerloop-url
kubernetes:
inlined: |
apiVersion: networking.k8s.io/v1
Expand All @@ -1233,7 +1387,27 @@ components:
port:
number: {{CONTAINER_PORT}}
```
</TabItem>
<TabItem value="openshift" label="OpenShift">

```yaml
- name: outerloop-url
kubernetes:
inlined: |
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: {{RESOURCE_NAME}}
spec:
path: /
to:
kind: Service
name: {{RESOURCE_NAME}}
port:
targetPort: {{CONTAINER_PORT}}
```
</TabItem>
</Tabs>

#### 3. Run the `odo deploy` command

Expand Down