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

Feature/support ipv6 dual #1537

Closed
wants to merge 20 commits into from

Conversation

VinceCui
Copy link
Collaborator

@VinceCui VinceCui commented Jun 22, 2022

Describe what this PR does / why we need it

支持ipv6双栈模式、ipv6only模式的部署,以扩展Sealer应对的场景

Does this pull request fix one issue?

fixes #1415

Describe how you did it

Describe how to verify it

Special notes for reviews

VinceCui and others added 13 commits June 10, 2022 15:05
2. Support choose log color mode.
3. Support silence usage, because usage info is noisy in some cases;
4. Silence error, because sealer has already print error itself.
5. Use logrus to print the final error.

Signed-off-by: huaiyou <[email protected]>
Fix register plugin bug;
Support ipv6 dual stack;

TODO:
seautil route need to support dual stack.
Fix nil pointer bug.
# Conflicts:
#	vendor/github.com/sealyun/lvscare/care/care.go
#	vendor/modules.txt
…6-dual

# Conflicts:
#	apply/apply.go
#	apply/run.go
#	apply/scale.go
#	cmd/sealer/cmd/upgrade.go
…6-dual

# Conflicts:
#	cmd/sealer/cmd/root.go
#	vendor/github.com/sealyun/lvscare/care/care.go
#	vendor/modules.txt
@codecov-commenter
Copy link

codecov-commenter commented Jun 22, 2022

Codecov Report

Merging #1537 (e551763) into main (5c4d885) will decrease coverage by 0.06%.
The diff coverage is 5.04%.

@@            Coverage Diff             @@
##             main    #1537      +/-   ##
==========================================
- Coverage   10.86%   10.80%   -0.07%     
==========================================
  Files          88       88              
  Lines        8015     8060      +45     
==========================================
  Hits          871      871              
- Misses       7037     7082      +45     
  Partials      107      107              
Impacted Files Coverage Δ
apply/apply.go 0.00% <0.00%> (ø)
apply/run.go 0.00% <0.00%> (ø)
apply/scale.go 6.87% <0.00%> (-0.88%) ⬇️
apply/validate.go 86.36% <ø> (-1.14%) ⬇️
pkg/ipvs/ipvs.go 0.00% <0.00%> (ø)
pkg/plugin/etcd_backup_plugin.go 4.54% <0.00%> (ø)
pkg/plugin/hostname_plugin.go 18.75% <0.00%> (ø)
pkg/plugin/plugins.go 0.00% <0.00%> (ø)
pkg/plugin/shell_plugin.go 23.07% <0.00%> (ø)
pkg/runtime/init.go 0.00% <0.00%> (ø)
... and 21 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c4d885...e551763. Read the comment docs.

@VinceCui VinceCui requested review from bxy4543 and allencloud June 22, 2022 09:04
@VinceCui VinceCui linked an issue Jun 22, 2022 that may be closed by this pull request
@VinceCui
Copy link
Collaborator Author

The DCO check fails, because some commit is not signed, but when i rebase, many conflict occurs..

So, please ignore this check and continue REVIEW.

@allencloud
Copy link
Member

Since I merged #1500, conflict happens. Please rebase. Thanks. @VinceCui

apply/apply.go Outdated
}
}

if hasBoth := hasIPV4 && hasIPV6; hasBoth {
Copy link
Member

Choose a reason for hiding this comment

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

if hasIPV4 && hasIPV6 {
blabla
}

pkg/env/env.go Outdated Show resolved Hide resolved
…6-dual

# Conflicts:
#	apply/apply.go
#	apply/run.go
#	apply/scale.go
#	utils/net/iputils_test.go
@github-actions github-actions bot removed the test label Jun 23, 2022
ImageManager: imgSvc,
ClusterImageMounter: mounter,
ImageStore: is,
}, nil
}

