Skip to content

[Merged by Bors] - Added owner-ref to pod templates #104

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ All notable changes to this project will be documented in this file.
- Include chart name when installing with a custom release name ([#97])
- Pinned MinIO version for tests ([#100])
- `operator-rs` `0.21.0` → `0.22.0` ([#102]).
- added owner-reference to pod templates ([#104])

[#97]: https://github.com/stackabletech/spark-k8s-operator/pull/92
[#100]: https://github.com/stackabletech/spark-k8s-operator/pull/100
[#102]: https://github.com/stackabletech/spark-k8s-operator/pull/102
[#104]: https://github.com/stackabletech/spark-k8s-operator/pull/104

## [0.3.0] - 2022-06-30

Expand Down
2 changes: 1 addition & 1 deletion examples/ny-tlc-report-external-dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
# Always | IfNotPresent | Never
sparkImagePullPolicy: IfNotPresent
mode: cluster
mainApplicationFile: s3a://my-bucket/ny-tlc-report.py
mainApplicationFile: s3a://my-bucket/ny_tlc_report.py
args:
- "--input 's3a://my-bucket/yellow_tripdata_2021-07.csv'"
deps:
Expand Down
10 changes: 10 additions & 0 deletions rust/crd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ mod tests {
use crate::ImagePullPolicy;
use crate::LocalObjectReference;
use crate::SparkApplication;
use stackable_operator::builder::ObjectMetaBuilder;
use stackable_operator::commons::s3::{
S3AccessStyle, S3BucketSpec, S3ConnectionDef, S3ConnectionSpec,
};
Expand Down Expand Up @@ -609,6 +610,7 @@ kind: SparkApplication
metadata:
name: ny-tlc-report-external-dependencies
namespace: default
uid: 12345678asdfghj
spec:
version: "1.0"
sparkImage: docker.stackable.tech/stackable/spark-k8s:3.2.1-hadoop3.2-python39-aws1.11.375-stackable0.3.0
Expand All @@ -631,6 +633,14 @@ spec:
memory: "512m"
"#).unwrap();

let meta = ObjectMetaBuilder::new()
.name_and_namespace(&spark_application)
.ownerreference_from_resource(&spark_application, None, Some(true))
.unwrap()
.build();

assert_eq!("12345678asdfghj", meta.owner_references.unwrap()[0].uid);

assert_eq!("1.0", spark_application.spec.version.unwrap_or_default());
assert_eq!(
Some("s3a://stackable-spark-k8s-jars/jobs/ny_tlc_report.py".to_string()),
Expand Down
2 changes: 2 additions & 0 deletions rust/operator-binary/src/spark_k8s_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ fn pod_template(
Ok(Pod {
metadata: ObjectMetaBuilder::new()
.name(container_name)
.ownerreference_from_resource(spark_application, None, Some(false))
.context(ObjectMissingMetadataForOwnerRefSnafu)?
.with_labels(spark_application.recommended_labels())
.build(),
spec: Some(pod_spec),
Expand Down