-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
feat: added persistent-mac option #1829
Conversation
@thomasferrandiz @rbrtbnfgl does any of you guys have time to review this? |
Hi sorry I was on vacation the last few weeks. Why adding a flag on the cmdline to enable this? Could it be enough to only check the annotation and if it's configured it'll use the defined MAC? |
@rbrtbnfgl no problem :) |
One important thing to note is that the k8s client should not be imported in |
@thomasferrandiz moved k8s related code |
@thomasferrandiz @rbrtbnfgl not sure why the k3s e2e test fails... do you have any idea why? |
I restarted the test and it's fine now. |
would you like to take a look again so we can merge this? |
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.
By reading the release notes, it seems there is going to be a new flag, but I don't see it in the code.
Could you add in the docs how user could operate this new feature please? Thanks!
I suggested to remove the flag. The feature should be enabled by default and it shouldn't break anything theoretically. |
pkg/subnet/kube/kube.go
Outdated
// The kube subnet mgr needs to know the k8s node name that it's running on so it can annotate it. | ||
// If we're running as a pod then the POD_NAME and POD_NAMESPACE will be populated and can be used to find the node | ||
// name. Otherwise, the environment variable NODE_NAME can be passed in. | ||
nodeName := os.Getenv("NODE_NAME") |
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.
kubeSubnetManager struct
already includes the node (nodeName field), can't you use that one?
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 are absolutely right!
@@ -160,6 +162,7 @@ func NewSubnetManager(ctx context.Context, apiUrl, kubeconfig, prefix, netConfPa | |||
func newKubeSubnetManager(ctx context.Context, c clientset.Interface, sc *subnet.Config, nodeName, prefix string, useMultiClusterCidr bool) (*kubeSubnetManager, error) { | |||
var err error | |||
var ksm kubeSubnetManager | |||
ksm.annotationPrefix = prefix |
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 do you need this? ksm.annotations
is already included the prefix
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 need to store the prefix that is passed newKubeSubnetManager in order to parse the annotations for the stored MAC address. Otherwise i would need to look at ksm.annotations and split any of them to get the prefix.
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, you have a point. Actually, it is strange that we allow to configure this
8718aba
to
b5f29b4
Compare
I changed the release notes |
@manuelbuil the e2e test failed again. Would you be so kind to restart it? |
@siredmar could you squash the commits please? |
Signed-off-by: Armin Schlegel <[email protected]>
b5f29b4
to
741366a
Compare
@thomasferrandiz done |
Thx |
Description
fixes #1828
New feature: flag
persistent-mac
that reads the nodes annotation during startup and spins up the flannel.1 interface with the same MAC address. This can be useful when a reboot of the node happened but the old setup needs to be restored.Release Note