Skip to content

Commit 06c1255

Browse files
committed
Fix missing owner references in create_owned_deployment function
1 parent 3cae514 commit 06c1255

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/deployment.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,24 @@ pub async fn create_owned_deployment(
234234
source: &Service,
235235
exit_node: &ExitNode,
236236
) -> Result<Deployment, ReconcileError> {
237-
let oref = exit_node.controller_owner_ref(&()).ok_or_else(|| {
237+
let oref = source.controller_owner_ref(&()).ok_or_else(|| {
238+
ReconcileError::KubeError(kube::Error::Api(ErrorResponse {
239+
code: 500,
240+
message: "Service is missing owner reference".to_string(),
241+
reason: "MissingOwnerReference".to_string(),
242+
status: "Failure".to_string(),
243+
}))
244+
})?;
245+
246+
let oref2 = exit_node.controller_owner_ref(&()).ok_or_else(|| {
238247
ReconcileError::KubeError(kube::Error::Api(ErrorResponse {
239248
code: 500,
240249
message: "ExitNode is missing owner reference".to_string(),
241250
reason: "MissingOwnerReference".to_string(),
242251
status: "Failure".to_string(),
243252
}))
244253
})?;
254+
245255
let service_name = source.metadata.name.as_ref().ok_or_else(|| {
246256
ReconcileError::KubeError(kube::Error::Api(ErrorResponse {
247257
code: 500,
@@ -254,7 +264,7 @@ pub async fn create_owned_deployment(
254264
Ok(Deployment {
255265
metadata: ObjectMeta {
256266
name: Some(format!("chisel-{}", service_name)),
257-
owner_references: Some(vec![oref]),
267+
owner_references: Some(vec![oref, oref2]),
258268
..ObjectMeta::default()
259269
},
260270
spec: Some(DeploymentSpec {

0 commit comments

Comments
 (0)