forked from jeremylvln/Shulker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(shulker-operator): assert valid cluster ref before reconciling (j…
- Loading branch information
1 parent
3e99751
commit c207cce
Showing
5 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use kube::{Api, Client}; | ||
use shulker_crds::v1alpha1::minecraft_cluster::{MinecraftCluster, MinecraftClusterRef}; | ||
|
||
use super::{ReconcilerError, Result}; | ||
|
||
pub async fn resolve_cluster_ref( | ||
client: &Client, | ||
namespace: &str, | ||
cluster_ref: &MinecraftClusterRef, | ||
) -> Result<MinecraftCluster> { | ||
let clusters_api: Api<MinecraftCluster> = Api::namespaced(client.clone(), namespace); | ||
let cluster = clusters_api | ||
.get(&cluster_ref.name) | ||
.await | ||
.map_err(|e| ReconcilerError::InvalidClusterRef(cluster_ref.name.clone(), e))?; | ||
|
||
Ok(cluster) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters