Skip to content

Commit

Permalink
Merge pull request #51 from yue9944882/feat/parent-storage-getter
Browse files Browse the repository at this point in the history
Feat: Support retrieving get-only storage storage
  • Loading branch information
k8s-ci-robot authored Sep 6, 2021
2 parents 8433bb8 + 428d0c2 commit 3162fb5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/util/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@ func GetParentStorage(ctx context.Context) (rest.StandardStorage, bool) {
}
return parentStorage.(rest.StandardStorage), true
}

// GetParentStorageGetter tries getting the get-only parent storage from
// context.
func GetParentStorageGetter(ctx context.Context) (rest.Getter, bool) {
parentStorage := ctx.Value(parentStorageContextKey)
if parentStorage == nil {
return nil, false
}
return parentStorage.(rest.Getter), true
}

0 comments on commit 3162fb5

Please sign in to comment.