Skip to content

Commit 8ebe2d4

Browse files
committed
Content is String now and not Object, didnt work correctly
1 parent 429791d commit 8ebe2d4

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

resources/epsilon_instance-definition.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ spec:
3333
properties:
3434
spec:
3535
properties:
36-
content: {}
36+
content:
37+
type: string
3738
template:
3839
type: string
3940
required:
@@ -45,7 +46,8 @@ spec:
4546
properties:
4647
close:
4748
type: boolean
48-
content: {}
49+
content:
50+
type: string
4951
hub:
5052
type: boolean
5153
ip:

src/controller/definitions/epsilon_instance.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use async_minecraft_ping::{ConnectionConfig, StatusResponse};
99
use kube::CustomResource;
1010
use schemars::JsonSchema;
1111
use serde::{Deserialize, Serialize};
12-
use serde_json::Value;
1312
use std::time::Duration;
1413
use tokio::time::timeout;
1514

@@ -26,7 +25,7 @@ use tokio::time::timeout;
2625
)]
2726
pub struct EpsilonInstanceSpec {
2827
pub template: String,
29-
pub content: Value,
28+
pub content: String,
3029
}
3130

3231
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema)]
@@ -38,7 +37,7 @@ pub struct EpsilonInstanceStatus {
3837

3938
pub hub: bool,
4039

41-
pub content: Value,
40+
pub content: String,
4241

4342
pub state: EpsilonState,
4443

@@ -159,7 +158,7 @@ pub struct InstanceJson {
159158
pub name: String,
160159
pub template: String,
161160

162-
pub content: Value,
161+
pub content: String,
163162

164163
pub hub: bool,
165164

src/controller/epsilon_controller.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ impl EpsilonController {
302302
},
303303
spec: EpsilonInstanceSpec {
304304
template: template_name.to_owned(),
305-
content,
305+
content: content.to_string(),
306306
},
307307
status: None,
308308
};

src/epsilon/server/instances/instance_provider.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::sync::Arc;
22

33
use kube::api::DeleteParams;
4-
use serde_json::Value;
4+
use serde_json::{Map, Value};
55

66
use crate::controller::definitions::epsilon_instance::EpsilonInstance;
77
use crate::epsilon::epsilon_error::EpsilonError;
@@ -25,9 +25,11 @@ impl InstanceProvider {
2525
template_name: &str,
2626
content: Option<Value>,
2727
) -> Result<EpsilonInstance, EpsilonError> {
28+
let default = Value::Object(Map::new());
29+
2830
Ok(self
2931
.epsilon_controller
30-
.create_epsilon_instance(template_name, content.unwrap_or_default())
32+
.create_epsilon_instance(template_name, content.unwrap_or(default))
3133
.await?)
3234
}
3335

0 commit comments

Comments
 (0)