@@ -35,6 +35,9 @@ pub enum Error {
3535 #[ snafu( display( "failed to deploy manifests using the kube client" ) ) ]
3636 DeployManifest { source : k8s:: Error } ,
3737
38+ #[ snafu( display( "failed to construct a valid request" ) ) ]
39+ ConstructRequest { source : reqwest:: Error } ,
40+
3841 #[ snafu( display( "failed to access the CRDs from source" ) ) ]
3942 AccessCRDs { source : reqwest:: Error } ,
4043
@@ -129,7 +132,7 @@ impl ReleaseSpec {
129132 namespace : & str ,
130133 k8s_client : & Client ,
131134 ) -> Result < ( ) > {
132- debug ! ( "Upgrading CRDs for release" ) ;
135+ info ! ( "Upgrading CRDs for release" ) ;
133136
134137 include_products. iter ( ) . for_each ( |product| {
135138 Span :: current ( ) . record ( "product.included" , product) ;
@@ -139,36 +142,31 @@ impl ReleaseSpec {
139142 } ) ;
140143
141144 let client = reqwest:: Client :: new ( ) ;
142-
143145 let operators = self . filter_products ( include_products, exclude_products) ;
144146
145- Span :: current ( ) . pb_set_style (
146- & ProgressStyle :: with_template ( "Upgrading CRDs {wide_bar} {pos}/{len}" ) . unwrap ( ) ,
147- ) ;
148- Span :: current ( ) . pb_set_length ( operators. len ( ) as u64 ) ;
149-
150147 for ( product_name, product) in operators {
151- Span :: current ( ) . record ( "product_name" , & product_name) ;
152- debug ! ( "Upgrading CRDs for {product_name}-operator" ) ;
148+ info ! ( "Upgrading CRDs for {product_name}-operator" ) ;
153149
154- let release = match product. version . pre . as_str ( ) {
150+ let release_branch = match product. version . pre . as_str ( ) {
155151 "dev" => "main" . to_string ( ) ,
156152 _ => {
157153 format ! ( "{}" , product. version)
158154 }
159155 } ;
160156
161157 let request_url = format ! (
162- "https://raw.githubusercontent.com/stackabletech/{product_name}-operator/{release }/deploy/helm/{product_name}-operator/crds/crds.yaml"
158+ "https://raw.githubusercontent.com/stackabletech/{product_name}-operator/{release_branch }/deploy/helm/{product_name}-operator/crds/crds.yaml"
163159 ) ;
164160
165- // Get CRD manifests
166- // TODO bei nicht 200 Status, Fehler werfen
161+ // Get CRD manifests from request_url
167162 let response = client
168163 . get ( request_url)
169164 . send ( )
170165 . await
166+ . context ( ConstructRequestSnafu ) ?
167+ . error_for_status ( )
171168 . context ( AccessCRDsSnafu ) ?;
169+
172170 let crd_manifests = response. text ( ) . await . context ( ReadManifestsSnafu ) ?;
173171
174172 // Upgrade CRDs
@@ -177,18 +175,29 @@ impl ReleaseSpec {
177175 . await
178176 . context ( DeployManifestSnafu ) ?;
179177
180- debug ! ( "Upgraded {product_name}-operator CRDs" ) ;
181- Span :: current ( ) . pb_inc ( 1 ) ;
178+ info ! ( "Upgraded {product_name}-operator CRDs" ) ;
182179 }
183180
184181 Ok ( ( ) )
185182 }
186183
187184 #[ instrument( skip_all) ]
188- pub fn uninstall ( & self , namespace : & str ) -> Result < ( ) > {
185+ pub fn uninstall ( & self ,
186+ include_products : & [ String ] ,
187+ exclude_products : & [ String ] ,
188+ namespace : & str ) -> Result < ( ) > {
189189 info ! ( "Uninstalling release" ) ;
190190
191- for ( product_name, product_spec) in & self . products {
191+ include_products. iter ( ) . for_each ( |product| {
192+ Span :: current ( ) . record ( "product.included" , product) ;
193+ } ) ;
194+ exclude_products. iter ( ) . for_each ( |product| {
195+ Span :: current ( ) . record ( "product.excluded" , product) ;
196+ } ) ;
197+
198+ let operators = self . filter_products ( include_products, exclude_products) ;
199+
200+ for ( product_name, product_spec) in operators {
192201 info ! ( "Uninstalling {product_name}-operator" ) ;
193202
194203 // Create operator spec
0 commit comments