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

Remove -sa suffix from generated service account #885

Conversation

SaschaSchwarze0
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 commented Oct 4, 2021

Changes

There was a bug in Calico before 3.20.0 where it unconditionally passed pod.spec.serviceAccountName as a label value to its WorkloadEndpoint. But label values cannot exceed 63 characters while a longer ServiceAccount name is allowed. Their fix is Use a spec field on WEPs for ServiceAccount name #1422.

But, especially in managed Kubernetes environments, the Calico version is not necessarily that new. For example, IKS 1.21 is at 3.19 just slightly below this.

In Shipwright, we already limit the BuildRun length to 63 characters because we use it as label value on the TaskRun (and pod). But, the name of the generated ServiceAccount used to be ${buildRunName}-sa.

I changed the logic to make the name of the ServiceAccount be the BuildRun name. Added code to still delete the one with the -sa suffix to not cause dangling SAs.

Used that chance to move the removal logic from buildrun.go into serviceaccount.go.

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Set a kind label on this PR
  • Release notes block has been filled in, or marked NONE

Release Notes

The -sa suffix from generated service accounts has been removed so that BuildRuns with names longer than 60 characters also work with older Calico versions

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Label for when a PR has specified a release note labels Oct 4, 2021
@SaschaSchwarze0 SaschaSchwarze0 changed the title WIP Remove -sa suffix from generated service account Remove -sa suffix from generated service account Oct 4, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 4, 2021
@SaschaSchwarze0 SaschaSchwarze0 added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Oct 4, 2021
Copy link
Contributor

@HeavyWombat HeavyWombat left a comment

Choose a reason for hiding this comment

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

Just quick question: Should we open an issue to remove the GetHeritageGeneratedServiceAccountName section at some point far into the future, where we believe there should be no more service accounts with that suffix?

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 6, 2021
@adambkaplan adambkaplan added this to the release-v0.6.0 milestone Oct 6, 2021
@SaschaSchwarze0
Copy link
Member Author

Just quick question: Should we open an issue to remove the GetHeritageGeneratedServiceAccountName section at some point far into the future, where we believe there should be no more service accounts with that suffix?

Yes, I'll open one for v1.0.0.

@HeavyWombat
Copy link
Contributor

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 6, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: HeavyWombat

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 6, 2021
@openshift-merge-robot openshift-merge-robot merged commit 8f7e256 into shipwright-io:main Oct 6, 2021
@SaschaSchwarze0 SaschaSchwarze0 deleted the sascha-remove-sa-suffix branch November 5, 2021 13:48
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. release-note Label for when a PR has specified a release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants