Skip to content

Commit

Permalink
feat: credentials field in sdl
Browse files Browse the repository at this point in the history
  • Loading branch information
ilbertt committed May 19, 2024
1 parent 7dbc66a commit 0284868
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/backend/src/akash/sdl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub struct ServiceV2 {
pub expose: Vec<ExposeV2>,
pub dependencies: Option<Vec<DependencyV2>>,
pub params: Option<ServiceParamsV2>,
pub credentials: Option<ServiceImageCredentialsV2>,
}

impl ServiceV2 {
Expand Down Expand Up @@ -223,6 +224,25 @@ impl From<ServiceParamsV2> for ManifestServiceParamsV3 {
}
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
pub struct ServiceImageCredentialsV2 {
pub host: String,
pub email: String,
pub username: String,
pub password: String,
}

impl From<ServiceImageCredentialsV2> for ManifestServiceCredentialsV3 {
fn from(val: ServiceImageCredentialsV2) -> Self {
ManifestServiceCredentialsV3 {
host: val.host,
email: val.email,
username: val.username,
password: val.password,
}
}
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
pub struct ServiceStorageParamsV2 {
pub mount: String,
Expand Down Expand Up @@ -574,6 +594,7 @@ impl SdlV3 {
},
dependencies: None,
params: None,
credentials: None,
},
);
services
Expand Down Expand Up @@ -880,6 +901,7 @@ impl SdlV3 {
count: svc_deployment.count,
expose: self.manifest_expose_v3(service),
params: service.params.to_owned().map(|params| params.into()),
credentials: service.credentials.to_owned().map(|creds| creds.into()),
}
}

Expand Down Expand Up @@ -1035,6 +1057,7 @@ pub struct ManifestServiceV3 {
pub args: Option<Vec<String>>,
pub command: Option<Vec<String>>,
pub count: u32,
pub credentials: Option<ManifestServiceCredentialsV3>,
pub env: Option<Vec<String>>,
pub expose: Vec<ServiceExposeV3>,
pub image: String,
Expand Down Expand Up @@ -1090,6 +1113,14 @@ pub struct ManifestServiceParamsV3 {
pub storage: Vec<ServiceStorageParamsV2>,
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
pub struct ManifestServiceCredentialsV3 {
pub email: String,
pub host: String,
pub password: String,
pub username: String,
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
pub struct GroupV3 {
pub name: String,
Expand Down

0 comments on commit 0284868

Please sign in to comment.