generated from interTwin-eu/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Diego Ciangottini <[email protected]>
- Loading branch information
Showing
26 changed files
with
996 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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 @@ | ||
.venv |
Empty file.
Empty file.
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,48 @@ | ||
import json | ||
import os.path | ||
from typing import List | ||
|
||
from fastapi import FastAPI | ||
from fastapi.openapi.utils import get_openapi | ||
from fastapi.responses import PlainTextResponse | ||
|
||
import interlink | ||
|
||
app = FastAPI() | ||
|
||
|
||
@app.post("/create") | ||
async def create_pod(pod: List[interlink.Pod]) -> interlink.CreateStruct: | ||
raise NotImplementedError | ||
|
||
|
||
@app.post("/delete") | ||
async def delete_pod(pod: interlink.PodRequest) -> str: | ||
raise NotImplementedError | ||
|
||
|
||
@app.get("/status") | ||
async def status_pod(pods: List[interlink.PodRequest]) -> List[interlink.PodStatus]: | ||
raise NotImplementedError | ||
|
||
|
||
@app.get("/getLogs", response_class=PlainTextResponse) | ||
async def get_logs(req: interlink.LogRequest) -> bytes: | ||
raise NotImplementedError | ||
|
||
|
||
openapi_schema = os.path.join( | ||
os.path.dirname(__file__), *["..", "docs", "openapi", "openapi.json"] | ||
) | ||
|
||
with open(openapi_schema, "w") as f: | ||
json.dump( | ||
get_openapi( | ||
title="interLink sidecar", | ||
version=os.environ.get("VERSION", "v0.0.0"), | ||
openapi_version=app.openapi()["openapi"], | ||
description="openapi spec for interLink apis <-> provider sidecar communication", | ||
routes=app.routes, | ||
), | ||
f, | ||
) |
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,9 @@ | ||
VKTokenFile: "$HOME/interLink/token" | ||
InterlinkAddress: "http://XXX.XXX.XXX.XXX" | ||
SidecarURL: "http://docker-sidecar" | ||
InterlinkPort: "3000" | ||
SidecarPort: "4000" | ||
ExportPodData: true | ||
DataRootFolder: ".local/interlink/jobs/" | ||
VerboseLogging: true | ||
ErrorsOnlyLogging: false |
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,46 @@ | ||
version: '3.7' | ||
services: | ||
interlink: | ||
build: | ||
context: ../../../ | ||
dockerfile: docker/Dockerfile.interlink | ||
restart: always | ||
#network_mode: "host" | ||
ports: | ||
- 3000:3000 | ||
volumes: | ||
- type: bind | ||
source: ./ | ||
target: /etc/interlink | ||
environment: | ||
- INTERLINKCONFIGPATH=/etc/interlink/InterLinkConfig.yaml | ||
# healthcheck: | ||
# test: ["CMD", "/check.sh"] | ||
# interval: 10s | ||
# timeout: 10s | ||
# retries: 3 | ||
# start_period: 5s | ||
docker-sidecar: | ||
image: ghcr.io/intertwin-eu/interlink-sidecar-docker:0.0.2-pre1 | ||
restart: always | ||
privileged: true | ||
cap_add: | ||
- SYS_ADMIN | ||
#network_mode: "host" | ||
ports: | ||
- 4000:4000 | ||
environment: | ||
- INTERLINKCONFIGPATH=/etc/interlink/sidecarConfig.yaml | ||
volumes: | ||
- type: bind | ||
source: ./ | ||
target: /etc/interlink | ||
- type: bind | ||
source: /var/run/docker.sock | ||
target: /var/run/docker.sock | ||
# healthcheck: | ||
# test: ["CMD", "/check.sh"] | ||
# interval: 10s | ||
# timeout: 10s | ||
# retries: 3 | ||
# start_period: 5s |
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,15 @@ | ||
SidecarURL: "http://docker-sidecar" | ||
SidecarPort: "4000" | ||
SbatchPath: "/usr/bin/sbatch" | ||
ScancelPath: "/usr/bin/scancel" | ||
SqueuePath: "/usr/bin/squeue" | ||
CommandPrefix: "" | ||
ExportPodData: true | ||
DataRootFolder: ".local/interlink/jobs/" | ||
Tsocks: false | ||
TsocksPath: "$WORK/tsocks-1.8beta5+ds1/libtsocks.so" | ||
TsocksLoginNode: "login01" | ||
BashPath: /bin/bash | ||
VerboseLogging: true | ||
ErrorsOnlyLogging: false | ||
|
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,21 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: test-pod-cfg-cowsay-dciangot | ||
namespace: vk | ||
annotations: | ||
slurm-job.vk.io/flags: "--job-name=test-pod-cfg -t 2800 --ntasks=8 --nodes=1 --mem-per-cpu=2000" | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- image: ghcr.io/grycap/cowsay | ||
command: ["/bin/sh"] | ||
args: ["-c", "\"touch /tmp/test.txt && sleep 60 && echo \\\"hello muu\\\" | /usr/games/cowsay \" " ] | ||
imagePullPolicy: Always | ||
name: cowsayo | ||
dnsPolicy: ClusterFirst | ||
nodeSelector: | ||
kubernetes.io/hostname: test-vk | ||
tolerations: | ||
- key: virtual-node.interlink/no-schedule | ||
operator: Exists |
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,11 @@ | ||
VKTokenFile: "$HOME/interLink/token" | ||
InterlinkAddress: "http://XXX.XXX.XXX.XXX" | ||
CommandPrefix: "" | ||
ExportPodData: true | ||
ServiceAccount: "interlink" | ||
Namespace: "vk" | ||
VerboseLogging: true | ||
ErrorsOnlyLogging: false | ||
CPU: 100 | ||
Memory: 128Gi | ||
Pod: 100 |
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,101 @@ | ||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: test-vk | ||
labels: | ||
nodeName: test-vk | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
nodeName: test-vk | ||
template: | ||
metadata: | ||
labels: | ||
nodeName: test-vk | ||
spec: | ||
initContainers: | ||
- name: settoken | ||
image: "docker.io/alpine:3" | ||
command: ["sh", "-c"] | ||
args: ["touch /opt/interlink/token"] | ||
volumeMounts: | ||
- name: token | ||
mountPath: /opt/interlink | ||
containers: | ||
- name: jaeger | ||
image: jaegertracing/all-in-one:1.51 | ||
- name: inttw-vk | ||
image: ghcr.io/intertwin-eu/interlink/virtual-kubelet-inttw:latest | ||
#image: dciangot/vk:latest | ||
imagePullPolicy: Always | ||
#command: ["sleep", "infinity"] | ||
env: | ||
- name: NODENAME | ||
value: test-vk | ||
- name: POD_IP | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.podIP | ||
#- name: KUBECONFIG | ||
# value: /etc/interlink/kubeconfig | ||
- name: KUBELET_PORT | ||
value: "10250" | ||
- name: CONFIGPATH | ||
value: "/etc/interlink/InterLinkConfig.yaml" | ||
- name: VKTOKENFILE | ||
value: "/opt/interlink/token" | ||
volumeMounts: | ||
- name: config | ||
mountPath: /etc/interlink/InterLinkConfig.yaml | ||
subPath: InterLinkConfig.yaml | ||
- name: token | ||
mountPath: /opt/interlink | ||
resources: | ||
limits: | ||
cpu: 500m | ||
memory: 600Mi | ||
requests: | ||
cpu: 50m | ||
memory: 100Mi | ||
- name: refresh-token | ||
image: ghcr.io/intertwin-eu/virtual-kubelet-inttw-refresh:latest | ||
imagePullPolicy: Always | ||
env: | ||
- name: IAM_SERVER | ||
value: "https://dodas-iam.cloud.cnaf.infn.it/" | ||
# TODO load env IAM client from secret | ||
- name: IAM_CLIENT_ID | ||
value: "DUMMY" | ||
- name: IAM_CLIENT_SECRET | ||
value: "DUMMY" | ||
- name: IAM_REFRESH_TOKEN | ||
value: "DUMMY" | ||
- name: IAM_VK_AUD | ||
value: intertw-vk | ||
- name: TOKEN_PATH | ||
value: /opt/interlink/token | ||
resources: | ||
limits: | ||
cpu: 500m | ||
memory: 600Mi | ||
requests: | ||
cpu: 50m | ||
memory: 100Mi | ||
volumeMounts: | ||
- name: token | ||
mountPath: /opt/interlink | ||
serviceAccountName: interlink | ||
volumes: | ||
- name: config | ||
configMap: | ||
# Provide the name of the ConfigMap you want to mount. | ||
name: vk-config | ||
- name: kubeconfig | ||
configMap: | ||
# Provide the name of the ConfigMap you want to mount. | ||
name: vk-kubeconfig | ||
- name: token | ||
emptyDir: {} |
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,13 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ./deployment.yaml | ||
- ./service-account.yaml | ||
|
||
configMapGenerator: | ||
- name: vk-config-json | ||
files: | ||
- vk-cfg.json=vk-cfg.json | ||
- name: vk-config | ||
files: | ||
- InterLinkConfig.yaml=InterLinkConfig.yaml |
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,41 @@ | ||
extensions: | ||
health_check: | ||
pprof: | ||
endpoint: 0.0.0.0:1777 | ||
zpages: | ||
endpoint: 0.0.0.0:55679 | ||
|
||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
endpoint: 0.0.0.0:4319 | ||
http: | ||
endpoint: 0.0.0.0:4318 | ||
|
||
processors: | ||
batch: | ||
|
||
exporters: | ||
otlp: | ||
endpoint: "localhost:4317" | ||
tls: | ||
insecure: true | ||
logging: | ||
verbosity: detailed | ||
|
||
service: | ||
|
||
pipelines: | ||
|
||
traces: | ||
receivers: [otlp, opencensus, jaeger, zipkin] | ||
processors: [batch] | ||
exporters: [logging] | ||
|
||
metrics: | ||
receivers: [otlp, opencensus, prometheus] | ||
processors: [batch] | ||
exporters: [logging] | ||
|
||
extensions: [health_check, pprof, zpages] |
Oops, something went wrong.