Added kubernetes config
This commit is contained in:
parent
a4946f0117
commit
0969366e27
6 changed files with 75 additions and 18 deletions
13
.kubernetes/beepsort-cert.yml
Normal file
13
.kubernetes/beepsort-cert.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: beepsort-cert
|
||||
namespace: beepsort
|
||||
spec:
|
||||
secretName: beepsort-cert
|
||||
issuerRef:
|
||||
name: acme-issuer
|
||||
kind: ClusterIssuer
|
||||
dnsNames:
|
||||
- "beepsort.polsevev.dev"
|
||||
|
21
.kubernetes/beepsort-deploy.yml
Normal file
21
.kubernetes/beepsort-deploy.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: beepsort
|
||||
namespace: beepsort
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: beepsort
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: beepsort
|
||||
name: beepsort
|
||||
spec:
|
||||
containers:
|
||||
- name: beepsort
|
||||
image: registry.lan.polsevev.dev/beepsort:v0.1.1
|
||||
ports:
|
||||
- containerPort: 80
|
21
.kubernetes/beepsort-ingress.yml
Normal file
21
.kubernetes/beepsort-ingress.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: beepsort-ingress
|
||||
namespace: beepsort
|
||||
spec:
|
||||
rules:
|
||||
- host: "beepsort.polsevev.dev"
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: beepsort-service
|
||||
port:
|
||||
number: 99
|
||||
tls:
|
||||
- hosts:
|
||||
- beepsort.polsevev.dev
|
||||
secretName: beepsort-cert
|
14
.kubernetes/beepsort-service.yml
Normal file
14
.kubernetes/beepsort-service.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: beepsort-service
|
||||
namespace: beepsort
|
||||
spec:
|
||||
selector:
|
||||
app: beepsort
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- name: docker-port
|
||||
protocol: TCP
|
||||
port: 99
|
||||
targetPort: 80
|
3
Dockerfile
Normal file
3
Dockerfile
Normal file
|
@ -0,0 +1,3 @@
|
|||
FROM nginx:alpine3.18
|
||||
COPY ./index.html /usr/share/nginx/html/
|
||||
COPY ./target/wasm32-unknown-unknown/release/BeepSortMacroQuad.wasm /usr/share/nginx/html/
|
|
@ -32,7 +32,6 @@ pub struct GuiVec{
|
|||
skipped:i32,
|
||||
lastTouched:Vec<usize>,
|
||||
lastPlayed:f64,
|
||||
sounds:Vec<Sound>
|
||||
}
|
||||
#[async_trait]
|
||||
pub trait SortingList{
|
||||
|
@ -77,11 +76,7 @@ impl SortingList for GuiVec{
|
|||
list.push(Bar::new(i, (colorStep*i as f32)/360.));
|
||||
}
|
||||
|
||||
//Generate sounds
|
||||
let mut sounds = Vec::with_capacity(1000);
|
||||
for i in (50..2051).step_by(2){
|
||||
sounds.push(soundGenerator::generateTone(i as f32, 0.1).await);
|
||||
}
|
||||
|
||||
|
||||
GuiVec{
|
||||
list,
|
||||
|
@ -97,7 +92,6 @@ impl SortingList for GuiVec{
|
|||
skipped:0,
|
||||
lastTouched:Vec::with_capacity(2),
|
||||
lastPlayed:0.,
|
||||
sounds,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,13 +172,7 @@ impl SortingList for GuiVec{
|
|||
self.list.swap(index1, index2);
|
||||
|
||||
|
||||
if time::get_time() + 0.1 >= self.lastPlayed{
|
||||
play_sound(self.sounds[ (self.list[index1].position * 1000 / self.list.len()) ], PlaySoundParams{
|
||||
looped:false,
|
||||
volume:0.5
|
||||
});
|
||||
self.lastPlayed = time::get_time()+0.1;
|
||||
}
|
||||
|
||||
|
||||
self.lastTouched.clear();
|
||||
self.lastTouched.push(index1);
|
||||
|
@ -235,10 +223,7 @@ impl SortingList for GuiVec{
|
|||
self.list[i] = elem;
|
||||
self.draw().await;
|
||||
if time::get_time() + 0.1 >= self.lastPlayed{
|
||||
play_sound(self.sounds[ (self.list[i].position * 1000 / self.list.len()) ], PlaySoundParams{
|
||||
looped:false,
|
||||
volume:1.
|
||||
});
|
||||
|
||||
self.lastPlayed = time::get_time()+0.1;
|
||||
}
|
||||
self.lastTouched.clear();
|
||||
|
|
Loading…
Reference in a new issue