-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: willzhang <willzhmic@outlook.com>
- Loading branch information
Showing
3 changed files
with
105 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# openkruise | ||
|
||
Automated management of large-scale applications on Kubernetes. | ||
|
||
## Prerequisites | ||
|
||
- Kubernetes(depends on the app requirements) | ||
- Sealos 4.x.x | ||
- Helm 3.x.x | ||
|
||
## Installing the app | ||
|
||
Run app with sealos | ||
|
||
```shell | ||
$ sealos run docker.io/labring/openkruise:v1.5.0 | ||
``` | ||
|
||
Get app status | ||
|
||
```shell | ||
$ helm -n kruise-system ls | ||
``` | ||
|
||
## Uninstalling the app | ||
|
||
Uninstall with helm command | ||
|
||
```shell | ||
helm -n kruise-system uninstall kruise | ||
``` | ||
|
||
## Configuration | ||
|
||
Refer to openkruise values.yaml for the full run-down on defaults. | ||
|
||
Specify each parameter using the `--set key=value[,key=value]` argument to `seaos run -e HELM_OPTS=`. For example, | ||
|
||
```shell | ||
$ sealos run docker.io/labring/openkruise:v1.5.0 \ | ||
-e NAME=my-kruise -e NAMESPACE=my-kruise -e HELM_OPTS="--set installation.namespace=my-kruise" |
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,10 @@ | ||
FROM scratch | ||
|
||
ENV NAME=${NAME:-"kruise"} | ||
ENV NAMESPACE=${NAMESPACE:-"default"} | ||
ENV CHARTS="./charts/kruise" | ||
ENV HELM_OPTS=${HELM_OPTS:-" \ | ||
"} | ||
|
||
COPY . . | ||
CMD ["helm upgrade -i $(NAME) $(CHARTS) -n $(NAMESPACE) --create-namespace $(HELM_OPTS)"] |
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,54 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 | ||
export readonly ARCH=${1:-amd64} | ||
export readonly NAME=${2:-$(basename "${PWD%/*}")} | ||
export readonly VERSION=${3:-$(basename "$PWD")} | ||
|
||
repo_url="https://openkruise.github.io/charts/" | ||
repo_name="openkruise/kruise" | ||
chart_name="openkruise" | ||
|
||
function check_command() { | ||
if ! command -v "$1" >/dev/null 2>&1; then | ||
echo "$1 is required, exiting the script" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function check_version(){ | ||
rm -rf charts | ||
helm repo add ${chart_name} ${repo_url} --force-update 1>/dev/null | ||
|
||
# Check version number exists | ||
all_versions=$(helm search repo --versions --regexp "\v"${repo_name}"\v" | awk '{print $3}' | grep -v VERSION) | ||
if ! echo "$all_versions" | grep -qw "${VERSION#v}"; then | ||
echo "Error: Exit, the provided version ${VERSION} does not exist in helm repo, get available version with: helm search repo ${repo_name} --versions" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function init(){ | ||
# Find the chart version through the app version | ||
chart_version=$(helm search repo --versions --regexp "\v"${repo_name}"\v" |grep ${VERSION#v} | awk '{print $2}' | sort -rn | head -n1) | ||
|
||
# Pull helm charts to local | ||
helm pull ${repo_name} --version=${chart_version} -d charts --untar | ||
if [ $? -eq 0 ]; then | ||
echo "init success, next run sealos build" | ||
fi | ||
} | ||
|
||
function main() { | ||
if [ $# -ne 3 ]; then | ||
echo "Usage: ./$0 <ARCH> <NAME> <VERSION>" | ||
exit 1 | ||
else | ||
check_command helm | ||
check_version | ||
init | ||
fi | ||
} | ||
|
||
main $@ |