@@ -35,6 +35,9 @@ pub enum Error {
35
35
#[ snafu( display( "failed to deploy manifests using the kube client" ) ) ]
36
36
DeployManifest { source : k8s:: Error } ,
37
37
38
+ #[ snafu( display( "failed to construct a valid request" ) ) ]
39
+ ConstructRequest { source : reqwest:: Error } ,
40
+
38
41
#[ snafu( display( "failed to access the CRDs from source" ) ) ]
39
42
AccessCRDs { source : reqwest:: Error } ,
40
43
@@ -129,7 +132,7 @@ impl ReleaseSpec {
129
132
namespace : & str ,
130
133
k8s_client : & Client ,
131
134
) -> Result < ( ) > {
132
- debug ! ( "Upgrading CRDs for release" ) ;
135
+ info ! ( "Upgrading CRDs for release" ) ;
133
136
134
137
include_products. iter ( ) . for_each ( |product| {
135
138
Span :: current ( ) . record ( "product.included" , product) ;
@@ -139,36 +142,31 @@ impl ReleaseSpec {
139
142
} ) ;
140
143
141
144
let client = reqwest:: Client :: new ( ) ;
142
-
143
145
let operators = self . filter_products ( include_products, exclude_products) ;
144
146
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
-
150
147
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" ) ;
153
149
154
- let release = match product. version . pre . as_str ( ) {
150
+ let release_branch = match product. version . pre . as_str ( ) {
155
151
"dev" => "main" . to_string ( ) ,
156
152
_ => {
157
153
format ! ( "{}" , product. version)
158
154
}
159
155
} ;
160
156
161
157
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"
163
159
) ;
164
160
165
- // Get CRD manifests
166
- // TODO bei nicht 200 Status, Fehler werfen
161
+ // Get CRD manifests from request_url
167
162
let response = client
168
163
. get ( request_url)
169
164
. send ( )
170
165
. await
166
+ . context ( ConstructRequestSnafu ) ?
167
+ . error_for_status ( )
171
168
. context ( AccessCRDsSnafu ) ?;
169
+
172
170
let crd_manifests = response. text ( ) . await . context ( ReadManifestsSnafu ) ?;
173
171
174
172
// Upgrade CRDs
@@ -177,18 +175,29 @@ impl ReleaseSpec {
177
175
. await
178
176
. context ( DeployManifestSnafu ) ?;
179
177
180
- debug ! ( "Upgraded {product_name}-operator CRDs" ) ;
181
- Span :: current ( ) . pb_inc ( 1 ) ;
178
+ info ! ( "Upgraded {product_name}-operator CRDs" ) ;
182
179
}
183
180
184
181
Ok ( ( ) )
185
182
}
186
183
187
184
#[ 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 < ( ) > {
189
189
info ! ( "Uninstalling release" ) ;
190
190
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 {
192
201
info ! ( "Uninstalling {product_name}-operator" ) ;
193
202
194
203
// Create operator spec
0 commit comments