@@ -28,12 +28,11 @@ mod register_server;
2828#[ cfg( test) ]
2929mod test_utils;
3030mod trustee;
31-
3231use crate :: conditions:: * ;
3332use operator:: * ;
3433
3534/// Default tag for Trustee image
36- const TRUSTEE_VERSION : & str = "v0.17 .0" ;
35+ const TRUSTEE_VERSION : & str = "v0.20 .0" ;
3736/// Default version tag for operator-managed component images
3837const COMPONENT_VERSION : & str = "v0.2.0" ;
3938/// Default registry
@@ -132,7 +131,6 @@ async fn reconcile(
132131 update_status ! ( clusters, name, status) ?;
133132 }
134133
135-
136134 if let Err ( e) = install_components ( & kube_client, & cluster) . await {
137135 // warn with `:?` to also get context
138136 warn ! ( "Installation of a component failed: {e:?}\n Requeueing..." ) ;
@@ -167,17 +165,18 @@ async fn install_trustee_configuration(
167165 . context ( "Failed to create the KBS configuration configmap" ) ?;
168166 info ! ( "Generated configmap for the KBS configuration" ) ;
169167
170- trustee :: generate_attestation_policy ( client. clone ( ) , owner_reference . clone ( ) )
168+ reference_values :: create_pcrs_config_map ( client. clone ( ) )
171169 . await
172- . context ( "Failed to create the attestation policy configmap" ) ?;
173- info ! ( "Generated configmap for the attestation policy" ) ;
174-
175- match trustee:: generate_trustee_auth_keys_secret ( client. clone ( ) , owner_reference. clone ( ) ) . await
176- {
177- Ok ( _) => info ! ( "Generate auth keys for the KBS API" , ) ,
178- Err ( e) => error ! ( "Failed to create the auth keys: {e}" ) ,
179- }
180-
170+ . context ( "Failed to create the PCRs configmap" ) ?;
171+ info ! ( "Created bare configmap for PCRs" ) ;
172+ trustee:: generate_trustee_auth_keys_secret ( client. clone ( ) , owner_reference. clone ( ) )
173+ . await
174+ . context ( "Failed to create the auth keys" ) ?;
175+ info ! ( "Generate auth keys for the KBS API" ) ;
176+ trustee:: generate_rv_data ( client. clone ( ) , owner_reference. clone ( ) )
177+ . await
178+ . context ( "Failed to create the reference values configmap" ) ?;
179+ info ! ( "Created configmap for reference values" ) ;
181180 let kbs_port = cluster. spec . trustee_kbs_port ;
182181 trustee:: generate_kbs_service ( client. clone ( ) , owner_reference. clone ( ) , kbs_port)
183182 . await
@@ -253,7 +252,7 @@ async fn install_attestation_key_register(
253252#[ tokio:: main]
254253async fn main ( ) -> Result < ( ) > {
255254 env_logger:: Builder :: from_env ( Env :: default ( ) . default_filter_or ( "info" ) ) . init ( ) ;
256-
255+ let _ = jsonwebtoken_openssl :: install_default ( ) ;
257256 let kube_client = Client :: try_default ( ) . await ?;
258257 info ! ( "trusted execution clusters operator" , ) ;
259258
@@ -284,9 +283,9 @@ async fn main() -> Result<()> {
284283 attestation_key_register:: launch_ak_controller ( ak_ctx. clone ( ) ) . await ;
285284 attestation_key_register:: launch_machine_ak_controller ( ak_ctx. clone ( ) ) . await ;
286285 attestation_key_register:: launch_secret_ak_controller ( ak_ctx) . await ;
287- reference_values:: create_pcrs_config_map ( kube_client. clone ( ) ) . await ?;
288286 reference_values:: launch_rv_image_controller ( kube_client. clone ( ) ) . await ;
289287 reference_values:: launch_rv_job_controller ( kube_client. clone ( ) ) . await ;
288+ trustee:: launch_trustee_sync_controller ( kube_client. clone ( ) ) . await ;
290289
291290 Controller :: new ( cl, watcher:: Config :: default ( ) )
292291 . run ( reconcile, controller_error_policy, ctx)
@@ -300,7 +299,7 @@ async fn main() -> Result<()> {
300299mod tests {
301300 use http:: { Method , Request , StatusCode } ;
302301 use k8s_openapi:: api:: apps:: v1:: Deployment ;
303- use k8s_openapi:: api:: core:: v1:: { ConfigMap , Service } ;
302+ use k8s_openapi:: api:: core:: v1:: { ConfigMap , Secret , Service } ;
304303 use k8s_openapi:: { apimachinery:: pkg:: apis:: meta:: v1:: Time , jiff:: Timestamp } ;
305304 use kube:: client:: Body ;
306305
@@ -440,25 +439,26 @@ mod tests {
440439 } ;
441440
442441 let clos = async |req : Request < Body > , ctr| {
443- if ctr < 8 && req. method ( ) == Method :: POST {
442+ if ctr < 10 && req. method ( ) == Method :: POST {
444443 use serde_json:: to_string;
445444 let resp = match ctr {
446- // Trustee
447- 0 => to_string ( & ConfigMap :: default ( ) ) ,
448- 1 => to_string ( & ConfigMap :: default ( ) ) ,
449- 2 => to_string ( & Service :: default ( ) ) ,
450- 3 => to_string ( & Deployment :: default ( ) ) ,
451- // Registration server
452- 4 => to_string ( & Deployment :: default ( ) ) ,
453- 5 => to_string ( & Service :: default ( ) ) ,
454- // Attestation key register server
455- 6 => to_string ( & Deployment :: default ( ) ) ,
456- 7 => to_string ( & Service :: default ( ) ) ,
445+ // install_trustee_configuration
446+ 0 => to_string ( & ConfigMap :: default ( ) ) , // trustee-data
447+ 1 => to_string ( & ConfigMap :: default ( ) ) , // image-pcrs
448+ 2 => to_string ( & Secret :: default ( ) ) , // trustee-auth
449+ 3 => to_string ( & ConfigMap :: default ( ) ) , // trustee-rv-data
450+ 4 => to_string ( & Service :: default ( ) ) , // kbs-service
451+ 5 => to_string ( & Deployment :: default ( ) ) , // trustee-deployment
452+ // install_register_server
453+ 6 => to_string ( & Deployment :: default ( ) ) , // register-server
454+ 7 => to_string ( & Service :: default ( ) ) , // register-server-svc
455+ // install_attestation_key_register
456+ 8 => to_string ( & Deployment :: default ( ) ) , // ak-register
457+ 9 => to_string ( & Service :: default ( ) ) , // ak-register-svc
457458 _ => unreachable ! ( "unexpected counter {ctr}" ) ,
458459 } ;
459460 Ok ( resp. unwrap ( ) )
460-
461- } else if ctr == 8 && req. method ( ) == Method :: PATCH {
461+ } else if ctr == 10 && req. method ( ) == Method :: PATCH {
462462 let body = req. into_body ( ) . collect_bytes ( ) . await . unwrap ( ) . to_vec ( ) ;
463463 let body = String :: from_utf8_lossy ( & body) ;
464464 assert ! ( body. contains( "ForeignCondition" ) , ) ;
@@ -489,7 +489,7 @@ mod tests {
489489 cluster. status = Some ( TrustedExecutionClusterStatus {
490490 conditions : Some ( vec ! [ pre_existing_installed, foreign_condition] ) ,
491491 } ) ;
492- count_check ! ( 9 , clos, |client| {
492+ count_check ! ( 11 , clos, |client| {
493493 let result = reconcile( Arc :: new( cluster) , Arc :: new( dummy_cluster_ctx( client) ) ) . await ;
494494 assert_eq!( result. unwrap( ) , Action :: await_change( ) ) ;
495495 } ) ;
0 commit comments