Skip to content

Commit

Permalink
lint-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ruokun-niu committed Jan 17, 2025
1 parent a5d2540 commit 6d6b125
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
16 changes: 9 additions & 7 deletions control-planes/kubernetes_provider/src/spec_builder/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::collections::BTreeMap;

use k8s_openapi::api::core::v1::{EnvVar, ServiceAccount};
use kube::{api::ObjectMeta, ResourceExt};
use resource_provider_api::models::{ServiceIdentity, ConfigValue};
use resource_provider_api::models::{ConfigValue, ServiceIdentity};

use crate::models::KubernetesSpec;

Expand Down Expand Up @@ -94,7 +94,7 @@ pub fn apply_identity(spec: &mut KubernetesSpec, identity: &ServiceIdentity) {
ServiceIdentity::AwsIamRole { role_arn } => {
env_vars.insert("AWS_ROLE_ARN".to_string(), role_arn.clone());
id_type = "AwsIamRole";

let arn = match role_arn {
ConfigValue::Inline { value } => value,
_ => panic!("role_arn must be an inline value"),
Expand All @@ -106,17 +106,19 @@ pub fn apply_identity(spec: &mut KubernetesSpec, identity: &ServiceIdentity) {
env_vars.insert("AWS_WEB_IDENTITY_TOKEN_FILE".to_string(), token_file);

// annotate the label for the service account
service_account.annotations_mut().insert(
"eks.amazonaws.com/role-arn".to_string(),
arn.to_string(),
);
service_account
.annotations_mut()
.insert("eks.amazonaws.com/role-arn".to_string(), arn.to_string());
}
ServiceIdentity::AwsIamAccessKey {
access_key_id,
secret_access_key,
} => {
env_vars.insert("AWS_ACCESS_KEY_ID".to_string(), access_key_id.clone());
env_vars.insert("AWS_SECRET_ACCESS_KEY".to_string(), secret_access_key.clone());
env_vars.insert(
"AWS_SECRET_ACCESS_KEY".to_string(),
secret_access_key.clone(),
);

id_type = "AwsIamAccessKey";
}
Expand Down
4 changes: 2 additions & 2 deletions control-planes/mgmt_api/src/api/v1/mappings/providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl From<ServiceIdentityDto> for ServiceIdentity {
} => ServiceIdentity::AwsIamAccessKey {
access_key_id: access_key_id.into(),
secret_access_key: secret_access_key.into(),
}
},
}
}
}
Expand Down Expand Up @@ -141,7 +141,7 @@ impl From<ServiceIdentity> for ServiceIdentityDto {
} => ServiceIdentityDto::AwsIamAccessKey {
access_key_id: access_key_id.into(),
secret_access_key: secret_access_key.into(),
}
},
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion control-planes/mgmt_api/src/api/v1/models/providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub enum ServiceIdentityDto {
access_key_id: ConfigValueDto,
#[serde(rename = "secretAccessKey")]
secret_access_key: ConfigValueDto,
}
},
}

#[derive(Serialize, Deserialize, Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion control-planes/mgmt_api/src/domain/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ pub enum ServiceIdentity {
access_key_id: ConfigValue,
#[serde(rename = "secretAccessKey")]
secret_access_key: ConfigValue,
}
},
}

#[derive(Serialize, Deserialize, Debug, Clone)]
Expand Down

0 comments on commit 6d6b125

Please sign in to comment.