Skip to content

Bump nightly rust #1048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr_pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN_VERSION: "nightly-2025-01-15"
RUST_TOOLCHAIN_VERSION: "nightly-2025-05-26"

permissions: {}

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ repos:
name: rustfmt
language: system
# Pinning to a specific rustc version, so that we get consistent formatting
entry: cargo +nightly-2025-01-15 fmt --all -- --check
entry: cargo +nightly-2025-05-26 fmt --all -- --check
stages: [pre-commit]
pass_filenames: false
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"rust-analyzer.cargo.features": "all",
"rust-analyzer.rustfmt.overrideCommand": [
"rustfmt",
"+nightly-2025-01-15",
"+nightly-2025-05-26",
"--"
],
]
}
11 changes: 7 additions & 4 deletions crates/stackable-operator-derive/src/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ pub fn derive(input: DeriveInput) -> TokenStream {

let (ty, variants) = match data {
// Structs are almost single-variant enums, so we can reuse most of the same matching code for both cases
Data::Struct(fields) => (InputType::Struct, vec![MergeVariant {
ident: Ident::new("__placeholder", Span::call_site()),
fields,
}]),
Data::Struct(fields) => (
InputType::Struct,
vec![MergeVariant {
ident: Ident::new("__placeholder", Span::call_site()),
fields,
}],
),
Data::Enum(variants) => (InputType::Enum, variants),
};
let merge_variants = variants
Expand Down
111 changes: 60 additions & 51 deletions crates/stackable-operator/src/builder/pdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,22 +229,28 @@ mod tests {
.with_min_available(42)
.build();

assert_eq!(pdb, PodDisruptionBudget {
metadata: ObjectMeta {
name: Some("trino".to_string()),
namespace: Some("default".to_string()),
..Default::default()
},
spec: Some(PodDisruptionBudgetSpec {
min_available: Some(IntOrString::Int(42)),
selector: Some(LabelSelector {
match_expressions: None,
match_labels: Some(BTreeMap::from([("foo".to_string(), "bar".to_string())])),
assert_eq!(
pdb,
PodDisruptionBudget {
metadata: ObjectMeta {
name: Some("trino".to_string()),
namespace: Some("default".to_string()),
..Default::default()
},
spec: Some(PodDisruptionBudgetSpec {
min_available: Some(IntOrString::Int(42)),
selector: Some(LabelSelector {
match_expressions: None,
match_labels: Some(BTreeMap::from([(
"foo".to_string(),
"bar".to_string()
)])),
}),
..Default::default()
}),
..Default::default()
}),
..Default::default()
})
}
)
}

#[test]
Expand Down Expand Up @@ -283,54 +289,57 @@ mod tests {
.with_max_unavailable(2)
.build();

assert_eq!(pdb, PodDisruptionBudget {
metadata: ObjectMeta {
name: Some("simple-trino-worker".to_string()),
namespace: Some("default".to_string()),
labels: Some(BTreeMap::from([
("app.kubernetes.io/name".to_string(), "trino".to_string()),
(
"app.kubernetes.io/instance".to_string(),
"simple-trino".to_string()
),
(
"app.kubernetes.io/managed-by".to_string(),
"trino.stackable.tech_trino-operator-trino-controller".to_string()
),
(
"app.kubernetes.io/component".to_string(),
"worker".to_string()
)
])),
owner_references: Some(vec![
OwnerReferenceBuilder::new()
.initialize_from_resource(&trino)
.block_owner_deletion_opt(None)
.controller_opt(Some(true))
.build()
.unwrap()
]),
..Default::default()
},
spec: Some(PodDisruptionBudgetSpec {
max_unavailable: Some(IntOrString::Int(2)),
selector: Some(LabelSelector {
match_expressions: None,
match_labels: Some(BTreeMap::from([
assert_eq!(
pdb,
PodDisruptionBudget {
metadata: ObjectMeta {
name: Some("simple-trino-worker".to_string()),
namespace: Some("default".to_string()),
labels: Some(BTreeMap::from([
("app.kubernetes.io/name".to_string(), "trino".to_string()),
(
"app.kubernetes.io/instance".to_string(),
"simple-trino".to_string()
),
(
"app.kubernetes.io/managed-by".to_string(),
"trino.stackable.tech_trino-operator-trino-controller".to_string()
),
(
"app.kubernetes.io/component".to_string(),
"worker".to_string()
)
])),
owner_references: Some(vec![
OwnerReferenceBuilder::new()
.initialize_from_resource(&trino)
.block_owner_deletion_opt(None)
.controller_opt(Some(true))
.build()
.unwrap()
]),
..Default::default()
},
spec: Some(PodDisruptionBudgetSpec {
max_unavailable: Some(IntOrString::Int(2)),
selector: Some(LabelSelector {
match_expressions: None,
match_labels: Some(BTreeMap::from([
("app.kubernetes.io/name".to_string(), "trino".to_string()),
(
"app.kubernetes.io/instance".to_string(),
"simple-trino".to_string()
),
(
"app.kubernetes.io/component".to_string(),
"worker".to_string()
)
])),
}),
..Default::default()
}),
..Default::default()
}),
..Default::default()
})
}
)
}
}
51 changes: 30 additions & 21 deletions crates/stackable-operator/src/builder/pod/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,16 @@ impl ContainerBuilder {
name: impl Into<String>,
field_path: FieldPathEnvVar,
) -> &mut Self {
self.add_env_var_from_source(name, EnvVarSource {
field_ref: Some(ObjectFieldSelector {
field_path: field_path.to_string(),
..ObjectFieldSelector::default()
}),
..EnvVarSource::default()
});
self.add_env_var_from_source(
name,
EnvVarSource {
field_ref: Some(ObjectFieldSelector {
field_path: field_path.to_string(),
..ObjectFieldSelector::default()
}),
..EnvVarSource::default()
},
);
self
}

Expand All @@ -137,14 +140,17 @@ impl ContainerBuilder {
secret_name: impl Into<String>,
secret_key: impl Into<String>,
) -> &mut Self {
self.add_env_var_from_source(name, EnvVarSource {
secret_key_ref: Some(SecretKeySelector {
name: secret_name.into(),
key: secret_key.into(),
self.add_env_var_from_source(
name,
EnvVarSource {
secret_key_ref: Some(SecretKeySelector {
name: secret_name.into(),
key: secret_key.into(),
..Default::default()
}),
..Default::default()
}),
..Default::default()
});
},
);
self
}

Expand All @@ -155,14 +161,17 @@ impl ContainerBuilder {
config_map_name: impl Into<String>,
config_map_key: impl Into<String>,
) -> &mut Self {
self.add_env_var_from_source(name, EnvVarSource {
config_map_key_ref: Some(ConfigMapKeySelector {
name: config_map_name.into(),
key: config_map_key.into(),
self.add_env_var_from_source(
name,
EnvVarSource {
config_map_key_ref: Some(ConfigMapKeySelector {
name: config_map_name.into(),
key: config_map_key.into(),
..Default::default()
}),
..Default::default()
}),
..Default::default()
});
},
);
self
}

Expand Down
9 changes: 5 additions & 4 deletions crates/stackable-operator/src/builder/pod/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,11 +767,12 @@ mod tests {
.build()
.unwrap();

assert_eq!(pod.spec.unwrap().image_pull_secrets.unwrap(), vec![
LocalObjectReference {
assert_eq!(
pod.spec.unwrap().image_pull_secrets.unwrap(),
vec![LocalObjectReference {
name: "company-registry-secret".to_string()
}
]);
}]
);
}

#[rstest]
Expand Down
89 changes: 46 additions & 43 deletions crates/stackable-operator/src/builder/pod/security.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,48 +365,51 @@ mod tests {
.win_run_as_user_name("winuser")
.build();

assert_eq!(context, PodSecurityContext {
fs_group: Some(1000),
fs_group_change_policy: Some("policy".to_string()),
run_as_user: Some(1001),
run_as_group: Some(1001),
run_as_non_root: Some(true),
supplemental_groups: Some(vec![1002, 1003]),
se_linux_options: Some(SELinuxOptions {
level: Some("level".to_string()),
role: Some("role".to_string()),
type_: Some("type".to_string()),
user: Some("user".to_string()),
}),
seccomp_profile: Some(SeccompProfile {
localhost_profile: Some("localhost".to_string()),
type_: "type".to_string(),
}),
sysctls: Some(vec![
Sysctl {
name: "param1".to_string(),
value: "value1".to_string(),
},
Sysctl {
name: "param2".to_string(),
value: "value2".to_string(),
},
]),
windows_options: Some(WindowsSecurityContextOptions {
gmsa_credential_spec: Some("spec".to_string()),
gmsa_credential_spec_name: Some("name".to_string()),
run_as_user_name: Some("winuser".to_string()),
..Default::default()
}),
// This attribute is supported starting with Kubernetes 1.30.
// Because we support older Kubernetes versions as well, we can
// not use it for now, as we would not work on older Kubernetes
// clusters.
app_armor_profile: None,
// This attribute is supported starting with Kubernetes 1.31.
supplemental_groups_policy: None,
// This attribute is supported starting with Kubernetes 1.32.
se_linux_change_policy: None,
});
assert_eq!(
context,
PodSecurityContext {
fs_group: Some(1000),
fs_group_change_policy: Some("policy".to_string()),
run_as_user: Some(1001),
run_as_group: Some(1001),
run_as_non_root: Some(true),
supplemental_groups: Some(vec![1002, 1003]),
se_linux_options: Some(SELinuxOptions {
level: Some("level".to_string()),
role: Some("role".to_string()),
type_: Some("type".to_string()),
user: Some("user".to_string()),
}),
seccomp_profile: Some(SeccompProfile {
localhost_profile: Some("localhost".to_string()),
type_: "type".to_string(),
}),
sysctls: Some(vec![
Sysctl {
name: "param1".to_string(),
value: "value1".to_string(),
},
Sysctl {
name: "param2".to_string(),
value: "value2".to_string(),
},
]),
windows_options: Some(WindowsSecurityContextOptions {
gmsa_credential_spec: Some("spec".to_string()),
gmsa_credential_spec_name: Some("name".to_string()),
run_as_user_name: Some("winuser".to_string()),
..Default::default()
}),
// This attribute is supported starting with Kubernetes 1.30.
// Because we support older Kubernetes versions as well, we can
// not use it for now, as we would not work on older Kubernetes
// clusters.
app_armor_profile: None,
// This attribute is supported starting with Kubernetes 1.31.
supplemental_groups_policy: None,
// This attribute is supported starting with Kubernetes 1.32.
se_linux_change_policy: None,
}
);
}
}
Loading
Loading