Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 65 additions & 78 deletions Taskfile.dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ version: "3"
env:
EDA_MODE: development
DJANGO_SETTINGS_MODULE: "aap_eda.settings.default"
KIND_EXPERIMENTAL_PROVIDER: '{{.CONTAINER_ENGINE}}'

vars:
DOCKER_COMPOSE: '{{ default "docker-compose" .DOCKER_COMPOSE }}'
DOCKER_COMPOSE_ARGS: '{{ default "-p eda -f tools/docker/docker-compose-dev.yaml" .DOCKER_COMPOSE_ARGS }}'
PYTEST_CMD: "poetry run python -m pytest"
MINIKUBE_CMD: "scripts/eda_kube.sh"
CONTAINER_ENGINE: '{{ default "podman" .CONTAINER_ENGINE }}'
Comment thread
coderabbitai[bot] marked this conversation as resolved.
SUSER_CMD: "scripts/create_superuser.sh"
PODMAN_CMD: "scripts/eda_podman.sh"

Expand Down Expand Up @@ -219,106 +220,92 @@ tasks:
cmds:
- "{{.SUSER_CMD}} {{.CLI_ARGS}}"

minikube:
desc: "Run eda_kube.sh with specified CLI arguments."
summary: |
Run eda_kube.sh with specified CLI arguments.

Example:
$ task minikube -- build
cmds:
- "{{.MINIKUBE_CMD}} {{.CLI_ARGS}}"

minikube:build:
desc: "Build docker image and push to minikube"
kind:build:
desc: "Build EDA API image and load into kind cluster"
cmds:
- task: minikube
vars:
CLI_ARGS: build {{.CLI_ARGS}}
- "{{.CONTAINER_ENGINE}} build -t localhost/aap-eda:latest -f tools/docker/Dockerfile ."
- kind load docker-image localhost/aap-eda:latest --name ${KIND_CLUSTER_NAME:-kind}

minikube:build:api:
desc: "Build EDA api image and push to minikube"
kind:deploy:
desc: "Deploy EDA to kind cluster using kustomize"
preconditions:
- sh: test -f tools/deploy/environment.properties
msg: "tools/deploy/environment.properties not found. Copy from environment.properties.example: cp tools/deploy/environment.properties.example tools/deploy/environment.properties"
cmds:
- task: minikube
vars:
CLI_ARGS: build-api {{.CLI_ARGS}}

minikube:build:ui:
desc: "Build EDA UI image and push to minikube"
cmds:
- task: minikube
vars:
CLI_ARGS: build-ui {{.CLI_ARGS}}
- kubectl create namespace ${NAMESPACE:-aap-eda} --dry-run=client -o yaml | kubectl apply -f -
- kubectl config set-context --current --namespace=${NAMESPACE:-aap-eda}
- >-
kubectl create secret generic eda-ui-certs
--from-file=wildcard.crt=tools/docker/nginx/certs/wildcard.crt
--from-file=wildcard.key=tools/docker/nginx/certs/wildcard.key
--from-file=client.crt=tools/docker/nginx/certs/client.crt
-n ${NAMESPACE:-aap-eda} --dry-run=client -o yaml | kubectl apply -f -
- >-
kubectl create configmap eda-ui-nginx-config
--from-file=default.conf.template=tools/docker/nginx/default.conf.template
-n ${NAMESPACE:-aap-eda} --dry-run=client -o yaml | kubectl apply -f -
- >-
kubectl create configmap eda-postgres-initdb
--from-file=create_event_persistence_db.sh=tools/docker/postgres/initdb.d/create_event_persistence_db.sh
-n ${NAMESPACE:-aap-eda} --dry-run=client -o yaml | kubectl apply -f -
- kustomize build tools/deploy | kubectl apply -f -

minikube:deploy:
desc: "Build deployment and deploy to minikube"
kind:clean:
desc: "Remove all EDA resources from kind cluster"
cmds:
- task: minikube
vars:
CLI_ARGS: deploy {{.CLI_ARGS}}
- kustomize build tools/deploy | kubectl delete --ignore-not-found -f -
- kubectl delete secret eda-ui-certs -n ${NAMESPACE:-aap-eda} --ignore-not-found
- kubectl delete configmap eda-ui-nginx-config -n ${NAMESPACE:-aap-eda} --ignore-not-found
- kubectl delete configmap eda-postgres-initdb -n ${NAMESPACE:-aap-eda} --ignore-not-found

minikube:quay-deploy:
desc: "Build deployment from quay deploy to minikube"
kind:clean:api:
desc: "Restart API, worker, and scheduler pods"
cmds:
- task: minikube
vars:
CLI_ARGS: quay-deploy {{.CLI_ARGS}}
- kubectl delete pods -l 'comp in (worker, api, ws, webhook-api, scheduler)' -n ${NAMESPACE:-aap-eda} --ignore-not-found

minikube:clean:
desc: "Clean deployment directory and clean minikube resources"
kind:fp:ui:
desc: "Forward local port to EDA UI (default: 8443)"
cmds:
- task: minikube
vars:
CLI_ARGS: clean {{.CLI_ARGS}}
- kubectl port-forward svc/eda-ui {{.CLI_ARGS | default "8443"}}:8443 -n ${NAMESPACE:-aap-eda}

