@@ -19,7 +19,7 @@ import (
1919// NewPodInterceptorWebhook creates a new pod mutating webhook to be registered
2020func NewPodInterceptorWebhook (c client.Client , decoder admission.Decoder ) webhook.AdmissionHandler {
2121 return & podInterceptor {
22- client : c ,
22+ client : c ,
2323 decoder : decoder ,
2424 }
2525}
@@ -72,23 +72,22 @@ func (p *podInterceptor) Handle(ctx context.Context, req admission.Request) admi
7272 }
7373 }
7474
75- args := []string {"verify" ,
76- fmt .Sprintf ("--model_path=%s" , rhmv .Spec .Model .Path ),
77- fmt .Sprintf ("--sig_path=%s" , rhmv .Spec .Model .SignaturePath ),
78- }
79- args = append (args , validationConfigToArgs (logger , rhmv .Spec .Config )... )
75+ args := []string {"verify" }
76+ args = append (args , validationConfigToArgs (logger , rhmv .Spec .Config , rhmv .Spec .Model .SignaturePath )... )
77+ args = append (args , rhmv .Spec .Model .Path )
8078
8179 pp := pod .DeepCopy ()
8280 vm := []corev1.VolumeMount {}
8381 for _ , c := range pod .Spec .Containers {
8482 vm = append (vm , c .VolumeMounts ... )
8583 }
8684 pp .Spec .InitContainers = append (pp .Spec .InitContainers , corev1.Container {
87- Name : modelValidationInitContainerName ,
85+ Name : modelValidationInitContainerName ,
8886 ImagePullPolicy : corev1 .PullAlways ,
89- Image : "ghcr.io/miyunari/model-transparency-cli:latest" , // TODO: get image from operator config.
90- Command : args ,
91- VolumeMounts : vm ,
87+ Image : "ghcr.io/sigstore/model-transparency-cli:v1.0.1" , // TODO: get image from operator config.
88+ Command : []string {"/usr/local/bin/model_signing" },
89+ Args : args ,
90+ VolumeMounts : vm ,
9291 })
9392 marshaledPod , err := json .Marshal (pp )
9493 if err != nil {
@@ -98,23 +97,25 @@ func (p *podInterceptor) Handle(ctx context.Context, req admission.Request) admi
9897 return admission .PatchResponseFromRaw (req .Object .Raw , marshaledPod )
9998}
10099
101- func validationConfigToArgs (logger logr.Logger , cfg v1alpha1.ValidationConfig ) []string {
100+ func validationConfigToArgs (logger logr.Logger , cfg v1alpha1.ValidationConfig , signaturePath string ) []string {
102101 logger .Info ("construct args" )
103102 res := []string {}
104103 if cfg .SigstoreConfig != nil {
105104 logger .Info ("found sigstore config" )
106105 res = append (res ,
107106 "sigstore" ,
107+ fmt .Sprintf ("--signature=%s" , signaturePath ),
108108 "--identity" , cfg .SigstoreConfig .CertificateIdentity ,
109- "--identity-provider " , cfg .SigstoreConfig .CertificateOidcIssuer ,
109+ "--identity_provider " , cfg .SigstoreConfig .CertificateOidcIssuer ,
110110 )
111111 return res
112112 }
113113
114114 if cfg .PrivateKeyConfig != nil {
115115 logger .Info ("found private-key config" )
116116 res = append (res ,
117- "private-key" ,
117+ "key" ,
118+ fmt .Sprintf ("--signature=%s" , signaturePath ),
118119 "--public_key" , cfg .PrivateKeyConfig .KeyPath ,
119120 )
120121 return res
@@ -123,8 +124,9 @@ func validationConfigToArgs(logger logr.Logger, cfg v1alpha1.ValidationConfig) [
123124 if cfg .PkiConfig != nil {
124125 logger .Info ("found pki config" )
125126 res = append (res ,
126- "pki" ,
127- "--root_certs" , cfg .PkiConfig .CertificateAuthority ,
127+ "certificate" ,
128+ fmt .Sprintf ("--signature=%s" , signaturePath ),
129+ "--certificate_chain" , cfg .PkiConfig .CertificateAuthority ,
128130 )
129131 return res
130132 }
0 commit comments