-
Notifications
You must be signed in to change notification settings - Fork 741
k8sutil: add recovery container instead of overriding #1853
Conversation
Stress testing proves that this will fix the bug: https://jenkins-etcd.prod.coreos.systems/job/etcd-operator-flaketest/buildTimeTrend |
@etcd-bot retest this please |
@@ -221,14 +222,17 @@ func addOwnerRefToObject(o metav1.Object, r metav1.OwnerReference) { | |||
// It's special that it has new token, and might need recovery init containers | |||
func NewSeedMemberPod(clusterName string, ms etcdutil.MemberSet, m *etcdutil.Member, cs api.ClusterSpec, owner metav1.OwnerReference, backupURL *url.URL) *v1.Pod { | |||
token := uuid.New() | |||
pod := NewEtcdPod(m, ms.PeerURLPairs(), clusterName, "new", token, cs, owner) | |||
pod := newEtcdPod(m, ms.PeerURLPairs(), clusterName, "new", token, cs) |
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.
why changing NewEtcdPod
to newEtcdPod
?
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.
nvm, i saw there is a order change.
test this pr. still see the same issue.
|
Also fix the ordering to apply pod policy on recovery containers too
This PR will make it more stable, but it still encountered failure: https://jenkins-etcd.prod.coreos.systems/job/etcd-operator-flaketest/buildTimeTrend So there are other bugs we need to dig. |
|
||
func NewEtcdPod(m *etcdutil.Member, initialCluster []string, clusterName, state, token string, cs api.ClusterSpec, owner metav1.OwnerReference) *v1.Pod { | ||
pod := newEtcdPod(m, initialCluster, clusterName, state, token, cs) | ||
applyPodPolicy(clusterName, pod, cs.Pod) | ||
addOwnerRefToObject(pod.GetObjectMeta(), owner) |
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 think addOwnerRefToObject
can stay in the newEtcdPod
function. I don't think order of addOwnerRefToObject
matters.
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.
The addOwnerRefToObject() doesn't matter. But it's good to separate one param owner
out of newEtcdPod().
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.
fair enough.
if backupURL != nil { | ||
addRecoveryToPod(pod, token, m, cs, backupURL) | ||
} | ||
applyPodPolicy(clusterName, pod, cs.Pod) | ||
addOwnerRefToObject(pod.GetObjectMeta(), owner) |
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 seems to me the order of calling applyPodPolicy
is important because this code reasons about init containers.
I don't think order of addOwnerRefToObject
matters in this case. correct me if i am wrong.
LGTM |
lgtm |
Also fix the ordering to apply pod policy on recovery containers too
ref: #1825 (comment)