Skip to content

Commit edcdda7

Browse files
committed
Set service account name.
1 parent bd285af commit edcdda7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ All notable changes to this project will be documented in this file.
99
- Build against Kubernetes 1.23 ([#330]).
1010

1111
### Added
12-
- More builder functionality: `SecurityContext` objects and `EnvVar`s from field refs ([#331])
12+
- More builder functionality ([#331])
13+
- builder for `SecurityContext` objects
14+
- add `EnvVar`s from field refs
15+
- set `serviceServiceAccountName` in pod templates
1316

1417
[#330]: https://github.com/stackabletech/operator-rs/pull/330
1518
[#331]: https://github.com/stackabletech/operator-rs/pull/331

src/builder.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,13 +1095,19 @@ pub struct PodBuilder {
10951095
security_context: Option<PodSecurityContext>,
10961096
tolerations: Option<Vec<Toleration>>,
10971097
volumes: Option<Vec<Volume>>,
1098+
service_account_name: Option<String>,
10981099
}
10991100

11001101
impl PodBuilder {
11011102
pub fn new() -> PodBuilder {
11021103
PodBuilder::default()
11031104
}
11041105

1106+
pub fn service_account_name(&mut self, value: impl Into<String>) -> &mut Self {
1107+
self.service_account_name = Some(value.into());
1108+
self
1109+
}
1110+
11051111
pub fn host_network(&mut self, host_network: bool) -> &mut Self {
11061112
self.host_network = Some(host_network);
11071113
self
@@ -1273,6 +1279,7 @@ impl PodBuilder {
12731279
// In practice, this just causes a bunch of unused environment variables that may conflict with other uses,
12741280
// such as https://github.com/stackabletech/spark-operator/pull/256.
12751281
enable_service_links: Some(false),
1282+
service_account_name: self.service_account_name.clone(),
12761283
..PodSpec::default()
12771284
}
12781285
}

0 commit comments

Comments
 (0)