minikube:clean:api:
desc: "Clean API related minikube resources"
kind:fp:api:
desc: "Forward local port to EDA API (default: 8000)"
cmds:
- task: minikube
vars:
CLI_ARGS: clean-api {{.CLI_ARGS}}
- kubectl port-forward svc/eda-api {{.CLI_ARGS | default "8000"}}:8000 -n ${NAMESPACE:-aap-eda}

minikube:fp:ui:
desc: "Forward local port to ui instance port in minikube"
kind:fp:pg:
desc: "Forward local port to PostgreSQL (default: 5432)"
cmds:
- task: minikube
vars:
CLI_ARGS: port-forward-ui {{.CLI_ARGS}}
- kubectl port-forward svc/eda-postgres {{.CLI_ARGS | default "5432"}}:5432 -n ${NAMESPACE:-aap-eda}

minikube:fp:api:
desc: "Forward local port to api instance port in minikube"
kind:logs:eda:
desc: "Stream logs for EDA application"
cmds:
- task: minikube
vars:
CLI_ARGS: port-forward-api {{.CLI_ARGS}}
- kubectl logs -n ${NAMESPACE:-aap-eda} -l app=eda --max-log-requests=10 -f

minikube:fp:pg:
desc: "Forward local port to postgres instance port in minikube"
kind:all:
desc: "Clean, build, and deploy EDA to kind cluster"
cmds:
- task: minikube
vars:
CLI_ARGS: port-forward-pg {{.CLI_ARGS}}
- task: kind:clean
- task: kind:build
- task: kind:deploy

minikube:logs:eda:
desc: "Stream logs for EDA application"
kind:api:
desc: "Rebuild and redeploy API pods"
cmds:
- task: minikube
vars:
CLI_ARGS: eda-logs {{.CLI_ARGS}}
- task: kind:clean:api
- task: kind:build
- task: kind:deploy

minikube:all:
desc: "clean, build, deploy"
kind:cluster:create:
desc: "Create a kind cluster for local development"
cmds:
- task: minikube:clean
- task: minikube:build
- task: minikube:deploy
- kind create cluster --name ${KIND_CLUSTER_NAME:-kind}

minikube:api:
desc: "build, deploy api pods"
kind:cluster:delete:
desc: "Delete the kind cluster"
cmds:
- task: minikube:clean:api
- task: minikube:build:api
- task: minikube:deploy
- kind delete cluster --name ${KIND_CLUSTER_NAME:-kind}

macpodman:
desc: "Run eda_podman.sh with specified CLI arguments."
Expand Down
34 changes: 20 additions & 14 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Currently there are three supported ways to deploy the EDA-Controller:

* Using the eda-server-operator for k8s/ocp (recommended one)
* Using docker-compose
* Using minikube
* Using kind (Kubernetes in Docker)

If you are looking for a development environment, please refer to the [development](development.md) document.

Expand Down Expand Up @@ -74,17 +74,17 @@ docker-compose -p eda -f docker-compose-stage.yaml up

Note: **You can use the environment variables `EDA_IMAGE_URL` and `EDA_UI_IMAGE` to use a different image url. By default is the latest code from the main branch.**

## Deploy using Minikube and Taskfile
## Deploy using Kind and Taskfile

Minikube is the recommended method for macOS users
Kind is the recommended method for local Kubernetes deployments

### Requirements

* [Docker](https://www.docker.com/) or [Podman](https://podman.io/)
* [Kubernetes CLI (kubectl)](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/)
* [kustomize](https://kubectl.docs.kubernetes.io/installation/kustomize/)
* [minikube](https://minikube.sigs.k8s.io/docs/start/)
* [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation)
* [Taskfile](https://taskfile.dev/installation/#binary)
* bash, version 3.* or above

### Deployment steps

Expand All @@ -96,33 +96,39 @@ Minikube is the recommended method for macOS users

2. Edit ./tools/deploy/environment.properties file and add your values.

3. Start minikube if it is not already running:
3. Create a kind cluster if one is not already running:

```shell
minikube start
kind create cluster
```

4. Ensure minikube instance is up and running:
4. Ensure the kind cluster is up and running:

```shell
minikube status
kind get clusters
```

5. Run the deployment:

```shell
task minikube:all
task kind:all
```

6. Forward the webserver port to the localhost:

```shell
task minikube:fp:ui
task kind:fp:ui
```

7. Access the UI at <https://localhost:8443/> with the default credentials `admin`/`testpass`.

You can also inspect the API documentation at <https://localhost:8443/api/eda/v1/docs>
or navigate through the resources with the DRF browsable API at <https://localhost:8443/api/eda/v1/>.

**Note**: For fedora, the binary may be `go-task`.

You can now inspect the API documentation at <https://localhost:8443/api/eda/v1/docs>
or navigate through the resources with the DRF browsable API at <https://localhost:8443/api/eda/v1/>
**Note**: Image builds use `podman` by default. To use Docker instead, set the `CONTAINER_ENGINE` variable:

You can also access the standalone UI at <http://localhost:8443/> with the default credentials `admin`/`testpass`.
```shell
CONTAINER_ENGINE=docker task kind:all
```
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ ansible/eda-server 12146d8 51fb0c850b94 10 minutes ago 682M
### Running services

AAP EDA requires some services, such as database to be running. We recommend running such services
in a containerized environment (e.g. docker / podman / minikube etc.).
in a containerized environment (e.g. docker / podman / kind etc.).

You can start all minimal required containers by running:

Expand Down
Loading
Loading