Skip to content

Commit

Permalink
Added docs on why we already check user access to the service/workloa…
Browse files Browse the repository at this point in the history
…d pods
  • Loading branch information
Razz4780 committed Jan 21, 2025
1 parent 9f72d00 commit d0e4758
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mirrord/kube/src/api/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ pub trait RuntimeDataProvider {
) -> impl Future<Output = Result<RuntimeData>>;
}

/// Trait for resources that abstract a set of pods
/// defined by a label selector.
///
/// Implementors are provided with an implementation of [`RuntimeDataProvider`].
/// When resolving [`RuntimeData`], the set of pods is fetched and [`RuntimeData`] is extracted from
/// the first pod on the list. If the set is empty, resolution fails.
pub trait RuntimeDataFromLabels {
type Resource: Resource<DynamicType = (), Scope = NamespaceResourceScope>
+ Clone
Expand Down
2 changes: 2 additions & 0 deletions mirrord/operator/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ impl OperatorApi<PreparedClientCert> {

// `targetless` has no `RuntimeData`!
if matches!(target, ResolvedTarget::Targetless(_)).not() {
// Extracting runtime data asserts that the user can see at least one pod from the
// workload/service targets.
let runtime_data = target
.runtime_data(self.client(), target.namespace())
.await?;
Expand Down

0 comments on commit d0e4758

Please sign in to comment.