Skip to content

Commit

Permalink
add openkruise (#633)
Browse files Browse the repository at this point in the history
Signed-off-by: willzhang <willzhmic@outlook.com>
  • Loading branch information
willzhang authored Oct 18, 2023
1 parent 9f2bae6 commit 7996adc
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 0 deletions.
41 changes: 41 additions & 0 deletions applications/openkruise/README.md
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"
10 changes: 10 additions & 0 deletions applications/openkruise/latest/Kubefile
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)"]
54 changes: 54 additions & 0 deletions applications/openkruise/latest/init.sh
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 $@

0 comments on commit 7996adc

Please sign in to comment.