Skip to content

Conversation

@jiuker
Copy link
Contributor

@jiuker jiuker commented Jun 24, 2022

When the operator restarts and adds defaultimagepullsecrets, the pod does not update imagepullsecrets in a timely manner. If MQ is switched or down, it may restart and fail to pull down the image
steps:
1.start operator with pull serect names
2.start mq instance
3.restart operator with new pull serect names

we found that mq instance won't restart to refresh pull serect key.
But if step1 with no serect names,step3 will make mq instance restart。That's is a bug, I think.

case by

if rabbitmqCluster.Spec.ImagePullSecrets == nil {
 		// split the comma separated list of default image pull secrets from
 		// the 'DEFAULT_IMAGE_PULL_SECRETS' env var, but ignore empty strings.
 		for _, reference := range strings.Split(r.DefaultImagePullSecrets, ",") {
 			if len(reference) > 0 {
 				rabbitmqCluster.Spec.ImagePullSecrets = append(rabbitmqCluster.Spec.ImagePullSecrets, corev1.LocalObjectReference{Name: reference})
 			}
 		}
 		if requeue, err := r.updateRabbitmqCluster(ctx, rabbitmqCluster, "image pull secrets"); err != nil {
 			return requeue, err
 		}
}

…does not update imagepullsecrets in a timely manner. If MQ is switched or down, it may restart and fail to pull down the image
guozhi.li added 2 commits June 29, 2022 16:20
@jiuker
Copy link
Contributor Author

jiuker commented Jul 4, 2022

@coro review?

Copy link
Member

@Zerpet Zerpet left a comment

Choose a reason for hiding this comment

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

I'm afraid we can't accept this contribution in its current state, due to the following reasons:

  1. Your commit messages do not adhere to our contribution guidelines regarding descriptive commit messages
  2. There are no new tests to ensure the correct behaviour of this new code

I'm not sure I understand why this would be a bug.

In scenario 1, a given RabbitmqCluster object will have pull secrets, as inherited from Operator's default pull secrets. After updating the Operator and a restart, the Operator should respect the previosly set pull secrets. This behaviour is common for other fields in the Spec.

In scenario 2, a given RabbitmqCluster object will have no pull secrets, as those were not set in the Spec, neither in the Operator default pull secrets. There could be an argument in favour of leaving pull secrets unset, as those were unset in a previous loop. However, it's not trivial to distinguish between set to nil and not set at all. That's the reason why it updates after an Operator restart. I believe this is a desirable behaviour.

@jiuker jiuker closed this Jul 5, 2022
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