-
Notifications
You must be signed in to change notification settings - Fork 24
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
Refactor secrets linking #130
Conversation
145bbd1
to
afc28c9
Compare
/test image-controller-e2e |
|
1 similar comment
/test images |
if errors.IsNotFound(err) { | ||
return nil | ||
} | ||
log.Error(err, "Failed to read pipeline service account", "ServiceAccountName", buildPipelineServiceAccountName, "NamespaceName", namespace, l.Action, l.ActionView) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add common log entries to the log
above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what you mean.
you mean in log := ctrllog.FromContext(ctx) ???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean something like
log := ctrllog.FromContext(ctx).WithValues("ServiceAccountName", buildPipelineServiceAccountName)
so all the log entries will have the value. But up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok didn't know that
will change it
|
||
secretExists = false | ||
log.Info("Secret doesn't exist, will unlink secret from service account", "SecretName", secretName) | ||
log.Info("To recreate secret use regenerate-token") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This log is not visible to the user, so makes no sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it isn't visible to the user, but it is good for debugging
keeping it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For debugging we can relay on Secret doesn't exist, will unlink secret from service account
, cannot we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok removing
controllers/suite_util_test.go
Outdated
@@ -296,6 +296,27 @@ func waitImageRepositoryFinalizerOnImageRepository(imageRepositoryKey types.Name | |||
}, timeout, interval).Should(BeTrue()) | |||
} | |||
|
|||
// func waitImageRepositoryCredentialGone(imageRepositoryKey types.NamespacedName, credentialName string) { | |||
func waitImageRepositoryCredentialGone(imageRepositoryKey types.NamespacedName, operationName string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name is confusing. It seems that it waits until the secrets with credentials gone...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it waits until imageRepository.Spec.Credentials sections are gone
hence the name : ImageRepositoryCredential
suggest better one if you have a idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waitImageRepositoryCredentialSectionGone
at least? Or maybe waitImageRepositoryCredentialSectionRequestGone
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok renamed
70274be
to
4d0be12
Compare
1. when linking secret to SA, don't add it if already present 2. unlink secret from SA upon imageRepository deletion 3. don't link secret anymore to imagePullSecrets (used for the image pod is using, task/pipeline bundle image) 4. new option to clean up secret links via spec.credentials.verify-linking - It will link secret to service account if link is missing. - It will remove duplicate links of secret in service account. - It will remove secret from imagePullSecrets in service account. - It will unlink secret from service account, if secret doesn't exist (can recreated by using 'regenerate-token'). STONEBLD-2540 Signed-off-by: Robert Cerven <[email protected]>
New changes are detected. LGTM label has been removed. |
STONEBLD-2540