@@ -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
@@ -167,17 +166,18 @@ async fn install_trustee_configuration(
167166 . context ( "Failed to create the KBS configuration configmap" ) ?;
168167 info ! ( "Generated configmap for the KBS configuration" ) ;
169168
170- trustee :: generate_attestation_policy ( client. clone ( ) , owner_reference . clone ( ) )
169+ reference_values :: create_pcrs_config_map ( client. clone ( ) )
171170 . 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-
171+ . context ( "Failed to create the PCRs configmap" ) ?;
172+ info ! ( "Created bare configmap for PCRs" ) ;
173+ trustee:: generate_trustee_auth_keys_secret ( client. clone ( ) , owner_reference. clone ( ) )
174+ . await
175+ . context ( "Failed to create the auth keys" ) ?;
176+ info ! ( "Generate auth keys for the KBS API" ) ;
177+ trustee:: generate_rv_data ( client. clone ( ) , owner_reference. clone ( ) )
178+ . await
179+ . context ( "Failed to create the reference values configmap" ) ?;
180+ info ! ( "Created configmap for reference values" ) ;
181181 let kbs_port = cluster. spec . trustee_kbs_port ;
182182 trustee:: generate_kbs_service ( client. clone ( ) , owner_reference. clone ( ) , kbs_port)
183183 . await
@@ -253,7 +253,7 @@ async fn install_attestation_key_register(
253253#[ tokio:: main]
254254async fn main ( ) -> Result < ( ) > {
255255 env_logger:: Builder :: from_env ( Env :: default ( ) . default_filter_or ( "info" ) ) . init ( ) ;
256-
256+ let _ = jsonwebtoken_openssl :: install_default ( ) ;
257257 let kube_client = Client :: try_default ( ) . await ?;
258258 info ! ( "trusted execution clusters operator" , ) ;
259259
@@ -284,9 +284,9 @@ async fn main() -> Result<()> {
284284 attestation_key_register:: launch_ak_controller ( ak_ctx. clone ( ) ) . await ;
285285 attestation_key_register:: launch_machine_ak_controller ( ak_ctx. clone ( ) ) . await ;
286286 attestation_key_register:: launch_secret_ak_controller ( ak_ctx) . await ;
287- reference_values:: create_pcrs_config_map ( kube_client. clone ( ) ) . await ?;
288287 reference_values:: launch_rv_image_controller ( kube_client. clone ( ) ) . await ;
289288 reference_values:: launch_rv_job_controller ( kube_client. clone ( ) ) . await ;
289+ trustee:: launch_trustee_sync_controller ( kube_client. clone ( ) ) . await ;
290290
291291 Controller :: new ( cl, watcher:: Config :: default ( ) )
292292 . run ( reconcile, controller_error_policy, ctx)
@@ -300,7 +300,7 @@ async fn main() -> Result<()> {
300300mod tests {
301301 use http:: { Method , Request , StatusCode } ;
302302 use k8s_openapi:: api:: apps:: v1:: Deployment ;
303- use k8s_openapi:: api:: core:: v1:: { ConfigMap , Service } ;
303+ use k8s_openapi:: api:: core:: v1:: { ConfigMap , Secret , Service } ;
304304 use k8s_openapi:: { apimachinery:: pkg:: apis:: meta:: v1:: Time , jiff:: Timestamp } ;
305305 use kube:: api:: ObjectList ;
306306 use kube:: client:: Body ;
@@ -442,31 +442,33 @@ mod tests {
442442 } ;
443443
444444 let clos = async |req : Request < Body > , ctr| {
445- if ctr < 8 && req. method ( ) == Method :: POST {
445+ if ctr < 10 && req. method ( ) == Method :: POST {
446446 use serde_json:: to_string;
447447 let resp = match ctr {
448- // Trustee
449- 0 => to_string ( & ConfigMap :: default ( ) ) ,
450- 1 => to_string ( & ConfigMap :: default ( ) ) ,
451- 2 => to_string ( & Service :: default ( ) ) ,
452- 3 => to_string ( & Deployment :: default ( ) ) ,
453- // Registration server
454- 4 => to_string ( & Deployment :: default ( ) ) ,
455- 5 => to_string ( & Service :: default ( ) ) ,
456- // Attestation key register server
457- 6 => to_string ( & Deployment :: default ( ) ) ,
458- 7 => to_string ( & Service :: default ( ) ) ,
448+ // install_trustee_configuration
449+ 0 => to_string ( & ConfigMap :: default ( ) ) , // trustee-data
450+ 1 => to_string ( & ConfigMap :: default ( ) ) , // image-pcrs
451+ 2 => to_string ( & Secret :: default ( ) ) , // trustee-auth
452+ 3 => to_string ( & ConfigMap :: default ( ) ) , // trustee-rv-data
453+ 4 => to_string ( & Service :: default ( ) ) , // kbs-service
454+ 5 => to_string ( & Deployment :: default ( ) ) , // trustee-deployment
455+ // install_register_server
456+ 6 => to_string ( & Deployment :: default ( ) ) , // register-server
457+ 7 => to_string ( & Service :: default ( ) ) , // register-server-svc
458+ // install_attestation_key_register
459+ 8 => to_string ( & Deployment :: default ( ) ) , // ak-register
460+ 9 => to_string ( & Service :: default ( ) ) , // ak-register-svc
459461 _ => unreachable ! ( "unexpected counter {ctr}" ) ,
460462 } ;
461463 Ok ( resp. unwrap ( ) )
462- } else if ctr == 8 && req. method ( ) == Method :: GET {
464+ } else if ctr == 10 && req. method ( ) == Method :: GET {
463465 let object_list = ObjectList :: < ApprovedImage > {
464466 items : Vec :: new ( ) ,
465467 types : Default :: default ( ) ,
466468 metadata : Default :: default ( ) ,
467469 } ;
468470 Ok ( serde_json:: to_string ( & object_list) . unwrap ( ) )
469- } else if ctr == 9 && req. method ( ) == Method :: PATCH {
471+ } else if ctr == 11 && req. method ( ) == Method :: PATCH {
470472 let body = req. into_body ( ) . collect_bytes ( ) . await . unwrap ( ) . to_vec ( ) ;
471473 let body = String :: from_utf8_lossy ( & body) ;
472474 assert ! ( body. contains( "ForeignCondition" ) , ) ;
@@ -497,7 +499,7 @@ mod tests {
497499 cluster. status = Some ( TrustedExecutionClusterStatus {
498500 conditions : Some ( vec ! [ pre_existing_installed, foreign_condition] ) ,
499501 } ) ;
500- count_check ! ( 10 , clos, |client| {
502+ count_check ! ( 12 , clos, |client| {
501503 let result = reconcile( Arc :: new( cluster) , Arc :: new( dummy_cluster_ctx( client) ) ) . await ;
502504 assert_eq!( result. unwrap( ) , Action :: await_change( ) ) ;
503505 } ) ;
0 commit comments