-
Notifications
You must be signed in to change notification settings - Fork 90
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
🌱 Remove and reinstall BMO in source cluster before and after pivot #838
Conversation
/test-ubuntu-e2e-main |
a862993
to
d689a8a
Compare
/test-ubuntu-e2e-main |
/retest |
/test-ubuntu-e2e-main |
/retest |
/test generate |
/retest |
/test all |
/test-ubuntu-e2e-main |
1 similar comment
/test-ubuntu-e2e-main |
/keep-test-ubuntu-integration-e2e-main |
/test-ubuntu-e2e-main |
d689a8a
to
def4b61
Compare
/test-ubuntu-e2e-main |
/test-centos-e2e-main |
def4b61
to
14684d4
Compare
/test-ubuntu-e2e-main |
14684d4
to
762326f
Compare
/test-ubuntu-e2e-main |
/test-centos-e2e-main |
/test-centos-e2e-main |
/test-upgrade-e2e-main |
3 similar comments
/test-upgrade-e2e-main |
/test-upgrade-e2e-main |
/test-upgrade-e2e-main |
/test-ubuntu-integration-main |
test/e2e/pivoting.go
Outdated
@@ -33,6 +33,7 @@ const ( | |||
ironicBasicAuth = "IRONIC_BASIC_AUTH" | |||
Kind = "kind" | |||
NamePrefix = "NAMEPREFIX" | |||
NameSuffix = "NAMESUFFIX" |
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 is not used.
NameSuffix = "NAMESUFFIX" |
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 is used, check RemoveIronicBMOInput
below
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.
That is different. It is defined in the struct here
NameSuffix string |
This is a constant that is never referenced. The other constants above are used to get the value from the e2e config as in
NamePrefix: input.E2EConfig.GetVariable(NamePrefix), |
But this
NameSuffix
does not exist in the e2e config so we never take it from there.
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.
true, good catch! I will remove it, with other change
test/e2e/pivoting.go
Outdated
iNamespace := &corev1.Namespace{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: input.E2EConfig.GetVariable(ironicNamespace), | ||
}, | ||
} | ||
_, err := targetClusterClientSet.CoreV1().Namespaces().Create(ctx, ironicNamespace, metav1.CreateOptions{}) | ||
_, err := targetClusterClientSet.CoreV1().Namespaces().Create(ctx, iNamespace, metav1.CreateOptions{}) |
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 change the variable name? I think it was easier to understand before. iNamespace
is harder to understand. Is it "in namespace" or "ironic namespace" or "input namespace"? 🤷
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.
If you see closely, it is creating a Namespace out of the ironicNameSpace
value and previously it was assigning it to ironicNameSpace
var only. That was ok since ironicNameSpace
was not needed as a string later. Now that we need it, simply converting it to string didn't work. So a rename was needed. And it is used in line 102 and 107 only.
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.
Oh I see! What if we rename ironicNamespace
-> ironicNamespaceName
or ironicNamespaceVar
(since it is the variable where we get the name from) and then this can be ironicNamespace
?
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.
done
test/e2e/pivoting.go
Outdated
} | ||
|
||
func removeIronic(ctx context.Context, inputGetter func() RemoveIronicInput) { | ||
func removeIronicBMO(ctx context.Context, inputGetter func() RemoveIronicBMOInput) { |
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 function is starting to feel a bit messy. It is almost a generic function for deleting a Deployment, but it also tries to handle the case when Ironic is running outside the cluster. If we combine the remove BMO part with IsDeployment=false, we get complete nonsense. Also, if we fail to delete the Deployment we get an error that it failed to delete Ironic (even if we tried to delete BMO).
I think a cleaner solution would be to separate out the case when Ironic is running outside the cluster, e.g. removeLocalIronic
. Then this function can be a generic deleteDeployment
function. No need for the prefix/suffix either, just take the name as input.
What do you think?
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.
combining ironic local and deployment deletion in one function was there before. I am not adding that functionality here. I am adding BMO removal only. And since we know its always a deployment we always hardcode the isDeployment
to true. Expecting common sense from developer here. Since a developer can also try to delete ironic deployment while it was deployed locally. One good point raised by you is the error message at line 304. We can add the deployment or component name to be deleted which I missed out .
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.
combining ironic local and deployment deletion in one function was there before
I know, but adding BMO to this makes it harder to understand and easier to make mistakes. Splitting it into two functions was just a suggestion for how to make it cleaner, we can go the other way also. Then I would suggest to make it "smarter", similar to installIronicBMO
. Add to the input a variable that tells if it is BMO or Ironic we are dealing with, then use it to set the other parameters that are already known, e.g. prefix/suffix. We also know that BMO is never deployed locally in this context so check and error out if we get this combination.
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 am in favor of keeping the function core as it is now as both ironic and bmo have the same lifecycle and do the refactoring later on?
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.
that might be this work will not solve the centos issue to delete bmh and then I would prefer to revert this changes
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'm not understanding the issue. Why make a messy implementation that we have to fix in the future when we can make a nice implementation? Both of them can easily be reverted but only one have to be improved.
Just think about how the function is used. I want to remove BMO, ok removeIronicBMO
sounds good. What does it take as input? Name suffix, what is this? Why should I have to know this to remove BMO? I just want to say if I want to remove BMO or Ironic.
I stand my ground. This must be simplified. Either split it into separate functions or make it "smarter" so it is harder to shoot yourself in the foot.
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.
Just think about how the function is used. I want to remove BMO, ok
removeIronicBMO
sounds good. What does it take as input? Name suffix, what is this? Why should I have to know this to remove BMO? I just want to say if I want to remove BMO or Ironic.
I didn't get your point here, this is not asked from user. Theres bunch of other similar suffix, prefix parameter in the same file here. You as a user dont need to know, you as a developer will always code the name to delete no matter how simplified the function is. Suffix is a part of 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.
I can agree on one point , this might be a bit difficult to understand in future since ironic is deployed locally and in deployment while BMO is only deployed as a deployment. So for BMO isDeployment var doesn’t make any sense and leaves room for mistakes. Splitting it in two functions increases readability and understanding of the code.
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.
There is always a user. The user of the function is the developer. And no, the developer does not need to know the suffix and should not need to think about this. It is always -controller-manager
for BMO and -ironic
for Ironic. This can be taken care of by the function.
Alternatively, if you want to keep the flexibility of setting the exact name, then just make a generic function that can delete any deployment by giving a name. I'm also fine with that. But mixing it in one function is not nice.
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.
There is always a user. The user of the function is the developer. And no, the developer does not need to know the suffix and should not need to think about this. It is always
-controller-manager
for BMO and-ironic
for Ironic. This can be taken care of by the function.
Hummm, I don’t think I agree. let’s agree to disagree here. Atleast we agree we need separate functions :)
762326f
to
9053948
Compare
157b6cc
to
cca7237
Compare
Please add proper description and commit message. |
cca7237
to
64c52df
Compare
/test-centos-e2e-feature-main |
2 similar comments
/test-centos-e2e-feature-main |
/test-centos-e2e-feature-main |
/test-ubuntu-integration-main |
I know its going to fail but just running it so that we can see it as a test in github. |
Funny enough, it passed |
/test-centos-e2e-integration-main |
ed00a04
to
9cf319b
Compare
/test-centos-e2e-integration-main |
1 similar comment
/test-centos-e2e-integration-main |
/keep-test-centos-e2e-integration-main |
9cf319b
to
7e04470
Compare
/keep-test-centos-e2e-integration-main |
7e04470
to
f968a98
Compare
/test-centos-e2e-integration-main |
/test-ubuntu-integration-main |
/assign @furkatgofurov7 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: furkatgofurov7 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
/lgtm
BMO is caching the old node states after pivoting back and that might be the cause to the flake where the bmh is not deleted in centos this PR tries to solve the issue by reinstating bmo after moving back to source cluster