Skip to content

Commit

Permalink
Deploying openyurt on top of kubernetes & knative
Browse files Browse the repository at this point in the history
unit test with github workflows
change template to yaml, add into subfolder configs

Signed-off-by: Jason Chua <[email protected]>
  • Loading branch information
jchua99 authored and ustiugov committed Feb 1, 2024
1 parent c57d8b6 commit fc14fa7
Show file tree
Hide file tree
Showing 47 changed files with 2,132 additions and 1,247 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'docs/**'
- '**.md'
pull_request:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support, openyurt ]
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
paths-ignore:
- 'docs/**'
- '**.md'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'docs/**'
- '**.md'
pull_request:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support, openyurt ]
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
paths-ignore:
- 'docs/**'
- '**.md'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support, openyurt ]
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
workflow_dispatch:
schedule:
- cron: '40 13 * * 2'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/firecracker_cri_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- '**.md'
- 'function-images/**'
pull_request:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support, openyurt ]
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
paths-ignore:
- 'docs/**'
- '**.md'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gvisor_cri_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- '**.md'
- 'function-images/**'
pull_request:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support, openyurt ]
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
paths-ignore:
- 'docs/**'
- '**.md'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- '**.md'
- 'function-images/**'
pull_request:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support, openyurt ]
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
paths-ignore:
- 'docs/**'
- '**.md'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
pull_request:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support, openyurt ]
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]

jobs:
build:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/openyurt-unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and Test OpenYurt Deployer

on:
push:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
paths-ignore:
- 'docs/**'
- '**.md'
pull_request:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
paths-ignore:
- 'docs/**'
- '**.md'
workflow_dispatch:

env:
GOOS: linux
GO111MODULE: on

jobs:
openyurt-unit-test:
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
with:
go-version: '1.19'

- name: Check out the code
uses: actions/checkout@v4

- name: Build scripts
run:
pushd scripts/openyurt-deployer && go build -o oy_deploy && popd

- name: Run Unit Test on OpenYurt helper function
run: |
cd scripts/openyurt-deployer
chmod +x unit_test_workflow.sh
./unit_test_workflow.sh
2 changes: 1 addition & 1 deletion .github/workflows/stargz_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- '**.md'
- 'function-images/**'
pull_request:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support, openyurt ]
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
paths-ignore:
- 'docs/**'
- '**.md'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- '**.md'
- 'function-images/**'
pull_request:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support, openyurt ]
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
paths-ignore:
- 'docs/**'
- '**.md'
Expand Down
64 changes: 36 additions & 28 deletions scripts/openyurt-deployer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ It support setting up a Kubernetes cluster using kubeadm and then deploy `OpenYu
| :----------: | :---: |
| main.go | script entry point |
| `conf.json` | json files that stores cluster's configuration |
| node | executing commands on remote nodes through ssh |
| configs | node runtime configurations |
| node.go | node structure and related functions for Section 3.2 |
| configs | yaml templates |

**Description**

Expand All @@ -30,9 +30,7 @@ It support setting up a Kubernetes cluster using kubeadm and then deploy `OpenYu
4. (Optional) Deploy Knative (vHive stock-only mode compatible)

## 3. Usage
```bash
./openyurt_deployer deploy # deploy openyurt on the cluster
```

```bash
./openyurt_deployer clean # clean the openyurt cluster and restore it to initial state
```
Expand All @@ -56,24 +54,38 @@ It support setting up a Kubernetes cluster using kubeadm and then deploy `OpenYu

### 3.2 Run Script

#### 3.2.1 To set up Kubernetes and Kubernetes cluster
```bash
go build .
./openyurt_deployer deploy
```
If it gives out error like:
```
FATA[0001] Failed to connect to: username@host
```
Please execute:
```
eval `ssh-agent -s` && ssh-add ~/.ssh/<your private key>
```
For example:
```
eval `ssh-agent -s` && ssh-add ~/.ssh/id_rsa
./openyurt_deployer k8s
```
---
**Note:**
> If it gives out error like:
> ```
> FATA[0001] Failed to connect to: username@host
> ```
> Please execute:
> ```
> eval `ssh-agent -s` && ssh-add ~/.ssh/<your private key>
> ```
> For example:
> ```
> eval `ssh-agent -s` && ssh-add ~/.ssh/id_rsa
> ```
> And try again
---
#### 3.2.2 To set up Knative
```bash
./openyurt_deployer knative
```
And try again
#### 3.2.2 To set up Open Yurt
```bash
./openyurt_deployer openyurt
```

## 4. Demo: Create `NodePool` And Deploy service on it
**Referenced from [`OpenYurt`](https://openyurt.io/docs/user-manuals/workload/node-pool-management)*
Expand All @@ -82,31 +94,27 @@ The demo would deploy a helloworld function to cloud node pool or edge node pool

Deploy the demo:
```
./openyurt_deployer demo-c
./openyurt_deployer demo-deploy-on-cloud
```
or:
```
./openyurt_deployer demo-e
./openyurt_deployer demo-deploy-on-edge
```
where `demo-c` would deploy the service to the cloud node pool and `demo-e` would deploy the service to the edge node pool.
where `demo-deploy-on-cloud` would deploy the service to the cloud node pool and `demo-deploy-on-edge` would deploy the service to the edge node pool.

The demo code will also show information about node pool after deployment.
The name for `demo-c` would be `helloworld-cloud`, while the name for `demo-e` would be `helloworld-edge`
The name for `demo-deploy-on-cloud` would be `helloworld-cloud`, while the name for `demo-deploy-on-edge` would be `helloworld-edge`
It will also show the services' `URL` so you can try to invoke it on the master node.

You can check the node pool information simply by:
```
./openyurt_deployer demo-print
```
Or delete the services deployed on node pool by:
```
./openyurt_deployer demo-clear
```

The demo code will also show information about node pool after deployment.

### 4.1 Invoke the Services (Optional)
You can try to invoke the services created by `demo-c` or `demo-e` on master node.
You can try to invoke the services created by `demo-deploy-on-cloud` or `demo-deploy-on-edge` on master node.
First, ssh to master node, following commands should all be executed on master node.
```
ssh <master-user>@<master-ip>
Expand Down
15 changes: 15 additions & 0 deletions scripts/openyurt-deployer/configs/benchmarkTemplate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-python-isCloud
namespace: default
spec:
template:
spec:
nodeSelector:
apps.openyurt.io/nodepool: poolName
containers:
- image: docker.io/vhiveease/hello-isCloud:latest
ports:
- name: h2c
containerPort: 50000
6 changes: 6 additions & 0 deletions scripts/openyurt-deployer/configs/cloudNodePoolTemplate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: apps.openyurt.io/v1beta1
kind: NodePool
metadata:
name: poolName
spec:
type: Cloud
91 changes: 0 additions & 91 deletions scripts/openyurt-deployer/configs/configs.go

This file was deleted.

21 changes: 0 additions & 21 deletions scripts/openyurt-deployer/configs/demo.go

This file was deleted.

6 changes: 6 additions & 0 deletions scripts/openyurt-deployer/configs/edgeNodePoolTemplate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: apps.openyurt.io/v1beta1
kind: NodePool
metadata:
name: poolName
spec:
type: Edge
3 changes: 0 additions & 3 deletions scripts/openyurt-deployer/configs/go.mod

This file was deleted.

Loading

0 comments on commit fc14fa7

Please sign in to comment.