Skip to content

Commit

Permalink
feat: added delivery scenario for acorn
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Schuetz <thomas.schuetz@dynatrace.com>
  • Loading branch information
Thomas Schuetz committed Mar 16, 2023
1 parent 8f75d9a commit 6ed0722
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 0 deletions.
20 changes: 20 additions & 0 deletions acorn/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# renovate: datasource=github-tags depName=acorn-io/acorn
ACORN_VERSION ?= v0.6.0

.PHONY: install
install:
curl https://get.acorn.io | INSTALL_ACORN_VERSION=$(ACORN_VERSION) sh -
acorn install

.PHONY: deploy-app
deploy-app:
acorn run --target-namespace podtato-acorn -n podtato-head app

.PHONY: uninstall
uninstall:
acorn uninstall -a -f

.PHONY: test
test: install deploy-app
kubectl kuttl test --start-kind=false ./kuttl --config=./kuttl/kuttl-test.yaml
make uninstall
33 changes: 33 additions & 0 deletions acorn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Deliver with Acorn
![Acorn](https://img.shields.io/badge/Acorn-v0.6.0-blue)
![PodTatoHead](https://img.shields.io/badge/PodTatoHead-v0.3.0-orange)


Website: https://acorn.io <BR>
Repository: https://github.com/acorn-io/acorn

## Deliver
Acorn delivers applications from source code or a container image in a kubernetes cluster.

## Install Acorn
You can install acorn with the following commands:
```shell
$> curl https://get.acorn.io | INSTALL_ACORN_VERSION=$(ACORN_VERSION) sh -
$> acorn install
```

## Deliver PodTatoHead
1. Clone this repository
2. Install acorn as specified above
3. Apply the [Acornfile](app/Acornfile) to your cluster
> `acorn apply --target-namespace podtato-acorn -f app/Acornfile`
4. After some time the application should be deployed in the podtato-acorn namespace
5. You can access the application via the ingress or port-forwarding
> `kubectl port-forward -n podtato-acorn svc/frontend 8080`
6. Open http://localhost:8080 in your browser

## Uninstall Acorn
You can uninstall acorn with the following command:
> `acorn uninstall -a -f`

77 changes: 77 additions & 0 deletions acorn/app/Acornfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
containers: {
frontend: {
image: "ghcr.io/podtato-head/podtato-server:v0.3.0"
ports: "8080/tcp"
env: {
"PODTATO_COMPONENT": "frontend"
"SERVICES_CONFIG_FILE_PATH": "/config/service-discovery.yaml"
}
files: {
"/config/service-discovery.yaml": "secret://service-discovery/template"
}
}
hat: {
image: "ghcr.io/podtato-head/podtato-server:v0.3.0"
ports: "8080/tcp"
env: {
"PODTATO_COMPONENT": "hat"
"PODTATO_PART_NUMBER": "02"
}
}
leftarm: {
image: "ghcr.io/podtato-head/podtato-server:v0.3.0"
ports: "8080/tcp"
env: {
"PODTATO_COMPONENT": "left-arm"
"PODTATO_PART_NUMBER": "03"
}
}
rightarm: {
image: "ghcr.io/podtato-head/podtato-server:v0.3.0"
ports: "8080/tcp"
env: {
"PODTATO_COMPONENT": "right-arm"
"PODTATO_PART_NUMBER": "01"
}
}
leftleg: {
image: "ghcr.io/podtato-head/podtato-server:v0.3.0"
ports: "8080/tcp"
env: {
"PODTATO_COMPONENT": "left-leg"
"PODTATO_PART_NUMBER": "02"
}
}
rightleg: {
image: "ghcr.io/podtato-head/podtato-server:v0.3.0"
ports: "8080/tcp"
env: {
"PODTATO_COMPONENT": "right-leg"
"PODTATO_PART_NUMBER": "04"
}
}
}

secrets: {
"service-discovery": {
type: "template"
data: {
template: """
hat: http://hat:8080
left-arm: http://leftarm:8080
right-arm: http://rightarm:8080
left-leg: http://leftleg:8080
right-leg: http://rightleg:8080
"""
}
}
}

jobs: {
"test-app": {
image: "busybox"
command: [ "wget", "-q", "--tries=10", "-timeout=5", "-O", "-", "http://frontend:8080" ]
dependsOn: [ "frontend", "hat", "leftleg", "rightleg", "leftarm", "rightarm" ]
}
}

7 changes: 7 additions & 0 deletions acorn/kuttl/kuttl-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kuttl.dev/v1
kind: TestSuite
testDirs:
- ./test
timeout: 400
skipDelete: true
namespace: podtato-acorn
61 changes: 61 additions & 0 deletions acorn/kuttl/test/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: hat
namespace: podtato-acorn
status:
readyReplicas: 1

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: leftleg
namespace: podtato-acorn
status:
readyReplicas: 1

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: rightleg
namespace: podtato-acorn
status:
readyReplicas: 1

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: leftarm
namespace: podtato-acorn
status:
readyReplicas: 1

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: rightarm
namespace: podtato-acorn
status:
readyReplicas: 1

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
namespace: podtato-acorn
status:
readyReplicas: 1

---
apiVersion: batch/v1
kind: Job
metadata:
name: test-app
namespace: podtato-acorn
status:
succeeded: 1

0 comments on commit 6ed0722

Please # to comment.