diff --git a/k8s/test-vreapis/ingress.yaml b/k8s/test-vreapis/ingress.yaml new file mode 100644 index 0000000..eb4f176 --- /dev/null +++ b/k8s/test-vreapis/ingress.yaml @@ -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 \ No newline at end of file diff --git a/k8s/test-vreapis/service.yaml b/k8s/test-vreapis/service.yaml new file mode 100644 index 0000000..05f5d35 --- /dev/null +++ b/k8s/test-vreapis/service.yaml @@ -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 \ No newline at end of file diff --git a/k8s/test-vreapis/vre-api-config.yaml b/k8s/test-vreapis/vre-api-config.yaml new file mode 100644 index 0000000..f2e74cc --- /dev/null +++ b/k8s/test-vreapis/vre-api-config.yaml @@ -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 \ No newline at end of file diff --git a/k8s/test-vreapis/vre-depts-db.yaml b/k8s/test-vreapis/vre-depts-db.yaml new file mode 100644 index 0000000..0aa695c --- /dev/null +++ b/k8s/test-vreapis/vre-depts-db.yaml @@ -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 diff --git a/k8s/vre-panel/config.yaml b/k8s/vre-panel/config.yaml new file mode 100644 index 0000000..4fcf8f3 --- /dev/null +++ b/k8s/vre-panel/config.yaml @@ -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 diff --git a/k8s/vreapis/vre-api-role.yaml b/k8s/vreapis/vre-api-role.yaml new file mode 100644 index 0000000..5ae94a6 --- /dev/null +++ b/k8s/vreapis/vre-api-role.yaml @@ -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 \ No newline at end of file diff --git a/vre-panel/.env.production b/vre-panel/.env.production index 0a5efa4..d939fee 100644 --- a/vre-panel/.env.production +++ b/vre-panel/.env.production @@ -1,2 +1,2 @@ -API_BASE_PATH=/vre-api-test/api +API_BASE_PATH=/vre-api/api FRONTEND_BASE_PATH=/vreapp diff --git a/vre-panel/.env.test b/vre-panel/.env.test index 0a5efa4..d939fee 100644 --- a/vre-panel/.env.test +++ b/vre-panel/.env.test @@ -1,2 +1,2 @@ -API_BASE_PATH=/vre-api-test/api +API_BASE_PATH=/vre-api/api FRONTEND_BASE_PATH=/vreapp diff --git a/vre-panel/pages/vlabs/[slug].tsx b/vre-panel/pages/vlabs/[slug].tsx index 6ee72cf..9cef635 100644 --- a/vre-panel/pages/vlabs/[slug].tsx +++ b/vre-panel/pages/vlabs/[slug].tsx @@ -37,7 +37,7 @@ const VLabDetails: React.FC = ({ token }) => { var requestOptions: RequestInit = { method: "GET", headers: { - "Authorization": "Token " + token.accessToken + "Authorization": "Bearer: " + token.accessToken }, }; @@ -52,9 +52,9 @@ const VLabDetails: React.FC = ({ token }) => { var requestOptions: RequestInit = { method: "GET", -// headers: { -// "Authorization": "Token " + token.accessToken -// }, + headers: { + "Authorization": "Bearer: " + token.accessToken + }, }; const apiUrl = `${window.location.origin}/${publicRuntimeConfig.apiBasePath}` @@ -70,10 +70,9 @@ const VLabDetails: React.FC = ({ token }) => { var requestOptions: RequestInit = { method: "GET", -// headers: { -// "Authorization": "Token " + token.accessToken -// -// }, + headers: { + "Authorization": "Bearer: " + token.accessToken + }, }; const apiUrl = `${window.location.origin}/${publicRuntimeConfig.apiBasePath}` diff --git a/vreapis/workflows/views.py b/vreapis/workflows/views.py index 0a5a311..6302e7a 100644 --- a/vreapis/workflows/views.py +++ b/vreapis/workflows/views.py @@ -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,