Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/20-vre-catalog-prototype' into 2…
Browse files Browse the repository at this point in the history
…0-django-api-token

# Conflicts:
#	.gitignore
#	README.md
#	Tiltfile
#	environment.yaml
#	k8s/ingress.yaml
#	k8s/test-vreapis/deployment.yaml
#	k8s/vre-panel/deployment.yaml
#	k8s/vre-panel/service.yaml
#	k8s/vreapis/deployment.yaml
#	tilt/helm-values-dev.yaml
#	vre-panel/.env.production
#	vre-panel/.env.test
#	vre-panel/pages/vlabs/[slug].tsx
#	vreapis/entrypoint.dev.sh
#	vreapis/virtual_labs/management/commands/check_or_create_admin.py
#	vreapis/workflows/views.py
  • Loading branch information
skoulouzis committed Sep 11, 2023
2 parents 6fa1f67 + 6fc18ed commit 79c38e1
Show file tree
Hide file tree
Showing 10 changed files with 187 additions and 10 deletions.
21 changes: 21 additions & 0 deletions k8s/test-vreapis/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: vre-paas
spec:
ingressClassName: nginx
tls:
- hosts:
- lifewatch.lab.uvalight.net
secretName: lifewatch.lab.uvalight.net-tls
rules:
- host: lifewatch.lab.uvalight.net
http:
paths:
- path: /vre-api-test
pathType: Prefix
backend:
service:
name: vreapi-svc
port:
number: 8000
15 changes: 15 additions & 0 deletions k8s/test-vreapis/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: vreapi-svc
labels:
app: vreapi-svc
spec:
ports:
- port: 8000
protocol: TCP
targetPort: 8000
nodePort: 30815
selector:
app: vreapi
type: NodePort
19 changes: 19 additions & 0 deletions k8s/test-vreapis/vre-api-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: vre-api-config
labels:
app: vreapp-svc

data:
ALLOWED_HOST: '*'
TRUSTED_ORIGINS: 'https://lifewatch.lab.uvalight.net:32443'
CORS_ALLOWED_ORIGIN_REGEXES: r'^https:\/\/lifewatch.lab.uvalight.net:\d+$'
CALL_BACK_URL: https://lifewatch.lab.uvalight.net:32443/vre-api/
ARGO_URL: https://lifewatch.lab.uvalight.net:32443/argowf
ARGO_NAMESPACE: argo
BASE_PATH: /vre-api-test
DB_USER: vreapi
DB_HOST: db-service
DB_PORT: '5432'
DB_NAME: vreapi
56 changes: 56 additions & 0 deletions k8s/test-vreapis/vre-depts-db.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: db-deployment
labels:
app: db
spec:
replicas: 1
selector:
matchLabels:
app: db
template:
metadata:
labels:
app: db
spec:
containers:
- name: db
image: postgis/postgis:15-3.3-alpine
imagePullPolicy: Always
ports:
- containerPort: 5432
protocol: TCP
env:
- name: POSTGRES_USER
valueFrom:
configMapKeyRef:
name: vre-api-config
key: DB_USER
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: django-secrets
key: DB_PASSWORD
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
name: vre-api-config
key: DB_NAME

---

apiVersion: v1
kind: Service
metadata:
name: db-service
labels:
app: db-service
spec:
ports:
- port: 5432
protocol: TCP
targetPort: 5432
selector:
app: db
type: ClusterIP
11 changes: 11 additions & 0 deletions k8s/vre-panel/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: env
labels:
app: vreapp-svc

data:
.env: |-
API_BASE_PATH=/vre-api/api
FRONTEND_BASE_PATH=/vreapp
53 changes: 53 additions & 0 deletions k8s/vreapis/vre-api-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: vre-api
namespace: argo
rules:
- verbs:
- get
- watch
- patch
- delete
apiGroups:
- ''
resources:
- pods
- verbs:
- get
- watch
- patch
apiGroups:
- ''
resources:
- pods/log
- verbs:
- create
apiGroups:
- ''
resources:
- pods/exec
- verbs:
- list
- watch
- create
- get
- update
- delete
apiGroups:
- argoproj.io
resources:
- workflowtasksets
- workflowartifactgctasks
- workflowtemplates
- workflows
- cronworkflows
- verbs:
- patch
apiGroups:
- argoproj.io
resources:
- workflowtasksets/status
- workflowartifactgctasks/status
- workflows/status
- cronworkflows/status
2 changes: 1 addition & 1 deletion vre-panel/.env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
API_BASE_PATH=/vre-api-test/api
API_BASE_PATH=/vre-api/api
FRONTEND_BASE_PATH=/vreapp
2 changes: 1 addition & 1 deletion vre-panel/.env.test
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
API_BASE_PATH=/vre-api-test/api
API_BASE_PATH=/vre-api/api
FRONTEND_BASE_PATH=/vreapp
15 changes: 7 additions & 8 deletions vre-panel/pages/vlabs/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const VLabDetails: React.FC<VLabDetailsProps> = ({ token }) => {
var requestOptions: RequestInit = {
method: "GET",
headers: {
"Authorization": "Token " + token.accessToken
"Authorization": "Bearer: " + token.accessToken
},
};

Expand All @@ -52,9 +52,9 @@ const VLabDetails: React.FC<VLabDetailsProps> = ({ token }) => {

var requestOptions: RequestInit = {
method: "GET",
// headers: {
// "Authorization": "Token " + token.accessToken
// },
headers: {
"Authorization": "Bearer: " + token.accessToken
},
};

const apiUrl = `${window.location.origin}/${publicRuntimeConfig.apiBasePath}`
Expand All @@ -70,10 +70,9 @@ const VLabDetails: React.FC<VLabDetailsProps> = ({ token }) => {

var requestOptions: RequestInit = {
method: "GET",
// headers: {
// "Authorization": "Token " + token.accessToken
//
// },
headers: {
"Authorization": "Bearer: " + token.accessToken
},
};

const apiUrl = `${window.location.origin}/${publicRuntimeConfig.apiBasePath}`
Expand Down
3 changes: 3 additions & 0 deletions vreapis/workflows/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ def submit(self, request, *args, **kwargs):
if not argo_api_token:
return Response({'message': 'Argo API token not set'}, status=500)

if not argo_api_token:
return Response({'message': 'Argo API token not set'}, status=500)

resp_submit = requests.post(
call_url,
json=workflow,
Expand Down

0 comments on commit 79c38e1

Please sign in to comment.