What commit ID of Portieris did you experience the problem with?
7cc209a
What went wrong?
Deploying an image with mutateImage: true removes the image tag which causes the following behaviour
% kubectl -n mynamespace rollout restart deployment my-deployment
error: failed to patch: admission webhook "trust.hooks.securityenforcement.admission.cloud.ibm.com" denied the request:
trust: policy denied the request: Deny "my-host/my-image@sha256:some-sha-256", failed to get content trust information: No valid trust data for latest
The image in the deployment is specified via a tag (not latest).
What should have happened differently?
kubectl rollout restart should be able to restart my deployment with the same image that was in use before
How can it be reproduced?
Creating a deployment referencing a valid tag (with a signature) and having a latest tag that doesn't have a signature and enabling mutateImage: true in the policy, then try to restart it.
Setting mutateImage: false makes it work but comes with the caveats noted in the README.
What commit ID of Portieris did you experience the problem with?
7cc209a
What went wrong?
Deploying an image with
mutateImage: true
removes the image tag which causes the following behaviourThe image in the deployment is specified via a tag (not
latest
).What should have happened differently?
kubectl rollout restart
should be able to restart my deployment with the same image that was in use beforeHow can it be reproduced?
Creating a deployment referencing a valid tag (with a signature) and having a
latest
tag that doesn't have a signature and enablingmutateImage: true
in the policy, then try to restart it. SettingmutateImage: false
makes it work but comes with the caveats noted in the README.Any other relevant information
Sample
ImagePolicy
Log output
To me, it looks like https://github.com/IBM/portieris/blob/main/pkg/verifier/trust/verifier.go#L103 is passing
latest
as atargetName
which passes it to https://github.com/IBM/portieris/blob/main/pkg/verifier/trust/trust.go#L63 which causesGetAllTargetMetadataByName
to fail because ourlatest
image doesn't have a signature. The tag is removed by https://github.com/IBM/portieris/blob/main/pkg/controller/multi/controller.go#L225 (also see #90). Having no tag defined causes https://github.com/IBM/portieris/blob/main/helpers/image/image.go#L65 to fallback tolatest
.When disabling
mutateImage
, the image reference is not modified which fixes the problems but comes with the caveats noted in the README.