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

Dont create deployment without a pull secret #343

Merged
merged 1 commit into from
Mar 16, 2022
Merged

Dont create deployment without a pull secret #343

merged 1 commit into from
Mar 16, 2022

Conversation

idlewis
Copy link
Collaborator

@idlewis idlewis commented Mar 7, 2022

The cluster automatically creates pull secrets for the service account.
This can take a while.
Sometimes, the controller creates the deployment before the pull secret
is created. This causes the pods to go into an image pull backoff loop.
Check that the pull secret exists before the deployment is created, to
prevent this

This will help us to fix issue OpenLiberty/open-liberty-operator#312

@idlewis idlewis requested a review from leochr March 10, 2022 09:37
Copy link
Member

@leochr leochr left a comment

Choose a reason for hiding this comment

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

@idlewis Looks good. Thank you. Added a comment to move more code into util.

if instance.Spec.ServiceAccountName != nil && *instance.Spec.ServiceAccountName != "" {
saName = *instance.Spec.ServiceAccountName
}
saErr := appstacksutils.PullSecretExists(saName, instance.Namespace, r.GetClient())
Copy link
Member

Choose a reason for hiding this comment

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

To minimize the amount of changes needed for each controller, it'll be good if the above logic to determine the service account name is also moved into the util method. The variable ba (of type common.BaseComponent) can be passed instead of saName and instance.Namespace. They can be retrieved from ba along with CR fields (i.e. ba.GetServiceAccountName()). Util method CustomizeRoute is a good reference. It's fine to pass in client along with ba.

Suggested name for the method: ServiceAccountPullSecretExists

The cluster automatically creates pull secrets for the service account.
This can take a while.
Sometimes, the controller creates the deployment before the pull secret
is created. This causes the pods to go into an image pull backoff loop.
Check that the pull secret exists before the deployment is created, to
prevent this
@idlewis
Copy link
Collaborator Author

idlewis commented Mar 15, 2022

@leochr review comments addressed, pls could you take another look?

Copy link
Member

@leochr leochr left a comment

Choose a reason for hiding this comment

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

@idlewis Looks good. Thank you.

@leochr leochr merged commit e552c30 into main Mar 16, 2022
halim-lee added a commit that referenced this pull request Mar 16, 2022
leochr pushed a commit that referenced this pull request Mar 16, 2022
* Add issues #293 #343 to 0.8.x

* Add pullSecret check in controller
@idlewis idlewis deleted the timing branch March 17, 2022 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants