This commit is contained in:
30404 2024-07-04 19:38:50 +08:00
parent 2d61b8bf7c
commit 71d7956e65
10 changed files with 102 additions and 76 deletions

View File

@ -0,0 +1,10 @@
.body-right-Pods{
width: 1420px;
height: 830px;
position: absolute;
top: 72px;
left: 220px;
border-radius: 10px;
float: right;
background-color: #f7f8fa;
}

View File

@ -0,0 +1,11 @@
import React, { useEffect, useState } from 'react';
import axios from 'axios';
import './TrainPods.css'
function TrainPods(){
return(
<div className='body-right-Pods'>asdas</div>
)
}
export default TrainPods

View File

@ -48,6 +48,7 @@ function TrainManage(){
<p>关闭时间2024-11-5</p>
</li>
</ul>
<Link to='/teacher/trainmanage/TrainPods' >管理实训</Link>
<Link to='/teacher/SendTrain' className='sendtestpage'>前往发布实训</Link>
</div>}
<button onClick={()=>{

View File

@ -254,7 +254,7 @@ function Operation1() {
</ul>
)}
</li>
<Link to={`/operation2/1`} style={{color:'#000',textDecoration:'none'}}>
<Link to={`/operation2/${operateID}`} style={{color:'#000',textDecoration:'none'}}>
<li style={{ marginTop: isSubjectDropdownOpen ? '186px' : '0' }}>实训题</li>
</Link>
</ul>

View File

@ -21,7 +21,7 @@ function SignInPage(){
if (data.result === '登录成功' && data.user==='user'){
localStorage.setItem('islogin',ID)
alert('用户登录成功')
window.location.href=''//
window.location.href='/'//
}else if(data.result==='登录成功'&&data.user==='teacher'){
localStorage.setItem('islogin',ID)
alert('教师登录成功')

View File

@ -27,6 +27,7 @@ import SendTrain from '../TeacherPages/Trainmanage/SendTrain'
import TrainManage from '../TeacherPages/Trainmanage/Trainmanage'
import StudentLink from '../TeacherPages/MarkingPages/StudentLink';
import Test from '../TeacherPages/TestManage/Test'
import TrainPods from '../TeacherPages/Trainmanage/TrainPods'
// (exam)使
@ -64,6 +65,7 @@ function App() {
<Route path='managetest' element={<ManageTest />}/> {/* 考试管理 */}
<Route path="classID/:key" element={<ClassID />} /> {/* 班级管理1 */}
<Route path='mark/studentlink/Mark/:key' element={<StudentLink/>}/> {/* 批改1 */}
<Route path='trainmanage/TrainPods' element={<TrainPods/> }/>
{/* 其他需要HeaderNavTeacher的页面 */}
</Route>

View File

@ -17,8 +17,8 @@ spec:
runAsGroup: 0
resources:
limits:
cpu: '0.5'
memory: 0.5Gi
cpu: '1'
memory: 1.2Gi
requests:
cpu: '0.3'
memory: 0.3Gi
cpu: '0.2'
memory: 0.2Gi

View File

@ -15,8 +15,8 @@ spec:
runAsGroup: 0
resources:
limits:
cpu: '0.5'
memory: 0.5Gi
cpu: '1.3'
memory: 1.3Gi
requests:
cpu: '0.3'
memory: 0.3Gi

View File

@ -1,5 +1,5 @@
import k8s_func
studentList=['n20240101-55']
studentList=['n20240101-56','n20240102-56','s20240101-52','s20240102-52']
for i in studentList:
k8s_func.delete_pod(i)

View File

@ -5,6 +5,7 @@ import yaml
from kubernetes import client, config
from flask import jsonify
import dmPython
# Load in-cluster config
config.load_incluster_config()
@ -12,6 +13,7 @@ v1 = client.CoreV1Api()
namespace = open("/var/run/secrets/kubernetes.io/serviceaccount/namespace").read()
IP = "36.138.114.105"
def list_pods():
ret = v1.list_namespaced_pod(namespace, watch=False)
return ({
@ -21,6 +23,7 @@ def list_pods():
} for item in ret.items]
})
def list_services():
ret = v1.list_namespaced_service(namespace)
return {
@ -31,6 +34,7 @@ def list_services():
} for item in ret.items]
}
def create_pod(type, name):
# 读取 pod yaml 文件
with open(f"assets/type{type}-pod.yaml") as f:
@ -65,6 +69,7 @@ def create_pod(type, name):
# print("访问地址:" + IP + ":" + str(service.spec.ports[0].node_port))
return "cjcg"
# create_pod(0,'20240101-zt-9-0')
def delete_pod(name):
@ -73,6 +78,7 @@ def delete_pod(name):
v1.delete_namespaced_service(name=name + "-service", namespace=namespace)
return "删除成功"
def check_dm(name):
try:
service = v1.read_namespaced_service(name=name + "-service", namespace=namespace)
@ -86,7 +92,3 @@ def check_dm(name):
except:
traceback.print_exc()
return "NO"