forked from kata-containers/kata-containers
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kata-deploy: Add StratoVirt support to deploy process
Allow kata-deploy process to pull StratoVirt from release binaries, and add them as a part of kata release. Fixes: kata-containers#7794 Signed-off-by: Liu Wenyuan <[email protected]>
- Loading branch information
1 parent
9542211
commit 14d8790
Showing
12 changed files
with
167 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
tools/packaging/kata-deploy/examples/nginx-deployment-stratovirt.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx-deployment-stratovirt | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
replicas: 2 | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
runtimeClassName: kata-stratovirt | ||
containers: | ||
- name: nginx | ||
image: nginx:1.14 | ||
ports: | ||
- containerPort: 80 |
42 changes: 42 additions & 0 deletions
42
tools/packaging/kata-deploy/examples/test-deploy-kata-stratovirt.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
run: php-apache-kata-stratovirt | ||
name: php-apache-kata-stratovirt | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
run: php-apache-kata-stratovirt | ||
template: | ||
metadata: | ||
labels: | ||
run: php-apache-kata-stratovirt | ||
spec: | ||
runtimeClassName: kata-stratovirt | ||
containers: | ||
- image: k8s.gcr.io/hpa-example | ||
imagePullPolicy: Always | ||
name: php-apache | ||
ports: | ||
- containerPort: 80 | ||
protocol: TCP | ||
resources: | ||
requests: | ||
cpu: 200m | ||
restartPolicy: Always | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: php-apache-kata-stratovirt | ||
spec: | ||
ports: | ||
- port: 80 | ||
protocol: TCP | ||
targetPort: 80 | ||
selector: | ||
run: php-apache-kata-stratovirt | ||
sessionAffinity: None | ||
type: ClusterIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tools/packaging/kata-deploy/runtimeclasses/kata-stratovirt.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
kind: RuntimeClass | ||
apiVersion: node.k8s.io/v1 | ||
metadata: | ||
name: kata-stratovirt | ||
handler: kata-stratovirt | ||
overhead: | ||
podFixed: | ||
memory: "130Mi" | ||
cpu: "250m" | ||
scheduling: | ||
nodeSelector: | ||
katacontainers.io/kata-runtime: "true" |
38 changes: 38 additions & 0 deletions
38
tools/packaging/static-build/stratovirt/build-static-stratovirt.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright (c) 2023 Huawei Technologies Co.,Ltd. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
ARCH=$(uname -m) | ||
|
||
# Currently, StratoVirt only support x86_64 and aarch64. | ||
[ "${ARCH}" != "x86_64" ] && [ "${ARCH}" != "aarch64" ] && exit | ||
|
||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
source "${script_dir}/../../scripts/lib.sh" | ||
|
||
info "Get stratovirt information from runtime versions.yaml" | ||
stratovirt_url="${stratovirt_url:-}" | ||
[ -n "$stratovirt_url" ] || stratovirt_url=$(get_from_kata_deps "assets.hypervisor.stratovirt.url") | ||
[ -n "$stratovirt_url" ] || die "failed to get stratovirt url" | ||
|
||
stratovirt_version="${stratovirt_version:-}" | ||
[ -n "$stratovirt_version" ] || stratovirt_version=$(get_from_kata_deps "assets.hypervisor.stratovirt.version") | ||
[ -n "$stratovirt_version" ] || die "failed to get stratovirt version" | ||
|
||
pull_stratovirt_released_binary() { | ||
file_name="stratovirt-static-${stratovirt_version##*v}-${ARCH}" | ||
download_url="${stratovirt_url}/releases/download/${stratovirt_version}/${file_name}.tar.gz" | ||
|
||
curl -L ${download_url} -o ${file_name}.tar.gz | ||
mkdir -p static-stratovirt | ||
tar zxvf ${file_name}.tar.gz -C static-stratovirt | ||
} | ||
|
||
pull_stratovirt_released_binary | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters