Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix task pod creation failure with duplicate serviceaccount secrets #4743

Merged
merged 1 commit into from
Jun 30, 2022

Conversation

timonwong
Copy link
Contributor

@timonwong timonwong commented Apr 8, 2022

Changes

Fixes a problem that when duplicate secrets are used in service account, task
pod cannot be created due to the following errors:

Pod "xxx" is invalid: spec.containers[0].volumeMounts[12].mountPath:
Invalid value: "/tekton/creds-secrets/xxxxx": must be unique.

/kind bug

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Release notes block below has been filled in
    (if there are no user facing changes, use release note "NONE")

Release Notes

Fix task pod creation failure when duplicate secrets present in service account.

This fix a problem that if duplicate secret used in service account, task
pod cannot start due to the following errors:

Pod "xxx" is invalid: spec.containers[0].volumeMounts[12].mountPath:
Invalid value: "/tekton/creds-secrets/xxxxx": must be unique.

Signed-off-by: Tianpeng Wang <tpwang@alauda.io>
@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Apr 8, 2022
@tekton-robot tekton-robot requested review from bobcatfish and jerop April 8, 2022 01:33
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Apr 8, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: timonwong / name: Timon Wong (15a37c9)

@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 8, 2022
@tekton-robot
Copy link
Collaborator

Hi @timonwong. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Apr 8, 2022
@dibyom
Copy link
Member

dibyom commented Apr 8, 2022

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 8, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/pod/creds_init.go 93.3% 93.9% 0.5

@timonwong timonwong changed the title Fix task pod creation failure with duplicate sa secrets Fix task pod creation failure with duplicate serviceaccount secrets Apr 14, 2022
Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Since k8s allows for duplicates there, it seems fair that we also support it.
/approve

Comment on lines +129 to +133
}, {
Name: "my-docker-creds",
}, {
Name: "my-docker-creds",
}},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems fair enough to not fail in this case, since there is no ambiguity about which credentials to setup anyways.

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afrittoli

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 22, 2022
@abayer
Copy link
Contributor

abayer commented Jun 30, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 30, 2022
@tekton-robot tekton-robot merged commit 74e1322 into tektoncd:main Jun 30, 2022
@timonwong timonwong deleted the allow-dup-sa-secrets branch January 25, 2024 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants