| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| version: '3' |
| |
| vars: |
| INGRESS: "https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml" |
| |
| env: |
| DATADIR: |
| sh: echo "$OPS_TMP/kind" |
| WORKSPACE: |
| sh: echo "$OPS_HOME/workspace" |
| KUBECONFIG: |
| sh: |- |
| if test -e "$OPS_TMP/kubeconfig" |
| then echo "$OPS_TMP/kubeconfig" |
| else echo ~/.kube/config |
| fi |
| |
| tasks: |
| |
| status: |
| silent: true |
| desc: status of the Apache OpenServerless cluster in Docker |
| cmds: |
| - | |
| if kind get clusters | rg nuvolaris |
| then echo Cluster Apache OpenServerless up and running |
| else echo Cluster Apache OpenServerless not found |
| fi |
| |
| info: |
| silent: true |
| desc: info the Apache OpenServerless cluster in Docker |
| cmds: |
| - | |
| echo "=== KUBECONFIG" |
| echo $KUBECONFIG |
| echo "=== Kind Version" |
| kind version |
| echo "=== Kind Clusters" |
| kind get clusters |
| if test -e $KUBECONFIG |
| then echo "=== Nodes" |
| kubectl get nodes |
| fi |
| |
| cluster: |
| silent: true |
| cmds: |
| - mkdir -p "$DATADIR" "$OPS_HOME/workspace" |
| - envsubst -i kind.yaml -o _kind.yaml |
| - > |
| kind create cluster |
| --kubeconfig="$OPS_TMP/kubeconfig" |
| --wait=1m --name=nuvolaris |
| --config=_kind.yaml |
| |
| ingress: |
| silent: true |
| cmds: |
| - > |
| kubectl --kubeconfig="$OPS_TMP/kubeconfig" |
| apply -f ingress-deploy.yaml |
| |
| check-space: |
| silent: true |
| desc: check if the user has the minimum required disk space |
| cmds: |
| - uv run space.py |
| |
| preload: |
| silent: true |
| desc: preload the Apache OpenServerless images in docker to speed up the cluster creation |
| ignore_errors: true |
| status: |
| - config SKIP_PRELOAD_IMAGES |
| cmds: |
| - | |
| for image in "$IMAGES_STREAMER" "$IMAGES_OPERATOR" "$IMAGES_CONTROLLER" |
| do |
| docker pull "$image" --platform "linux/{{ARCH}}" |
| if ! kind load docker-image "$image" --name nuvolaris |
| then |
| echo "*** Cannot preload images. You can disable preload with ops -config SKIP_PRELOAD_IMAGES=1" |
| echo "*** Workaround on Docker Desktop: disable 'Use containerd for pulling and storing images' on General" |
| echo "*** WARNING! If you skip preload, it can take a lot of time before the system starts. Be patient." |
| exit 1 |
| fi |
| docker rmi "$image" |
| done |
| - | |
| jq -r '.runtimes[][] |
| | select(.default == true) |
| | .image |
| | "\(.prefix)/\(.name):\(.tag)"' <$OPS_ROOT/runtimes.json \ |
| | rg apache/openserverless-runtime \ |
| | while read -r image; do |
| docker pull "$image" --platform "linux/{{ARCH}}" |
| kind load docker-image "$image" --name nuvolaris |
| docker rmi "$image" |
| done |
| |
| clean-all: |
| silent: true |
| desc: remove all images and containers from docker |
| prompt: Are you sure? This will remove all images, containers and volumes from docker |
| cmds: |
| - echo "Cleaning all docker images and containers" |
| - docker ps -qa | while read a ; do docker rm -f "$a" ; done |
| - docker images -qa | while read a ; do docker rmi -f "$a" ; done |
| - docker system prune -af |
| - docker volume prune -af |
| - docker system df |
| |
| create: |
| silent: true |
| desc: create the Apache OpenServerless cluster in Docker |
| cmds: |
| - task: cluster |
| - task: ingress |
| - cp "$OPS_TMP/kubeconfig" "$OPS_TMP/kind.kubeconfig" |
| status: |
| - kind get clusters | rg nuvolaris |
| |
| delete: |
| silent: true |
| desc: destroy the Apache OpenServerless cluster in Docker |
| cmds: |
| - kind delete clusters nuvolaris |
| - rm -f "$OPS_TMP/kubeconfig" "$OPS_TMP/kind.kubeconfig" |
| |
| kubeconfig: |
| desc: export kubeconfig |
| silent: true |
| cmds: |
| - kind export kubeconfig --name=nuvolaris --kubeconfig "$OPS_TMP/kubeconfig" |
| - cp "$OPS_TMP/kubeconfig" "$OPS_TMP/kind.kubeconfig" |