-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from geobeyond/#5_kube_configs
#5 kube configs
- Loading branch information
Showing
17 changed files
with
454 additions
and
39 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,7 @@ | ||
.cookiecutter.json | ||
.pytest_cache/ | ||
dist/ | ||
.k3d/ | ||
.github | ||
examples/ | ||
tests/ |
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 |
---|---|---|
|
@@ -69,11 +69,3 @@ jobs: | |
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
|
||
- name: Publish the release notes | ||
uses: release-drafter/[email protected] | ||
with: | ||
publish: ${{ steps.check-version.outputs.tag != '' }} | ||
tag: ${{ steps.check-version.outputs.tag }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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
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,94 @@ | ||
**Note:** Run all commands from base repo dir | ||
|
||
### Build Fastflows Docker Image | ||
|
||
```console | ||
|
||
docker build . -f ./docker/Dockerfile -t geobeyond/fastflows:latest | ||
|
||
``` | ||
|
||
### Run Fastflows on Kube cluster | ||
|
||
Steps to run: | ||
|
||
1. **(For local env only)** Install minikube (will be used to create & manage local cluster): https://minikube.sigs.k8s.io/docs/start/ | ||
|
||
2. Install kubectl if you don't have it - https://kubernetes.io/docs/tasks/tools/ | ||
|
||
3. **(For local env only)** Create kubernetes cluster: | ||
|
||
```console | ||
|
||
minikube start | ||
|
||
# Important!!! | ||
# On MacOS to make Ingress work you should run minikube with hyperkit: | ||
|
||
minikube start --driver=hyperkit | ||
|
||
|
||
``` | ||
|
||
4. **(For local env only)** | ||
|
||
Enable Ingress & host resolving (full explanation here) | ||
|
||
```console | ||
|
||
minikube addons enable ingress | ||
|
||
``` | ||
|
||
Get minikube cluster ip | ||
|
||
```console | ||
|
||
minikube ip | ||
|
||
``` | ||
|
||
Add domains to /etc/hosts linked to minikube cluster ip. | ||
|
||
Add this to /etc/hosts file: | ||
|
||
```console | ||
|
||
your-mini-kube-ip fastflows.geo | ||
your-mini-kube-ip prefect.geo | ||
|
||
# for example (where 192.168.64.2 - minikube ip): | ||
# 192.168.64.2 fastflows.geo | ||
# 192.168.64.2 prefect.geo | ||
|
||
``` | ||
|
||
5. Apply Kube manifests to the cluster | ||
|
||
```console | ||
|
||
kubectl apply -f docker/kube-infra | ||
|
||
``` | ||
|
||
5. Check pods statuses & wait until all pods will not be in status "Running" | ||
|
||
```console | ||
|
||
kubectl get pods | ||
|
||
``` | ||
|
||
Now you can access service by links: | ||
|
||
http://fastflows.geo/ & http://prefect.geo/ | ||
|
||
### Tips | ||
|
||
1. **(For local env only)** If for some reason you need to delete cluster, use: | ||
|
||
```console | ||
|
||
minikube delete | ||
|
||
``` |
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
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,93 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: fastflows | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: fastflows | ||
replicas: 2 | ||
template: | ||
metadata: | ||
labels: | ||
app: fastflows | ||
spec: | ||
initContainers: | ||
- name: check-orion-is-ready | ||
image: curlimages/curl | ||
command: | ||
[ | ||
"sh", | ||
"-c", | ||
'while [ `curl -fsS http://localhost:4200/" --silent --output /dev/null"` -ne 200 ]; do sleep 2; done', | ||
] | ||
- name: orion-queue | ||
image: prefecthq/prefect:2.0b8-python3.9 | ||
command: | ||
[ | ||
"sh", | ||
"-c", | ||
'prefect work-queue create default-queue; r=$?; [ "$r" -gt 0 ] && exit 0; exit 0', | ||
] | ||
imagePullPolicy: "IfNotPresent" | ||
ports: | ||
- containerPort: 4200 | ||
env: | ||
- name: PREFECT_API_URL | ||
value: http://orion:4200/api | ||
containers: | ||
- name: main | ||
image: geobeyond/fastflows:latest | ||
imagePullPolicy: "IfNotPresent" | ||
ports: | ||
- containerPort: 5010 | ||
env: | ||
- name: PREFECT_URI | ||
value: http://orion:4200 | ||
- name: FASTFLOWS_PORT | ||
value: "5010" | ||
command: ["fastflows", "server"] | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: fastflows | ||
labels: | ||
app: fastflows | ||
spec: | ||
ports: | ||
- name: http | ||
protocol: TCP | ||
port: 5010 | ||
targetPort: 5010 | ||
selector: | ||
app: fastflows | ||
|
||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
namespace: default | ||
name: flow-runner | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["pods", "pods/log", "pods/status"] | ||
verbs: ["get", "watch", "list"] | ||
- apiGroups: ["batch"] | ||
resources: ["jobs"] | ||
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: flow-runner-role-binding | ||
namespace: default | ||
subjects: | ||
- kind: ServiceAccount | ||
name: default | ||
namespace: default | ||
roleRef: | ||
kind: Role | ||
name: flow-runner | ||
apiGroup: rbac.authorization.k8s.io |
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,28 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: fastflows-cluster | ||
annotations: | ||
kubernetes.io/ingress.class: nginx | ||
spec: | ||
rules: | ||
- host: prefect.geo | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: orion | ||
port: | ||
number: 4200 | ||
- host: fastflows.geo | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: fastflows | ||
port: | ||
number: 5010 |
Oops, something went wrong.