func checkAllHostsSameFamily(nodeList []string) error {
Copy link
Member

Choose a reason for hiding this comment

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

This is the validate function, you could add them into validate.go . Actually It seems to have nothing to do with the main apply procedure. @VinceCui

if err != nil {
return nil, err

for _, cidr := range strings.Split(SvcCIDR, ",") {
Copy link
Member

Choose a reason for hiding this comment

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

Same issue, this should be validated at the very beginning part, or validation layer. It is not suggested that we validate this in the underlying implementation layer. Should use Defensive Programming.

@allencloud
Copy link
Member

@VinceCui

I have several suggestions here after review:

  1. put all validation all of codes for IPv4 and IPv6 into a validation layer before the main processor, such as before NewDefaultApplier. We could unified the validation of input, no matter the command ARG input or Clustefile content input. When we could achieve main procedure more focused and decoupled inner architecture.

@VinceCui
Copy link
Collaborator Author

@allencloud
I agree, but it is a big engineering

VinceCui added 4 commits June 25, 2022 23:19
ignore Port-10250 in kubeadm
…ow a warning.

Fix bug, a node slice should be nil if arg --masters or --workers is empty.
Signed-off-by: huaiyou <[email protected]>
@@ -49,6 +49,7 @@ type Applier struct {
Client *k8s.Client
ImageStore store.ImageStore
CurrentClusterInfo *version.Info
Action string
Copy link
Member

Choose a reason for hiding this comment

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

I am afraid that I do not agree that passing a cmd layer type into an underlying procedure, here is the Applier struct. It makes me feel a bottom struct relies on the upper struct.

Ignore DirAvailable--etc-kubernetes-manifests when join;
Explicitly specify the list of nodes to be deleted and to be added;

Signed-off-by: huaiyou <[email protected]>
InitMaser115Upper = `kubeadm init --config=%s/etc/kubeadm.yml --upload-certs`
JoinMaster115Upper = "kubeadm join --config=%s/etc/kubeadm.yml"
JoinNode115Upper = "kubeadm join --config=%s/etc/kubeadm.yml"
RemoveKubeConfig = "rm -rf /usr/bin/kube* && rm -rf ~/.kube/"
RemoteCleanMasterOrNode = `if which kubeadm;then kubeadm reset -f %s;fi && \
RemoteCleanMasterOrNode = `systemctl restart docker kubelet;if which kubeadm;then kubeadm reset -f %s;fi && \
Copy link
Member

Choose a reason for hiding this comment

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

Why does the delete operation have to restart the service instead of stopping the service?

if err := mergo.Merge(&host.SSH, &cluster.Spec.SSH); err != nil {
return nil, err
if host.SSH.Pk != "" || host.SSH.Passwd != "" {
return NewSSHClient(&host.SSH, false), nil
Copy link
Member

Choose a reason for hiding this comment

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

false --> isStdout

return nil, err
}
return NewSSHClient(&host.SSH, true), nil
return NewSSHClient(&cluster.Spec.SSH, false), nil
Copy link
Member

Choose a reason for hiding this comment

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

false --> isStdout

}
}
}
if cluster.Spec.SSH.Pk != "" || cluster.Spec.SSH.Passwd != "" {
return NewSSHClient(&cluster.Spec.SSH, false), nil
Copy link
Member

Choose a reason for hiding this comment

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

false --> isStdout

if len(newSlice) == 0 {
// Sanitize for unit tests so we don't need to distinguish empty array
// and nil.
newSlice = nil
Copy link
Member

Choose a reason for hiding this comment

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

return nil is better?

@@ -306,10 +307,10 @@ func (k *KubeadmRuntime) Command(version string, name CommandType) (cmd string)
return fmt.Sprintf("%s%s%s", v, vlogToStr(k.Vlog), " --ignore-preflight-errors=all")
}
if name == InitMaster || name == JoinMaster {
return fmt.Sprintf("%s%s%s", v, vlogToStr(k.Vlog), " --ignore-preflight-errors=SystemVerification")
return fmt.Sprintf("%s%s%s", v, vlogToStr(k.Vlog), " --ignore-preflight-errors=SystemVerification,Port-10250,DirAvailable--etc-kubernetes-manifests")
Copy link
Member

Choose a reason for hiding this comment

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

If kubelet is not started, port 10250 does not need to be ignored

@VinceCui VinceCui closed this Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ipv4/ipv6 dual stack.
5 participants