openshift / openshift/origin

Duplicate secret names in secrets list of service account.

Open
#15,894 4 comments 0 reactions 1 assignee View on GitHub

@spadgett is already working on this.

Since Aug 22, 2017.

component/web kind/bug lifecycle/frozen lifecycle/stale priority/P2
Dominant language
Go
Stars
8.7k
Forks
4.8k
Avg merge
4d 10h
Merged PRs (30d)
53

Description

Secret name being added to service account secrets list multiple times when UI used.

Version

oc v3.6.0+c4dd4cf
kubernetes v1.6.1+5115d708d7
features: Basic-Auth

Server https://127.0.0.1:8443
openshift v3.6.0+c4dd4cf
kubernetes v1.6.1+5115d708d7

Steps To Reproduce

First create a secret from the command link it to the builder service account.

oc secrets new-sshauth repo-at-github --ssh-privatekey=repo-at-github
oc secrets link builder repo-at-github

Listing the service account we get:

$ oc describe sa/builder
Name:		builder
Namespace:	myproject
Labels:		<none>
Annotations:	<none>

Image pull secrets:	builder-dockercfg-2k679

Mountable secrets: 	builder-token-z99xr
                   	builder-dockercfg-2k679
                   	repo-at-github

Tokens:            	builder-token-xsr30
                   	builder-token-z99xr

Delete the secret.

$ oc delete secret/repo-at-github
secret "repo-at-github" deleted

Run oc describe sa/builder again and you will see the secret name still listed. That is sort of to be expected, and is not the issue here. It is marked as (not found) at least.

Create the secret again and link it once more.

oc secrets new-sshauth repo-at-github --ssh-privatekey=repo-at-github
oc secrets link builder repo-at-github

Run oc describe sa/builder again and the secret name is still listed once, which is what one would expect. That is, avoids adding duplicates.

Delete the secret once more.

$ oc delete secret/repo-at-github
secret "repo-at-github" deleted

Remember that this will leave the secret still listed against the service account as noted above.

Now go and create the same secret from the web console and when doing that link the secret to the builder service account at the same time.

image

Now go back to the command line and describe the service account once more.

$ oc describe sa/builder
Name:		builder
Namespace:	myproject
Labels:		<none>
Annotations:	<none>

Image pull secrets:	builder-dockercfg-2k679

Mountable secrets: 	builder-token-z99xr
                   	builder-dockercfg-2k679
                   	repo-at-github
                   	repo-at-github

Tokens:            	builder-token-xsr30
                   	builder-token-z99xr

What you will find is that the name of the secret is listed more than once, presumably because the method used to link the secret from the web console, doesn't ensure that the secret name isn't already in the list.

Current Result

Can get duplicate secret name in secrets linked linked to service account when linked from web console.

Expected Result

Should not see duplicate name.

Additional Information

None.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.