Expected Behavior
If the ServiceAccount used in the TaskRun or PipelineRun has both imagePullSecrets and secrets, chains controller is expected to use the mounted Secrets which would have push permission to the given registry rather than relying on imagePullSecrets which will have only READ permission to the targeted oci registry for signed artifact upload.
Actual Behavior
If the ServiceAccount used in the TaskRun or PipelineRun has both imagePullSecrets and secrets, chains controller is always using the imagePullSecrets to upload the signed artifacts resulting in AUTH error.
Steps to Reproduce the Problem
-
Install pipelines,chains in a kind cluster and complete config and execute a TaskRun following the script: https://gist.github.com/anithapriyanatarajan/ffa14efcc0274f7c22ec599df092ba21
-
verify that the annotation chains.tekton.dev/signed: "false" on TR after 3 retries
-
Remove the imagePullSecret attached the serviceAccount and start the TaskRun again.
kubectl patch serviceaccount $SERVICE_ACCOUNT_NAME -p '{"imagePullSecrets": null}' -n $NAMESPACE
-
verify that the annotation chains.tekton.dev/signed: "true"
Additional Info
Client Version: v1.31.1
Kustomize Version: v5.4.2
Server Version: v1.31.0
Relevance to another issue
#700 - As part of this we have enabled usage of secrets from service Account.
https://github.com/lcarva/chains/blob/843c6b3477fee1154093d5a8660630f3ebdaef31/pkg/chains/storage/oci/oci.go#L58-L60 - here we do not seem to specify which secret to use for oci storage in options and hence as per the library both imagePullSecrets and Secrets are consolidated into a single slice and controller repeatedly fails always using the imagePullSecrets. This issue will be evident only if the oci registry is same for pull and push but the auth secret for pull is configured in imagePullSecrets and that for push is kept in secrets patched to the service account used by the chains controller
@jkhelil - Thankyou for detailed inputs regarding the library details that is causing this concern.
@lcarva - could you suggest a way forward for this issue? Is it fine to explicity include logic in oci backend storage to use only secrets but never imagePullSecrets for signed artifact upload.
Expected Behavior
If the ServiceAccount used in the TaskRun or PipelineRun has both
imagePullSecretsandsecrets, chains controller is expected to use the mountedSecretswhich would have push permission to the given registry rather than relying onimagePullSecretswhich will have only READ permission to the targeted oci registry for signed artifact upload.Actual Behavior
If the ServiceAccount used in the TaskRun or PipelineRun has both
imagePullSecretsandsecrets, chains controller is always using theimagePullSecretsto upload the signed artifacts resulting in AUTH error.Steps to Reproduce the Problem
Install pipelines,chains in a kind cluster and complete config and execute a TaskRun following the script: https://gist.github.com/anithapriyanatarajan/ffa14efcc0274f7c22ec599df092ba21
verify that the annotation
chains.tekton.dev/signed: "false"on TR after 3 retriesRemove the imagePullSecret attached the serviceAccount and start the TaskRun again.
kubectl patch serviceaccount $SERVICE_ACCOUNT_NAME -p '{"imagePullSecrets": null}' -n $NAMESPACEverify that the annotation
chains.tekton.dev/signed: "true"Additional Info
Relevance to another issue
#700 - As part of this we have enabled usage of
secretsfrom service Account.https://github.com/lcarva/chains/blob/843c6b3477fee1154093d5a8660630f3ebdaef31/pkg/chains/storage/oci/oci.go#L58-L60 - here we do not seem to specify which secret to use for oci storage in options and hence as per the library both imagePullSecrets and Secrets are consolidated into a single slice and controller repeatedly fails always using the imagePullSecrets. This issue will be evident only if the oci registry is same for pull and push but the auth secret for pull is configured in
imagePullSecretsand that for push is kept insecretspatched to the service account used by the chains controller@jkhelil - Thankyou for detailed inputs regarding the library details that is causing this concern.
@lcarva - could you suggest a way forward for this issue? Is it fine to explicity include logic in oci backend storage to use only
secretsbut neverimagePullSecretsfor signed artifact upload.