@@ -174,12 +174,17 @@ pub async fn kube_api_for(
174
174
}
175
175
}
176
176
177
- /// Apply multi-document manifest file
178
- pub async fn apply_manifest_yaml ( client : & kube:: Client , manifest : & str ) -> Result < ( ) > {
177
+ /// Apply multi-document manifest file, return created resources
178
+ pub async fn apply_manifest_yaml (
179
+ client : & kube:: Client ,
180
+ manifest : & str ,
181
+ ) -> Result < Vec < DynamicObject > > {
179
182
// set ourself as the owner for managed fields
180
183
// https://kubernetes.io/docs/reference/using-api/server-side-apply/#managers
181
184
let pp = PatchParams :: apply ( "beavercds" ) . force ( ) ;
182
185
186
+ let mut results = vec ! [ ] ;
187
+
183
188
// this manifest has multiple documents (crds, deployment)
184
189
for yaml in multidoc_deserialize ( manifest) ? {
185
190
let obj: DynamicObject = serde_yml:: from_value ( yaml) ?;
@@ -195,7 +200,10 @@ pub async fn apply_manifest_yaml(client: &kube::Client, manifest: &str) -> Resul
195
200
. patch ( & obj. name_any ( ) , & pp, & Patch :: Apply ( & obj) )
196
201
. await
197
202
{
198
- Ok ( d) => Ok ( ( ) ) ,
203
+ Ok ( d) => {
204
+ results. push ( d) ;
205
+ Ok ( ( ) )
206
+ }
199
207
// if error is from cluster api, mark it as such
200
208
Err ( kube:: Error :: Api ( ae) ) => {
201
209
// Err(kube::Error::Api(ae).into())
@@ -206,7 +214,7 @@ pub async fn apply_manifest_yaml(client: &kube::Client, manifest: &str) -> Resul
206
214
} ?;
207
215
}
208
216
209
- Ok ( ( ) )
217
+ Ok ( results )
210
218
}
211
219
212
220
/// Deserialize multi-document yaml string into a Vec of the documents
0 commit comments